Separate package by version

This commit is contained in:
Andrea Cavalli 2021-10-22 11:03:58 +02:00
parent 2af1195612
commit 57a7929da5
4 changed files with 20 additions and 12 deletions

View File

@ -12,7 +12,7 @@ source ./setup-variables.sh
cd ../../generated cd ../../generated
mvn -B -Drevision=${REVISION} clean deploy mvn -B -DrevisionNumber="${REVISION}" -DrevisionSuffix="" clean deploy
echo "Done." echo "Done."
exit 0 exit 0

View File

@ -1,4 +1,4 @@
package it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name; package it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name.version;
import java.lang.ClassLoader; import java.lang.ClassLoader;
import java.io.InputStream; import java.io.InputStream;
@ -6,7 +6,8 @@ import java.io.File;
public class LoadLibrary { public class LoadLibrary {
public static InputStream getLibraryAsStream() { public static InputStream getLibraryAsStream() {
return LoadLibrary.class.getResourceAsStream("/libs/" + getOsName() + "/" + getArchName() + "/" + getFileName() + getExtension()); return LoadLibrary.class.getResourceAsStream("/libs/" + getOsName() + "/" + getArchName() + "/"
+ getFileName() + "/" + getVersionName() + getExtension());
} }
private static String getOsName() { private static String getOsName() {
@ -17,6 +18,10 @@ public class LoadLibrary {
return LoadLibrary.class.getPackage().getName().split("\\.")[5]; return LoadLibrary.class.getPackage().getName().split("\\.")[5];
} }
private static String getVersionName() {
return LoadLibrary.class.getPackage().getName().split("\\.")[6];
}
private static String getFileName() { private static String getFileName() {
return "tdjni"; return "tdjni";
} }

View File

@ -2,12 +2,14 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>
<artifactId>${IMPLEMENTATION_NAME}-natives-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}</artifactId> <artifactId>${IMPLEMENTATION_NAME}-natives-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}</artifactId>
<version>3.3.${revision}</version> <!-- Don't change the version! (or change it also in <shadedPattern>) -->
<version>4.0.${revisionNumber}${revisionSuffix}</version>
<name>${IMPLEMENTATION_NAME} natives for ${OPERATING_SYSTEM_NAME} (${CPU_ARCHITECTURE_NAME})</name> <name>${IMPLEMENTATION_NAME} natives for ${OPERATING_SYSTEM_NAME} (${CPU_ARCHITECTURE_NAME})</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0-SNAPSHOT</revision> <revisionNumber>0</revisionNumber>
<revisionSuffix>-SNAPSHOT</revisionSuffix>
</properties> </properties>
<distributionManagement> <distributionManagement>
<repository> <repository>
@ -42,8 +44,8 @@
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<source>1.8</source> <source>8</source>
<target>1.8</target> <target>8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -96,8 +98,8 @@
<configuration> <configuration>
<relocations> <relocations>
<relocation> <relocation>
<pattern>it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name</pattern> <pattern>it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name.version</pattern>
<shadedPattern>it.tdlight.jni.${IMPLEMENTATION_NAME}.${OPERATING_SYSTEM_NAME_SHORT}.${CPU_ARCHITECTURE_NAME}</shadedPattern> <shadedPattern>it.tdlight.jni.${IMPLEMENTATION_NAME}.${OPERATING_SYSTEM_NAME_SHORT}.${CPU_ARCHITECTURE_NAME}.v_4_0_${revisionNumber}</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

View File

@ -2,12 +2,13 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>
<artifactId>${IMPLEMENTATION_NAME}-api</artifactId> <artifactId>${IMPLEMENTATION_NAME}-api</artifactId>
<version>3.3.${revision}</version> <version>4.0.${revisionNumber}${revisionSuffix}</version>
<name>${IMPLEMENTATION_NAME} API</name> <name>${IMPLEMENTATION_NAME} API</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0-SNAPSHOT</revision> <revisionNumber>0</revisionNumber>
<revisionSuffix>-SNAPSHOT</revisionSuffix>
</properties> </properties>
<distributionManagement> <distributionManagement>
<repository> <repository>
@ -55,7 +56,7 @@
<configuration> <configuration>
<additionalOptions>-html5</additionalOptions> <additionalOptions>-html5</additionalOptions>
<additionalOptions>-public</additionalOptions> <additionalOptions>-public</additionalOptions>
<release>13</release> <release>17</release>
<quiet>true</quiet> <quiet>true</quiet>
<notimestamp>true</notimestamp> <notimestamp>true</notimestamp>
</configuration> </configuration>