2022-10-19 10:11:29 +00:00
|
|
|
plugins {
|
|
|
|
id 'com.android.application'
|
2024-08-18 12:45:41 +00:00
|
|
|
id 'org.jetbrains.kotlin.android' version '1.9.20'
|
2023-08-02 04:50:03 +00:00
|
|
|
id "org.hidetake.ssh" version "2.11.2"
|
2022-10-19 10:11:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
namespace 'com.tungsten.fcl'
|
2023-12-25 11:04:07 +00:00
|
|
|
compileSdk 34
|
2022-10-19 10:11:29 +00:00
|
|
|
|
2024-02-07 11:24:11 +00:00
|
|
|
def pwd = System.getenv("FCL_KEYSTORE_PASSWORD")
|
|
|
|
def curseApiKey = System.getenv("CURSE_API_KEY")
|
2024-02-07 11:31:21 +00:00
|
|
|
def oauthApiKey = System.getenv("OAUTH_API_KEY")
|
|
|
|
if (pwd == null || curseApiKey == null || oauthApiKey == null) {
|
2024-02-07 11:24:11 +00:00
|
|
|
if (new File("${rootDir}/local.properties").exists()) {
|
|
|
|
Properties prop = new Properties()
|
|
|
|
prop.load(new FileInputStream("${rootDir}/local.properties"))
|
|
|
|
pwd = prop.get("pwd")
|
|
|
|
curseApiKey = prop.get("curse.api.key")
|
2024-02-07 11:31:21 +00:00
|
|
|
oauthApiKey = prop.get("oauth.api.key")
|
2024-02-07 11:24:11 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-07 15:13:11 +00:00
|
|
|
if (curseApiKey == null || oauthApiKey == null) {
|
|
|
|
curseApiKey = "null"
|
|
|
|
oauthApiKey = "null"
|
|
|
|
}
|
2024-02-07 11:24:11 +00:00
|
|
|
|
2024-01-14 01:22:55 +00:00
|
|
|
signingConfigs {
|
2024-01-16 05:53:43 +00:00
|
|
|
FCLKey {
|
2024-01-14 01:22:55 +00:00
|
|
|
storeFile file("../key-store.jks")
|
2024-01-16 05:53:43 +00:00
|
|
|
storePassword pwd
|
2024-01-14 01:22:55 +00:00
|
|
|
keyAlias "FCL-Key"
|
2024-01-16 05:53:43 +00:00
|
|
|
keyPassword pwd
|
2024-01-14 01:22:55 +00:00
|
|
|
}
|
2024-02-03 03:18:48 +00:00
|
|
|
FCLDebugKey {
|
|
|
|
storeFile file("../debug-key.jks")
|
|
|
|
storePassword "FCL-Debug"
|
|
|
|
keyAlias "FCL-Debug"
|
|
|
|
keyPassword "FCL-Debug"
|
|
|
|
}
|
2024-01-14 01:22:55 +00:00
|
|
|
}
|
|
|
|
|
2022-10-19 10:11:29 +00:00
|
|
|
defaultConfig {
|
|
|
|
applicationId "com.tungsten.fcl"
|
2022-10-19 13:29:48 +00:00
|
|
|
minSdk 26
|
2023-12-25 11:04:07 +00:00
|
|
|
targetSdk 34
|
2024-08-16 04:42:04 +00:00
|
|
|
versionCode 1175
|
|
|
|
versionName "1.1.7.5"
|
2022-10-19 10:11:29 +00:00
|
|
|
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
2024-01-16 05:53:43 +00:00
|
|
|
signingConfig signingConfigs.FCLKey
|
2022-10-19 10:11:29 +00:00
|
|
|
}
|
2024-02-03 03:18:48 +00:00
|
|
|
fordebug {
|
|
|
|
initWith debug
|
2024-02-03 07:55:36 +00:00
|
|
|
applicationIdSuffix ".debug"
|
2024-02-03 03:18:48 +00:00
|
|
|
signingConfig signingConfigs.FCLDebugKey
|
|
|
|
}
|
2023-08-01 12:19:23 +00:00
|
|
|
configureEach {
|
|
|
|
resValue "string", "app_version", "${defaultConfig.versionName}"
|
2024-02-07 11:24:11 +00:00
|
|
|
resValue "string", "curse_api_key", curseApiKey
|
2024-02-07 11:31:21 +00:00
|
|
|
resValue "string", "oauth_api_key", oauthApiKey
|
2023-08-01 12:19:23 +00:00
|
|
|
}
|
2022-10-19 10:11:29 +00:00
|
|
|
}
|
2023-07-31 09:56:03 +00:00
|
|
|
applicationVariants.configureEach { variant ->
|
|
|
|
variant.outputs.configureEach { output ->
|
2024-01-16 05:53:43 +00:00
|
|
|
def abi = output.getFilter(ABI)
|
|
|
|
if (abi == null) {
|
|
|
|
abi = "all"
|
|
|
|
}
|
|
|
|
variant.mergeAssetsProvider.get().doLast {
|
|
|
|
def arch = System.getProperty("arch", "all")
|
|
|
|
def assetsDir = mergeAssetsProvider.get().outputDir.get()
|
2024-01-28 13:14:51 +00:00
|
|
|
def java = ['jre8', 'jre11', 'jre17', 'jre21']
|
2024-01-16 05:53:43 +00:00
|
|
|
println(arch)
|
|
|
|
java.forEach { String str ->
|
|
|
|
def runtimeDir = new File([assetsDir, "app_runtime/java/" + str].join(File.separator))
|
|
|
|
println(runtimeDir)
|
|
|
|
def files = fileTree(dir: runtimeDir, include: ['*.tar.xz'])
|
|
|
|
files.forEach { File file ->
|
2024-01-16 06:19:01 +00:00
|
|
|
if (arch != 'all' && !file.getName().contains(arch) && !file.getName().contains("universal")) {
|
2024-01-16 05:53:43 +00:00
|
|
|
print("delete:${file} :")
|
|
|
|
println(delete(file))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
outputFileName = "FCL-${variant.buildType.name}-${defaultConfig.versionName}-${abi}.apk"
|
2023-07-31 09:56:03 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-19 10:11:29 +00:00
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
2023-07-31 10:12:38 +00:00
|
|
|
packagingOptions {
|
|
|
|
jniLibs {
|
|
|
|
useLegacyPackaging true
|
|
|
|
}
|
2024-08-15 05:11:09 +00:00
|
|
|
pickFirst '**/libbytehook.so'
|
2023-07-31 10:12:38 +00:00
|
|
|
}
|
2024-08-18 12:45:41 +00:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
dataBinding {
|
|
|
|
enabled true
|
|
|
|
}
|
|
|
|
buildFeatures {
|
|
|
|
buildConfig true
|
|
|
|
}
|
2024-01-16 05:53:43 +00:00
|
|
|
splits {
|
|
|
|
def arch = System.getProperty("arch", "all")
|
|
|
|
if (arch != 'all') {
|
|
|
|
abi {
|
|
|
|
enable true
|
|
|
|
reset()
|
|
|
|
switch (arch) {
|
|
|
|
case 'arm':
|
|
|
|
include 'armeabi-v7a'
|
|
|
|
break
|
|
|
|
case 'arm64':
|
|
|
|
include 'arm64-v8a'
|
|
|
|
break
|
|
|
|
case 'x86':
|
|
|
|
include 'x86'
|
|
|
|
break
|
2024-05-21 16:48:43 +00:00
|
|
|
case 'x86_64':
|
2024-01-16 05:53:43 +00:00
|
|
|
include 'x86_64'
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-19 10:11:29 +00:00
|
|
|
}
|
|
|
|
|
2023-08-01 13:52:11 +00:00
|
|
|
tasks.register('updateMap') {
|
|
|
|
doLast {
|
|
|
|
def list = []
|
|
|
|
new File("${rootDir}/version_map.json").withReader("UTF-8") { reader ->
|
|
|
|
reader.eachLine {
|
|
|
|
if (it.contains('versionCode')) {
|
|
|
|
it = it.replaceAll('[0-9]+', "${android.defaultConfig.versionCode}")
|
|
|
|
} else if (it.contains("versionName")) {
|
|
|
|
it = it.replaceAll(': ".+', ": \"${android.defaultConfig.versionName}\",")
|
|
|
|
} else if (it.contains("date")) {
|
|
|
|
def date = new Date().format("yyyy.MM.dd", TimeZone.getTimeZone("UTC"))
|
|
|
|
it = it.replaceAll(': ".+', ": \"${date}\",")
|
|
|
|
} else if (it.contains("url")) {
|
2024-02-07 07:44:08 +00:00
|
|
|
it = it.replaceAll('download/.+"', "download/${android.defaultConfig.versionName}/FCL-release-${android.defaultConfig.versionName}-all.apk\"")
|
2023-08-01 13:52:11 +00:00
|
|
|
}
|
|
|
|
list.add(it + "\n")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
new File("${rootDir}/version_map.json").withWriter("UTF-8") { writer ->
|
|
|
|
list.each {
|
|
|
|
writer.write(it)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-08-02 00:24:00 +00:00
|
|
|
|
2024-01-14 01:22:55 +00:00
|
|
|
task uploadMap(dependsOn: 'updateMap') {
|
2023-08-02 04:50:03 +00:00
|
|
|
doLast {
|
|
|
|
ssh.run {
|
|
|
|
session(remotes.debugServer) {
|
|
|
|
File file = file "${rootDir}/version_map.json"
|
|
|
|
put from: file.getAbsolutePath(), into: "/www/wwwroot/FCLApi/public/files"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-19 10:11:29 +00:00
|
|
|
dependencies {
|
|
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
|
|
implementation project(path: ':FCLCore')
|
2022-10-25 16:04:56 +00:00
|
|
|
implementation project(path: ':FCLLibrary')
|
2022-10-21 16:58:02 +00:00
|
|
|
implementation project(path: ':FCLauncher')
|
2022-11-03 08:09:42 +00:00
|
|
|
implementation 'org.nanohttpd:nanohttpd:2.3.1'
|
2024-02-01 13:50:12 +00:00
|
|
|
implementation 'org.apache.commons:commons-compress:1.25.0'
|
2023-06-28 14:21:28 +00:00
|
|
|
implementation 'org.tukaani:xz:1.9'
|
2023-07-11 17:59:14 +00:00
|
|
|
implementation 'com.github.steveice10:opennbt:1.5'
|
2023-06-28 14:21:28 +00:00
|
|
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
2023-12-24 14:25:06 +00:00
|
|
|
implementation 'com.google.android.material:material:1.11.0'
|
2022-10-19 10:11:29 +00:00
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
2024-04-06 04:35:25 +00:00
|
|
|
implementation 'com.github.Mathias-Boulay:android_gamepad_remapper:06184ddbce'
|
2024-08-19 05:58:06 +00:00
|
|
|
implementation 'com.github.bumptech.glide:glide:4.16.0'
|
2022-10-19 10:11:29 +00:00
|
|
|
testImplementation 'junit:junit:4.13.2'
|
2023-01-19 08:35:08 +00:00
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
2023-08-02 04:50:03 +00:00
|
|
|
}
|
2023-08-02 04:56:32 +00:00
|
|
|
|
2023-08-02 04:50:03 +00:00
|
|
|
ssh.settings {
|
|
|
|
knownHosts = allowAnyHosts
|
|
|
|
}
|
2023-08-02 04:56:32 +00:00
|
|
|
|
2023-08-02 04:50:03 +00:00
|
|
|
remotes {
|
2024-01-07 10:37:21 +00:00
|
|
|
try {
|
2024-01-07 10:47:49 +00:00
|
|
|
Properties prop = new Properties()
|
|
|
|
prop.load(new FileInputStream("${rootDir}/local.properties"))
|
2024-01-07 10:37:21 +00:00
|
|
|
debugServer {
|
|
|
|
host = prop.getProperty("sftp.host")
|
|
|
|
port = prop.getProperty("sftp.port").toInteger()
|
|
|
|
user = prop.getProperty("sftp.username")
|
|
|
|
password = prop.getProperty("sftp.password")
|
|
|
|
}
|
2024-01-16 05:53:43 +00:00
|
|
|
} catch (Exception ignored) {
|
2024-01-07 10:37:21 +00:00
|
|
|
|
2023-08-02 04:50:03 +00:00
|
|
|
}
|
2024-01-07 10:26:26 +00:00
|
|
|
}
|