Add build_generated_maven_project

This commit is contained in:
Andrea Cavalli 2020-10-10 01:06:26 +02:00
parent eeec132f99
commit 5693d30bab
11 changed files with 80 additions and 6 deletions

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "tdlib-serializer"]
path = tdlib-serializer
url = https://git.ignuranza.net/windoz/tdlib-serializer.git
[submodule "implementations/tdlib"]
path = implementations/tdlib
url = https://github.com/tdlib/td.git
[submodule "implementations/tdlight"]
path = implementations/tdlight
url = https://git.ignuranza.net/tdlight-team/tdlight.git

1
implementations/tdlib Submodule

@ -0,0 +1 @@
Subproject commit 62d7423bc3f1925eb777e4f5e43de8c48ebf3191

@ -0,0 +1 @@
Subproject commit 459e08c1b46d67e80777355e011e615f703184c8

View File

@ -1,9 +1,9 @@
<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"> <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">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId> <groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}</artifactId> <artifactId>${IMPLEMENTATION_NAME}-natives-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}</artifactId>
<version>3.0.0-${IMPLEMENTATION_NAME}-SNAPSHOT</version> <version>3.0.0-SNAPSHOT</version>
<name>TDLight Natives for Windows (amd64)</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>
@ -86,8 +86,8 @@
<configuration> <configuration>
<relocations> <relocations>
<relocation> <relocation>
<pattern>it.tdlight.jni.operating_system_name.cpu_architecture_name.implementation_name</pattern> <pattern>it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name</pattern>
<shadedPattern>it.tdlight.jni.${OPERATING_SYSTEM_NAME}.${CPU_ARCHITECTURE_NAME}.${IMPLEMENTATION_NAME}</shadedPattern> <shadedPattern>it.tdlight.jni.${IMPLEMENTATION_NAME}.${OPERATING_SYSTEM_NAME}.${CPU_ARCHITECTURE_NAME}</shadedPattern>
</relocation> </relocation>
</relocations> </relocations>
</configuration> </configuration>

View File

@ -0,0 +1,7 @@
#!/bin/bash -e
cd ../generated
mvn clean package
echo "Done."
exit 0

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,52 @@
#!/bin/bash -e
# REQUIRED PARAMETERS:
# OPERATING_SYSTEM_NAME = <windows | linux | osx>
# CPU_ARCHITECTURE_NAME = <amd64 | aarch64>
# IMPLEMENTATION_NAME = <tdlib | tdlight>
# Check variables correctness
if [ -z "${OPERATING_SYSTEM_NAME}" ]; then
echo "Missing parameter: OPERATING_SYSTEM_NAME"
exit 1
fi
if [ -z "${CPU_ARCHITECTURE_NAME}" ]; then
echo "Missing parameter: CPU_ARCHITECTURE_NAME"
exit 1
fi
if [ -z "${IMPLEMENTATION_NAME}" ]; then
echo "Missing parameter: IMPLEMENTATION_NAME"
exit 1
fi
cd ../
# Print details
echo "Generating maven project..."
echo "Current directory: $(pwd)"
echo "Operating system: ${OPERATING_SYSTEM_NAME}"
echo "Architecture: ${CPU_ARCHITECTURE_NAME}"
echo "Td implementation: ${IMPLEMENTATION_NAME}"
# Delete old data
echo "Deleting old data..."
[ -d ./generated/ ] && rm -r ./generated/
# Create missing folders
echo "Creating missing folders..."
[ -d ./generated/ ] || mkdir ./generated/
[ -d ./src/main/java/ ] || mkdir -p ./src/main/java/
[ -d ./src/main/resources/ ] || mkdir -p ./src/main/resources/
[ -d ./generated/src/main/ ] || mkdir -p ./generated/src/main/
[ -d ./generated/src/main/ ] || mkdir -p ./generated/src/main/
# Generate pom.xml
echo "Generating pom.xml..."
sed -f "src/main/replacements/replace-${OPERATING_SYSTEM_NAME}-${CPU_ARCHITECTURE_NAME}-${IMPLEMENTATION_NAME}.sed" pom.template.xml > generated/pom.xml
# Copy source files
echo "Copying source files..."
cp -r ./src/main/java ./generated/src/main/java
cp -r ./src/main/resources ./generated/src/main/resources
echo "Done."
exit 0

View File

@ -1,4 +1,4 @@
package it.tdlight.jni.operating_system_name.cpu_architecture_name.implementation_name; package it.tdlight.jni.implementation_name.operating_system_name.cpu_architecture_name;
import java.lang.ClassLoader; import java.lang.ClassLoader;

1
tdlib Submodule

@ -0,0 +1 @@
Subproject commit 62d7423bc3f1925eb777e4f5e43de8c48ebf3191

1
tdlib-serializer Submodule

@ -0,0 +1 @@
Subproject commit 02e9f2796f092637930280e2d075d81bfca0f645

1
tdlight Submodule

@ -0,0 +1 @@
Subproject commit 459e08c1b46d67e80777355e011e615f703184c8