Skip to content

Commit e56be82

Browse files
committed
Initial multi-release jar support
Signed-off-by: Ryan Nett <[email protected]>
1 parent 97298ca commit e56be82

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

tensorflow-core/tensorflow-core-api/pom.xml

+48
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<java.module.name>org.tensorflow.core.api</java.module.name>
2323
<ndarray.version>0.3.1</ndarray.version>
2424
<truth.version>1.0.1</truth.version>
25+
26+
<java9.sourceDirectory>${project.basedir}/src/main/java9</java9.sourceDirectory>
27+
<java9.build.outputDirectory>${project.build.directory}/classes-java9</java9.build.outputDirectory>
2528
</properties>
2629

2730
<dependencies>
@@ -143,6 +146,50 @@
143146
</execution>
144147
</executions>
145148
</plugin>
149+
<plugin>
150+
<groupId>org.apache.maven.plugins</groupId>
151+
<artifactId>maven-antrun-plugin</artifactId>
152+
<version>3.0.0</version>
153+
<executions>
154+
<execution>
155+
<id>compile-java9</id>
156+
<phase>compile</phase>
157+
<configuration>
158+
<target>
159+
<mkdir dir="${java9.build.outputDirectory}" />
160+
<javac srcdir="${java9.sourceDirectory}" destdir="${java9.build.outputDirectory}"
161+
classpath="${project.build.outputDirectory}" includeantruntime="false"
162+
target="9" source="9" release="9"/>
163+
</target>
164+
</configuration>
165+
<goals>
166+
<goal>run</goal>
167+
</goals>
168+
</execution>
169+
</executions>
170+
</plugin>
171+
<plugin>
172+
<groupId>org.apache.maven.plugins</groupId>
173+
<artifactId>maven-resources-plugin</artifactId>
174+
<version>3.2.0</version>
175+
<executions>
176+
<execution>
177+
<id>copy-resources</id>
178+
<phase>prepare-package</phase>
179+
<goals>
180+
<goal>copy-resources</goal>
181+
</goals>
182+
<configuration>
183+
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/9</outputDirectory>
184+
<resources>
185+
<resource>
186+
<directory>${java9.build.outputDirectory}</directory>
187+
</resource>
188+
</resources>
189+
</configuration>
190+
</execution>
191+
</executions>
192+
</plugin>
146193
<plugin>
147194
<artifactId>maven-compiler-plugin</artifactId>
148195
<version>3.8.0</version>
@@ -372,6 +419,7 @@
372419
<archive>
373420
<manifestEntries>
374421
<Automatic-Module-Name>${java.module.name}</Automatic-Module-Name>
422+
<Multi-Release>true</Multi-Release>
375423
</manifestEntries>
376424
</archive>
377425
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2021 The TensorFlow Authors. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
=======================================================================
16+
17+
*/
18+
package org.tensorflow;
19+
20+
public class MRTest {
21+
public static int version() {
22+
return 8;
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Copyright 2021 The TensorFlow Authors. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
=======================================================================
16+
17+
*/
18+
package org.tensorflow;
19+
20+
import java.lang.ref.Cleaner;
21+
22+
public class MRTest {
23+
public static int version(){
24+
Cleaner.create();
25+
return 9;
26+
}
27+
}

0 commit comments

Comments
 (0)