ICU-22324 Mavenization, remove maven proof of concept and ant script

This commit is contained in:
Mihai Nita 2023-10-02 20:36:19 -07:00
parent e1af930c6a
commit e6f7ef7ef4
4073 changed files with 0 additions and 4638 deletions

View file

@ -1,12 +0,0 @@
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
#*******************************************************************************
#* Copyright (C) 2009-2016, International Business Machines Corporation and *
#* others. All Rights Reserved. *
#*******************************************************************************
api.report.version = 74
api.report.prev.version = 73
release.file.ver = 74rc
api.doc.version = 74
maven.pom.ver = 74.1-SNAPSHOT

File diff suppressed because it is too large Load diff

View file

@ -1,12 +0,0 @@
<!--
* © 2017 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
-->
<ivy-module version="2.0">
<info organisation="com.ibm.icu" module="icu4j"/>
<dependencies>
<!--if these are updated then eclipse projects need to be updated-->
<dependency org="junit" name="junit" rev="4.12"/>
<dependency org="pl.pragmatists" name="JUnitParams" rev="1.0.5"/>
</dependencies>
</ivy-module>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>external-libraries</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

View file

@ -1,19 +0,0 @@
Manifest-Version: 1.0
Specification-Title: International Components for Unicode for Java
Specification-Version: @SPECVERSION@
Specification-Vendor: Unicode, Inc.
Implementation-Title: International Components for Unicode for Java
Implementation-Version: @IMPLVERSION@
Implementation-Vendor: Unicode, Inc.
Implementation-Vendor-Id: org.unicode
Bundle-ManifestVersion: 2
Bundle-Name: ICU4J
Bundle-Description: International Components for Unicode for Java
Bundle-SymbolicName: com.ibm.icu
Bundle-Version: @IMPLVERSION@
Bundle-Vendor: Unicode, Inc.
Bundle-Copyright: @COPYRIGHT@
Bundle-RequiredExecutionEnvironment: @EXECENV@
Main-Class: com.ibm.icu.util.VersionInfo
Export-Package: com.ibm.icu.lang,com.ibm.icu.math,com.ibm.icu.number,com.ibm.icu.text,com.ibm.icu.util
Automatic-Module-Name: com.ibm.icu

View file

