Skip to content

Commit

Permalink
Do unified deployment in POM
Browse files Browse the repository at this point in the history
  • Loading branch information
karllessard committed Feb 13, 2024
1 parent e480c1b commit 20db2e0
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 156 deletions.
140 changes: 0 additions & 140 deletions deploy.sh

This file was deleted.

15 changes: 13 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# ==============================================================================
#
# Script to upload release artifacts for the TensorFlow Java library to
# Maven Central. See RELEASE.md for an explanation.
# Maven Central. See RELEASE.md for explanation.

cd $(dirname "$0")
STAGING_SEQ="$1"
Expand All @@ -34,12 +34,17 @@ fi
# To get a shell to poke around the maven artifacts with.
if [[ -z "${CMD}" ]]
then
CMD="bash deploy.sh"
CMD="mvn clean deploy -B -e --settings ./settings.xml -Pdeploying -Preleasing"
fi

export GPG_TTY=$(tty)
set -ex

if [[ ! -f settings.xml ]]
then
cp -f ~/.m2/settings.xml .
fi

docker run \
-e IN_CONTAINER="true" \
-e STAGING_SEQ="${STAGING_SEQ}" \
Expand All @@ -51,3 +56,9 @@ docker run \
--platform linux/amd64 \
maven:3.8.6-jdk-11 \
${CMD}

echo
echo "Uploaded to the staging repository"
echo "After validating the release: "
echo "* Login to https://oss.sonatype.org/#stagingRepositories"
echo "* Find the 'org.tensorflow' staging release and click either 'Release' to release or 'Drop' to abort"
12 changes: 2 additions & 10 deletions tensorflow-core/tensorflow-core-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
<version>3.3.0</version>
<executions>
<execution>
<id>attach-source</id>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
Expand All @@ -237,15 +237,7 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down
99 changes: 96 additions & 3 deletions tensorflow-core/tensorflow-core-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<dist.download.skip>false</dist.download.skip>
<dist.download.url/>
<dist.download.folder>${project.build.directory}/dist/</dist.download.folder>
<nativeSourceDirectory>${project.basedir}/src/main/native</nativeSourceDirectory>
<native.source.directory>${project.basedir}/src/main/native</native.source.directory>
</properties>

<dependencies>
Expand Down Expand Up @@ -81,6 +81,99 @@
<javacpp.build.skip>true</javacpp.build.skip>
<dist.download.skip>true</dist.download.skip>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<id>copy-native-artifacts</id>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteReleases>true</overWriteReleases>
<useBaseVersion>true</useBaseVersion>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-x86_64}-gpu</classifier>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-x86_64}</classifier>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-arm64}</classifier>
</artifactItem>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.windows-x86_64}</classifier>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>validate</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${artifactId}-${project.version}-${javacpp.platform.linux-x86_64}.jar</file>
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${artifactId}-${project.version}-${javacpp.platform.linux-x86_64}-gpu.jar</file>
<classifier>${javacpp.platform.linux-x86_64}-gpu</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${artifactId}-${project.version}-${javacpp.platform.macosx-arm64}.jar</file>
<classifier>${javacpp.platform.macosx-arm64}</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${artifactId}-${project.version}-${javacpp.platform.macosx-x86_64}.jar</file>
<classifier>${javacpp.platform.macosx-x86_64}</classifier>
</artifact>
<artifact>
<file>${project.build.directory}/${artifactId}-${project.version}-${javacpp.platform.windows-x86_64}.jar</file>
<classifier>${javacpp.platform.windows-x86_64}</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<!-- Generating mode: produce Java files from native resources -->
Expand Down Expand Up @@ -220,7 +313,7 @@
<classPath>${project.build.outputDirectory}</classPath>
<includePaths>
<includePath>${dist.download.folder}/tensorflow/include/</includePath>
<includePath>${nativeSourceDirectory}/org/tensorflow/internal/c_api/</includePath>
<includePath>${native.source.directory}/org/tensorflow/internal/c_api/</includePath>
<!-- additional include paths in case of a full native build -->
<includePath>${project.basedir}/bazel-${project.artifactId}/external/org_tensorflow/</includePath>
<includePath>${project.basedir}/bazel-bin/external/org_tensorflow/</includePath>
Expand Down Expand Up @@ -530,7 +623,7 @@
<version>3.3.0</version>
<executions>
<execution>
<id>attach-source</id>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
Expand Down
8 changes: 7 additions & 1 deletion tensorflow-core/tensorflow-core-platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-arm64.extension}</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.macosx-x86_64.extension}</classifier>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
<artifactId>tensorflow-core-native</artifactId>
Expand All @@ -67,7 +73,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>tensorflow-core-api.jar tensorflow-core-native-linux-x86_64.jar tensorflow-core-native-macosx-x86_64.jar tensorflow-core-native-windows-x86_64.jar</Class-Path>
<Class-Path>tensorflow-core-api.jar tensorflow-core-native.jar tensorflow-core-native-linux-x86_64.jar tensorflow-core-native-macosx-arm64.jar tensorflow-core-native-macosx-x86_64.jar tensorflow-core-native-windows-x86_64.jar</Class-Path>
<Automatic-Module-Name>${java.module.name}</Automatic-Module-Name>
</manifestEntries>
</archive>
Expand Down

0 comments on commit 20db2e0

Please sign in to comment.