From 9ae8dbb7edfd87628537d85c7d12c667e8a65450 Mon Sep 17 00:00:00 2001 From: Nullptr <52071314+Dr-TSNG@users.noreply.github.com> Date: Thu, 10 Feb 2022 21:15:41 +0800 Subject: [PATCH] Migrate all groovy to kts --- apkzlib/build.gradle | 18 ------- apkzlib/build.gradle.kts | 21 ++++++++ app/build.gradle | 96 ---------------------------------- app/build.gradle.kts | 99 ++++++++++++++++++++++++++++++++++++ appstub/build.gradle | 55 -------------------- appstub/build.gradle.kts | 60 ++++++++++++++++++++++ axmlprinter/build.gradle | 10 ---- axmlprinter/build.gradle.kts | 13 +++++ build.gradle | 56 -------------------- build.gradle.kts | 46 +++++++++++++++++ imanager/build.gradle | 32 ------------ imanager/build.gradle.kts | 40 +++++++++++++++ manager/build.gradle | 47 ----------------- manager/build.gradle.kts | 58 +++++++++++++++++++++ patch/build.gradle | 69 ------------------------- patch/build.gradle.kts | 69 +++++++++++++++++++++++++ settings.gradle | 21 -------- settings.gradle.kts | 24 +++++++++ share/build.gradle | 7 --- share/build.gradle.kts | 11 ++++ 20 files changed, 441 insertions(+), 411 deletions(-) delete mode 100644 apkzlib/build.gradle create mode 100644 apkzlib/build.gradle.kts delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 appstub/build.gradle create mode 100644 appstub/build.gradle.kts delete mode 100644 axmlprinter/build.gradle create mode 100644 axmlprinter/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 imanager/build.gradle create mode 100644 imanager/build.gradle.kts delete mode 100644 manager/build.gradle create mode 100644 manager/build.gradle.kts delete mode 100644 patch/build.gradle create mode 100644 patch/build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts delete mode 100644 share/build.gradle create mode 100644 share/build.gradle.kts diff --git a/apkzlib/build.gradle b/apkzlib/build.gradle deleted file mode 100644 index 759066e..0000000 --- a/apkzlib/build.gradle +++ /dev/null @@ -1,18 +0,0 @@ -plugins { - id 'java-library' -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 -} - -dependencies { - implementation 'com.google.code.findbugs:jsr305:3.0.2' - implementation 'org.bouncycastle:bcpkix-jdk15on:1.69' - implementation 'org.bouncycastle:bcprov-jdk15on:1.69' - api 'com.google.guava:guava:30.1.1-jre' - api 'com.android.tools.build:apksig:7.0.1' - compileOnlyApi 'com.google.auto.value:auto-value-annotations:1.8.2' - annotationProcessor 'com.google.auto.value:auto-value:1.8.2' -} diff --git a/apkzlib/build.gradle.kts b/apkzlib/build.gradle.kts new file mode 100644 index 0000000..96e7e0a --- /dev/null +++ b/apkzlib/build.gradle.kts @@ -0,0 +1,21 @@ +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("java-library") +} + +java { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility +} + +dependencies { + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("org.bouncycastle:bcpkix-jdk15on:1.70") + implementation("org.bouncycastle:bcprov-jdk15on:1.70") + api("com.google.guava:guava:31.0.1-jre") + api("com.android.tools.build:apksig:7.1.1") + compileOnlyApi("com.google.auto.value:auto-value-annotations:1.9") + annotationProcessor("com.google.auto.value:auto-value:1.9") +} diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index c3c1e59..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,96 +0,0 @@ -apply plugin: 'com.android.application' - -android { - flavorDimensions "api" - productFlavors { - Riru { - dimension 'api' - } - } - compileSdkVersion rootProject.ext.androidCompileSdkVersion - defaultConfig { - applicationId "org.lsposed.lspatch" - minSdkVersion rootProject.ext.androidMinSdkVersion - targetSdkVersion rootProject.ext.androidTargetSdkVersion - versionCode rootProject.ext.verCode - versionName rootProject.ext.verName - - multiDexEnabled false - - signingConfigs { - config { - if (project.hasProperty('androidStoreFile') && !androidStoreFile.isEmpty()) { - storeFile = file(androidStoreFile) - storePassword = androidStorePassword - keyAlias = androidKeyAlias - keyPassword = androidKeyPassword - } - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - - } - buildTypes { - debug { - debuggable true - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig = signingConfigs.config.storeFile == null ? signingConfigs.debug : signingConfigs.config - } - release { - debuggable false - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig = signingConfigs.config.storeFile == null ? signingConfigs.debug : signingConfigs.config - } - } - lintOptions { - abortOnError false - } - applicationVariants.all { variant -> - def buildType = variant.name.capitalize() - def variantName = variant.name - - variant.outputs.all { - outputFileName = "${variant.getFlavorName()}-${variant.versionName}.apk" - } - - task "copyDex$buildType"(type: Copy) { - dependsOn("assemble$buildType") - def dexFilePath = "$buildDir/intermediates/dex/${variantName}/mergeDex${buildType}/classes.dex" - from dexFilePath - rename "classes.dex", "lsp.dex" - into "$rootProject.projectDir/out/dexes" - } - - task "copySo$buildType"(type: Copy) { - dependsOn("assemble$buildType") - from "$buildDir/intermediates/merged_native_libs/${variantName}/out/lib" - into "$rootProject.projectDir/out/so" - } - - task "copy$buildType"() { - dependsOn("copySo$buildType") - dependsOn("copyDex$buildType") - - doLast { - System.out.println("Dex and so files has been copy to ${rootProject.projectDir}${File.separator}out") - } - } - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation project(path: ':lspcore') - implementation project(path: ':hiddenapi-bridge') - compileOnly project(":hiddenapi-stubs") - implementation project(':share') - implementation project(':imanager') - - implementation 'com.google.code.gson:gson:2.8.8' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..3f24382 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,99 @@ +val androidCompileSdkVersion: Int by rootProject.extra +val androidMinSdkVersion: Int by rootProject.extra +val androidTargetSdkVersion: Int by rootProject.extra + +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("com.android.application") +} + +android { + flavorDimensions += "api" + productFlavors { + create("Riru") { + dimension = "api" + } + } + + compileSdk = androidCompileSdkVersion + + defaultConfig { + minSdk = androidMinSdkVersion + targetSdk = androidTargetSdkVersion + + multiDexEnabled = false + + signingConfigs.create("config") { + val androidStoreFile = project.findProperty("androidStoreFile") as String? + if (!androidStoreFile.isNullOrEmpty()) { + storeFile = file(androidStoreFile) + storePassword = project.property("androidStorePassword") as String + keyAlias = project.property("androidKeyAlias") as String + keyPassword = project.property("androidKeyPassword") as String + } + } + + compileOptions { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility + } + } + + buildTypes { + debug { + isDebuggable = true + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + if (signingConfigs["config"].storeFile != null) signingConfigs["config"] else signingConfigs["debug"] + } + release { + isDebuggable = false + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + if (signingConfigs["config"].storeFile != null) signingConfigs["config"] else signingConfigs["debug"] + } + } + + lint { + isAbortOnError = false + } +} + +androidComponents.onVariants { variant -> + val variantCapped = variant.name.capitalize() + val variantLowered = variant.name.toLowerCase() + + task("copyDex$variantCapped") { + dependsOn("assemble$variantCapped") + from("$buildDir/intermediates/dex/$variantLowered/mergeDex$variantCapped/classes.dex") + rename("classes.dex", "lsp.dex") + into("${rootProject.projectDir}/out/dexes") + } + + task("copySo$variantCapped") { + dependsOn("assemble$variantCapped") + from("$buildDir/intermediates/merged_native_libs/$variantLowered/out/lib") + into("${rootProject.projectDir}/out/so") + } + + task("copy$variantCapped") { + dependsOn("copySo$variantCapped") + dependsOn("copyDex$variantCapped") + + doLast { + println("Dex and so files has been copied to ${rootProject.projectDir}${File.separator}out") + } + } +} + +dependencies { + implementation(project(":lspcore")) + implementation(project(":hiddenapi-bridge")) + compileOnly(project(":hiddenapi-stubs")) + implementation(project(":share")) + implementation(project(":imanager")) + + implementation("com.google.code.gson:gson:2.8.9") +} diff --git a/appstub/build.gradle b/appstub/build.gradle deleted file mode 100644 index b216341..0000000 --- a/appstub/build.gradle +++ /dev/null @@ -1,55 +0,0 @@ -apply plugin: 'com.android.application' - -android { - compileSdk 30 - buildToolsVersion "30.0.3" - - defaultConfig { - minSdk rootProject.ext.androidMinSdkVersion - targetSdk rootProject.ext.androidTargetSdkVersion - versionCode 1 - versionName "1.0" - - multiDexEnabled false - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 - } - applicationVariants.all { variant -> - def buildType = variant.name.capitalize() - def variantLowered = variant.name.toLowerCase() - - variant.outputs.all { - outputFileName = "${variant.getFlavorName()}-${variant.versionName}.apk" - } - - task "copyDex$buildType"(type: Copy) { - dependsOn("assemble$buildType") - def dexFilePath = "$buildDir/intermediates/dex/${variantLowered}/mergeDex${buildType}/classes.dex" - from dexFilePath - rename "classes.dex", "loader.dex" - into "$rootProject.projectDir/out/dexes" - } - - task "copy$buildType"() { - dependsOn("copyDex$buildType") - - doLast { - System.out.println("Dex and so files has been copy to ${rootProject.projectDir}${File.separator}out") - } - } - } -} - -dependencies { - implementation 'de.upb.cs.swt:axml:2.1.1' - compileOnly project(":hiddenapi-stubs") -} diff --git a/appstub/build.gradle.kts b/appstub/build.gradle.kts new file mode 100644 index 0000000..88dd430 --- /dev/null +++ b/appstub/build.gradle.kts @@ -0,0 +1,60 @@ +val androidMinSdkVersion: Int by rootProject.extra +val androidTargetSdkVersion: Int by rootProject.extra +val androidCompileSdkVersion: Int by rootProject.extra +val androidBuildToolsVersion: String by rootProject.extra + +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("com.android.application") +} + +android { + compileSdk = androidCompileSdkVersion + buildToolsVersion = androidBuildToolsVersion + + defaultConfig { + minSdk = androidMinSdkVersion + targetSdk = androidTargetSdkVersion + + multiDexEnabled = false + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility + } +} + +androidComponents.onVariants { variant -> + val variantCapped = variant.name.capitalize() + val variantLowered = variant.name.toLowerCase() + + task("copyDex$variantCapped") { + dependsOn("assemble$variantCapped") + from("$buildDir/intermediates/dex/$variantLowered/mergeDex$variantCapped/classes.dex") + rename("classes.dex", "loader.dex") + into("${rootProject.projectDir}/out/dexes") + } + + task("copy$variantCapped") { + dependsOn("copyDex$variantCapped") + + doLast { + println("Loader dex has been copied to ${rootProject.projectDir}${File.separator}out") + } + } +} + +dependencies { + implementation("de.upb.cs.swt:axml:2.1.2") + compileOnly(project(":hiddenapi-stubs")) +} diff --git a/axmlprinter/build.gradle b/axmlprinter/build.gradle deleted file mode 100644 index 06c39b4..0000000 --- a/axmlprinter/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -description = 'android manifest content parser' -apply plugin: 'java-library' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) -} -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 -} \ No newline at end of file diff --git a/axmlprinter/build.gradle.kts b/axmlprinter/build.gradle.kts new file mode 100644 index 0000000..2922bcf --- /dev/null +++ b/axmlprinter/build.gradle.kts @@ -0,0 +1,13 @@ +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +description = "android manifest content parser" + +plugins { + id("java-library") +} + +java { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e758533..0000000 --- a/build.gradle +++ /dev/null @@ -1,56 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.0.3' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31' - classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.4.0-beta02") - } -} - -// sync from https://github.com/LSPosed/LSPosed/blob/master/build.gradle.kts -ext { - androidCompileSdkVersion = 31 - androidCompileNdkVersion = "23.0.7599858" - androidBuildToolsVersion = "31.0.0" - androidMinSdkVersion = 28 - androidTargetSdkVersion = 30 - verCode = 1 - verName = "lspatch" - apiCode = 93 - defaultManagerPackageName = "org.lsposed.lspatch" - androidSourceCompatibility = JavaVersion.VERSION_11 - androidTargetCompatibility = JavaVersion.VERSION_11 - agpVersion = "7.0.3" - navVersion = "2.4.0-beta02" -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -//subprojects { -// afterEvaluate { module -> -// if (module.name == 'apksigner') { -// sourceSets.main.java.srcDirs += 'src/apksigner/java' -// } -// } -//} - -task clean(type: Delete) { - delete rootProject.buildDir -} - -["Debug", "Release"].each { variant -> - tasks.register("build$variant") { - description("Build LSPatch with $variant") - dependsOn tasks.getByPath(":patch:build$variant") - } -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..e1092de --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,46 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + google() + mavenCentral() + } + val agpVersion by extra("7.0.3") + val navVersion by extra("2.5.0-alpha01") + dependencies { + classpath("com.android.tools.build:gradle:$agpVersion") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10") + classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$navVersion") + } +} + +// sync from https://github.com/LSPosed/LSPosed/blob/master/build.gradle.kts +val defaultManagerPackageName by extra("org.lsposed.lspatch") +val apiCode by extra(93) +val verCode by extra(1) +val verName by extra("0.3") +val androidMinSdkVersion by extra(28) +val androidTargetSdkVersion by extra(32) +val androidCompileSdkVersion by extra(32) +val androidCompileNdkVersion by extra("23.1.7779620") +val androidBuildToolsVersion by extra("31.0.0") +val androidSourceCompatibility by extra(JavaVersion.VERSION_11) +val androidTargetCompatibility by extra(JavaVersion.VERSION_11) + +allprojects { + repositories { + google() + mavenCentral() + } +} + +tasks.register("clean") { + delete(rootProject.buildDir) +} + +listOf("Debug", "Release").forEach { variant -> + tasks.register("build$variant") { + description = "Build LSPatch with $variant" + dependsOn(tasks.getByPath(":patch:build$variant")) + } +} diff --git a/imanager/build.gradle b/imanager/build.gradle deleted file mode 100644 index 6edcf49..0000000 --- a/imanager/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -plugins { - id 'com.android.library' -} - -android { - flavorDimensions "api" - productFlavors { - Riru { - dimension 'api' - } - } - compileSdk 31 - - defaultConfig { - minSdk 27 - targetSdk 31 - } - - buildTypes { - release { - minifyEnabled true - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - implementation project(path: ':lspcore') -} diff --git a/imanager/build.gradle.kts b/imanager/build.gradle.kts new file mode 100644 index 0000000..7e9c77f --- /dev/null +++ b/imanager/build.gradle.kts @@ -0,0 +1,40 @@ +val androidMinSdkVersion: Int by rootProject.extra +val androidTargetSdkVersion: Int by rootProject.extra +val androidCompileSdkVersion: Int by rootProject.extra +val androidBuildToolsVersion: String by rootProject.extra + +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("com.android.library") +} + +android { + flavorDimensions += "api" + productFlavors.create("Riru") { + dimension = "api" + } + + compileSdk = androidCompileSdkVersion + + defaultConfig { + minSdk = androidMinSdkVersion + targetSdk = androidTargetSdkVersion + } + + buildTypes { + release { + isMinifyEnabled = true + } + } + + compileOptions { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility + } +} + +dependencies { + implementation(project(":lspcore")) +} diff --git a/manager/build.gradle b/manager/build.gradle deleted file mode 100644 index a575e59..0000000 --- a/manager/build.gradle +++ /dev/null @@ -1,47 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' -} - -android { - compileSdk 31 - - defaultConfig { - applicationId "org.lsposed.lspatch" - minSdk 27 - targetSdk 31 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - buildFeatures { - viewBinding = true - } -} - -dependencies { - compileOnly project(":patch") - compileOnly project(path: ':lspcore') - implementation project(":imanager") - - implementation 'androidx.core:core-ktx:1.6.0' - implementation 'androidx.appcompat:appcompat:1.3.1' - implementation 'com.google.android.material:material:1.4.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.0' -} \ No newline at end of file diff --git a/manager/build.gradle.kts b/manager/build.gradle.kts new file mode 100644 index 0000000..0dd3c2a --- /dev/null +++ b/manager/build.gradle.kts @@ -0,0 +1,58 @@ +val androidCompileSdkVersion: Int by rootProject.extra +val androidMinSdkVersion: Int by rootProject.extra +val androidTargetSdkVersion: Int by rootProject.extra + +val defaultManagerPackageName: String by rootProject.extra +val verCode: Int by rootProject.extra +val verName: String by rootProject.extra + +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("com.android.application") + kotlin("android") +} + +android { + compileSdk = androidCompileSdkVersion + + defaultConfig { + applicationId = defaultManagerPackageName + minSdk = androidMinSdkVersion + targetSdk = androidTargetSdkVersion + versionCode = verCode + versionName = verName + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility + } + + kotlinOptions { + jvmTarget = "11" + } + + buildFeatures { + viewBinding = true + } +} + +dependencies { + compileOnly(project(":patch")) + compileOnly(project(":lspcore")) + implementation(project(":imanager")) + + implementation("androidx.core:core-ktx:1.7.0") + implementation("androidx.appcompat:appcompat:1.4.1") + implementation("com.google.android.material:material:1.5.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.3") +} diff --git a/patch/build.gradle b/patch/build.gradle deleted file mode 100644 index c406a04..0000000 --- a/patch/build.gradle +++ /dev/null @@ -1,69 +0,0 @@ -plugins { - id 'java-library' -} - -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 -} - -compileJava.options.encoding = "UTF-8" - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation project(':axmlprinter') - implementation project(':share') - implementation project(':apkzlib') - implementation 'commons-io:commons-io:2.11.0' - implementation 'com.beust:jcommander:1.81' - implementation 'com.google.code.gson:gson:2.8.8' -} - -jar { - baseName = "lspatch" - destinationDirectory = new File("$rootProject.projectDir/out") - manifest { - attributes 'Main-Class': 'org.lsposed.patch.LSPatch' - } - dependsOn configurations.runtimeClasspath - from { - configurations.runtimeClasspath.collect { - it.isDirectory() ? it : zipTree(it) - } - } - - from fileTree(dir: 'src/main', includes: ['assets/**']) - into("assets/dex") { - from fileTree(dir: "$rootProject.projectDir/out/dexes") - } - - into("assets/so") { - from fileTree(dir: "$rootProject.projectDir/out/so") - } - - exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF', 'META-INF/*.txt', "META-INF/versions/**" -} - -tasks.register("buildDebug") { - jar.dependsOn(':appstub:copyDebug') - jar.dependsOn(':app:copyRiruDebug') - dependsOn(build) -} - -tasks.register("buildRelease") { - jar.dependsOn(':appstub:copyRelease') - jar.dependsOn(':app:copyRiruRelease') - dependsOn(build) -} - -tasks.build.doLast { - println("Build to " + jar.archivePath) - println("Try \'java -jar " + jar.archiveName + "\' find more help") -} - -sourceSets.main.resources { - srcDirs = [ - "src/main/java", - ]; - include "**/*.*" -} diff --git a/patch/build.gradle.kts b/patch/build.gradle.kts new file mode 100644 index 0000000..1e28c75 --- /dev/null +++ b/patch/build.gradle.kts @@ -0,0 +1,69 @@ +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("java-library") +} + +java { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility +} + +dependencies { + implementation(fileTree("dir" to "libs", "include" to listOf("*.jar"))) + implementation(project(":axmlprinter")) + implementation(project(":share")) + implementation(project(":apkzlib")) + implementation("commons-io:commons-io:2.11.0") + implementation("com.beust:jcommander:1.82") + implementation("com.google.code.gson:gson:2.8.9") +} + +tasks.jar { + archiveBaseName.set("lspatch") + destinationDirectory.set(file("${rootProject.projectDir}/out")) + manifest { + attributes("Main-Class" to "org.lsposed.patch.LSPatch") + } + dependsOn(configurations.runtimeClasspath) + from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) + + from("src/main") { + include("assets/**") + } + + into("assets/dex") { + from("${rootProject.projectDir}/out/dexes") + } + + into("assets/so") { + from("${rootProject.projectDir}/out/so") + } + + exclude("META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "META-INF/*.MF", "META-INF/*.txt", "META-INF/versions/**") +} + +val jar = tasks.jar.get() + +tasks.register("buildDebug") { + jar.dependsOn(":appstub:copyDebug") + jar.dependsOn(":app:copyRiruDebug") + dependsOn(tasks.build) +} + +tasks.register("buildRelease") { + jar.dependsOn(":appstub:copyRelease") + jar.dependsOn(":app:copyRiruRelease") + dependsOn(tasks.build) +} + +tasks["build"].doLast { + println("Build to " + jar.archiveFile) + println("Try \'java -jar " + jar.archiveFileName + "\' find more help") +} + +sourceSets["main"].resources { + srcDirs("src/main/java") + include("**/*.*") +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index bf47e3e..0000000 --- a/settings.gradle +++ /dev/null @@ -1,21 +0,0 @@ -include ':app' -rootProject.name='LSPatch' -include ':lspcore' -project(':lspcore').projectDir = new File('core/core') -include ':lspapp' -project(':lspapp').projectDir = new File('core/app') -include ':hiddenapi-stubs' -project(':hiddenapi-stubs').projectDir = new File('core/hiddenapi-stubs') -include ':interface' -project(':interface').projectDir = new File('core/service/interface') -include ':hiddenapi-bridge' -project(':hiddenapi-bridge').projectDir = new File('core/hiddenapi-bridge') -include ':manager-service' -project(':manager-service').projectDir = new File('core/manager-service') -include ':patch' -include ':axmlprinter' -include ':share' -include ':appstub' -include ':apkzlib' -include ':imanager' -include ':manager' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..c3b3647 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,24 @@ +rootProject.name = "LSPatch" + +include(":hiddenapi-bridge") +include(":hiddenapi-stubs") +include(":interface") +include(":lspapp") +include(":lspcore") +include(":manager-service") + +project(":hiddenapi-bridge").projectDir = file("core/hiddenapi-bridge") +project(":hiddenapi-stubs").projectDir = file("core/hiddenapi-stubs") +project(":interface").projectDir = file("core/service/interface") +project(":lspapp").projectDir = file("core/app") +project(":lspcore").projectDir = file("core/core") +project(":manager-service").projectDir = file("core/manager-service") + +include(":apkzlib") +include(":app") +include(":appstub") +include(":axmlprinter") +include(":imanager") +include(":manager") +include(":patch") +include(":share") diff --git a/share/build.gradle b/share/build.gradle deleted file mode 100644 index 6d66b73..0000000 --- a/share/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -plugins { - id 'java-library' -} -java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 -} \ No newline at end of file diff --git a/share/build.gradle.kts b/share/build.gradle.kts new file mode 100644 index 0000000..6db7e78 --- /dev/null +++ b/share/build.gradle.kts @@ -0,0 +1,11 @@ +val androidSourceCompatibility: JavaVersion by rootProject.extra +val androidTargetCompatibility: JavaVersion by rootProject.extra + +plugins { + id("java-library") +} + +java { + sourceCompatibility = androidSourceCompatibility + targetCompatibility = androidTargetCompatibility +}