Skip to content

Commit 2ff87c7

Browse files
committed
bump td to v1.8.47
1 parent 6cb975a commit 2ff87c7

12 files changed

Lines changed: 306 additions & 242 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
name: Releases
2-
31
on:
42
push:
5-
tags:
6-
- '*'
73

84
jobs:
95
build:
@@ -24,14 +20,9 @@ jobs:
2420
allowUpdates: true
2521
artifacts: "libs.tar.gz,jniLibs.tar.gz"
2622
token: ${{ secrets.GITHUB_TOKEN }}
27-
- uses: gradle/wrapper-validation-action@v1
2823
- run: |
2924
cp -r ./jniLibs ./app/src/main/
30-
- uses: actions/setup-java@v3
31-
with:
32-
distribution: 'temurin'
33-
java-version: '17'
34-
cache: 'gradle'
25+
- uses: gradle/actions/wrapper-validation@v4
3526
- run: |
3627
./gradlew assembleRelease publish
3728
- uses: up9cloud/action-notify@master

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021-2024 https://github.com/up9cloud
3+
Copyright (c) 2021-Present https://github.com/up9cloud
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 47 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
Prebuilt [libtdjson](https://github.com/tdlib/td) for Android
66

7-
`Version` tag is same as the version of tdlib
7+
> Version
8+
9+
- Git tag is same as the version of tdlib
810

911
> Releases
1012
@@ -28,94 +30,72 @@ Prebuilt [libtdjson](https://github.com/tdlib/td) for Android
2830

2931
> Method 1: Download jniLibs
3032
31-
- Download jniLibs.tar.gz (from `Releases`) and extract it to your ./app/`src/main/jniLibs/`
32-
- Copy `./app/src/main/java/io/github/up9cloud/td/JsonClient.java` to your repo
33-
34-
> TODO: Method 2: Download .jar
35-
36-
- Download .jar file (from `Packages`) to your ./app/`libs/`
37-
- Be sure "*.jar" is the part of dependencies in your `build.gradle` file
38-
39-
```gradle
40-
dependencies {
41-
implementation fileTree(dir: "libs", include: ["*.jar"])
42-
}
43-
```
33+
- Download `jniLibs.tar.gz` (from `Releases`) and extract it to your ./app/`src/main/jniLibs/`
34+
- Download `./app/src/main/java/io/github/up9cloud/td/JsonClient.java` and put to your code base.
4435

45-
> Method 3: Github Maven
36+
> Method 2: Github Maven
4637
4738
- Add those to your `build.gradle` file
4839

49-
```gradle
50-
repositories {
51-
google()
52-
...
53-
maven {
54-
name = "GitHubPackages"
55-
url = uri("https://maven.pkg.github.com/up9cloud/android-libtdjson")
56-
credentials {
57-
username = System.getenv("GITHUB_ACTOR")
58-
password = System.getenv("GITHUB_TOKEN")
59-
}
60-
}
40+
```gradle
41+
repositories {
42+
google()
43+
...
44+
maven {
45+
name = "GitHubPackages"
46+
url = uri("https://maven.pkg.github.com/up9cloud/android-libtdjson")
47+
credentials {
48+
username = System.getenv("GITHUB_ACTOR")
49+
password = System.getenv("GITHUB_TOKEN")
50+
}
6151
}
62-
dependencies {
63-
// Modify the version, see release
64-
implementation 'io.github.up9cloud:td:<version>'
65-
}
66-
```
52+
}
53+
dependencies {
54+
// Modify the version, see release
55+
implementation 'io.github.up9cloud:td:<version>'
56+
}
57+
```
6758

6859
- Setup ENVs
6960

70-
```bash
71-
export GITHUB_ACTOR=<your github account>
72-
export GITHUB_TOKEN=<your github personal access token>
73-
```
61+
```bash
62+
export GITHUB_ACTOR=<your github account>
63+
export GITHUB_TOKEN=<your github personal access token>
64+
```
7465

7566
Other refs:
7667

7768
- GitHub Docs - [Gradle registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#installing-a-package)
7869
- [enefce/AndroidLibraryForGitHubPackagesDemo](https://github.com/enefce/AndroidLibraryForGitHubPackagesDemo)
7970

80-
## Usage
81-
82-
TODO
83-
84-
## Example
85-
86-
TODO
87-
8871
## Dev memo
8972

90-
### Bump the version of tdlib
91-
92-
- Modify the version for git checkout in `./prepare.sh`
93-
- Modify the getVersionName function in `./app/build.gradle`
94-
- Git commit (message example: `bump td to vx.x.x`)
95-
- Git add tag (`git tag vx.x.x`, the tag version should be same as the version of tdlib)
96-
- Push with tags (`git push && git push --tags`)
97-
- Wait for CI task
98-
99-
### Build on local, see `.github/workflows/main.yml` also
100-
101-
```console
102-
$ docker run --rm -it -v `pwd`:/app sstc/android-ndk /bin/bash
103-
104-
# ./build.sh
105-
```
106-
107-
### Cleanup generated .so files for strip testing
108-
109-
```bash
110-
rm -fr \
73+
- Bump the version of tdlib
74+
- Modify the version for git checkout in `./prepare.sh`
75+
- Modify the getVersionName function in `./app/build.gradle`
76+
- Git commit (message example: `bump td to vx.x.x`)
77+
- Git add tag (`git tag vx.x.x`, the tag version should be same as the version of tdlib)
78+
- Push with tags (`git push && git push --tags`)
79+
- Wait for CI task
80+
- Build on local, see `.github/workflows/main.yml` also
81+
82+
```bash
83+
# cleanup generated .so files for strip testing
84+
rm -fr \
11185
./build/jni/**/*.so \
11286
./build/jni/**/td/*.so \
11387
./build/td/**/*.so \
11488
./jniLibs \
11589
./libs
11690

117-
./build.sh
118-
```
91+
docker run --rm -v $(pwd):/app sstc/android-ndk ./build.sh
92+
```
93+
94+
- update gradle
95+
96+
```bash
97+
docker run --rm -v $(pwd):/app sstc/android-ndk ./gradlew wrapper --gradle-version latest
98+
```
11999

120100
- `.travis.yml`: Travis CI has build time limitation (1 hour), and building this lib needs much more than it, so can't build on it.
121101

app/build.gradle

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@ def getGroupId = { ->
77
}
88

99
def getVersionName = { ->
10-
return "1.8.31"
10+
return "1.8.47"
1111
}
1212

13-
def getArtificatId = { ->
13+
def getArtifactId = { ->
1414
return "td" // For less confusing, set it as the suffix from `package xxx.xxx.xxx.<suffix>`
1515
}
1616

1717
android {
18-
ndkVersion "22.1.7171670"
19-
compileSdkVersion 30
20-
namespace getGroupId()
18+
ndkVersion = "28.0.13004108"
19+
compileSdkVersion = 35
20+
namespace = getGroupId()
2121

2222
defaultConfig {
2323
minSdkVersion 16
24-
targetSdkVersion 30
24+
targetSdkVersion 31
2525
versionCode 1
2626
versionName getVersionName()
27-
archivesBaseName = getArtificatId()
27+
base {
28+
archivesName = getArtifactId()
29+
}
2830
}
2931
buildTypes {
3032
release {
@@ -47,7 +49,7 @@ android {
4749
// externalNativeBuild {
4850
// cmake {
4951
// arguments "-CMAKE_BUILD_TYPE=MinSizeRel", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_STL=c++_static"
50-
// abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
52+
// abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
5153
// }
5254
// }
5355
// }
@@ -69,10 +71,10 @@ afterEvaluate {
6971
}
7072
publications {
7173
gpr(MavenPublication) {
72-
from components.release
73-
groupId getGroupId()
74-
artifactId getArtificatId()
75-
version getVersionName()
74+
from = components.release
75+
groupId = getGroupId()
76+
artifactId = getArtifactId()
77+
version = getVersionName()
7678
}
7779
}
7880
}

app/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (CMAKE_CROSSCOMPILING)
3232
# E/linker ... /lib/x86_64/libtdjson.so" has unsupported e_shentsize: 0x0 (expected 0x40)
3333
COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:tdjson_android> -o "${root_DIR}/jniLibs/${ANDROID_ABI}/libtdjson.so"
3434
)
35-
# TODO: don't know how to assgin target of sub folder, so strip in build.sh instead here.
35+
# TODO: don't know how to assign target of sub folder, so strip in build.sh instead here.
3636
# add_custom_command(TARGET ??? POST_BUILD
3737
# COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:tdjson_android> $<TARGET_FILE:tdjson_android>.debug
3838
# COMMAND ${CMAKE_COMMAND} -E make_directory "${root_DIR}/libs/${ANDROID_ABI}"

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
// https://developer.android.com/build/releases/gradle-plugin#updating-gradle
88
// https://gradle.org/releases/
99
// https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google
10-
classpath "com.android.tools.build:gradle:8.1.1"
10+
classpath "com.android.tools.build:gradle:8.9.1"
1111
}
1212
}
1313

gradle/wrapper/gradle-wrapper.jar

-10.4 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)