{"action":"created","issue":{"url":"https://api.github.com/repos/brunobowden/j2objc-gradle/issues/3","labels_url":"https://api.github.com/repos/brunobowden/j2objc-gradle/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/brunobowden/j2objc-gradle/issues/3/comments","events_url":"https://api.github.com/repos/brunobowden/j2objc-gradle/issues/3/events","html_url":"https://github.com/brunobowden/j2objc-gradle/issues/3","id":56934528,"number":3,"title":"Cycle Finder Task","user":{"login":"confile","id":64265,"avatar_url":"https://avatars.githubusercontent.com/u/64265?v=3","gravatar_id":"","url":"https://api.github.com/users/confile","html_url":"https://github.com/confile","followers_url":"https://api.github.com/users/confile/followers","following_url":"https://api.github.com/users/confile/following{/other_user}","gists_url":"https://api.github.com/users/confile/gists{/gist_id}","starred_url":"https://api.github.com/users/confile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confile/subscriptions","organizations_url":"https://api.github.com/users/confile/orgs","repos_url":"https://api.github.com/users/confile/repos","events_url":"https://api.github.com/users/confile/events{/privacy}","received_events_url":"https://api.github.com/users/confile/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-02-08T01:45:22Z","updated_at":"2015-02-10T02:02:44Z","closed_at":"2015-02-10T00:29:18Z","body":"I created a cycle Finder Task: \r\n\r\n```\r\nclass J2objcCycleFinderTask extends DefaultTask {\r\n\t\r\n\t@InputFiles FileCollection srcFiles\r\n\t@OutputFile File destFile\r\n\t\r\n\t@TaskAction\r\n\tdef start() {\r\n\r\n\t\tprintln \"Start\"\r\n\t\t\r\n        def isWindows = J2objcUtils.isWindows()\r\n        def j2objcHome = J2objcUtils.j2objcHome(getProject())\r\n        def cycleFinderExec = j2objcHome + \"/cycle_finder\"\r\n        def firstArgs = \"\"\r\n        if (isWindows) {\r\n            j2objcExec = \"java\"\r\n            // \"-Xbootclasspath:${j2objcHome}/lib/jre_emul.jar\"\r\n            firstArgs = \"-jar ${j2objcHome}/lib/cycle_finder.jar\"\r\n        }\r\n\r\n\t\t// clear the destFile\r\n\t\tproject.delete destFile\r\n\t\t\r\n        srcFiles = J2objcUtils.fileFilter(srcFiles,\r\n                project.j2objcConfig.translateIncludeRegex,\r\n                project.j2objcConfig.translateExcludeRegex)\r\n\r\n        if (project.j2objcConfig.filenameCollisionCheck) {\r\n            J2objcUtils.filenameCollisionCheck(srcFiles)\r\n        }\r\n\r\n\t\tprint \"cycleFinderExec: \"+cycleFinderExec\r\n\t\t\r\n\r\n//\t\tdef stdout = new ByteArrayOutputStream()\r\n        project.exec {\r\n            executable cycleFinderExec\r\n\t\t\t\r\n//                args firstArgs.split()\r\n\r\n            args \"-sourcepath\", project.file(\"src/main/java\").path\r\n\r\n            project.j2objcConfig.translateJ2objcLibs.each { library ->\r\n                def libPath = J2objcUtils.j2objcHome(getProject()) + \"/lib/\" + library\r\n                args \"-classpath\", project.file(libPath).path\r\n            }\r\n\r\n//                args \"${project.j2objcConfig.translateFlags}\".split()\r\n\r\n            srcFiles.each { file ->\r\n                args file.path\r\n            }\r\n\t\t\t\r\n\t\t\tstandardOutput = stdout\r\n\t\t\tdestFile << stdout\r\n        }\r\n\t\t\r\n\t}\r\n\t\r\n}\r\n```\r\n\r\nand append in ``class j2objc implements Plugin<Project>``:\r\n\r\n```\r\n\t\t\ttasks.create(name: \"j2objcCycleFinder\", type: J2objcCycleFinderTask) {\r\n\t\t\t\tdescription \"Run the cycle_finder tool on all Java source files\"\r\n\t\t\t\toutputs.upToDateWhen { false }\t// make the task run on every execution\r\n\t\t\t\tsrcFiles = files(\r\n\t\t\t\t\tfileTree(dir: projectDir,\r\n\t\t\t\t\t\t\tinclude: \"**/*.java\",\r\n\t\t\t\t\t\t\texclude: project.relativePath(buildDir)))\r\n\t\t\t\tdestFile = file(\"${buildDir}/j2objc_cycleFinderResult\")\r\n\t\t\t}\r\n```\r\n\r\nThe command is executed correctly but the task fails. May be this helps you. It was designed to write the output in the ``destFile`` so one can see the printout of the cycle finder."},"comment":{"url":"https://api.github.com/repos/brunobowden/j2objc-gradle/issues/comments/73630980","html_url":"https://github.com/brunobowden/j2objc-gradle/issues/3#issuecomment-73630980","issue_url":"https://api.github.com/repos/brunobowden/j2objc-gradle/issues/3","id":73630980,"user":{"login":"confile","id":64265,"avatar_url":"https://avatars.githubusercontent.com/u/64265?v=3","gravatar_id":"","url":"https://api.github.com/users/confile","html_url":"https://github.com/confile","followers_url":"https://api.github.com/users/confile/followers","following_url":"https://api.github.com/users/confile/following{/other_user}","gists_url":"https://api.github.com/users/confile/gists{/gist_id}","starred_url":"https://api.github.com/users/confile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/confile/subscriptions","organizations_url":"https://api.github.com/users/confile/orgs","repos_url":"https://api.github.com/users/confile/repos","events_url":"https://api.github.com/users/confile/events{/privacy}","received_events_url":"https://api.github.com/users/confile/received_events","type":"User","site_admin":false},"created_at":"2015-02-10T02:02:44Z","updated_at":"2015-02-10T02:02:44Z","body":"Great it work fine thank you Bruno."}}