Skip to content

Commit

Permalink
WIP: Android 10+ as target and Google Play distribution support
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Oct 12, 2023
1 parent e2f0edf commit 3fd5dc8
Show file tree
Hide file tree
Showing 134 changed files with 4,727 additions and 7,956 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/debug_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ on:
push:
branches:
- master
- google-play
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package_variant: [ apt-android-7, apt-android-5 ]

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup java 17 as required by gradle
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Build APKs
shell: bash {0}
env:
PACKAGE_VARIANT: ${{ matrix.package_variant }}
run: |
exit_on_error() { echo "$1"; exit 1; }
Expand All @@ -42,7 +42,7 @@ jobs:
fi
APK_DIR_PATH="./app/build/outputs/apk/debug"
APK_VERSION_TAG="$RELEASE_VERSION_NAME-${{ env.PACKAGE_VARIANT }}-github-debug" # Note the "-", GITHUB_SHA will already have "+" before it
APK_VERSION_TAG="$RELEASE_VERSION_NAME-github-debug" # Note the "-", GITHUB_SHA will already have "+" before it
APK_BASENAME_PREFIX="termux-app_$APK_VERSION_TAG"
# Used by attachment steps later
Expand All @@ -53,7 +53,6 @@ jobs:
echo "Building APKs for 'APK_VERSION_TAG' build"
export TERMUX_APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle
export TERMUX_APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle
export TERMUX_PACKAGE_VARIANT="${{ env.PACKAGE_VARIANT }}" # Used by app/build.gradle
if ! ./gradlew assembleDebug; then
exit_on_error "Build failed for '$APK_VERSION_TAG' build."
fi
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup java 17 as required by gradle
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Execute tests
run: |
./gradlew test
51 changes: 24 additions & 27 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,40 @@ ext {
// crash at startup.
// Bootstrap of a different variant must not be manually installed by the user after app installation
// by replacing $PREFIX since app code is dependant on the variant used to build the APK.
// Currently supported values are: [ "apt-android-7" "apt-android-5" ]
packageVariant = System.getenv("TERMUX_PACKAGE_VARIANT") ?: "apt-android-7" // Default: "apt-android-7"
}

