{"action":"created","issue":{"url":"https://api.github.com/repos/openmole/openmole/issues/47","labels_url":"https://api.github.com/repos/openmole/openmole/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/openmole/openmole/issues/47/comments","events_url":"https://api.github.com/repos/openmole/openmole/issues/47/events","html_url":"https://github.com/openmole/openmole/issues/47","id":73674037,"number":47,"title":"Why do outputFiles variables need to be set in ScalaTask?","user":{"login":"schuhschuh","id":975451,"avatar_url":"https://avatars.githubusercontent.com/u/975451?v=3","gravatar_id":"","url":"https://api.github.com/users/schuhschuh","html_url":"https://github.com/schuhschuh","followers_url":"https://api.github.com/users/schuhschuh/followers","following_url":"https://api.github.com/users/schuhschuh/following{/other_user}","gists_url":"https://api.github.com/users/schuhschuh/gists{/gist_id}","starred_url":"https://api.github.com/users/schuhschuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schuhschuh/subscriptions","organizations_url":"https://api.github.com/users/schuhschuh/orgs","repos_url":"https://api.github.com/users/schuhschuh/repos","events_url":"https://api.github.com/users/schuhschuh/events{/privacy}","received_events_url":"https://api.github.com/users/schuhschuh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-06T16:40:50Z","updated_at":"2015-05-06T17:09:02Z","closed_at":null,"body":"Currently it is required to set each File path of a variable in the ```outputFiles``` list within the ScalaTask. However, I cannot see a reason why this should be necessary. The value of these variables is specified already as part of the outputFiles declaration:\r\n\r\n```scala\r\nval f = Val[File]\r\nval task = ScalaTask(\" ... \") set (outputFiles += (\"path/to/output/file\", f))\r\n```\r\n\r\nFurther, I think that similar to the change of the inputFiles variables (cf. #34), the outputFiles variable should be available within the ScalaTask with a path preset to be ```java.io.File(workDir, \"path/to/output/file\")```. If the output file should be written to the ```tmpDir``` instead, there could also be a ```inWorkDir``` option as for input files.\r\n\r\nSo as example, instead of:\r\n\r\n```scala\r\nval task = ScalaTask(\r\n  \"\"\"\r\n    | val f = new java.io.File(workDir, \"path/to/output/file\")\r\n    | val w = new java.io.FileWriter(f)\r\n    | w.write(\"Why not preset f ?\")\r\n    | w.close()\r\n  \"\"\".stripMargin) set (\r\n    outputFiles += (\"path/to/output/file\", f)\r\n  )\r\n```\r\nwhich requires me to twice specify the same path, I would like to simplify this to:\r\n```scala\r\nval task = ScalaTask(\r\n  \"\"\"\r\n    | val w = new java.io.FileWriter(f)\r\n    | w.write(\"Now I just specify the path once, as argument of ExternalTaskBuilder.addOutputFile!\")\r\n    | w.close()\r\n  \"\"\".stripMargin) set (\r\n    outputFiles += (\"path/to/output/file\", f)\r\n  )\r\n```\r\nif you want to support writing to the ```tmpDir``` instead of ```workDir```, I would do:\r\n```scala\r\nval task = ScalaTask(\r\n  \"\"\"\r\n    | val w = new java.io.FileWriter(f)\r\n    | w.write(\"Now I just specify the path once, as argument of ExternalTaskBuilder.addOutputFile!\")\r\n    | w.close()\r\n  \"\"\".stripMargin) set (\r\n    outputFiles += (\"path/to/output/file\", f, inWorkDir = false)\r\n  )\r\n```"},"comment":{"url":"https://api.github.com/repos/openmole/openmole/issues/comments/99540011","html_url":"https://github.com/openmole/openmole/issues/47#issuecomment-99540011","issue_url":"https://api.github.com/repos/openmole/openmole/issues/47","id":99540011,"user":{"login":"schuhschuh","id":975451,"avatar_url":"https://avatars.githubusercontent.com/u/975451?v=3","gravatar_id":"","url":"https://api.github.com/users/schuhschuh","html_url":"https://github.com/schuhschuh","followers_url":"https://api.github.com/users/schuhschuh/followers","following_url":"https://api.github.com/users/schuhschuh/following{/other_user}","gists_url":"https://api.github.com/users/schuhschuh/gists{/gist_id}","starred_url":"https://api.github.com/users/schuhschuh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schuhschuh/subscriptions","organizations_url":"https://api.github.com/users/schuhschuh/orgs","repos_url":"https://api.github.com/users/schuhschuh/repos","events_url":"https://api.github.com/users/schuhschuh/events{/privacy}","received_events_url":"https://api.github.com/users/schuhschuh/received_events","type":"User","site_admin":false},"created_at":"2015-05-06T17:09:02Z","updated_at":"2015-05-06T17:09:02Z","body":"Well, but that doesn't work for me as long as I cannot control the extension of the ```newFile``` because the programs we use depends on it to know what type of file it is dealing with."}}