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