Narco wrote:
Found the correct solution: project.sourceSets { 'test-unit' { compileClasspath = project.sourceSets.main.classes + project.configurations.compile + project.configurations.testCompile runtimeClasspath = project.sourceSets.'test-unit'.classes + project.sourceSets.main.classes + project.configurations.compile + project.configurations.testRuntime } }project.getTasks().add('testUnitJar', Jar.class)project.testUnitJar.from(project.sourceSets.'test-unit'.classes) project.testUnitJar.fileSet(dir: project.sourceSets.'test-unit'.classesDir) project.testUnitJar.appendix = 'test-unit' project.getTasks().add('testUnitTest', Test.class) project.testUnitTest.testClassesDir = project.sourceSets.'test-unit'.classesDir project.testUnitTest.classpath = project.sourceSets.'test-unit'.runtimeClasspath Works nice, but I need to define almost every task attribute by hands. I was expecting that 'test-unit' folder will be mapped everywhere by default.
That would be good. Could you add a JIRA issue for this?
Narco wrote:I`m trying to reuse this example: build.gradle task intTestJar(type: Jar) { from sourceSets.intTest.classes } I`m trying to do it from custom plugin so I have: public class LibraryPlugin implements Plugin { ... def void use (Project project, ProjectPluginsContainer projectPluginsHandler){ project.usePlugin('java') ... project.task unitTestJar(type: Jar) { from project.sourceSets.unitTest.classes } } ... } The gradle throws exception on evaluating: * What went wrong: A problem occurred evaluating project ':app'. Cause: No signature of method: lv.ctco.scm.cs.LibraryPlugin.unitTestJar() is app licable for argument types: (java.util.LinkedHashMap, lv.ctco.scm.cs.LibraryPlug in$_LibraryBuild_closure3) values: [[type:class org.gradle.api.tasks.bundling.Ja r], lv.ctco.scm.cs.libraryplugin$_librarybuild_closu...@10948cf] How to reuse task type of other plugin?
-- Adam Murdoch Gradle Developer http://www.gradle.org
