xref: /aosp_15_r20/external/icu/icu4j/releases_tools/github_release.sh (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker#!/usr/bin/env bash
2*0e209d39SAndroid Build Coastguard Worker# Copyright (C) 2023 and later: Unicode, Inc. and others.
3*0e209d39SAndroid Build Coastguard Worker# License & terms of use: http://www.unicode.org/copyright.html
4*0e209d39SAndroid Build Coastguard Worker
5*0e209d39SAndroid Build Coastguard Workerif [ ! -f "releases_tools/shared.sh" ]; then
6*0e209d39SAndroid Build Coastguard Worker  echo "ERROR: This script should be executed while being in the icu4j folder"
7*0e209d39SAndroid Build Coastguard Worker  exit
8*0e209d39SAndroid Build Coastguard Workerfi
9*0e209d39SAndroid Build Coastguard Worker. releases_tools/shared.sh
10*0e209d39SAndroid Build Coastguard Worker
11*0e209d39SAndroid Build Coastguard Workerfunction copyArtifactForGithubRelease() {
12*0e209d39SAndroid Build Coastguard Worker  local artifactId=$1
13*0e209d39SAndroid Build Coastguard Worker  # Copy artifacts in the output folder
14*0e209d39SAndroid Build Coastguard Worker  mvn dependency:copy -q -Dmdep.stripVersion=true -Dartifact=com.ibm.icu:${artifactId}:${artifact_version} -DoutputDirectory=${release_folder}
15*0e209d39SAndroid Build Coastguard Worker  mvn dependency:copy -q -Dmdep.stripVersion=true -Dartifact=com.ibm.icu:${artifactId}:${artifact_version}:jar:sources -DoutputDirectory=${release_folder}
16*0e209d39SAndroid Build Coastguard Worker  mvn dependency:copy -q -Dmdep.stripVersion=true -Dartifact=com.ibm.icu:${artifactId}:${artifact_version}:jar:javadoc -DoutputDirectory=${release_folder}
17*0e209d39SAndroid Build Coastguard Worker  # Change the names
18*0e209d39SAndroid Build Coastguard Worker  mv ${release_folder}/${artifactId}.jar ${release_folder}/${artifactId}-${github_rel_version}.jar
19*0e209d39SAndroid Build Coastguard Worker  mv ${release_folder}/${artifactId}-sources.jar ${release_folder}/${artifactId}-${github_rel_version}-sources.jar
20*0e209d39SAndroid Build Coastguard Worker  mv ${release_folder}/${artifactId}-javadoc.jar ${release_folder}/${artifactId}-${github_rel_version}-javadoc.jar
21*0e209d39SAndroid Build Coastguard Worker}
22*0e209d39SAndroid Build Coastguard Worker
23*0e209d39SAndroid Build Coastguard Worker# ====================================================================================
24*0e209d39SAndroid Build Coastguard Worker# The start of the script proper
25*0e209d39SAndroid Build Coastguard Worker
26*0e209d39SAndroid Build Coastguard Workerrelease_folder=${out_dir}/github_release
27*0e209d39SAndroid Build Coastguard Worker# We still need JDK 8 to generate the javadoc (because of the doclets)
28*0e209d39SAndroid Build Coastguard WorkercheckThatJdk8IsDefault
29*0e209d39SAndroid Build Coastguard Worker
30*0e209d39SAndroid Build Coastguard Worker# ====================================================================================
31*0e209d39SAndroid Build Coastguard Worker# Build artifacts and copy them in the output folder
32*0e209d39SAndroid Build Coastguard Worker
33*0e209d39SAndroid Build Coastguard WorkerreportTitle Prepare folder with artifacts for GitHub release
34*0e209d39SAndroid Build Coastguard Worker
35*0e209d39SAndroid Build Coastguard Workermvn clean install -DskipITs -DskipTests -P with_sources,with_javadoc
36*0e209d39SAndroid Build Coastguard Worker
37*0e209d39SAndroid Build Coastguard Workerrm   -fr ${release_folder}
38*0e209d39SAndroid Build Coastguard Workermkdir -p ${release_folder}
39*0e209d39SAndroid Build Coastguard WorkercopyArtifactForGithubRelease icu4j
40*0e209d39SAndroid Build Coastguard WorkercopyArtifactForGithubRelease icu4j-charset
41*0e209d39SAndroid Build Coastguard WorkercopyArtifactForGithubRelease icu4j-localespi
42*0e209d39SAndroid Build Coastguard Worker
43*0e209d39SAndroid Build Coastguard Worker# ====================================================================================
44*0e209d39SAndroid Build Coastguard Worker# Build complete javadoc and copy it in the output folder
45*0e209d39SAndroid Build Coastguard Worker
46*0e209d39SAndroid Build Coastguard WorkerreportTitle Prepare complete javadoc for GitHub release
47*0e209d39SAndroid Build Coastguard Worker
48*0e209d39SAndroid Build Coastguard Workermvn site -DskipITs -DskipTests -P with_full_javadoc
49*0e209d39SAndroid Build Coastguard Worker
50*0e209d39SAndroid Build Coastguard Workerjar -Mcf ${release_folder}/icu4j-${github_rel_version}-fulljavadoc.jar  -C ${out_dir}/site/apidocs/ .
51*0e209d39SAndroid Build Coastguard Worker
52*0e209d39SAndroid Build Coastguard Worker# ====================================================================================
53*0e209d39SAndroid Build Coastguard Worker
54*0e209d39SAndroid Build Coastguard Workerpushd ${release_folder}
55*0e209d39SAndroid Build Coastguard Workermd5sum *.jar > icu4j-${github_rel_version}.md5
56*0e209d39SAndroid Build Coastguard Workerpopd
57*0e209d39SAndroid Build Coastguard Worker
58*0e209d39SAndroid Build Coastguard WorkerreportTitle "You can find the results in ${release_folder}/"
59