Less hacky.

Could you use an #include directory search order that puts a
target/generated-sources/c first.

If you build without Maven, that dir will be empty and version.h will be
found from the regular source sir and say “a snapshot”

If you build with Maven, Maven will populate the generated source with a
concrete version.h that gets found first and presto!

On Sat 2 Nov 2019 at 09:59, Stephen Connolly <
[email protected]> wrote:

>
>
> On Thu 3 Oct 2019 at 16:13, Enrico Olivelli <[email protected]> wrote:
>
>> Hello,
>> I am going to propose a new release procedure in Apache ZooKeeper project
>> in the direction of using the Maven Release Plugin.
>> Usually with the Maven Release Plugin you are performing to tasks:
>>
>> mvn release:prepare -> change version + create tag
>> mvn release:perform  -> create final artifacts and deploy
>>
>> in the specific case of Apache ZooKeeper we have a C-client that  contains
>> C sources under a mavenized project, so in src/c or something like that,
>> not so important.
>>
>> The important fact is that I have the 'version' in pom.xml and in the C
>> client (make/configure based build).
>> I would like to introduce an hook that during "release:prepare" while
>> changing the version in all of the pom.xml files it changes the version
>> inside the C project.
>> I just need a way to invoke a bash script with a 'sed' command that has
>> the
>> new VERSION variable in a shell environment.
>> I can also write some java code or whatever else....
>>
>> But I need some "hook" during release:prepare.
>>
>> I can't find any documentation about this feature other then
>> "prepationGoals" but it is not documented and there is no good example on
>> the Internet
>>
>> https://maven.apache.org/maven-release/maven-release-plugin/examples/run-goals-before-commit.html
>>
>> Any idea or working example ?
>
>
> So if you are using GIT as your SCM, as long as you do `git add
> name-of-file` after changing the file inside preparationGoals then it will
> get committed with the pom.xml changes.
>
> A bit hacky, but works. My only use of it is closed source so cannot share
>
>
>>
>> Thanks
>> Enrico
>
>
>> --
> Sent from my phone
>
-- 
Sent from my phone

Reply via email to