Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support jpms in annotations module #2302

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion annotations/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="lib" path="build_result/j2objc_annotations.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build_result/eclipse"/>
<classpathentry kind="output" path="build_result/eclipse"/>
</classpath>
1 change: 1 addition & 0 deletions annotations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
sgammon marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 12 additions & 3 deletions annotations/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,26 @@ DIST_JAR = $(DIST_JAR_DIR)/$(JAR_NAME)

CLASSES_DIR = $(BUILD_DIR)/classes
JAVA_SOURCE_DIR = src/main/java
JAVA9_CLASSES_DIR = $(BUILD_DIR)/classes-java9
JPMS_CLASS = $(JAVA9_CLASSES_DIR)/module-info.class
tomball marked this conversation as resolved.
Show resolved Hide resolved

SOURCE_JAVA_FULL = $(ANNOTATION_SOURCE_JAVA:%=$(JAVA_SOURCE_DIR)/%)
SOURCE_JAVA9_MODULE = $(ANNOTATION_MODULE_INFO:%=$(JAVA_SOURCE_DIR)/%)

$(BUILD_DIR) $(CLASSES_DIR) $(DIST_JAR_DIR):
$(BUILD_DIR) $(CLASSES_DIR) $(JAVA9_CLASSES_DIR) $(DIST_JAR_DIR):
@mkdir -p $@

$(JAR): $(SOURCE_JAVA_FULL) | $(BUILD_DIR) $(CLASSES_DIR)
$(JPMS_CLASS):
@echo Building j2objc annotations JPMS module
@$(JAVAC) -sourcepath $(JAVA_SOURCE_DIR) -encoding UTF-8 --release 9 -d $(JAVA9_CLASSES_DIR) \
-nowarn $(SOURCE_JAVA9_MODULE)
@rm -fr $(JAVA9_CLASSES_DIR)/com

$(JAR): $(SOURCE_JAVA_FULL) | $(BUILD_DIR) $(CLASSES_DIR) $(JAVA9_CLASSES_DIR) $(JPMS_CLASS)
@echo Building j2objc annotations
@$(JAVAC) -encoding UTF-8 -d $(CLASSES_DIR) -source 1.8 -target 1.8 \
-nowarn $^
@jar cf $(JAR) -C $(CLASSES_DIR) .
@jar cf $(JAR) -C $(CLASSES_DIR) . --release 9 -C $(JAVA9_CLASSES_DIR) .
tomball marked this conversation as resolved.
Show resolved Hide resolved

$(DIST_JAR): $(JAR) | $(DIST_JAR_DIR)
@install -m 0644 $< $@
Expand Down
3 changes: 3 additions & 0 deletions annotations/classes.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ANNOTATION_MODULE_INFO = \
module-info.java

ANNOTATION_SOURCE_JAVA = \
com/google/j2objc/annotations/AutoreleasePool.java \
com/google/j2objc/annotations/GenerateObjectiveCGenerics.java \
Expand Down
43 changes: 43 additions & 0 deletions annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,49 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<source>1.8</source>
<target>1.8</target>
<excludes>
<exclude>module-info.java</exclude>
</excludes>
</configuration>
sgammon marked this conversation as resolved.
Show resolved Hide resolved
</execution>
<execution>
<id>compile-java9</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
sgammon marked this conversation as resolved.
Show resolved Hide resolved
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<excludes>
<exclude>META-INF/versions/9/com/**</exclude>
</excludes>
tomball marked this conversation as resolved.
Show resolved Hide resolved
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
20 changes: 20 additions & 0 deletions annotations/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

open module com.google.j2objc.annotations {
requires java.base;
exports com.google.j2objc.annotations;
}
tomball marked this conversation as resolved.
Show resolved Hide resolved