Upgrade gradle

This commit is contained in:
LoveSy 2023-02-20 14:55:27 +08:00 committed by John Wu
parent ae34659b26
commit 4ba365565f
19 changed files with 28 additions and 64 deletions

View File

@ -57,6 +57,10 @@ android {
keepDebugSymbols += "**/*.so"
}
}
kotlin {
jvmToolchain(17)
}
}
setupApp()

View File

@ -7,7 +7,3 @@ setupCommon()
android {
namespace = "com.topjohnwu.shared"
}
dependencies {
api("io.michaelrocks:paranoid-core:0.3.7")
}

View File

@ -2,9 +2,6 @@ package com.topjohnwu.magisk;
import android.content.Context;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class ProviderInstaller {
public static boolean install(Context context) {

View File

@ -20,9 +20,6 @@ import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Map;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class StubApk {
private static File dynDir;
private static Method addAssetPath;

View File

@ -25,9 +25,6 @@ import java.util.UUID;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public final class APKInstall {
public static void transfer(InputStream in, OutputStream out) throws IOException {

View File

@ -17,16 +17,10 @@ gradlePlugin {
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
implementation(kotlin("gradle-plugin", "1.8.0"))
implementation("com.android.tools.build:gradle:7.4.1")
implementation("androidx.navigation:navigation-safe-args-gradle-plugin:2.5.3")
implementation("io.michaelrocks:paranoid-gradle-plugin:0.3.7")
implementation("org.lsposed.lsparanoid:gradle-plugin:0.5.0")
implementation("org.eclipse.jgit:org.eclipse.jgit:6.4.0.202211300538-r")
}

View File

@ -159,7 +159,7 @@ fun genStubManifest(srcDir: File, outDir: File): String {
fun List<String>.process() = asSequence()
.filter(::notJavaKeyword)
// Distinct by lower case to support case insensitive file systems
.distinctBy { it.toLowerCase(Locale.ROOT) }
.distinctBy { it.lowercase() }
val names = mutableListOf<String>()
names.addAll(c1)
@ -174,8 +174,7 @@ fun genStubManifest(srcDir: File, outDir: File): String {
cls.append(names.random(kRANDOM))
// Old Android does not support capitalized package names
// Check Android 7.0.0 PackageParser#buildClassName
cls[0] = cls[0].toLowerCase()
yield(cls.toString())
yield(cls.toString().replaceFirstChar { it.lowercase() })
}
}.distinct().iterator()

View File

@ -53,12 +53,12 @@ fun Project.setupCommon() {
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "11"
jvmTarget = "17"
}
}
}
@ -133,8 +133,8 @@ private fun Project.setupAppCommon() {
}
android.applicationVariants.all {
val projectName = project.name.toLowerCase(Locale.ROOT)
val variantCapped = name.capitalize(Locale.ROOT)
val projectName = project.name.lowercase()
val variantCapped = name.replaceFirstChar { it.uppercase() }
tasks.getByPath(":$projectName:package$variantCapped").doLast {
val apk = outputs.files.asFileTree.filter { it.name.endsWith(".apk") }.singleFile
val comment = "version=${Config.version}\nversionCode=${Config.versionCode}"
@ -191,7 +191,7 @@ fun Project.setupApp() {
}
android.applicationVariants.all {
val variantCapped = name.capitalize(Locale.ROOT)
val variantCapped = name.replaceFirstChar { it.uppercase() }
val stubTask = tasks.getByPath(":stub:package$variantCapped")
val stubApk = stubTask.outputs.files.asFileTree.filter {
@ -249,8 +249,8 @@ fun Project.setupStub() {
setupAppCommon()
android.applicationVariants.all {
val variantCapped = name.capitalize(Locale.ROOT)
val variantLowered = name.toLowerCase(Locale.ROOT)
val variantCapped = name.replaceFirstChar { it.uppercase() }
val variantLowered = name.lowercase()
val manifest = file("src/${variantLowered}/AndroidManifest.xml")
val outSrcDir = File(buildDir, "generated/source/obfuscate/${variantLowered}")
val templateDir = file("template")
@ -299,11 +299,12 @@ fun Project.setupStub() {
}
// Override optimizeReleaseResources task
tasks.whenTaskAdded {
if (name == "optimizeReleaseResources") {
dependsOn("generateReleaseObfuscatedSources")
val apk = File(buildDir, "intermediates/processed_res/" +
"release/out/resources-release.ap_")
val optRes = File(buildDir, "intermediates/optimized_processed_res/" +
"release/resources-release-optimize.ap_")
if (name == "optimizeReleaseResources") {
doLast { apk.copyTo(optRes, true) }
}
}

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -1,11 +1,12 @@
plugins {
id("com.android.application")
id("io.michaelrocks.paranoid")
id("org.lsposed.lsparanoid")
}
paranoid {
obfuscationSeed = if (RAND_SEED != 0) RAND_SEED else null
includeSubprojects = true
lsparanoid {
seed = if (RAND_SEED != 0) RAND_SEED else null
includeDependencies = true
global = true
}
android {

View File

@ -14,13 +14,9 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import io.michaelrocks.paranoid.Obfuscate;
// Wrap the actual classloader as we only want to resolve classname
// mapping when loading from platform (via LoadedApk.mClassLoader)
@Obfuscate
class AppClassLoader extends ClassLoader {
final Map<String, String> mapping = new HashMap<>();
AppClassLoader(File apk) {

View File

@ -4,9 +4,6 @@ import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class DelegateApplication extends Application {
private Application receiver;

View File

@ -9,9 +9,6 @@ import android.util.Log;
import java.io.File;
import java.lang.reflect.Constructor;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class DelegateRootService extends ContextWrapper {
public DelegateRootService() {

View File

@ -43,9 +43,6 @@ import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class DownloadActivity extends Activity {
private static final String APP_NAME = "Magisk";

View File

@ -21,9 +21,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
@SuppressWarnings("ResultOfMethodCallIgnored")
public class DynLoad {

View File

@ -10,9 +10,6 @@ import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class Networking {
private static final int READ_TIMEOUT = 15000;

View File

@ -22,9 +22,6 @@ import java.net.HttpURLConnection;
import java.util.Scanner;
import java.util.concurrent.Executor;
import io.michaelrocks.paranoid.Obfuscate;
@Obfuscate
public class Request implements Closeable {
private final HttpURLConnection conn;
private Executor executor = null;