android {
compileSdkVersion project.properties.compileSdkVersion.toInteger()
namespace "com.termux"

ndkVersion = System.getenv("JITPACK_NDK_VERSION") ?: project.properties.ndkVersion
def appVersionName = System.getenv("TERMUX_APP_VERSION_NAME") ?: ""
def apkVersionTag = System.getenv("TERMUX_APK_VERSION_TAG") ?: ""
def splitAPKsForDebugBuilds = System.getenv("TERMUX_SPLIT_APKS_FOR_DEBUG_BUILDS") ?: "1"
def splitAPKsForReleaseBuilds = System.getenv("TERMUX_SPLIT_APKS_FOR_RELEASE_BUILDS") ?: "0" // F-Droid does not support split APKs #1904

dependencies {
implementation "androidx.annotation:annotation:1.3.0"
implementation "androidx.core:core:1.6.0"
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
implementation "androidx.preference:preference:1.1.1"
implementation "androidx.annotation:annotation:1.7.0"
implementation "androidx.core:core:1.12.0"
implementation "androidx.drawerlayout:drawerlayout:1.2.0"
implementation "androidx.preference:preference:1.2.1"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "com.google.android.material:material:1.4.0"
implementation "com.google.android.material:material:1.10.0"
implementation "com.google.guava:guava:24.1-jre"
implementation "io.noties.markwon:core:$markwonVersion"
implementation "io.noties.markwon:ext-strikethrough:$markwonVersion"
implementation "io.noties.markwon:linkify:$markwonVersion"
implementation "io.noties.markwon:recycler:$markwonVersion"
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

implementation project(":terminal-view")
implementation project(":termux-shared")
}

defaultConfig {
applicationId "com.termux"
minSdkVersion project.properties.minSdkVersion.toInteger()
targetSdkVersion project.properties.targetSdkVersion.toInteger()
compileSdk project.properties.compileSdkVersion.toInteger()
versionCode 118
versionName "0.118.0"

Expand Down Expand Up @@ -97,11 +98,8 @@ android {
}

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true

sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

externalNativeBuild {
Expand All @@ -110,7 +108,7 @@ android {
}
}

lintOptions {
lint {
disable 'ProtectedPermissions'
}

Expand Down Expand Up @@ -143,7 +141,6 @@ android {
dependencies {
testImplementation "junit:junit:4.13.2"
testImplementation "org.robolectric:robolectric:4.10"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
}

task versionName {
Expand Down Expand Up @@ -182,7 +179,8 @@ def downloadBootstrap(String arch, String expectedChecksum, String version) {
}
}

def remoteUrl = "https://github.com/termux/termux-packages/releases/download/bootstrap-" + version + "/bootstrap-" + arch + ".zip"
// def remoteUrl = "https://github.com/termux/termux-packages/releases/download/bootstrap-" + version + "/bootstrap-" + arch + ".zip"
def remoteUrl = "https://fornwall.me/tmp/bootstrap-" + arch + "-test-v" + version + ".zip"
logger.quiet("Downloading " + remoteUrl + " ...")

file.parentFile.mkdirs()
Expand Down Expand Up @@ -214,17 +212,11 @@ task downloadBootstraps() {
doLast {
def packageVariant = project.ext.packageVariant
if (packageVariant == "apt-android-7") {
def version = "2022.04.28-r5" + "+" + packageVariant
downloadBootstrap("aarch64", "4a51a7eb209fe82efc24d52e3cccc13165f27377290687cb82038cbd8e948430", version)
downloadBootstrap("arm", "6459a786acbae50d4c8a36fa1c3de6a4dd2d482572f6d54f73274709bd627325", version)
downloadBootstrap("i686", "919d212b2f19e08600938db4079e794e947365022dbfd50ac342c50fcedcd7be", version)
downloadBootstrap("x86_64", "61b02fdc03ea4f5d9da8d8cf018013fdc6659e6da6cbf44e9b24d1c623580b89", version)
} else if (packageVariant == "apt-android-5") {
def version = "2022.04.28-r6" + "+" + packageVariant
downloadBootstrap("aarch64", "913609d439415c828c5640be1b0561467e539cb1c7080662decaaca2fb4820e7", version)
downloadBootstrap("arm", "26bfb45304c946170db69108e5eb6e3641aad751406ce106c80df80cad2eccf8", version)
downloadBootstrap("i686", "46dcfeb5eef67ba765498db9fe4c50dc4690805139aa0dd141a9d8ee0693cd27", version)
downloadBootstrap("x86_64", "615b590679ee6cd885b7fd2ff9473c845e920f9b422f790bb158c63fe42b8481", version)
def version = "3"
downloadBootstrap("aarch64", "308484efc4400a003a731836f6c33dfa6e5fc04abc27a2268968a3e5f549114b", version)
downloadBootstrap("arm", "0b39a9d53882fb7878cd5b2cf5846e50853e69ebf7df283afcf8ea51af14b322", version)
downloadBootstrap("i686", "ec7a18f5fa17d01cc0aa8e1389b21f3d9b99c8eddd33d4ddde36dd2380f74a07", version)
downloadBootstrap("x86_64", "e7d90df0dcb698c2413c5581b238d425e59fc84e178358a9e56b2101be341279", version)
} else {
throw new GradleException("Unsupported TERMUX_PACKAGE_VARIANT \"" + packageVariant + "\"")
}
Expand All @@ -236,3 +228,8 @@ afterEvaluate {
variant.javaCompileProvider.get().dependsOn(downloadBootstraps)
}
}

// https://stackoverflow.com/questions/75274720/a-failure-occurred-while-executing-appcheckdebugduplicateclasses/
configurations.implementation {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
5 changes: 0 additions & 5 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@
-dontobfuscate
#-renamesourcefileattribute SourceFile
#-keepattributes SourceFile,LineNumberTable

# Temp fix for androidx.window:window:1.0.0-alpha09 imported by termux-shared
# https://issuetracker.google.com/issues/189001730
# https://android-review.googlesource.com/c/platform/frameworks/support/+/1757630
-keep class androidx.window.** { *; }

0 comments on commit 3fd5dc8

Please sign in to comment.