ajoberstar / reckon

Infer a project's version from your Git repository.
Apache License 2.0
187 stars 28 forks source link

Gradle Plugin as composite build breaks reckon #74

Closed rodney757 closed 6 years ago

rodney757 commented 6 years ago

I recently migrated to reckon from you're older plugin and am running into an issue.

I have a gradle plugin that I include in a composite build

Both of these repos (plugin & main project) use reckon for version inferencing. However when I try and release the main project, I get the following error b/c reckon is "reckoning" the gradle plugin.

Cannot re-release a final version 1.3.0 as a pre-release: 2.0.0-beta.1

I've tried running the task with the : prefix to only run it for the root project w/ no luck

ajoberstar commented 6 years ago

I haven't used composite builds much myself, but I tried to reproduce this quickly and it seemed to reckon each project correctly. It's possible you're just running into some new validation in reckon 0.5.0.

To help figure out if this is tied to composite builds or 0.5.0, can you provide some more information?

rodney757 commented 6 years ago

gradle version: 4.6 reckon version: 0.5.0

plugin build.gradle:

reckon {
    normal = scopeFromProp()
    preRelease = stageFromProp('beta', 'rc', 'final')
}

git describe plugin: 1.3.0 git describe project: 1.0.0-beta.1-1-ge901882

gradle command: gw build -Preckon.scope=major -Preckon.stage=beta

cmd fail evaluating the plugin project.

The plugin applies the reckon plugin to the main project, so at the point of failure, reckon isn't even configured on the main project. However I was able to reproduce the issue by adding reckon to mainProject build.gradle and removing the apply step from the plugin

ajoberstar commented 6 years ago

I wonder if it has to do with it being a plugin project. I'll try to reproduce it that way. Thanks for the info!

ajoberstar commented 6 years ago

Ah, I think I see the issue now... Both projects are reading the -Preckon.* properties and trying to increment based on them. But, ideally you only want those properties to apply to the primary build within the composite.

I'll try a few things to see if there's a way to do this. May need to try to detect whether your part of a composite build within the plugin.

ajoberstar commented 6 years ago

FYI, I expect you'll run into the lack of composite build support for plugins once you get past this.

ajoberstar commented 6 years ago

You can test out 0.6.0-rc.1 to see if it solves your issue.

rodney757 commented 6 years ago

Thanks for the speedy fix!

Thanks for the head up on the composite issue. I remember running into it about a year ago, I we have some custom logic to make it work (though I can't remember the details, I would need to look at the code)