ICU-22324 Mavenization, script to generate serial test data

This commit is contained in:
Mihai Nita 2023-09-27 14:54:45 -07:00 committed by Mihai Nita
parent 7a0373411e
commit aa377d7366
4 changed files with 102 additions and 47 deletions

View file

@ -210,7 +210,7 @@ Edit the root pom file at `icu4j/pom.xml` and manually make this change:
<api.doc.version>${icu.major.version}</api.doc.version>
```
5. Update the following variables in `icu4j/releases_tools/api_reports.sh`
5. Update the following variables in `icu4j/releases_tools/shared.sh`
* `artifact_version` - The version used in the Maven `pom.xml` files. You can alternatively produce this value by running `mvn help:evaluate -Dexpression=project.version -q -DforceStdout`.
* `api_report_version` - The major version of the new version. Change during RC BRS.

View file

@ -2,19 +2,16 @@
# Copyright (C) 2023 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
export MAVEN_ARGS='--no-transfer-progress'
# Version update!
export artifact_version='74.1-SNAPSHOT'
export api_report_version='74'
export api_report_prev_version='73'
export out_dir=target
if [ ! -f "releases_tools/shared.sh" ]; then
echo "ERROR: This script should be executed while being in the icu4j folder"
exit
fi
. releases_tools/shared.sh
function checkThatJdk8IsDefault() {
javac -version appPath 2>&1 | grep -E 'javac 1\.8\.' > /dev/null
if [ $? -eq 0 ]; then
echo "The default JDK is JDK 8, all good!"
echo "The default JDK version is 8, all good!"
javac -version
else
echo "This step can only be executed with JDK 8!"
@ -25,40 +22,6 @@ function checkThatJdk8IsDefault() {
}
# Copy the icu artifacts from the local maven repo to the lib folder,
# so that we can use it as classpath.
function copyArtifacts() {
rm -fr ${out_dir}/lib/
mkdir -p ${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:tools_build:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:core:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:collate:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:icu4j-charset:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:currdata:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:langdata:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:regiondata:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:translit:${artifact_version} -DoutputDirectory=${out_dir}/lib/
}
function checkFileCreated() {
local OUT_FILE=$1
if [ -f "$OUT_FILE" ]; then
echo " Output file $OUT_FILE generated"
else
echo " Error generating output file $OUT_FILE"
exit
fi
}
function reportTitle() {
echo ""
echo "=============================================="
echo $*
echo "=============================================="
echo ""
}
# ====================================================================================
# The start of the script proper
@ -78,8 +41,7 @@ mvn site -q --batch-mode -DskipITs -DskipTests -P gatherapi > /dev/null
checkFileCreated "${out_dir}/icu4j${api_report_version}.api3.gz"
# Prepare classpath folder to run the tools
copyArtifacts
export toolcp="${out_dir}/lib/*"
copyDependencyArtifacts
# ====================================================================================
@ -137,4 +99,3 @@ java -cp "$toolcp" \
-t ${out_dir}/icu4j${api_report_version}.api3.gz
checkFileCreated "${out_dir}/draftAPIs.tsv"

View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Copyright (C) 2023 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
if [ ! -f "releases_tools/shared.sh" ]; then
echo "ERROR: This script should be executed while being in the icu4j folder"
exit
fi
. releases_tools/shared.sh
export serial_test_data_dir=${out_dir}/serialTestData
# ====================================================================================
# The start of the script proper
# Build everything
mvn clean install -DskipITs -DskipTests
# Prepare classpath folder to run the tools
copyDependencyArtifacts
reportTitle serialTestData :: generate the serialization compatibility test data files
rm -fr ${serial_test_data_dir}
mkdir -p ${serial_test_data_dir}
java -cp "$toolcp" com.ibm.icu.dev.test.serializable.SerializableWriter ${serial_test_data_dir}
echo "Note: The serialization compatibility test data files were"
echo "created in ${serial_test_data_dir}. Once you confirm"
echo "the test runs clean, you should copy the data file directory to"
echo "main/core/src/test/resources/com/ibm/icu/dev/test/serializable/data"

62
icu4j/releases_tools/shared.sh Executable file
View file

@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Copyright (C) 2023 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
export MAVEN_ARGS='--no-transfer-progress'
# Version update!
export artifact_version='74.1-SNAPSHOT'
export api_report_version='74'
export api_report_prev_version='73'
export out_dir=target
function checkThatJdk8IsDefault() {
javac -version appPath 2>&1 | grep -E 'javac 1\.8\.' > /dev/null
if [ $? -eq 0 ]; then
echo "The default JDK is JDK 8, all good!"
javac -version
else
echo "This step can only be executed with JDK 8!"
echo "Make sure that you have the PATH pointing to a JDK 8!"
javac -version
exit
fi
}
# Copy the icu artifacts from the local maven repo to the lib folder,
# so that we can use it as classpath.
function copyDependencyArtifacts() {
rm -fr ${out_dir}/lib/
mkdir -p ${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:core:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:collate:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:icu4j-charset:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:currdata:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:langdata:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:regiondata:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:translit:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:tools_build:${artifact_version} -DoutputDirectory=${out_dir}/lib/
mvn dependency:copy -q -Dartifact=com.ibm.icu:common_tests:${artifact_version}:jar:tests -DoutputDirectory=${out_dir}/lib/
export toolcp="${out_dir}/lib/*"
}
function checkFileCreated() {
local OUT_FILE=$1
if [ -f "$OUT_FILE" ]; then
echo " Output file $OUT_FILE generated"
else
echo " Error generating output file $OUT_FILE"
exit
fi
}
function reportTitle() {
echo ""
echo "=============================================="
echo $*
echo "=============================================="
echo ""
}