119 lines
3.4 KiB
Groovy
119 lines
3.4 KiB
Groovy
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
|
|
android {
|
|
compileSdkVersion versions.compile
|
|
|
|
defaultConfig {
|
|
applicationId "com.stardust.auojs.inrt"
|
|
minSdkVersion versions.mini
|
|
targetSdkVersion versions.target
|
|
versionCode versions.appVersionCode
|
|
versionName versions.appVersionName
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
multiDexEnabled true
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
disable 'MissingTranslation'
|
|
disable 'ExtraTranslation'
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_16
|
|
targetCompatibility JavaVersion.VERSION_16
|
|
}
|
|
splits {
|
|
|
|
// Configures multiple APKs based on ABI.
|
|
abi {
|
|
|
|
// Enables building multiple APKs per ABI.
|
|
enable true
|
|
|
|
// By default all ABIs are included, so use reset() and include to specify that we only
|
|
// want APKs for x86 and x86_64.
|
|
|
|
// Resets the list of ABIs that Gradle should create APKs for to none.
|
|
reset()
|
|
|
|
// Specifies a list of ABIs that Gradle should create APKs for.
|
|
include "armeabi-v7a"
|
|
|
|
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
|
|
universalApk false
|
|
}
|
|
}
|
|
buildTypes {
|
|
debug {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
}
|
|
|
|
def buildApkPluginForAbi(File pluginProjectDir, String abi) {
|
|
copy {
|
|
from file('..\\app\\release\\')
|
|
into new File(pluginProjectDir, 'app\\src\\main\\assets')
|
|
def fileName = "inrt-" + abi + "-release.apk"
|
|
include fileName
|
|
rename fileName, 'template.apk'
|
|
}
|
|
exec {
|
|
workingDir pluginProjectDir
|
|
commandLine 'gradlew.bat', 'assembleRelease'
|
|
}
|
|
copy {
|
|
from new File(pluginProjectDir, 'app\\build\\outputs\\apk\\release')
|
|
into file('..\\common\\release')
|
|
def fileName = '打包插件-' + versions.appVersionName + '-release.apk'
|
|
include fileName
|
|
rename fileName, '打包插件-' + abi + '-' + versions.appVersionName + '-release.apk'
|
|
}
|
|
}
|
|
|
|
task buildApkPlugin {
|
|
doLast {
|
|
def pluginProjectDirPath = '..\\..\\AutoJsApkBuilderPlugin'
|
|
def pluginProjectDir = file(pluginProjectDirPath)
|
|
if (!pluginProjectDir.exists() || !pluginProjectDir.isDirectory()) {
|
|
println 'pluginProjectDir not exists'
|
|
return
|
|
}
|
|
buildApkPluginForAbi(pluginProjectDir, 'armeabi-v7a')
|
|
}
|
|
}
|
|
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name == 'assembleRelease') {
|
|
task.finalizedBy 'buildApkPlugin'
|
|
}
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_16
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
google()
|
|
}
|
|
|
|
dependencies {
|
|
testImplementation 'junit:junit:4.13.2'
|
|
|
|
implementation 'com.github.bumptech.glide:glide:4.12.0'
|
|
|
|
implementation project(":libs:org.mozilla.rhino-1.7.14")
|
|
implementation project(":libs:org.opencv-4.5.4")
|
|
|
|
implementation project(':automator')
|
|
implementation project(':common')
|
|
implementation project(':autojs')
|
|
}
|