ICU-22324 Small fixes for script moving folders to maven structure

- Symlinks to LICENSE, so that it is included in the .jar files
- Fixed version in the jar manifests (s/73/74/)
- Added Main-Class, Export-Package, some *-Title and *-Description

At this point the .jar files (including manifests) produced by ant / maven
are byte to byte identical, except for some small differences that are
expected and can be explained (will cover them in the email to the team)
This commit is contained in:
Mihai Nita 2023-08-21 16:06:05 -07:00
parent 2270c174a5
commit fb0f36203a
8 changed files with 107 additions and 24 deletions

View file

@ -20,7 +20,7 @@ checkout `<feature_branch>`, and run script from where you copied it.
Probably modify the step that produces the .jar files (in the C/C++ world)
- done: The tests for localespi should become integration tests
- We might want some integration tests to begin with
- `LICENSE`, `security.policy`, anything else from `main/shared/` => LICENSE should be symlink.
- done: `LICENSE`, `security.policy`, anything else from `main/shared/` => LICENSE should be symlink.
- done: The `.lst` files. All tests pass without, we can probably delete them. But need more testing.
If not, we need a way to generate them (right now I've copied them by hand)
- Double-check dependencies.

View file

@ -15,7 +15,8 @@
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
<mf.Automatic-Module-Name>com.ibm.icu.charset</mf.Automatic-Module-Name>
<module-name>charset</module-name>
<proj.displayname>charset</proj.displayname>
</properties>
<dependencies>
@ -55,4 +56,19 @@
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Export-Package>com.ibm.icu.charset</Export-Package>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -53,6 +53,16 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Main-Class>com.ibm.icu.util.VersionInfo</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

View file

@ -39,7 +39,18 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Main-Class>com.ibm.icu.dev.test.TestAll</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -16,6 +16,14 @@
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
<mf.Automatic-Module-Name>com.ibm.icu</mf.Automatic-Module-Name>
<mf.Bundle-SymbolicName>com.ibm.icu</mf.Bundle-SymbolicName>
<mf.Bundle-Name>ICU4J</mf.Bundle-Name>
<localTitle>International Components for Unicode for Java</localTitle>
<mf.Bundle-Description>${localTitle}</mf.Bundle-Description>
<mf.Implementation-Title>${localTitle}</mf.Implementation-Title>
<mf.Specification-Title>${localTitle}</mf.Specification-Title>
</properties>
<dependencies>
@ -71,6 +79,17 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Main-Class>com.ibm.icu.util.VersionInfo</Main-Class>
<Export-Package>com.ibm.icu.lang,com.ibm.icu.math,com.ibm.icu.number,com.ibm.icu.text,com.ibm.icu.util</Export-Package>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>

View file

@ -39,34 +39,40 @@
<proj-title>International Components for Unicode for Java</proj-title>
<proj.displayname>${project.artifactId}</proj.displayname>
<mf.Manifest-Version>1.0</mf.Manifest-Version>
<mf.Specification-Title>${proj-title} (${proj.displayname})</mf.Specification-Title>
<mf.Implementation-Title>${proj-title} (${proj.displayname})</mf.Implementation-Title>
<mf.Bundle-Description>${proj-title} (${proj.displayname})</mf.Bundle-Description>
<mf.Automatic-Module-Name>com.ibm.icu.${project.artifactId}</mf.Automatic-Module-Name>
<api.doc.version>73 Release Candidate</api.doc.version>
<!-- Variables used to generate the javadoc -->
<api.doc.version>74 Release Candidate</api.doc.version>
<icu4j.api.doc.window.title>ICU4J ${api.doc.version}</icu4j.api.doc.window.title>
<icu4j.api.doc.header>ICU4J ${api.doc.version}</icu4j.api.doc.header>
<icu4j.api.doc.copyright.footer>&lt;font size=-1&gt;Copyright © 2016 Unicode, Inc. and others.&lt;/font&gt;</icu4j.api.doc.copyright.footer>
<!-- Needs to be overriden in sub-modules -->
<icu4j.api.doc.root.dir>${project.basedir}</icu4j.api.doc.root.dir>
<mf.Specification-Version>73</mf.Specification-Version>
<mf.Implementation-Version>73.0.1</mf.Implementation-Version>
<mf.Bundle-Version>73.0.1</mf.Bundle-Version>
<!-- Used for the .jar Manifest files -->
<mf.Specification-Version>74</mf.Specification-Version>
<mf.Implementation-Version>74.0.1</mf.Implementation-Version>
<mf.Bundle-Version>74.0.1</mf.Bundle-Version>
<mf.Bundle-RequiredExecutionEnvironment>JavaSE-1.8</mf.Bundle-RequiredExecutionEnvironment>
<!-- For most modules artifactId does not have an "icu4j" prefix, so this is a good default -->
<module-name>${project.artifactId}</module-name>
<!-- Manifest fields that rarely change, if ever -->
<mf.Specification-Title>${proj-title} (${proj.displayname})</mf.Specification-Title>
<mf.Implementation-Title>${proj-title} (${proj.displayname})</mf.Implementation-Title>
<mf.Bundle-Description>${proj-title} (${proj.displayname})</mf.Bundle-Description>
<mf.Bundle-SymbolicName>com.ibm.icu.${module-name}</mf.Bundle-SymbolicName>
<mf.Automatic-Module-Name>com.ibm.icu.${module-name}</mf.Automatic-Module-Name>
<mf.Bundle-Name>ICU4J ${proj.displayname}</mf.Bundle-Name>
<mf.Specification-Vendor>Unicode, Inc.</mf.Specification-Vendor>
<mf.Implementation-Vendor>Unicode, Inc.</mf.Implementation-Vendor>
<mf.Bundle-Vendor>Unicode, Inc.</mf.Bundle-Vendor>
<mf.Implementation-Vendor-Id>org.unicode</mf.Implementation-Vendor-Id>
<mf.Manifest-Version>1.0</mf.Manifest-Version>
<mf.Bundle-ManifestVersion>2</mf.Bundle-ManifestVersion>
<mf.Bundle-Name>ICU4J ${proj.displayname}</mf.Bundle-Name>
<mf.Automatic-Module-Name>com.ibm.icu.${project.artifactId}</mf.Automatic-Module-Name>
<mf.Bundle-Copyright>© 2016 and later: Unicode, Inc. and others. License &amp; terms of use: http://www.unicode.org/copyright.html</mf.Bundle-Copyright>
<mf.Bundle-RequiredExecutionEnvironment>JavaSE-1.8</mf.Bundle-RequiredExecutionEnvironment>
</properties>
<build>

View file

@ -148,11 +148,14 @@ function mainModuleToMaven() {
echo "Migrating $1 to maven"
moveMainModuleToMaven $1 classes main
moveMainModuleToMaven $1 tests test
mkdir -p main/$MODULE_NAME/src/main/resources/
ln -s ../../../../../../LICENSE main/$MODULE_NAME/src/main/resources/LICENSE
}
function simpleModuleToMaven() {
# 1. $1: component name (core, charset, etc)
export MODULE_NAME=$1
export LICENSE_PATH=$2
echo "Migrating $MODULE_NAME to maven"
safeMoveDir com $MODULE_NAME/src $MODULE_NAME/src/main/java
@ -160,6 +163,9 @@ function simpleModuleToMaven() {
removeEclipseProjectFiles $MODULE_NAME
mkdir -p $MODULE_NAME/src/main/resources/
ln -s $LICENSE_PATH $MODULE_NAME/src/main/resources/LICENSE
echo " Remove empty folders from '$MODULE_NAME'"
removeEmptyFolders $MODULE_NAME
}
@ -231,15 +237,15 @@ function moveCircDepTestOutOfCore() {
# ===============================================================
# Here starts the real script execution
if [ -f "main/core/pom.xml" ]; then
echo "ERROR: looks like the structure was already migrated to maven?"
exit
fi
if [ ! -f "main/classes/core/build.xml" ]; then
echo "ERROR: the current folder when running this script should be <icu_root>/icu4j"
echo "It is currently $PWD."
exit
fi
if [ -f "main/core/pom.xml" ]; then
echo "ERROR: looks like the structure was already migrated to maven?"
exit
fi
MVN_MIG_DIR="$(dirname "${BASH_SOURCE[0]}")"
@ -269,10 +275,10 @@ mainModuleToMaven framework
echo "===================================="
echo "==== Migrating the root modules ===="
echo "===================================="
simpleModuleToMaven demos
simpleModuleToMaven samples
simpleModuleToMaven tools/build
simpleModuleToMaven tools/misc
simpleModuleToMaven demos ../../../../../LICENSE
simpleModuleToMaven samples ../../../../../LICENSE
simpleModuleToMaven tools/build ../../../../../../LICENSE
simpleModuleToMaven tools/misc ../../../../../../LICENSE
echo "================================================================================="
echo "==== Moving core unit tests that depend on non-core (circular dependencies) ====="

View file

@ -31,4 +31,19 @@
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Main-Class>com.ibm.icu.dev.tool.localeconverter.XLIFF2ICUConverter</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>