From c24793679270a9d4b7de916228569bdb49d6a769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 8 Jul 2020 04:00:22 +0000 Subject: [PATCH] Update dependencies --- .github/workflows/release.yml | 41 ++------- .gitignore | 1 + README.md | 11 +-- TMessagesProj/build.gradle | 101 ++++++++++++++--------- update_jni.sh => bin/binary_libs.sh | 14 ++-- init_jni.sh => bin/native_libs.sh | 2 +- bin/publish_play.sh | 3 + bin/publish_release_apks.sh | 16 ++++ bin/publish_repo_apks.sh | 18 ++++ bin/release.sh | 22 +++++ bin/tag.sh | 4 + build.gradle | 1 + gradle/wrapper/gradle-wrapper.properties | 3 +- release.sh | 4 - 14 files changed, 151 insertions(+), 90 deletions(-) rename update_jni.sh => bin/binary_libs.sh (69%) rename init_jni.sh => bin/native_libs.sh (97%) create mode 100755 bin/publish_play.sh create mode 100755 bin/publish_release_apks.sh create mode 100755 bin/publish_repo_apks.sh create mode 100755 bin/release.sh create mode 100755 bin/tag.sh delete mode 100755 release.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2f015ab7d..fb7587c6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,42 +21,15 @@ jobs: - name: assembleRelease run: | export LOCAL_PROPERTIES="${{ secrets.LOCAL_PROPERTIES }}" - ./gradlew TMessagesProj:assembleRelease \ - TMessagesProj:assembleReleaseNoGcm \ - TMessagesProj:bundleFullRelease - echo ::set-env name=AAB_FILE::$(find TMessagesProj/build/outputs/bundle -name "*.aab") - - name: Setup ghr - run: | - wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz - tar xvzf ghr.tar.gz; rm ghr.tar.gz - sudo mv ghr*linux_amd64/ghr /usr/local/bin; rm -rf ghr*linux_amd64 - - name: Upload apks - run: | export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" - mkdir apks; find . -name "*.apk" -exec mv {} apks \; - ref="${{ github.ref }}" - ref=${ref/"refs/tags/"/} - msg="${{ github.event.head_commit.message }}" - ghr -delete -n "$ref" -b "$msg" "$ref" apks/ rm -rf $HOME/.ssh mkdir -p $HOME/.ssh echo "${{ secrets.SSH_KEY }}" > $HOME/.ssh/id_rsa chmod 600 $HOME/.ssh/id_rsa - mv build/update.json apks - cd apks - rm *universal* - xz *.apk - export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - git init - git config --global user.name "世界" - git config --global user.email "i@nekox.me" - git remote add origin "git@github.com:NekoX-Dev/Resources.git" - git add . --all - git commit -m 喵 - git push origin master -f - - uses: r0adkll/upload-google-play@master - with: - serviceAccountJsonPlainText: ${{ secrets.GOOGLE_ACCOUNT_SERVICE }} - packageName: nekox.messenger - releaseFile: ${{ env.AAB_FILE }} - track: production \ No newline at end of file + cat > service_account_credentials.json << EOF + ${{ secrets.GOOGLE_ACCOUNT_SERVICE }} + EOF + ref="${{ github.ref }}" + ref=${ref/"refs/tags/"/} + ./bin/release.sh "$ref" + ./bin/publish_play.sh \ No newline at end of file diff --git a/.gitignore b/.gitignore index 77cd60584..6251ff23e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ local.properties /TMessagesProj/jni/boringssl/build/ CMakeLists.txt CMakeLists.txt.orig +service_account_credentials.json \ No newline at end of file diff --git a/README.md b/README.md index cdcfbbcd8..f748328f6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ NekoX is an open source third-party Telegram android app. - Chat Group (Persian) : https://t.me/NekogramX_Persian - FAQ: https://telegra.ph/NekoX-FAQ-03-31 - FAQ (Chinese): https://telegra.ph/NekoX-%E5%B8%B8%E8%A6%8B%E5%95%8F%E9%A1%8C-03-31 -- [Wall of Shame - Nekogram](https://github.com/Nekogram/Nekogram/wiki/Wall-of-Shame) ## Telegram-FOSS Changes: @@ -34,7 +33,9 @@ NekoX is an open source third-party Telegram android app. - Added the ability to parse locations from intents containing a `geo:,,` string - Force static map previews from Telegram -## Nekogram Changes +## Old 0penSource Nekogram Changes + +We regret that [Nekogram](https://github.com/Nekogram/Nekogram-issue-tracker) is no longer open source, but uses drklo/master to [disguise open source](https://github.com/Nekogram/Android). - Repeat others' message in one click. - Save to saved messages in one click. @@ -126,7 +127,7 @@ If you don't use NekoX's APP_ID and APP_HASH, you need to register a physical fi OK, a version without firebase cloud messaging and precompiled native libraries, maybe this makes you feel more free, or your phone does not have Google services. -To compile the foss version, please refer to [build script](.github/workflows/build.yml). +To compile the foss version, please refer to [build script](./update_jni.sh). ### Build Variants @@ -137,13 +138,13 @@ Available variant list: ## Localization -Join project at https://nekox.crowdin.com/nekox and https://neko.crowdin.com/ . +Join project at https://nekox.crowdin.com/nekox. ## Credits
  • Telegram-FOSS: GPLv2
  • -
  • Nekogram: GPLv2
  • +
  • Nekogram: GPLv2 (No longer open source)
  • v2rayNG: GPLv3
  • AndroidLibV2rayLite: LGPLv3
  • shadowsocks-android: GPLv3
  • diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 15f7c1ba6..b72b9dc69 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -7,13 +7,44 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' +def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") + +if (serviceAccountCredentialsFile.isFile()) { + + setupPlay() + + play.serviceAccountCredentials = serviceAccountCredentialsFile + +} else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) { + + setupPlay() + +} + +void setupPlay() { + + apply plugin: 'com.github.triplet.play' + + play { + + track = "production" + + defaultToAppBundles = true + + userFraction = 1 + + } + +} + + configurations { compile.exclude module: 'support-v4' } def okHttpVersion = '4.7.2' -def fcmVersion = '20.2.1' -def crashlyticsVersion = '17.1.0' +def fcmVersion = '20.2.2' +def crashlyticsVersion = '17.1.1' def playCoreVersion = '1.7.3' buildscript { @@ -90,8 +121,8 @@ dependencies { } -def verName = "6.2.0.2-preview-1" -def verCode = 51 +def verName = "6.2.0.3-rc03" +def verCode = 56 task writeUpdateInfo { @@ -251,42 +282,36 @@ android { } } - sourceSets.main { - jni.srcDirs = ['./jni/'] - } - - sourceSets.debug { - jniLibs.srcDir 'src/main/libs' - } - - sourceSets.releaseNoGcm { - jniLibs.srcDir 'src/main/libs' - } - - sourceSets.release { - jniLibs.srcDir 'src/main/libs' - manifest.srcFile 'src/gservcies/AndroidManifest.xml' - } - - sourceSets.foss { - jni.srcDirs = ['./jni/'] - } - - flavorDimensions "version" - - splits { - - abi { - - enable true - - reset() - include "armeabi-v7a", "arm64-v8a", "x86", "x86_64" - - universalApk true + sourceSets { + main { + jni.srcDirs = ['./jni/'] } + debug { + jniLibs.srcDir 'src/main/libs' + } + + releaseNoGcm { + jniLibs.srcDir 'src/main/libs' + } + + release { + jniLibs.srcDir 'src/main/libs' + manifest.srcFile 'src/gservcies/AndroidManifest.xml' + } + + foss { + jni.srcDirs = ['./jni/'] + } + + } + + splits.abi { + + enable true + universalApk true + } def tgVoipDexFileName = "libtgvoip.dex" @@ -362,7 +387,7 @@ android { set.dependencies { implementation 'com.vanniktech:emoji-facebook:0.7.0-SNAPSHOT' } - } else { + } else if (!set.name.contains("NoEmoji")) { set.assets.srcDirs = ["src/main/assets", "src/emojis/blob"] } } diff --git a/update_jni.sh b/bin/binary_libs.sh similarity index 69% rename from update_jni.sh rename to bin/binary_libs.sh index 06b468d9e..a378624cf 100755 --- a/update_jni.sh +++ b/bin/binary_libs.sh @@ -12,16 +12,16 @@ cp ssr-libev/build/outputs/aar/* TMessagesProj/libs cd TMessagesProj/libs -go get -u github.com/golang/protobuf/protoc-gen-go go get -v golang.org/x/mobile/cmd/... -go get -v go.starlark.net/starlark -go get -v github.com/refraction-networking/utls -go get -v github.com/gorilla/websocket -go get -v -insecure v2ray.com/core -go get github.com/2dust/AndroidLibV2rayLite + +v2rayCore="$(go env GOPATH)/src/v2ray.com/core" +rm -rf "$v2rayCore" +mkdir -p "$v2rayCore" +git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" +go get -d github.com/2dust/AndroidLibV2rayLite gomobile init -env GO111MODULE=off gomobile bind -v -ldflags='-s -w' github.com/2dust/AndroidLibV2rayLite +gomobile bind -v -ldflags='-s -w' github.com/2dust/AndroidLibV2rayLite rm *-sources.jar cd ../.. diff --git a/init_jni.sh b/bin/native_libs.sh similarity index 97% rename from init_jni.sh rename to bin/native_libs.sh index 8cc7226bf..12c27253d 100755 --- a/init_jni.sh +++ b/bin/native_libs.sh @@ -55,7 +55,7 @@ export NINJA_PATH="$(command -v ninja)" export PATH=$(echo "$ANDROID_HOME"/cmake/*/bin):$PATH -cd TMessagesProj/jni +cd TMessagesProj/jni || exit 1 git submodule update --init --recursive diff --git a/bin/publish_play.sh b/bin/publish_play.sh new file mode 100755 index 000000000..db7df7f8d --- /dev/null +++ b/bin/publish_play.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./gradlew TMessagesProj:publishFullBlobEmojiRelease \ No newline at end of file diff --git a/bin/publish_release_apks.sh b/bin/publish_release_apks.sh new file mode 100755 index 000000000..4266aee87 --- /dev/null +++ b/bin/publish_release_apks.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +if [ ! -x "$(command -v ghr)" ]; then + + wget -O ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz && + tar xvzf ghr.tar.gz && + rm ghr.tar.gz && + sudo mv ghr*linux_amd64/ghr /usr/local/bin && + rm -rf ghr*linux_amd64 || exit 1 + +fi + +rm -rf build/apks && +mkdir -p build/apks && +find TMessagesProj/build/outputs/apk -name "*.apk" -exec cp {} build/apks \; && +ghr -delete -n "$1" "$1" build/apks/ \ No newline at end of file diff --git a/bin/publish_repo_apks.sh b/bin/publish_repo_apks.sh new file mode 100755 index 000000000..583d58853 --- /dev/null +++ b/bin/publish_repo_apks.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +rm -rf build/apks && +mkdir -p build/apks && +find TMessagesProj/build/outputs/apk -name "*.apk" -exec cp {} build/apks \; && +cp build/update.json build/apks && +cd build/apks && +rm *universal* && +xz *.apk && +export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" && +git init && +git config --global user.name "世界" && +git config --global user.email "i@nekox.me" && +git remote add origin "git@github.com:NekoX-Dev/Resources.git" && +git add . --all && +git commit -m "Update" && +git push origin master -f && +rm -rf build/apks \ No newline at end of file diff --git a/bin/release.sh b/bin/release.sh new file mode 100755 index 000000000..6c0505556 --- /dev/null +++ b/bin/release.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +function assemble() { + + ./gradlew TMessagesProj:assembleFullRelease \ + TMessagesProj:assembleFullReleaseNoGcm \ + TMessagesProj:assembleMiniRelease \ + TMessagesProj:assembleMiniReleaseNoGcm \ + TMessagesProj:assembleMiniNoEmojiRelease \ + TMessagesProj:assembleMiniNoEmojiReleaseNoGcm + + return $? + +} + +#./gradlew TMessagesProj:assembleRelease \ +# TMessagesProj:assembleReleaseNoGcm + +assemble && +assemble && +./bin/publish_repo_apks.sh && +./bin/publish_release_apks.sh "$1" \ No newline at end of file diff --git a/bin/tag.sh b/bin/tag.sh new file mode 100755 index 000000000..95e0830aa --- /dev/null +++ b/bin/tag.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +git tag "$1" -f && +git push origin "$1" -f \ No newline at end of file diff --git a/build.gradle b/build.gradle index c237bf755..78d85dde3 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ buildscript { classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.8.3' + classpath 'com.github.triplet.gradle:play-publisher:2.8.0' } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 186b71557..a2190901c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Fri Jul 10 12:31:49 UTC 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip diff --git a/release.sh b/release.sh deleted file mode 100755 index abb09f443..000000000 --- a/release.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -git tag "$1" -f -git push origin "$1" -f \ No newline at end of file