FoldCraftLauncher/FCL/build.gradle

124 lines
3.9 KiB
Groovy
Raw Normal View History

2022-10-19 10:11:29 +00:00
plugins {
id 'com.android.application'
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
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-01-13 11:42:07 +00:00
versionCode 15
versionName "1.1.3"
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'
}
configureEach {
resValue "string", "app_version", "${defaultConfig.versionName}"
}
2022-10-19 10:11:29 +00:00
}
2023-07-31 09:56:03 +00:00
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
outputFileName = "FCL-${variant.buildType.name}-${defaultConfig.versionName}.apk"
}
}
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
}
}
2022-10-19 10:11:29 +00:00
}
2023-08-01 13:52:11 +00:00
tasks.whenTaskAdded { Task task ->
if (task.name.contentEquals("assembleRelease")) {
2023-08-02 04:50:03 +00:00
task.dependsOn(uploadMap)
2023-08-01 13:52:11 +00:00
}
}
2023-08-02 00:24:00 +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")) {
2023-08-02 00:24:00 +00:00
it = it.replaceAll('download/.+"', "download/${android.defaultConfig.versionName}/FCL-release-${android.defaultConfig.versionName}.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
2023-08-02 04:50:03 +00:00
task uploadMap(dependsOn:'updateMap') {
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')
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'
implementation 'org.apache.commons:commons-compress:1.23.0'
implementation 'org.tukaani:xz:1.9'
2023-07-11 17:59:14 +00:00
implementation 'com.github.steveice10:opennbt:1.5'
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'
testImplementation 'junit:junit:4.13.2'
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-07 11:39:17 +00:00
} catch (Exception e) {
2024-01-07 10:37:21 +00:00
2023-08-02 04:50:03 +00:00
}
2024-01-07 10:26:26 +00:00
}