ICU-22324 Script moving folders to maven structure

This commit is contained in:
Mihai Nita 2023-02-22 00:08:00 -08:00
parent ffc449de62
commit a7a2fdbcf2
20 changed files with 1675 additions and 0 deletions

View file

@ -0,0 +1,49 @@
# Maven progress
## Running the migration scripts
Change the folder to `<icuroot>/icu4j/` and run `maven-migration/toMaven.sh`.
For convenience you can copy the `maven-migration` folder somewhere else and
run the script from there. \
But the current folder when running the script MUST be `<icuroot>/icu4j/`. \
This is convenient if you work in a feature branch and don't want to integrate
from `main` at this point. \
So you checkout `main`, copy the `maven-migration` folder somewhere else,
checkout `<feature_branch>`, and run script from where you copied it.
## TODO
- Packaging the many data files in a jar is slow (especially core)
- The data files (.res & Co.) are spread out in the various modules.
So we would need a (non maven) step to distribute them.
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: 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.
Also see https://stackoverflow.com/questions/27726779/declare-maven-dependency-as-test-runtime-only
- BOM (Bill of Materials). See https://reflectoring.io/maven-bom/
- See the library shared with cldr tools
- Also to do:
- promote this one folder up?
- done: - build things in parent (demos, samples, tools)
- done: - from the parent folder these will go away
- `main/` ?
- `maven/`
- `maven-build/`
- `manifest.stub`
- `coverage-exclusion.txt`
- `build.xml`
- `ivy.xml`
- Change icu4j artifact description: \
from "International Component for Unicode for Java" \
to "International Components for Unicode for Java" (Components) \
Fix all instances (found 6 instances, 4 in older pom.xml files, 2 in .md files)
> Copyright © 2023 and later Unicode, Inc. and others. All Rights Reserved.
Unicode and the Unicode Logo are registered trademarks
of Unicode, Inc. in the U.S. and other countries.
[Terms of Use and License](http://www.unicode.org/copyright.html)

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>demos</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-charset</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>translit</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>icu4j-charset</artifactId>
<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>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>framework</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>${junitparams.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>collate</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>framework</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>langdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>regiondata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>currdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>common_tests</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>framework</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>currdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>translit</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>langdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>collate</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>regiondata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>${junitparams.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>core</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>framework</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>${junitparams.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>currdata</artifactId>
<properties>
<proj.displayname>currency data</proj.displayname>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>framework</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>icu4j</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>collate</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>currdata</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>langdata</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>regiondata</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>translit</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>langdata</artifactId>
<properties>
<proj.displayname>language data</proj.displayname>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>icu4j-localespi</artifactId>
<properties>
<proj.displayname>JDK locale service provider</proj.displayname>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
<mf.Automatic-Module-Name>com.ibm.icu.localespi</mf.Automatic-Module-Name>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>framework</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>currdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>langdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>regiondata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--
Do not run localespi tests as unit tests because they depend on loading the main code via a .jar file
via the Java extensions mechanism.
-->
<skipTests>true</skipTests>
</configuration>
</plugin>
<!--
Mainly for running localespi tests in Java 8:
The easiest way to get the integration tests to pass (in particular, to get the JVM that is
spawned with the `-Djava.ext.dirs` system property value to be interpreted properly in order
for the extensions jars therein to be loaded correctly) was to copy the jars needed to a
separate directory. (The alternative of pointing to the build directories of the respective
submodules didn't seem to work.)
This isn't of much use for Java 9+, in which extensions are deprecated and the regular
classpath is to be used instead.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>it-test-copy-localespi-extension-jars</id>
<phase>integration-test</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>icu4j</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>icu4j-localespi</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
</artifactItem>
</artifactItems>
<!-- https://stackoverflow.com/questions/36181371/how-can-i-get-the-temp-folder-of-a-machine-running-maven -->
<outputDirectory>${java.io.tmpdir}/ext-test-jars</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.2</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<!-- treat localespi tests as integration tests because they depend on .jar files from package phase -->
<include>**/*.java</include>
<!-- default integration test wildcard patterns -->
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
<!--
For Java 8:
Set up the locale service provider using the .jar file of `icu4j-localespi` main code from the `package` phase
Leave empty for Java 9+.
Using the `java.ext.dirs` special Java system property on Java 9+ runtimes triggers an
error that tells the user to place those jars on the classpath instead.
-->
<!--
Notes:
https://stackoverflow.com/a/5039973/2077918
The `java.ext.dirs` is a special Java system property that activates the Java extension mechanism.
The Java extension mechanism was deprecated in Java 8 (users are recommended to use `-classpath` instead),
and the extension mechanism was removed in Java 9 altogether.
For backwards compatibility testing for users of the Java extension mechansim,
this configuration achieves the effect of having the localespi code in a .jar file that gets loaded
by running this test in a phase following the `package` phase in which the .jar file is created.
https://stackoverflow.com/questions/45223908/why-does-the-java-extension-mechanism-not-check-the-classpath-for-an-optional-pa
For some reason, the plugin was effectively not honoring the values as expected that were set in
<systemPropertyVariables>, so instead, the <argLine> value was used to set the JVM options. This
approach was inspired by: https://stackoverflow.com/a/48213614/2077918
-->
<argLine>${localespi-tests.jvm.args}</argLine>
<!--
For Java 9+:
Configure to use the locale service provider using the .jar file of `icu4j-localespi` main code from the `package` phase
Leave empty for Java 8 to take defaults ("SPI,JRE").
See: https://stackoverflow.com/questions/45223908/why-does-the-java-extension-mechanism-not-check-the-classpath-for-an-optional-pa
-->
<systemPropertyVariables>
<java.locale.providers>${localespi-tests.locale-providers}</java.locale.providers>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!--
For testing localespi using the Java extensions feature, which last existed in Java 8.
ICU4J currently has a minimum supported version of 8.
-->
<profile>
<id>localespi-tests-java8</id>
<activation>
<jdk>(,8]</jdk>
</activation>
<properties>
<localespi-tests.jvm.args>-Djava.ext.dirs="${java.io.tmpdir}/ext-test-jars"</localespi-tests.jvm.args>
<localespi-tests.locale-providers></localespi-tests.locale-providers>
</properties>
</profile>
<!--
For testing localespi using the classpath for Java 9+, since Java extensions were
deprecated after Java 8.
-->
<profile>
<id>localespi-tests-java9</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<properties>
<localespi-tests.jvm.args></localespi-tests.jvm.args>
<localespi-tests.locale-providers>CLDR,COMPAT,SPI</localespi-tests.locale-providers>
</properties>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>main</artifactId>
<packaging>pom</packaging>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/..</icu4j.api.doc.root.dir>
</properties>
<modules>
<module>framework</module>
<module>core</module>
<!-- For publishing to Maven Central -->
<module>charset</module>
<module>collate</module>
<module>currdata</module>
<module>langdata</module>
<module>regiondata</module>
<module>translit</module>
<module>common_tests</module>
<!-- Shaded jar for publishing to Maven Central -->
<module>icu4j</module>
<!-- For publishing to Maven Central. Not shaded, but depends on the shaded artifacts above.
Also contains all the project properties (developers, scm, etc) needed for maven publishing.
-->
<module>localespi</module>
</modules>
</project>

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>regiondata</artifactId>
<properties>
<proj.displayname>region data</proj.displayname>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>main</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>translit</artifactId>
<properties>
<proj.displayname>transliteration</proj.displayname>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>framework</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>langdata</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<version>${junitparams.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,327 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>74.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>${proj-title} (${project.artifactId})</name>
<description>International Component for Unicode for Java (ICU4J) is a mature, widely used Java library
providing Unicode and Globalization support</description>
<organization>
<name>Unicode, Inc.</name>
<url>https://icu.unicode.org/</url>
</organization>
<modules>
<module>main</module>
<module>demos</module>
<module>samples</module>
<module>tools/build</module>
<module>tools/misc</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<junit.version>4.13.2</junit.version>
<junitparams.version>1.1.1</junitparams.version>
<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 -->
<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>
<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.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>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>4.0.0-M9</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.4.5</version>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<excludePackageNames>com.ibm.icu.impl,com.ibm.icu.impl.*,com.ibm.icu.dev.*,com.ibm.icu.samples,com.ibm.icu.samples.*</excludePackageNames>
<!--
The ant project specified <doclint>reference,html</doclint>.
But that fails in main\core\src\main\java because maven enforces dependencies more strictly:
[ERROR] com\ibm\icu\text\UnicodeFilter.java:15: error: reference not found
[ERROR] * {@link com.ibm.icu.text.Transliterator}
[ERROR] com\ibm\icu\util\ULocale.java:100: error: reference not found
[ERROR] * {@link com.ibm.icu.text.Collator}
-->
<doclint>html</doclint>
<notimestamp>true</notimestamp>
<nodeprecatedlist>true</nodeprecatedlist>
<quiet>true</quiet>
<windowtitle>${icu4j.api.doc.window.title}</windowtitle>
<doctitle>${icu4j.api.doc.window.title}</doctitle>
<header>${icu4j.api.doc.header}</header>
<bottom>${icu4j.api.doc.copyright.footer}</bottom>
<stylesheetfile>stylesheet8.css</stylesheetfile>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<charset>UTF-8</charset>
<breakiterator>true</breakiterator>
<use>true</use>
<!-- <verbose>true</verbose> -->
<additionalJOptions>
<additionalJOption>-J-Djcitesourcepath=${icu4j.api.doc.root.dir}/samples/src/main/java${path.separator}${icu4j.api.doc.root.dir}/demos/src/main/java${path.separator}${icu4j.api.doc.root.dir}/main/core/src/main/java</additionalJOption>
<additionalJOption>-J-Dfile.encoding=UTF-8</additionalJOption>
<additionalJOption>-J-Djciteverbose=true</additionalJOption>
</additionalJOptions>
<taglets>
<taglet>
<tagletClass>com.ibm.icu.dev.tool.docs.ICUTaglet</tagletClass>
<!-- We can use `tagletArtifact` instead of `tagletpath`,
but then we must `mvn install` the `tools_build` artifact. -->
<tagletpath>${icu4j.api.doc.root.dir}/tools/build/target/classes</tagletpath>
</taglet>
<taglet>
<tagletClass>ch.arrenbrecht.jcite.JCiteTaglet</tagletClass>
</taglet>
</taglets>
<tagletArtifacts>
<tagletArtifact>
<groupId>org.mcraig</groupId>
<artifactId>jcite</artifactId>
<version>1.13.0</version>
</tagletArtifact>
<!-- Dependencies for org.mcraig:jcite -->
<tagletArtifact>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
</tagletArtifact>
<tagletArtifact>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</tagletArtifact>
</tagletArtifacts>
<tags>
<tag>
<name>category</name>
<placement>a</placement>
<head>Category:</head>
</tag>
</tags>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<Automatic-Module-Name>${mf.Automatic-Module-Name}</Automatic-Module-Name>
<Bundle-Copyright>${mf.Bundle-Copyright}</Bundle-Copyright>
<Specification-Title>${mf.Specification-Title}</Specification-Title>
<Specification-Version>${mf.Specification-Version}</Specification-Version>
<Specification-Vendor>${mf.Specification-Vendor}</Specification-Vendor>
<Implementation-Title>${mf.Implementation-Title}</Implementation-Title>
<Implementation-Version>${mf.Implementation-Version}</Implementation-Version>
<Implementation-Vendor>${mf.Implementation-Vendor}</Implementation-Vendor>
<Implementation-Vendor-Id>${mf.Implementation-Vendor-Id}</Implementation-Vendor-Id>
<Bundle-ManifestVersion>${mf.Bundle-ManifestVersion}</Bundle-ManifestVersion>
<Bundle-Name>${mf.Bundle-Name}</Bundle-Name>
<Bundle-Description>${mf.Bundle-Description}</Bundle-Description>
<Bundle-SymbolicName>${mf.Bundle-SymbolicName}</Bundle-SymbolicName>
<Bundle-Version>${mf.Bundle-Version}</Bundle-Version>
<Bundle-Vendor>${mf.Bundle-Vendor}</Bundle-Vendor>
<Bundle-Copyright>${mf.Bundle-Copyright}</Bundle-Copyright>
<Bundle-RequiredExecutionEnvironment>${mf.Bundle-RequiredExecutionEnvironment}</Bundle-RequiredExecutionEnvironment>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<!-- This is used to create the *-sources.jar for individual modules -->
<!-- TODO: the shaded equivalent. -->
<profile>
<id>with_sources</id>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- This is used to create the *-javadoc.jar for individual modules -->
<!-- TODO: the shaded equivalent. -->
<profile>
<id>with_javadoc</id>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- This is used to create the *-javadoc.jar for individual modules -->
<profile>
<id>with_full_javadoc</id>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>aggregate</id>
<phase>site</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>74.0.1-SNAPSHOT</version>
</parent>
<artifactId>samples</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>collate</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

290
icu4j/maven-migration/toMaven.sh Executable file
View file

@ -0,0 +1,290 @@
#!/usr/bin/env bash
# Copyright (C) 2023 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
# Move the sources from main/classes and main/tests into a maven structure
# - `main/classes/foo/src/java` go to `foo/src/main`, then split into `java` and `resources`
# - `main/tests/foo/src/java` go to `foo/src/test`, then split into `java` and `resources`
# - `main/tests/foo/src/META-INF` goes to ... `resources`
#
# From this:
# classes/
# <module>/
# src/
# test/
# <module>/
# src/
#
# To this (standard maven structure):
# <module>/
# main/
# src/
# java/
# resources/
# test/
# src/
# java/
# resources/
#
# Then we cleanup older Eclipse project & launcher files, ant scripts, manifest.stub
function rmDirIfExists() {
[ -d "$1" ] && rm -fr "$1"
}
function rmFileIfExists() {
[ -f "$1" ] && rm "$1"
}
function safeMoveDir() {
export FOLDER_NAME=$1
export FROM_FOLDER=$2
export TO_FOLDER=$3
if [ ! -d "$FROM_FOLDER/$FOLDER_NAME" ]; then
echo " No '$FROM_FOLDER/$FOLDER_NAME' to move."
return
fi
if [ -e "$TO_FOLDER/$FOLDER_NAME" ]; then
echo " Error: folder '$TO_FOLDER/$FOLDER_NAME' already exists!"
exit
else
mkdir -p $TO_FOLDER
mv $FROM_FOLDER/$FOLDER_NAME $TO_FOLDER/
echo " Moving '$FOLDER_NAME' folder from '$FROM_FOLDER' to '$TO_FOLDER'"
fi
}
# Split the content of the `java` foldert into `java` and `resources`, the way maven wants it
function splitJavaToResources() {
# Should point to the folder containing `java`, either main/ or test/
export BASE_FOLDER=$1
echo " Splitting '$BASE_FOLDER/java/' into '$BASE_FOLDER/java/' and '$BASE_FOLDER/resources/'"
# copy `java` to `resources`
cp -R $BASE_FOLDER/java/ $BASE_FOLDER/resources/
# delete all not `.java` from `java`
find $BASE_FOLDER/java/ -type f -not -name *.java -exec rm {} \;
# delete all `.java` from `resources`
find $BASE_FOLDER/resources/ -type f -name *.java -exec rm {} \;
}
function removeEclipseProjectFiles() {
# Should point to the old folder (to be moved), containing the eclipse / ant files
export BASE_FOLDER=$1
# Cleanup Eclipse project & launcher files, ant projects, other stuff
# Eclipse
rmDirIfExists "$BASE_FOLDER/.externalToolBuilders/"
rmDirIfExists "$BASE_FOLDER/.settings/"
rmFileIfExists "$BASE_FOLDER/.project"
rmFileIfExists "$BASE_FOLDER/.classpath"
# Ant
rmFileIfExists "$BASE_FOLDER/build.properties"
rmFileIfExists "$BASE_FOLDER/build.xml"
rmFileIfExists "$BASE_FOLDER/manifest.stub"
rmFileIfExists "$BASE_FOLDER/findbugs-exclude.xml"
find $BASE_FOLDER/ -type f -name '*.launch' -exec rm {} \;
}
# Takes a folder as parameter and removes the all the empty sub-folders.
function removeEmptyFolders() {
export BASE_FOLDER=$1
# `find -type d .` finds all subfolders, empty or not.
# We can't just force delete (-r), as that would also delete non-empty folders.
# And the find iteration is not children first, but parent first.
# If I call this with `main/classes/` then I need a loop:
# loop 1:
# rm `main/classes/` => FAILS, not empty
# rm `main/classes/core/` => FAILS, not empty
# rm `main/classes/core/src/` => OK
# loop 2:
# rm `main/classes/` => FAILS, not empty
# rm `main/classes/core/` => OK
# loop 3:
# rm `main/classes/` => OK
# If there is any file left in some folder, that (and the parent folders) are not deleted.
# That's why we loop here (although 15 might be a bit much :-)
for ((n = 0; n < 15; n++)) do
find $BASE_FOLDER -type d -exec rm -d {} \; 2> /dev/null
done
}
function moveMainModuleToMaven() {
# 1. $1: component name (core, charset, etc)
export MODULE_NAME=$1
# 2. folder name in the pre-maven structure (`classes` or `tests`)
export SRC_TYPE=$2
# 3. folder name in the maven standard structure (`main` or `test`)
export TRG_TYPE=$3
if [ ! -d main/$SRC_TYPE/$MODULE_NAME ]; then
echo " Module '$MODULE_NAME' does not have '$SRC_TYPE' to move to '$TRG_TYPE'"
return
fi
safeMoveDir com main/$SRC_TYPE/$MODULE_NAME/src main/$MODULE_NAME/src/$TRG_TYPE/java
splitJavaToResources main/$MODULE_NAME/src/$TRG_TYPE
safeMoveDir META-INF main/$SRC_TYPE/$MODULE_NAME/src main/$MODULE_NAME/src/$TRG_TYPE/resources
removeEclipseProjectFiles main/$SRC_TYPE/$MODULE_NAME
# Remove the original (pre-maven) folders that were left empty after we moved stuff out
# For example if all we had was source code + Eclipse files the folder will be left empty.
# e.g. main/classes/collate
echo " Remove all empty pre-maven folders from 'main/$SRC_TYPE/$MODULE_NAME'"
removeEmptyFolders main/$SRC_TYPE/$MODULE_NAME
# Remove folders that didn't receive any content in the new structure.
# For example when we copy the `java` folder to `resources`, then remove
# all the *.java files, we might end up with empty `resources` folder
# if there was no data file mixed-in with the code to begin with.
# e.g. main/collate/src/main
echo " Remove all empty post-maven folders from 'main/$MODULE_NAME/src/$TRG_TYPE'"
removeEmptyFolders main/$MODULE_NAME/src/$TRG_TYPE
}
function mainModuleToMaven() {
echo "Migrating $1 to maven"
moveMainModuleToMaven $1 classes main
moveMainModuleToMaven $1 tests test
}
function simpleModuleToMaven() {
# 1. $1: component name (core, charset, etc)
export MODULE_NAME=$1
echo "Migrating $MODULE_NAME to maven"
safeMoveDir com $MODULE_NAME/src $MODULE_NAME/src/main/java
splitJavaToResources $MODULE_NAME/src/main
removeEclipseProjectFiles $MODULE_NAME
echo " Remove empty folders from '$MODULE_NAME'"
removeEmptyFolders $MODULE_NAME
}
function moveCoreTestFileToCommon() {
export FOLDER_NAME=$1
export FILE_NAME=$2
mkdir -p $COMMON_TEST_FOLDER/$FOLDER_NAME
mv $CORE_TEST_FOLDER/$FOLDER_NAME/$FILE_NAME $COMMON_TEST_FOLDER/$FOLDER_NAME/
}
function moveCircDepTestOutOfCore() {
export CORE_TEST_FOLDER=main/core/src/test/java/com/ibm/icu/dev/test
export COMMON_TEST_FOLDER=main/common_tests/src/test/java/com/ibm/icu/dev/test
mkdir -p $CORE_TEST_FOLDER
moveCoreTestFileToCommon calendar DataDrivenCalendarTest.java
moveCoreTestFileToCommon format CompactDecimalFormatTest.java
moveCoreTestFileToCommon format DataDrivenFormatTest.java
moveCoreTestFileToCommon format DateFormatTest.java
moveCoreTestFileToCommon format MeasureUnitTest.java
moveCoreTestFileToCommon format NumberFormatDataDrivenTest.java
moveCoreTestFileToCommon format NumberFormatRegressionTest.java
moveCoreTestFileToCommon format NumberFormatSpecificationTest.java
moveCoreTestFileToCommon format NumberFormatTest.java
moveCoreTestFileToCommon format NumberRegressionTests.java
moveCoreTestFileToCommon format PluralRangesTest.java
moveCoreTestFileToCommon format PluralRulesTest.java
moveCoreTestFileToCommon format RbnfTest.java
moveCoreTestFileToCommon format TestMessageFormat.java
moveCoreTestFileToCommon format TimeZoneFormatTest.java
moveCoreTestFileToCommon message2 Mf2FeaturesTest.java
moveCoreTestFileToCommon normalizer BasicTest.java
moveCoreTestFileToCommon number ModifierTest.java
moveCoreTestFileToCommon number NumberFormatterApiTest.java
moveCoreTestFileToCommon number NumberParserTest.java
moveCoreTestFileToCommon number NumberPermutationTest.java
moveCoreTestFileToCommon number NumberRangeFormatterTest.java
moveCoreTestFileToCommon number PatternStringTest.java
moveCoreTestFileToCommon number PropertiesTest.java
moveCoreTestFileToCommon rbbi LSTMBreakEngineTest.java
moveCoreTestFileToCommon serializable CalendarHandler.java
moveCoreTestFileToCommon serializable CompatibilityTest.java
moveCoreTestFileToCommon serializable CoverageTest.java
moveCoreTestFileToCommon serializable ExceptionHandler.java
moveCoreTestFileToCommon serializable FormatHandler.java
moveCoreTestFileToCommon serializable SerializableChecker.java
moveCoreTestFileToCommon serializable SerializableTestUtility.java
moveCoreTestFileToCommon serializable SerializableWriter.java
moveCoreTestFileToCommon stringprep TestIDNARef.java
moveCoreTestFileToCommon stringprep TestStringPrep.java
moveCoreTestFileToCommon util CurrencyTest.java
moveCoreTestFileToCommon util ICUResourceBundleTest.java
moveCoreTestFileToCommon util ICUServiceTest.java
moveCoreTestFileToCommon util LocaleDataTest.java
moveCoreTestFileToCommon util ULocaleTest.java
# Looks like the packaging project was already some kind of test for how things come together.
# Should we move all the files in this project instead of common_tests?
mv main/tests/packaging/src/com/ibm/icu/dev/test/* $COMMON_TEST_FOLDER/
removeEclipseProjectFiles main/tests/packaging
# At this point this folder should be empty
# So remove if empty (-d) should work
rm -d main/core/src/test/java/com/ibm/icu/dev/test/serializable
}
# ===============================================================
# Here starts the real script execution
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]}")"
cp -R ${MVN_MIG_DIR}/* .
# Don't copy files that are only used for migration
rm README_MAVEN.md
rm toMaven.sh
rm unpack_jars.sh
# Migrate the modules in icu4j/main, which have code (in main/classes) & unit tests (in main/test)
echo "===================================="
echo "==== Migrating the main modules ===="
echo "===================================="
mainModuleToMaven core
mainModuleToMaven langdata
mainModuleToMaven charset
mainModuleToMaven collate
mainModuleToMaven localespi
mainModuleToMaven translit
# main only
mainModuleToMaven currdata
mainModuleToMaven regiondata
# test only
mainModuleToMaven framework
# Migrate the modules in icu4j, which have only code and no unit tests
echo "===================================="
echo "==== Migrating the root modules ===="
echo "===================================="
simpleModuleToMaven demos
simpleModuleToMaven samples
simpleModuleToMaven tools/build
simpleModuleToMaven tools/misc
echo "================================================================================="
echo "==== Moving core unit tests that depend on non-core (circular dependencies) ====="
echo "================================================================================="
moveCircDepTestOutOfCore
# Some final cleanup for any empty folders
removeEmptyFolders main/classes
removeEmptyFolders main/tests
# Unpack the CLDR data from the shared .jar files
${MVN_MIG_DIR}/unpack_jars.sh
echo DONE

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>74.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>tools_build</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* © 2023 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>74.0.1-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>tools_misc</artifactId>
<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
</properties>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>translit</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# Copyright (C) 2023 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
# Unpack the pre-built .jar files with data only
ICU_DATA_VER=icudt74b
echo "Unpacking icudata.jar"
unzip -q -d main/core/src/main/resources/ main/shared/data/icudata.jar
rm -fr main/core/src/main/resources/META-INF
echo " Moving charset data"
mkdir -p main/charset/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/*.cnv main/charset/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/cnvalias.icu main/charset/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
echo " Moving currency data"
mkdir -p main/currdata/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/curr main/currdata/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/curr
echo " Moving collate data"
mkdir -p main/collate/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/coll main/collate/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/coll
echo " Moving langdata data"
mkdir -p main/langdata/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/lang main/langdata/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/lang
echo " Moving regiondata data"
mkdir -p main/regiondata/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/region main/regiondata/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/region
echo " Moving translit data"
mkdir -p main/translit/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/
mv main/core/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/translit main/translit/src/main/resources/com/ibm/icu/impl/data/${ICU_DATA_VER}/translit
echo "Unpacking icutzudata.jar"
unzip -q -d main/core/src/main/resources/ main/shared/data/icutzdata.jar
rm -fr main/core/src/main/resources/META-INF
echo "Unpacking testdata.jar"
unzip -q -d main/core/src/test/resources/ main/shared/data/testdata.jar
rm -fr main/core/src/test/resources/META-INF
echo DONE