On 24/03/10 7:51 AM, phil swenson wrote:
I did make progress. Had a path wrong, that's why my buildSrc/build.gradle didn't work.
We could have probably done better with the error message, I think. Or we should probably fail the build if buildSrc produces an empty jar - it doesn't really make sense to produce no classes from buildSrc, so if the jar is empty, there's probably something wrong with buildSrc.
I still would like an answer to this question though: " what is the relationship between buildSrc/build.gradle and the root build.gradle (do they share gradle properties or classpath or anything)? "
They don't share anything*. Gradle treats the buildSrc project as a separate build: First it builds the buildSrc project, then adds the jar it produces (plus its runtime dependencies) to the classpath of the main build, then executes the main build.
* Actually, they share the stuff that is common to all builds, eg ~/.gradle/init.script and ~/.gradle/gradle.properties
On Tue, Mar 23, 2010 at 2:39 PM, phil swenson<[email protected]> wrote:opps, have some copy paste artifacts at end of my message. ignore the stuff past "thanks!" anyway. I tried editing the buildSrc/build.gradle file and I get this for output: [ant:jar] Warning: skipping jar archive /Users/pswenson/dev/sag/bam/optimize/trunk/gradle/buildSrc/build/libs/buildSrc-SNAPSHOT.jar because no files were included. [ant:jar] Warning: skipping jar archive /Users/pswenson/dev/sag/bam/optimize/trunk/gradle/buildSrc/build/libs/buildSrc-SNAPSHOT.jar because no files were included. FAILURE: Build failed with an exception. * Where: Build file '/Users/pswenson/dev/sag/bam/optimize/trunk/gradle/build.gradle' line: 213 * What went wrong: Could not compile build file '/Users/pswenson/dev/sag/bam/optimize/trunk/gradle/build.gradle'. Cause: startup failed, build_gradle_2aa21a5bdb333d2e058970288746dab7: 213: unable to resolve class wcom.pushTools.ExecutePushTools @ line 213, column 1. 1 error * Try: Run with -S option to get the full (very verbose) stacktrace. * Exception is: org.gradle.api.GradleScriptException: Build file '/Users/pswenson/dev/sag/bam/optimize/trunk/gradle/build.gradle' line: 213 Could not compile build file '/Users/pswenson/dev/sag/bam/optimize/trunk/gradle/build.gradle'. at org.gradle.groovy.scripts.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:122) at org.gradle.groovy.scripts.DefaultScriptCompilationHandler.writeToCache(DefaultScriptCompilationHandler.java:74) at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.loadViaCache(DefaultScriptCompilerFactory.java:95) at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:68) at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:48) at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProjectEvaluator.java:35) at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:521) at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:54) at org.gradle.api.internal.project.ProjectInternal$evaluate.call(Unknown Source) at org.gradle.configuration.BuildConfigurer$_closure1.doCall(BuildConfigurer.groovy:41) at $Proxy9.execute(Unknown Source) at org.gradle.api.internal.project.AbstractProject.applyActions(AbstractProject.java:491) at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:486) at org.gradle.api.Project$allprojects.call(Unknown Source) at org.gradle.configuration.BuildConfigurer.process(BuildConfigurer.groovy:48) at org.gradle.GradleLauncher.doBuildStages(GradleLauncher.java:147) at org.gradle.GradleLauncher.doBuild(GradleLauncher.java:124) at org.gradle.GradleLauncher.run(GradleLauncher.java:95) at org.gradle.Main.execute(Main.java:100) at org.gradle.Main.main(Main.java:43) at org.gradle.BootstrapMain.main(BootstrapMain.java:50) Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, build_gradle_2aa21a5bdb333d2e058970288746dab7: 213: unable to resolve class wcom.pushTools.ExecutePushTools @ line 213, column 1. 1 error at org.gradle.groovy.scripts.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:117) ... 20 common frames omitted here is my buildSrc/build.gradle: usePlugin 'groovy' sourceSets { main { groovy { srcDir '../../../gant/PushToolsExecutor/src' } } } commonLibDir = "/Users/pswenson/dev/sag/common/trunk/lib" commonLibExtDir = "/Users/pswenson/dev/sag/common/trunk/lib/ext" repositories { flatDir(name: 'commonLib', dirs: commonLibDir) flatDir(name: 'commonLibExt', dirs: commonLibExtDir) flatDir(name: 'optimizeLib', dirs: "../../../lib") flatDir(name: 'groovy', dirs: "${gradle.gradleHomeDir}/lib") } dependencies { compile name: 'commons-collections' compile name: 'commons-io' groovy module(':groovy:1.6.4') { dependency('asm:asm-all:2.2.3') dependency('antlr:antlr:2.7.7') dependency('commons-cli:commons-cli:1.2') module(':ant:1.7.0') { dependencies(':ant-junit:1.7.0', ':ant-launcher:1.7.0') } } } On Tue, Mar 23, 2010 at 2:21 PM, phil swenson<[email protected]> wrote:I want to write a gradle task that executes a particular process. This process needs to be built by gradle though. Looking here: http://gradle.org/0.8/docs/userguide/organizing_build_logic.html I see this: "If you run Gradle, it checks for the existence of a folder called buildSrc. Just put your build source code in this folder and stick to the layout convention for a Java/Groovy project (see Table 18.4, “Java plugin - default project layout”). Gradle then automatically compiles and tests this code and puts it in the classpath of your build script." This is good, but I need to use source code that is not stored under buildSrc and has dependencies. The docs continue: "If you need more flexibility, you can provide a build.gradle and a settings.gradle file in the buildSrc folder" Could someone give me a little help here? 1) what is the relationship between buildSrc/build.gradle and the root build.gradle (do they share gradle properties or classpath or anything)? 2) could someone give me an example of a buildSrc/build.gradle that points to src and jars outside the default dir structure (like ../../java/src) + (../../java/lib) thanks! 1) create another buildPushTools.gradle file and run this first 2) use buildSrc somehow: http://gradle.org/0.8/docs/userguide/organizing_build_logic.html The problem is I can't move the code to ./buildSrc. Can I override this? 3)--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
-- Adam Murdoch Gradle Developer http://www.gradle.org --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
