Skip to content

Commit

Permalink
Merge pull request #3136 from elahrvivaz/fcr_refactor_builddir
Browse files Browse the repository at this point in the history
Add release script
  • Loading branch information
aheyne authored Jul 16, 2024
2 parents 6eaea0b + 85d3fb9 commit eef4bc8
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 895 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-2.13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
java-version: '11'
cache: 'maven'
- name: Set Scala version
run: ./build/change-scala-version.sh 2.13
run: ./build/scripts/change-scala-version.sh 2.13
- name: Build with Maven
run: ./build/mvn clean install $MAVEN_CLI_OPTS -DskipTests -T4
- name: Unit tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-2.13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
java-version: '11'
cache: 'maven'
- name: Set Scala version
run: ./build/change-scala-version.sh 2.13
run: ./build/scripts/change-scala-version.sh 2.13
- name: Build with Maven
run: ./build/mvn clean install $MAVEN_CLI_OPTS -DskipTests -T4
- name: Integration Tests
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ To run unit tests, omit the `-DskipTests` (note: requires `docker` to be availab
GeoMesa also provides experimental support for the [Bloop](https://scalacenter.github.io/bloop/) compile server,
which provides fast incremental compilation. To export the GeoMesa build to Bloop, run:

./build/bloop-export.sh
./build/scripts/bloop-export.sh

For more information on using Bloop, refer to the
[Bloop documentation](https://scalacenter.github.io/bloop/docs/build-tools/maven).
Expand All @@ -221,7 +221,7 @@ environment variable to point to the root of your JDK. Example from a Mac:

To build for a different Scala version (e.g. 2.13), run the following script, then build as normal:

./build/change-scala-version.sh 2.13
./build/scripts/change-scala-version.sh 2.13

### Building on OS X

Expand Down
63 changes: 0 additions & 63 deletions build/cyclonedx-settings.xml

This file was deleted.

188 changes: 0 additions & 188 deletions build/gt-30-api-changes.sed

This file was deleted.

573 changes: 0 additions & 573 deletions build/remove-opengis.xml

This file was deleted.

2 changes: 1 addition & 1 deletion build/bloop-export.sh → build/scripts/bloop-export.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

cd "$(dirname "$0")/.." || exit
cd "$(dirname "$0")/../.." || exit

mvn -Pbloop initialize ch.epfl.scala:bloop-maven-plugin:2.0.0:bloopInstall
2 changes: 2 additions & 0 deletions build/calculate-cqs.sh → build/scripts/calculate-cqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

export LC_ALL=C # ensure stable sort order across different locales

cd "$(dirname "$0")/../.." || exit

rm build/cqs.tsv 2>/dev/null
mvn dependency:tree -Dstyle.color=never > build/deps-raw
grep ':compile' build/deps-raw | grep -v 'omitted' | grep -v 'org.locationtech.geomesa' | sed -e 's/\[INFO\] //' -e 's/[\| +-]*//' -e 's/(.*)//' -e 's/ //g' -e 's/\(.*\):\(.*\):jar:\(.*\):\(\w*\)/\1:\2\t\3\t\4/' | sort | uniq > build/cqs.tsv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [[ ($# -ne 1) || ( $1 == "--help") || $1 == "-h" ]]; then
usage
fi

BASEDIR=$(dirname "$0")/..
BASEDIR="$(dirname "$0")/../.."
TO_VERSION=$1
FULL_VERSION=""

Expand Down
99 changes: 99 additions & 0 deletions build/scripts/do-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/../.." || exit

usage() {
echo "Usage: $(basename "$0") [-h|--help]
where :
-h| --help Display this help text
" 1>&2
exit 1
}

if [[ ($# -ne 0) || ( $1 == "--help") || $1 == "-h" ]]; then
usage
fi

readReleaseProp() {
grep "^$1=" release.properties | head -n1 | sed "s/$1=//"
}

readPomVersion() {
grep '^ <version>' "$1" | head -n1 | sed -E 's|.*<version>(.*)</version>.*|\1|'
}

copyReleaseArtifacts() {
while IFS= read -r -d '' file; do
pushd "$(dirname "$file")" >/dev/null
gpg --armor --detach-sign "$(basename "$file")"
sha256sum "$(basename "$file")" > "$(basename "$file").sha256"
popd >/dev/null
mv "$file"{,.sha256,.asc} "$RELEASE"
done < <(find geomesa-* -name '*-bin.tar.gz' -print0)
}

JAVA_VERSION="$(mvn help:evaluate -Dexpression=jdk.version -q -DforceStdout)"
if ! [[ $(java -version 2>&1 | head -n 1 | cut -d'"' -f2) =~ ^$JAVA_VERSION.* ]]; then
echo "Error: invalid Java version - Java $JAVA_VERSION required"
exit 1
fi

if ! [[ $(which gpg) ]]; then
echo "Error: gpg executable not found"
exit 1
fi

# get current branch we're releasing off
BRANCH="$(git branch --show-current)"

# use the maven release plugin to prep the pom changes but use dryRun to skip commit and tag
mvn release:prepare \
-DdryRun=true \
-DautoVersionSubmodules=true \
-Darguments="-DskipTests -Dmaven.javadoc.skip=true -Ppython" \
-Ppython

RELEASE="$(readPomVersion pom.xml.tag)"
TAG="$(readReleaseProp scm.tag)"
NEXT="$(readPomVersion pom.xml.next)"

# update README versions and commit
for pom in pom.xml pom.xml.tag pom.xml.next; do
sed -i "s|<geomesa\.release\.version>.*|<geomesa.release.version>$RELEASE</geomesa.release.version>|" "$pom"
sed -i "s|<geomesa\.devel\.version>.*|<geomesa.devel.version>$NEXT</geomesa.devel.version>|" "$pom"
done
mvn clean install -pl .
git commit -am "Set version for release $RELEASE"

# commit release tag
find . -name pom.xml -exec mv {}.tag {} \;
git commit -am "[maven-release-plugin] prepare release $TAG"
git tag "$TAG"

# commit next dev version
find . -name pom.xml -exec mv {}.next {} \;
git commit -am "[maven-release-plugin] prepare for next development iteration"

# clean up leftover release artifacts
mvn release:clean

# deploy to maven central
git checkout "$TAG"
mkdir -p "$RELEASE"

mvn clean deploy -Pcentral,python -DskipTests | tee build_2.12.log
copyReleaseArtifacts

./build/scripts/change-scala-version.sh 2.13
mvn clean deploy -Pcentral,python -DskipTests | tee build_2.13.log
copyReleaseArtifacts

# reset pom changes
./build/scripts/change-scala-version.sh 2.12

# push commits and tags
git checkout "$BRANCH"
git push lt "$BRANCH"
git push lt "$TAG"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

to="$(date +%Y)"
from="$((to - 1))"
dir="$(cd "$(dirname "$0")/.." || exit; pwd)"
dir="$(dirname "$0")/../.."

sed -i "s|<copyright.year>$from</copyright.year>|<copyright.year>$to</copyright.year>|" "$dir/pom.xml"

Expand Down
4 changes: 2 additions & 2 deletions build/README.md → build/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ To run unit tests, omit the `-DskipTests` (note: requires `docker` to be availab
GeoMesa also provides experimental support for the [Bloop](https://scalacenter.github.io/bloop/) compile server,
which provides fast incremental compilation. To export the GeoMesa build to Bloop, run:

./build/bloop-export.sh
./build/scripts/bloop-export.sh

For more information on using Bloop, refer to the
[Bloop documentation](https://scalacenter.github.io/bloop/docs/build-tools/maven).
Expand All @@ -221,7 +221,7 @@ environment variable to point to the root of your JDK. Example from a Mac:

To build for a different Scala version (e.g. 2.13), run the following script, then build as normal:

./build/change-scala-version.sh 2.13
./build/scripts/change-scala-version.sh 2.13

### Building on OS X

Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion geomesa-spark/geomesa-spark-jupyter-vegas/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>geomesa-spark_2.12</artifactId>
<groupId>org.locationtech.geomesa</groupId>
<version>5.0.0-SNAPSHOT</version>
<version>5.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit eef4bc8

Please sign in to comment.