diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-05-11 10:45:58 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-05-11 10:45:58 +0200 |
commit | efaefcd64ee798508df04c0b2c4d37e91d0049e8 (patch) | |
tree | 1958b88348e3cd0184ee8cd3d34ea16e11f51613 | |
parent | 0e05006d3a345a0219c7c607783d26d7f0b4fdf0 (diff) |
Add utility class containing Vespa version
-rw-r--r-- | vespa-feed-client/pom.xml | 21 | ||||
-rwxr-xr-x | vespa-feed-client/src/main/sh/vespa-version-generator.sh | 24 |
2 files changed, 45 insertions, 0 deletions
diff --git a/vespa-feed-client/pom.xml b/vespa-feed-client/pom.xml index 32b44012107..d0b0066f07e 100644 --- a/vespa-feed-client/pom.xml +++ b/vespa-feed-client/pom.xml @@ -70,6 +70,27 @@ </compilerArgs> </configuration> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-simplified-vtag</id> + <phase>generate-sources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>src/main/sh/vespa-version-generator.sh</executable> + <arguments> + <argument>${project.basedir}/../dist/vtag.map</argument> + <argument>${project.build.directory}/generated-sources/vespa-version/com/yahoo/vespa/feed/client/Vespa.java</argument> + </arguments> + <sourceRoot>${project.build.directory}/generated-sources/vespa-version</sourceRoot> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> </project> diff --git a/vespa-feed-client/src/main/sh/vespa-version-generator.sh b/vespa-feed-client/src/main/sh/vespa-version-generator.sh new file mode 100755 index 00000000000..d8f5878e2c5 --- /dev/null +++ b/vespa-feed-client/src/main/sh/vespa-version-generator.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +# Extracts the current version number (V_TAG_COMPONENT) from vtag.map and outputs this into a Java class. +# This replaces vespajlib/../VersionTagger.java as this module cannot depend on that, nor the dependencies +# of the resulting class. +# +# Author: bjorncs + +source=$1 +destination=$2 +destinationDir=$(dirname $destination) + +mkdir -p $destinationDir + +versionNumber=$(cat $source | grep V_TAG_COMPONENT | awk '{print $2}' ) + +cat > $destination <<- END +package com.yahoo.vespa.feed.client; + +class Vespa { + static final String VERSION = "$versionNumber"; +} +END |