@ -1,163 +0,0 @@
<!--
© 2022 and later: Unicode, Inc. and others.
License & terms of use: http://www.unicode.org/copyright.html
-->
# ICU4J Maven Build
This directory exists as part of work to build ICU4J with Maven.
Specifically, this directory was created to exist alongside the code
directory structure without changing it.
This preserves the existing behavior of Ant build targets and BRS tasks / artifact
deploy processes based on the output of those Ant builds.
If / when the Ant build is suitable to be replaced and remove by Maven
or other such build tool, this directory should be removed.
Note: This directory is the root of the directory structure that defines
the Maven build without changing the existing code structure and Ant build.
## Usage
Maven is a pretty standard build tool in the Java ecosystem with a very well-defined
preferred way to do file layout and build execution.
Thus, many IDEs for Java will have some level of support for Maven.
The command line invocation is still, of course, the standard of truth for the build.
In this current setup for the ICU4J Maven build, in which the existing file layout and
processes remain the same in order to keep the Ant build unchanged,
the Maven build is configured in ways that are non-standard for a typical Maven setup.
Therefore, IDE support for this non-standard Maven build might be less than if ICUJ4's
directories and build process were modified to be more consistent with Maven expectations.
However, there still exist IDEs with good support, and the results of the command line
invocation's test and artifact jar packaging are designed to be equivalent to the Ant build.
### Usage in IDEs
Users of IDEs should familiarize themselves with the information about how to use Maven at
the command line,
which also includes information about Maven builds.
#### IntelliJ
IntelliJ does a good job of understanding multi-module Maven projects,
including the non-standard configuration here.
It also recognizes the customized locations of source code files and test code files in the configuration here.
To import into IntelliJ:
1. In IntelliJ, open a new project.
a. Recent versions of IntelliJ provide a dialog box on startup to select a project. Click the "Open" button.)
2. Select the `pom.xml` in this same directory (ex: `<ICU>/icu4j/maven-build/pom.xml`)
3. That's it. Note: IntelliJ will take a few minutes to do a one-time indexing of the new source code.
Navigating the source code files between main code and test code, and running tests individually or for an entire module,
work as they do normally in IntelliJ.
#### VS Code
VS Code's support of Maven projects is not as robust as IntelliJ's when it comes to the non-standard file layout for sources and tests.
The Maven support comes from the standard Java extension (which depends on the standard Maven extension) from the extension marketplace.
Source and test code files are not recognized properly, and it is not clear how to execute the tests.
However, a workaround exists for those who want to use VS Code as their preferred editor and still execute commands to recompile or run tests.
The workaround relies on invoking the Maven commands in a shell, and using a VS Code extension to create shortcuts within the IDE to invoke those commands.
The extension is [Command Runner](https://marketplace.visualstudio.com/items?itemName=edonet.vscode-command-runner).
Next, create a VS Code workspace (File > Open Folder...) at the ICU4J root at `<ICU>/icu4j`.
Then edit your settings for your VS Code workspace for ICU4J (this is the file at `<ICU>/icu4j/.vscode/settings.json`)
by adding this section to the settings:
```json
{
...
"command-runner.commands": {
// The following commands assume your VS Code workspace is rooted at `<ICU_ROOT>/icu4j`. If not,
// then adjust accordingly.
"core > all > compile": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j compile",
"core > all > test": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j test -DfailIfNoTests=false",
"core > number > test": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j test -Dtest=\"com.ibm.icu.dev.test.number.*,com.ibm.icu.dev.impl.number.*\" -DfailIfNoTests=false",
"core > text > test": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j test -Dtest=\"com.ibm.icu.dev.test.text.*\" -DfailIfNoTests=false",
"charset > compile": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j-charset compile",
"charset > test": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j-charset test -DfailIfNoTests=false",
"localespi > compile": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j-localespi compile",
"localespi > test": "cd ${workspaceFolder}/maven-build; mvn -am -pl maven-icu4j-localespi test -DfailIfNoTests=false",
}
...
}
```
As the extension's documentation describes, there are multiple ways to open up the palette of command shortcuts.
One way is to hit Ctrl/Cmd+Shift+P, then type "Run Command", then hit enter.
Another way is to right-click the background of any editor pane.
After the palette appears, you can choose which Maven build target to execute.
#### Eclipse
Although Eclipse's Maven plugin works reasonably well and can support the import of a multi-module Maven project,
the non-Maven-standard layout that it currently has seems to prevent an effective usage.
In particular, even though Eclipse can be configured to build the project,
it does not dispay the source code files and test code files for editing within the IDE through any of the usual Views.
### Usage at the command line
Maven divides its concept of a build into a "lifecycle" of a linear sequence of steps, called "phases".
These phases have a predefined order, and each phase can only begin if all of the previous phases have finished successfully.
Phases also serve as default build targets.
The sequence of phases include ... `compile` ... `test` ... `package` ... `integration-test` ... `deploy`.
At the root of the project, you can run `mvn compile` to build/compile, and `mvn test` to run all of the tests (after first compiling successfully).
To only execute a command within a submodule of the project, from the root, use the `-am -pl <projectlist>` syntax like this:
```
mvn test -am -pl maven-icu4j
```
where `<projectlist>` is a comma-separated list of names of the subfolders which contain the submodule configuration pom.xml files.
If you want to run only a specific test(s), use the `-Dtest="<test>"` option, where `<test>` can be a test name, a class name / package prefix, or a comma-separate list of them.
If you want to skip tests, use the `-DskipTests=true` option.
#### Special Note about the Resources
Currently, the Maven build reads the resources NOT from `icu4j/main/shared/data/icudata.jar` but from the individual files checked into [icu4j/maven-build/maven-icu4j-datafiles/src/main/resources/com/ibm/icu/impl/data/icudt73b](https://github.com/unicode-org/icu/tree/main/icu4j/maven-build/maven-icu4j-datafiles/src/main/resources/com/ibm/icu/impl/data/icudt73b) directory (when the version of ICU is 73). Therefore, if your PR changed any resource data files (ex: the ones contained within`icudata.jar`), you also need to update the corresponding resources files in order for your test to pass in the Maven build.
To update the resources file under `icu4j/maven-build/maven-icu4j-datafiles/src/main/resources/com/ibm/icu/impl/data/icudt73b` :
First build the `icu4j/main/shared/data/icudata.jar`, then
```
cd icu4j/maven-build
git update-index --chmod=+x extract-data-files.sh
./extract-data-files.sh
```
#### Run a single test
```
mvn test -Dtest="ULocaleTest" -DfailIfNoTests=false
```
or
```
mvn test -Dtest="com.ibm.icu.dev.test.util.ULocaleTest" -DfailIfNoTests=false
```
#### Run a single method in a single test
```
mvn test -Dtest="ULocaleTest#TestGetAvailableByType" -DfailIfNoTests=false
```
#### Run multiple tests
Either
```
mvn test -Dtest="RBBI*" -DfailIfNoTests=false
mvn test -Dtest="*Locale*" -DfailIfNoTests=false
```
or
```
mvn test -Dtest="*Locale*,RBBI*" -DfailIfNoTests=false
```
Notice the package name is not important in the regular expression expanasion so the following will NOT match any tests
```
mvn test -Dtest="com.ibm.icu.dev.test.util.*" -DfailIfNoTests=false
```

View file

@ -1,28 +0,0 @@
#!/bin/bash
# Copyright (C) 2023 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
# This command will copy data files from the ICU4J jars built for the
# Ant build by extracting and copying them over to the Maven build.
#
# If and when the Ant build is fully replaced by the Maven build, then the
# upstream ICU4C make target `icu4j-data-install` can be modified accordingly
# to copy the files directly for Maven, and then allowing this script to be
# deleted.
#
# This script should be run from the root of the Maven build.
rm -rf maven-icu4j-datafiles/src/main/resources/*
rm -rf maven-icu4j-test-datafiles/src/main/resources/*
unzip ../main/shared/data/icudata.jar \
-d ./maven-icu4j-datafiles/src/main/resources/ \
-x *MANIFEST.MF
unzip ../main/shared/data/icutzdata.jar\
-d ./maven-icu4j-datafiles/src/main/resources/ \
-x *MANIFEST.MF
unzip ../main/shared/data/testdata.jar\
-d ./maven-icu4j-test-datafiles/src/main/resources/ \
-x *MANIFEST.MF

View file

@ -1,15 +0,0 @@
<!--
© 2022 and later: Unicode, Inc. and others.
License & terms of use: http://www.unicode.org/copyright.html
-->
# maven-icu4j-charset
This directory exists as part of work to build ICU4J with Maven.
Specifically, this directory was created to exist alongside the code
directory structure without changing it.
This preserves the existing behavior of Ant build targets and BRS tasks / artifact
deploy processes based on the output of those Ant builds.
If / when the Ant build is suitable to be replaced and remove by Maven
or other such build tool, this directory should be removed.

View file

@ -1,248 +0,0 @@
<?xml version="1.0"?>
<!--
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
*******************************************************************************
* Copyright (C) 2010-2016, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
-->
<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">
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>73.1-SNAPSHOT</version>
<!-- default relativePath for parent -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-charset</artifactId>
<version>73.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name> ICU4J Charset Provider</name>
<description>icu4j-charset is a supplemental library for icu4j, implementing Java Charset SPI.</description>
<properties>
<!-- Bundle-SymbolicName -->
<jar.symbolic.name>org.ibm.icu.charset</jar.symbolic.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<!-- add directories with main executable code -->
<execution>
<id>add-source</id>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>../../main/classes/charset/src</source>
</sources>
</configuration>
</execution>
<!-- add directories with test code -->
<execution>
<id>add-test-source</id>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>../../main/tests/charset/src</source>
<source>../../main/tests/framework/src</source>
</sources>
</configuration>
</execution>
<!-- add directories with main executable resources -->
<execution>
<id>add-resource</id>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../../main/classes/charset/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<!-- add directories with test resources -->
<execution>
<id>add-test-resource</id>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>../../main/tests/charset/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>../../main/tests/framework/src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!--
Extract the resource files from the icu4j-datafiles dependency so that it is available during `test`.
Note: The extraction here will not result in these files being included in the packaged jar.
-->
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<executions>
<execution>
<id>process-remote-resources</id>
<goals>
<goal>process</goal>
</goals>
<configuration>
<resourceBundles>
<resourceBundle>com.ibm.icu:icu4j-datafiles:${icu4j.version}</resourceBundle>
<resourceBundle>com.ibm.icu:icu4j-test-datafiles:${icu4j.version}</resourceBundle>
</resourceBundles>
</configuration>
</execution>
</executions>
</plugin>
<!--
Extract and unpack the *.cnv files + cnvalias.icu from the *.jar files in the upstream depenendency
`com.ibm.icu:icu4j-datafiles`.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.ibm.icu</includeGroupIds>
<!-- exclude test resource files which come through dependencies as `provided` scope -->
<excludeScope>provided</excludeScope>
<includes>**/*.cnv,**/cnvalias.icu</includes>
<excludes>**/*.jar</excludes>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!--
Enable configuration of the Manifest file, etc. during the process of packaging the .jar file.
For future reference: https://stackoverflow.com/questions/38548271/difference-between-maven-plugins-assembly-plugins-jar-plugins-shaded-plugi
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
<Specification-Title>${jar.spec.title}</Specification-Title>
<Specification-Version>${jar.spec.version}</Specification-Version>
<Specification-Vendor>${jar.spec.vendor}</Specification-Vendor>
<Implementation-Title>${jar.impl.title}</Implementation-Title>
<Implementation-Version>${jar.impl.version}</Implementation-Version>
<Implementation-Vendor>${jar.impl.vendor}</Implementation-Vendor>
<Implementation-Vendor-Id>${jar.impl.vendor.id}</Implementation-Vendor-Id>
<Bundle-ManifestVersion>${jar.manifest.version}</Bundle-ManifestVersion>
<Bundle-Name>${jar.name}</Bundle-Name>
<Bundle-Description>${jar.description}</Bundle-Description>
<Bundle-SymbolicName>${jar.symbolic.name}</Bundle-SymbolicName>
<Bundle-Version>${jar.version}</Bundle-Version>
<Bundle-Vendor>${jar.vendor}</Bundle-Vendor>
<Bundle-Copyright>${jar.copyright.info}</Bundle-Copyright>
<!-- TODO: We should remove this, right??? -->
<Main-Class>${jar.main.class}</Main-Class>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-test-datafiles</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- this is for parameterized JUnit tests -->
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -1,15 +0,0 @@
<!--
© 2022 and later: Unicode, Inc. and others.
License & terms of use: http://www.unicode.org/copyright.html
-->
# maven-icu4j-charset
This directory exists as part of work to build ICU4J with Maven.
Specifically, this directory was created to exist alongside the code
directory structure without changing it.
This preserves the existing behavior of Ant build targets and BRS tasks / artifact
deploy processes based on the output of those Ant builds.
If / when the Ant build is suitable to be replaced and remove by Maven
or other such build tool, this directory should be removed.

View file

@ -1,31 +0,0 @@
<?xml version="1.0"?>
<!--
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
*******************************************************************************
* Copyright (C) 2010-2016, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
-->
<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">
<parent>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-root</artifactId>
<version>73.1-SNAPSHOT</version>
<!-- default relativePath for parent -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j-datafiles</artifactId>
<version>73.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>ICU4J Data Files</name>
<description>Various resource files needed by ICU4J components' main code.</description>
</project>

Some files were not shown because too many files have changed in this diff Show more