2019-10-13 21:13:06 +00:00
|
|
|
plugins {
|
|
|
|
id "com.android.application"
|
|
|
|
}
|
2015-10-25 14:27:32 +00:00
|
|
|
|
|
|
|
android {
|
2020-08-04 12:36:14 +00:00
|
|
|
compileSdkVersion project.properties.compileSdkVersion.toInteger()
|
|
|
|
ndkVersion project.properties.ndkVersion
|
2015-11-28 23:25:51 +00:00
|
|
|
|
|
|
|
dependencies {
|
2021-04-06 01:00:05 +00:00
|
|
|
implementation "androidx.annotation:annotation:1.2.0"
|
|
|
|
implementation "androidx.core:core:1.5.0-rc01"
|
2021-01-01 16:14:04 +00:00
|
|
|
implementation "androidx.drawerlayout:drawerlayout:1.1.1"
|
2021-04-06 01:00:05 +00:00
|
|
|
implementation "androidx.preference:preference:1.1.1"
|
2021-03-18 16:55:42 +00:00
|
|
|
implementation "androidx.viewpager:viewpager:1.0.0"
|
2021-04-06 01:00:05 +00:00
|
|
|
implementation "com.google.guava:guava:24.1-jre"
|
2021-04-07 06:31:30 +00:00
|
|
|
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"
|
2021-04-06 01:00:05 +00:00
|
|
|
|
2021-04-07 06:31:30 +00:00
|
|
|
implementation project(":terminal-view")
|
|
|
|
implementation project(":termux-shared")
|
2015-10-25 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "com.termux"
|
2020-08-04 12:36:14 +00:00
|
|
|
minSdkVersion project.properties.minSdkVersion.toInteger()
|
|
|
|
targetSdkVersion project.properties.targetSdkVersion.toInteger()
|
2021-02-18 23:54:46 +00:00
|
|
|
versionCode 108
|
|
|
|
versionName "0.108"
|
2019-10-13 21:13:06 +00:00
|
|
|
|
2021-03-08 10:09:22 +00:00
|
|
|
manifestPlaceholders.TERMUX_PACKAGE_NAME = "com.termux"
|
|
|
|
manifestPlaceholders.TERMUX_APP_NAME = "Termux"
|
|
|
|
manifestPlaceholders.TERMUX_API_APP_NAME = "Termux:API"
|
|
|
|
manifestPlaceholders.TERMUX_BOOT_APP_NAME = "Termux:Boot"
|
|
|
|
manifestPlaceholders.TERMUX_FLOAT_APP_NAME = "Termux:Float"
|
|
|
|
manifestPlaceholders.TERMUX_STYLING_APP_NAME = "Termux:Styling"
|
|
|
|
manifestPlaceholders.TERMUX_TASKER_APP_NAME = "Termux:Tasker"
|
|
|
|
manifestPlaceholders.TERMUX_WIDGET_APP_NAME = "Termux:Widget"
|
|
|
|
|
2019-10-13 21:13:06 +00:00
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
cFlags "-std=c11", "-Wall", "-Wextra", "-Werror", "-Os", "-fno-stack-protector", "-Wl,--gc-sections"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-18 23:45:39 +00:00
|
|
|
ndk {
|
|
|
|
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
|
2019-10-13 21:13:06 +00:00
|
|
|
}
|
|
|
|
|
2015-10-25 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
2019-10-06 19:30:57 +00:00
|
|
|
signingConfigs {
|
|
|
|
debug {
|
|
|
|
storeFile file('dev_keystore.jks')
|
|
|
|
keyAlias 'alias'
|
|
|
|
storePassword 'xrj45yWGLbsO7W0v'
|
|
|
|
keyPassword 'xrj45yWGLbsO7W0v'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-25 14:27:32 +00:00
|
|
|
buildTypes {
|
|
|
|
release {
|
2016-05-20 08:30:25 +00:00
|
|
|
minifyEnabled true
|
|
|
|
shrinkResources true
|
2015-10-25 14:27:32 +00:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
|
|
}
|
2019-10-06 19:30:57 +00:00
|
|
|
|
|
|
|
debug {
|
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
}
|
2015-10-25 14:27:32 +00:00
|
|
|
}
|
2018-09-28 22:49:05 +00:00
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
2019-10-13 21:13:06 +00:00
|
|
|
|
|
|
|
externalNativeBuild {
|
|
|
|
ndkBuild {
|
|
|
|
path "src/main/cpp/Android.mk"
|
|
|
|
}
|
|
|
|
}
|
2020-01-05 00:02:13 +00:00
|
|
|
|
2021-01-01 16:41:18 +00:00
|
|
|
lintOptions {
|
|
|
|
disable 'ProtectedPermissions'
|
|
|
|
}
|
|
|
|
|
2020-01-05 00:02:13 +00:00
|
|
|
testOptions {
|
|
|
|
unitTests {
|
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
|
|
|
}
|
2015-10-25 14:27:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-04-07 06:31:30 +00:00
|
|
|
testImplementation "junit:junit:4.13.2"
|
2021-04-06 01:00:05 +00:00
|
|
|
testImplementation "org.robolectric:robolectric:4.4"
|
2015-10-25 14:27:32 +00:00
|
|
|
}
|
2019-05-26 22:07:41 +00:00
|
|
|
|
|
|
|
task versionName {
|
|
|
|
doLast {
|
|
|
|
print android.defaultConfig.versionName
|
|
|
|
}
|
|
|
|
}
|
2019-10-13 21:13:06 +00:00
|
|
|
|
2021-02-11 15:51:46 +00:00
|
|
|
def downloadBootstrap(String arch, String expectedChecksum, String version) {
|
2019-10-13 21:13:06 +00:00
|
|
|
def digest = java.security.MessageDigest.getInstance("SHA-256")
|
|
|
|
|
|
|
|
def localUrl = "src/main/cpp/bootstrap-" + arch + ".zip"
|
|
|
|
def file = new File(projectDir, localUrl)
|
|
|
|
if (file.exists()) {
|
|
|
|
def buffer = new byte[8192]
|
|
|
|
def input = new FileInputStream(file)
|
|
|
|
while (true) {
|
|
|
|
def readBytes = input.read(buffer)
|
|
|
|
if (readBytes < 0) break
|
|
|
|
digest.update(buffer, 0, readBytes)
|
|
|
|
}
|
|
|
|
def checksum = new BigInteger(1, digest.digest()).toString(16)
|
|
|
|
if (checksum == expectedChecksum) {
|
|
|
|
return
|
|
|
|
} else {
|
|
|
|
logger.quiet("Deleting old local file with wrong hash: " + localUrl)
|
|
|
|
file.delete()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-11 15:51:46 +00:00
|
|
|
def remoteUrl = "https://github.com/termux/termux-packages/releases/download/bootstrap-" + version + "/bootstrap-" + arch + ".zip"
|
2019-10-13 21:13:06 +00:00
|
|
|
logger.quiet("Downloading " + remoteUrl + " ...")
|
|
|
|
|
|
|
|
file.parentFile.mkdirs()
|
|
|
|
def out = new BufferedOutputStream(new FileOutputStream(file))
|
|
|
|
|
|
|
|
def connection = new URL(remoteUrl).openConnection()
|
|
|
|
connection.setInstanceFollowRedirects(true)
|
|
|
|
def digestStream = new java.security.DigestInputStream(connection.inputStream, digest)
|
|
|
|
out << digestStream
|
|
|
|
out.close()
|
|
|
|
|
|
|
|
def checksum = new BigInteger(1, digest.digest()).toString(16)
|
|
|
|
if (checksum != expectedChecksum) {
|
|
|
|
file.delete()
|
|
|
|
throw new GradleException("Wrong checksum for " + remoteUrl + ": expected: " + expectedChecksum + ", actual: " + checksum)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clean {
|
|
|
|
doLast {
|
|
|
|
def tree = fileTree(new File(projectDir, 'src/main/cpp'))
|
|
|
|
tree.include 'bootstrap-*.zip'
|
|
|
|
tree.each { it.delete() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task downloadBootstraps(){
|
|
|
|
doLast {
|
2021-02-18 23:54:26 +00:00
|
|
|
def version = "2021.02.19-r1"
|
|
|
|
downloadBootstrap("aarch64", "1e3d80bd8cc8771715845ab4a1e67fc125d84c4deda3a1a435116fe4d1f86160", version)
|
|
|
|
downloadBootstrap("arm", "317a987cab3d4da6f9d42f024a5f25e3aaf8557b8ec68eaf80411fde6b8ea78d", version)
|
|
|
|
downloadBootstrap("i686", "dd4632350474058fe5dec14b7bd882798bb3e9fe738b2de8c84a51a0b6395f4b", version)
|
|
|
|
downloadBootstrap("x86_64", "5458119186c3ea631420833e59730461dc2a5faf17b8fad239823c88aa4569ae", version)
|
2019-10-13 21:13:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
afterEvaluate {
|
|
|
|
android.applicationVariants.all { variant ->
|
2019-11-03 21:35:52 +00:00
|
|
|
variant.javaCompileProvider.get().dependsOn(downloadBootstraps)
|
2019-10-13 21:13:06 +00:00
|
|
|
}
|
|
|
|
}
|