Auto.js/inrt/build.gradle
2022-01-12 14:01:38 +08:00

120 lines
3.7 KiB
Groovy

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion versions.compile
buildToolsVersion versions.buildTool
defaultConfig {
applicationId "com.stardust.auojs.inrt"
minSdkVersion versions.mini
targetSdkVersion versions.target
versionCode versions.appVersionCode - 200
versionName versions.appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
lintOptions {
disable 'MissingTranslation'
disable 'ExtraTranslation'
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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", "arm64-v8a"
// 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')
buildApkPluginForAbi(pluginProjectDir, 'arm64-v8a')
buildApkPluginForAbi(pluginProjectDir, 'x86')
}
}
tasks.whenTaskAdded { task ->
if (task.name == 'assembleRelease') {
task.finalizedBy 'buildApkPlugin'
}
}
repositories {
google()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1-alpha01', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//Glide
implementation('com.github.bumptech.glide:glide:4.12.0', {
exclude group: 'com.android.support'
})
testImplementation "junit:junit:$junit_version"
implementation project(':automator')
implementation project(':common')
implementation project(':autojs')
}