SmartGridready / SGrJava

SmartGridready communication handler in Java
0 stars 0 forks source link

Version detection with palantir fails #82

Closed mkrebs81 closed 1 month ago

mkrebs81 commented 3 months ago

When I check out the master branch and compile, I get 1.1.0-SNAPSHOT as version string, which seems correct. This also happens when the commit of the master branch matches the latest release tag.

When I check out a release tag like 1.1.0 directly, I get unspecified as version string, instead of 1.1.0.

ergo-furrer commented 3 months ago

Hmm, that's strange. Let me check this. Palantir should take the latest tag, which is 1.1.0, when you check out 1.1.0 I think. However may I misunderstood something...

mkrebs81 commented 3 months ago

When I add version = rootProject.version to the CommHandler4Modbus build file, it works.

Setting the version in publishing {...} is probably not correct, or does not work as intended.

ergo-furrer commented 3 months ago

To check, I did the following:

then I did:

It seems to work on my machine without moving the tag out of the publishing {...}.

However, I am not sure if it was a good idea to add SNAPSHOT depending on the branch not being 'master'. Maybe using just 'isCleanTag' and 'commitDistance' is enough. So we can use the branch name 'rel-1.1.0' or something like that whe checking out the 1.1.0 tag.

mkrebs81 commented 3 months ago

It's weird... after trying again a few times, I also get the correct version in my local maven repo.

Note that ./gradlew printVersion outputs the root project's version and not the version of the actual project. But it seems to work when publishing.

I agree that it might be feasible to ignore the branch name. That way we could also create updated releases on older branches, like 1.0.x.

ergo-furrer commented 3 months ago

Right. I will remove the master check.

mkrebs81 commented 1 month ago

will be removed in refactoring