project.output setting weirdness

Robert Sanders's Avatar

Robert Sanders

13 Jun, 2011 06:27 PM

I think this may be some form of bug, but I thought I'd report it here as it is unclear it is is or not.

What I have is a multi-project build, and I would like to set the output of the various sub-projects to include the version information.

If, in my root build.gradle I set the output using afterEvaluate then I can change the individual outputs of the subprojects, the problem is that the dependencies seem to have already been evaluated at this point, meaning that if project-B depends on the output of project-A then the dependency will simply be listed as "${project.name}.${project.type}" while the actual artificat will include the version.

Setting the output inside the subprojects closure seems to result in the project output simply being overwritten, I suspect because the GradleFxConvention class has its own output field.

Any ideas would be appreciated.

  1. Support Staff 1 Posted by Yennick Trevels on 13 Jun, 2011 07:36 PM

    Yennick Trevels's Avatar

    Hi Robert, thanks for trying out GradleFx ;)

    I have fixed an issue today concerning the output property. Overriding it in the build script didn't work because it was set afterwards by the plugin, this is resolved now on Github. I'll upload a 0.2.1 version of GradleFx so you have the fix.

  2. 2 Posted by Robert Sanders on 13 Jun, 2011 08:06 PM

    Robert Sanders's Avatar

    Hi Yennick, thanks for the quick reply, and the cool tool (GradleFx).

    I went ahead and built gradlefx.jar from source and the updated version is functioning as advertised.

    My only 'issue' is that what I am doing is essentially:

    subprojects {

    output = name + '-' + version + '.swc';
    

    }

    although what I would really like to do is:

    subprojects {

    afterEvaluate { Project project ->
        project.output = project.name + '-' + project.version + '.' + project.type;
    }
    

    }

    as the project.type isn't set until the afterEvaluate. I could drop the output = into each sub-projects build.gradle I suppose, it just seems a little against the gradle grain.

  3. Support Staff 3 Posted by Yennick Trevels on 13 Jun, 2011 08:35 PM

    Yennick Trevels's Avatar

    I tried this on one of my sample projects and it is indeed not working with the afterEvaluate, probably because we also execute some code in that phase. I'll try to come up with a solution for this.
    Meanwhile you should check out the examples section (https://github.com/GradleFx/GradleFx-Examples), and especially the multiproject-no-conventions one which I pushed today. It gives you examples on how to override each convention.
    I've uploaded the new 0.2.1 GradleFx jar just now, but it's awesome that you builded it yourself :)

  4. Support Staff 4 Posted by Yennick Trevels on 23 Jun, 2011 05:37 PM

    Yennick Trevels's Avatar

    I changed the convention for the output property. From now on you only have to specify the name, the type is handled internally. So you can now just do this:

    subprojects {
         output = name + '-' + version
    }
    

    You can download the 0.2.2 version from GitHub.

  5. Yennick Trevels closed this discussion on 28 Jun, 2011 02:37 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac