Update .gitmodules, TdApi.java, and 3 more files...

This commit is contained in:
Andrea Cavalli 2020-05-14 22:24:49 +02:00
parent 89fdbcd3cb
commit a9860ca547
4 changed files with 36 additions and 19 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "src/main/jni/td"] [submodule "src/main/jni/td"]
path = src/main/jni/td path = src/main/jni/td
url = git@ssh.git.ignuranza.net:andreacavalli/tdlib-fork.git url = git@ssh.git.ignuranza.net:andreacavalli/tdlib-fork.git
[submodule "src/main/jni/tdlib-serializer"]
path = src/main/jni/tdlib-serializer
url = ssh://git@ssh.git.ignuranza.net/windoz/tdlib-serializer.git

View File

@ -1,35 +1,35 @@
package it.ernytech.tdlib; package it.ernytech.tdlib;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.DataInputStream; import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.lang.IllegalStateException; import java.lang.IllegalStateException;
import java.io.IOException; import java.io.IOException;
import java.io.DataInput;
public class TdApi { public class TdApi {
public abstract static class Object { public abstract static class Object {
public native String toString(); public native String toString();
public abstract int getConstructor(); public abstract int getConstructor();
public byte[] serialize() throws IOException { public byte[] serialize() throws IOException {
try(var baos = new ByteArrayOutputStream()) { try(var baos = new ByteArrayOutputStream()) {
try(var out = new DataOutputStream(baos)) { try(var out = new DataOutputStream(baos)) {
serialize(out); serialize(out);
return baos.toByteArray(); return baos.toByteArray();
}
}
} }
}
public abstract void serialize(DataOutputStream out) throws IOException;
} }
public abstract void serialize(DataOutputStream out) throws IOException; public abstract static class Function extends Object {
} public native String toString();
}
public abstract static class Function extends Object {
public native String toString();
}
public static class Deserializer { public static class Deserializer {
public static Object deserialize(DataInput input) throws IOException { public static Object deserialize(DataInput input) throws IOException {

View File

@ -2,6 +2,9 @@
#rm -r jtdlib/jnibuild #rm -r jtdlib/jnibuild
#rm -r jtdlib/build #rm -r jtdlib/build
rm ../java/it/ernytech/tdlib/TdApi.java || true
rm ../java/it/ernytech/tdlib/new_TdApi.java || true
export TD_SRC_DIR=${PWD}/td export TD_SRC_DIR=${PWD}/td
export TD_BIN_DIR=${PWD}/jtdlib/td export TD_BIN_DIR=${PWD}/jtdlib/td
export JAVA_SRC_DIR=$(dirname `pwd`)/java export JAVA_SRC_DIR=$(dirname `pwd`)/java
@ -19,7 +22,7 @@ cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=
cmake --build . --target install -- -j1 cmake --build . --target install -- -j1
cd ../../../../../ cd ../../../../../
mvn install -X #mvn install -X
cd src/main/jni/jtdlib/build cd src/main/jni/jtdlib/build
cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DCMAKE_INSTALL_PREFIX:PATH=.. .. cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DCMAKE_INSTALL_PREFIX:PATH=.. ..
@ -37,5 +40,15 @@ mv bin/libtdjni.so ../bin/tdjni.so
cd ../ cd ../
cp bin/tdjni.so ../resources/libs/linux/amd64/tdjni.so cp bin/tdjni.so ../resources/libs/linux/amd64/tdjni.so
echo "Compilation done. Patching TdApi.java"
python3 tdlib-serializer ../java/it/ernytech/tdlib/TdApi.java ../java/it/ernytech/tdlib/new_TdApi.java tdlib-serializer/headers.txt
rm ../java/it/ernytech/tdlib/TdApi.java
unexpand --tabs=2 ../java/it/ernytech/tdlib/new_TdApi.java > ../java/it/ernytech/tdlib/TdApi.java
rm ../java/it/ernytech/tdlib/new_TdApi.java
cd ../../../ cd ../../../
mvn install -X
echo "Installing jar"
mvn clean install -X

@ -0,0 +1 @@
Subproject commit 57bf30757952daafcd28352e38fda21e260ce664