From 04ea3fca43b6eb4da16109aac4c51220b7bd0d89 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 7 Apr 2021 20:46:11 +0200 Subject: [PATCH] chore: adapt android scripts to use maven central (#307) The main changes here are two. First, tweak some bits of the POM template to make sure it's current, including referencing the correct repo. (We were still referencing probe-engine in there, weirdly enough). Second, change the android build script to create the same bundle that mavan would build. What remains to do is uploading manually. (Because it seems my PGP key is required, I guess this development rules out automatically generating releases at GitHub. We will see about it later on and possibly zap the publish-android.sh script.) Reference issue: https://github.com/ooni/probe/issues/1437. The release 2021.04.07-180801 has been created by me using this diff from the v3.9.0 tag. I will update the release notes as soon as this new release becomes available from Maven Central. --- MOBILE/template.pom | 12 +++++++++--- build-android.bash | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/MOBILE/template.pom b/MOBILE/template.pom index 086196b..cc116f4 100644 --- a/MOBILE/template.pom +++ b/MOBILE/template.pom @@ -2,13 +2,16 @@ 4.0.0 + org.ooni oonimkall @VERSION@ aar + oonimkall - OONI Probe Engine for Android - https://github.com/ooni/probe-engine + OONI Probe for Android + https://github.com/ooni/probe-cli + The 3-Clause BSD License @@ -16,18 +19,21 @@ repo + https://github.com/ooni/probe-engine https://github.com/ooni/probe-engine.git + Simone Basso simone@openobservatory.org - developer + Core developer Europe/Rome + diff --git a/build-android.bash b/build-android.bash index 161edb7..afef66f 100755 --- a/build-android.bash +++ b/build-android.bash @@ -2,7 +2,7 @@ set -e if [ -z "$ANDROID_HOME" -o "$1" = "--help" ]; then echo "" - echo "usage: $0" + echo "usage: $0 [--sign]" echo "" echo "Please set ANDROID_HOME. We assume you have installed" echo "the Android SDK. You can do that on macOS using:" @@ -27,5 +27,16 @@ set -x export PATH=$(go env GOPATH)/bin:$PATH go get -u golang.org/x/mobile/cmd/gomobile gomobile init -output=MOBILE/android/oonimkall.aar -gomobile bind -target=android -o $output -ldflags="-s -w" ./pkg/oonimkall +version=$(date -u +%Y.%m.%d-%H%M%S) +aarfile=MOBILE/android/oonimkall-$version.aar +gomobile bind -target=android -o $aarfile -ldflags="-s -w" ./pkg/oonimkall +pomfile=./MOBILE/android/oonimkall-$version.pom +pomtemplate=./MOBILE/template.pom +cat $pomtemplate|sed "s/@VERSION@/$version/g" > $pomfile +if [ "$1" == "--sign" ]; then + cd ./MOBILE/android + for file in `ls *`; do + gpg -ab -u simone@openobservatory.org $file + done + jar -cvf bundle.jar oonimkall-$version* +fi