From 5eb32b71118991ed7828c5e72b700b54a614e965 Mon Sep 17 00:00:00 2001 From: Nathan Voxland Date: Tue, 8 Feb 2022 15:54:32 -0600 Subject: [PATCH] Correctly set Bundle-Version in meta-inf on release --- .github/util/ManifestReversion.java | 7 +++++-- .github/util/re-version.sh | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/util/ManifestReversion.java b/.github/util/ManifestReversion.java index 690771d8c84..92308277985 100644 --- a/.github/util/ManifestReversion.java +++ b/.github/util/ManifestReversion.java @@ -12,7 +12,9 @@ public class ManifestReversion { public static void main(String[] args) throws Exception { String filename = args[0]; - String version = args[1]; + String version = args[1] + .replaceFirst("^v", ""); + Manifest manifest; try (InputStream input = new FileInputStream(filename)) { manifest = new Manifest(input); @@ -21,7 +23,8 @@ public static void main(String[] args) throws Exception { attributes.putValue("Liquibase-Version", version); - if (attributes.containsKey("Bundle-Version")) { + final String bundleVersion = attributes.getValue("Bundle-Version"); + if (bundleVersion != null) { attributes.putValue("Bundle-Version", version); } diff --git a/.github/util/re-version.sh b/.github/util/re-version.sh index e314928cbc2..6714fc3f012 100755 --- a/.github/util/re-version.sh +++ b/.github/util/re-version.sh @@ -55,6 +55,22 @@ do cp $workdir/$jar $outdir rename.ul 0-SNAPSHOT $version $outdir/$jar + + ## Make sure there are no left-over 0-SNAPSHOT versions + mkdir -p $workdir/test + unzip -q $outdir/*.jar -d $workdir/test + + if grep -rl "0-SNAPSHOT" $workdir/test; then + echo "Found '0-SNAPSHOT' in re-versioned jars" + exit 1 + fi + + if grep -rl "0.0.0.SNAPSHOT" $workdir/test; then + echo "Found '0.0.0.SNAPSHOT' in re-versioned jars" + exit 1 + fi + + rm -rf $workdir/test done #### Update javadoc jars