Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for -Dbuild.version_qualifier. #139

Merged
merged 1 commit into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ testClusters.javaRestTest {

ext {
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
buildVersionQualifier = System.getProperty("build.version_qualifier")
}

allprojects {
group = 'org.opensearch'
version = opensearch_version - '-SNAPSHOT' + '.0'
version = opensearch_version.tokenize('-')[0] + '.0'
if (buildVersionQualifier) {
version += "-${buildVersionQualifier}"
}
if (isSnapshot) {
version += "-SNAPSHOT"
}
Expand Down
12 changes: 8 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ function usage() {
echo ""
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch version."
echo -e "-q QUALIFIER\t[Optional] Build qualifier."
echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'."
echo -e "-p PLATFORM\t[Optional] Platform, ignored."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored."
echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'."
echo -e "-h help"
}

while getopts ":h:v:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:" arg; do
case $arg in
h)
usage
Expand All @@ -29,6 +30,9 @@ while getopts ":h:v:s:o:p:a:" arg; do
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
Expand Down Expand Up @@ -62,12 +66,12 @@ fi
[[ "$SNAPSHOT" == "true" ]] && VERSION=$VERSION-SNAPSHOT
[ -z "$OUTPUT" ] && OUTPUT=artifacts

./gradlew publishToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
./gradlew publishAllPublicationsToStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
./gradlew publishToMavenLocal -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER
./gradlew publishAllPublicationsToStagingRepository -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER
mkdir -p $OUTPUT/maven/org/opensearch
cp -r ./build/local-staging-repo/org/opensearch/. $OUTPUT/maven/org/opensearch

./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT
./gradlew assemble --no-daemon --refresh-dependencies -DskipTests=true -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER
[ -z "$OUTPUT" ] && OUTPUT=artifacts
mkdir -p $OUTPUT/plugins
cp ./build/distributions/*.zip $OUTPUT/plugins