Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add release scripts, and fill out the remaining rules that we need to…
… deploy to maven I've used these to successfully install a local snapshot on my machine. Fixes #5 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=193705583
- Loading branch information
1 parent
b08ed99
commit 019f11b
Showing
6 changed files
with
184 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
if [ $# -lt 2 ]; then | ||
echo "usage $0 <ssl-key> <version-name> [<param> ...]" | ||
exit 1; | ||
fi | ||
key=$1 | ||
version_name=$2 | ||
shift 2 | ||
|
||
if [[ ! "$version_name" =~ ^2\. ]]; then | ||
echo 'Version name must begin with "2."' | ||
exit 2 | ||
fi | ||
|
||
if [[ "$version_name" =~ " " ]]; then | ||
echo "Version name must not have any spaces" | ||
exit 3 | ||
fi | ||
|
||
#validate key | ||
keystatus=$(gpg --list-keys | grep ${key} | awk '{print $1}') | ||
if [ "${keystatus}" != "pub" ]; then | ||
echo "Could not find public key with label ${key}" | ||
echo -n "Available keys from: " | ||
gpg --list-keys | grep --invert-match '^sub' | ||
|
||
exit 64 | ||
fi | ||
|
||
bazel test //... | ||
|
||
bash $(dirname $0)/execute-deploy.sh \ | ||
"gpg:sign-and-deploy-file" \ | ||
"$version_name" \ | ||
"-DrepositoryId=sonatype-nexus-staging" \ | ||
"-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/" \ | ||
"-Dgpg.keyname=${key}" | ||
|
||
# TODO(b/27549364): add a tag and publish Javadoc to the docs site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/sh | ||
set -eu | ||
|
||
readonly MVN_GOAL="$1" | ||
readonly VERSION_NAME="$2" | ||
shift 2 | ||
readonly EXTRA_MAVEN_ARGS=("$@") | ||
|
||
bazel_output_file() { | ||
library=$1 | ||
library_output=bazel-bin/$library | ||
if [[ ! -e $library_output ]]; then | ||
library_output=bazel-genfiles/$library | ||
fi | ||
if [[ ! -e $library_output ]]; then | ||
echo "Could not find bazel output file for $library" | ||
exit 1 | ||
fi | ||
echo -n $library_output | ||
} | ||
|
||
deploy_library() { | ||
library=$1 | ||
srcjar=$2 | ||
javadoc=$3 | ||
pomfile=$4 | ||
bazel build --define=pom_version="$VERSION_NAME" \ | ||
$library $srcjar $javadoc $pomfile | ||
|
||
mvn $MVN_GOAL \ | ||
-Dfile=$(bazel_output_file $library) \ | ||
-Djavadoc=$(bazel_output_file $javadoc) \ | ||
-DpomFile=$(bazel_output_file $pomfile) \ | ||
-Dsources=$(bazel_output_file $srcjar) \ | ||
"${EXTRA_MAVEN_ARGS[@]:+${EXTRA_MAVEN_ARGS[@]}}" | ||
} | ||
|
||
deploy_library \ | ||
api/merged_api.jar \ | ||
api/merged_api_src.jar \ | ||
api/api_javadoc.jar \ | ||
api/api_pom.xml | ||
|
||
deploy_library \ | ||
api/libsystem_backend.jar \ | ||
api/libsystem_backend-src.jar \ | ||
api/system_backend_javadoc.jar \ | ||
api/system_backend_pom.xml | ||
|
||
deploy_library \ | ||
api/libtesting.jar \ | ||
api/libtesting-src.jar \ | ||
api/testing_javadoc.jar \ | ||
api/testing_pom.xml | ||
|
||
deploy_library \ | ||
google/libflogger.jar \ | ||
google/libflogger-src.jar \ | ||
google/flogger_javadoc.jar \ | ||
google/google_logger_pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
echo -e "Installing maven snapshot locally...\n" | ||
|
||
bash $(dirname $0)/execute-deploy.sh \ | ||
"install:install-file" \ | ||
"LOCAL-SNAPSHOT" | ||
|
||
echo -e "Installed local snapshot" |