Upgrade AGP and Gradle (#295)

Refine Gradle script
fix parse log delay after disable detail log
This commit is contained in:
Howard Wu 2024-04-19 10:50:05 +08:00 • committed by GitHub
commit dfdaa0e98a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 65 additions and 41 deletions

View file

@ -73,13 +73,13 @@ materialThemeBuilder {
}
fun afterEval() = android.applicationVariants.forEach { variant ->
val variantCapped = variant.name.capitalize(Locale.ROOT)
val variantLowered = variant.name.toLowerCase(Locale.ROOT)
val variantCapped = variant.name.replaceFirstChar { it.titlecase(Locale.ROOT) }
val variantLowered = variant.name.lowercase(Locale.ROOT)
task<Sync>("build$variantCapped") {
dependsOn("assemble$variantCapped")
from("$buildDir/outputs/apk/$variantLowered")
into("$buildDir/apk/$variantLowered")
from(layout.buildDirectory.dir("outputs/apk/$variantLowered"))
into(layout.buildDirectory.dir("apk/$variantLowered"))
rename(".*.apk", "HMA-V${variant.versionName}-${variant.buildType.name}.apk")
}
}

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.tsng.hidemyapplist">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission
android:name="android.permission.QUERY_ALL_PACKAGES"
@ -15,8 +14,6 @@
android:fullBackupOnly="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme">
<activity

View file

@ -40,7 +40,7 @@ localProperties.load(file("local.properties").inputStream())
val officialBuild by extra(localProperties.getProperty("officialBuild", "false") == "true")
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
fun Project.configureBaseExtension() {

View file

@ -1,5 +1,5 @@
[versions]
agp = "8.0.2"
agp = "8.3.2"
kotlin = "1.9.0"
rxhttp = "3.0.6"
hidden-api = "4.2.0"

Binary file not shown.

View file

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

22
gradlew vendored
View file

@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -130,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@ -141,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -149,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

20
gradlew.bat vendored
View file

@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View file

@ -23,16 +23,16 @@ kotlin {
afterEvaluate {
android.libraryVariants.forEach { variant ->
val variantCapped = variant.name.capitalize(Locale.ROOT)
val variantLowered = variant.name.toLowerCase(Locale.ROOT)
val variantCapped = variant.name.replaceFirstChar { it.titlecase(Locale.ROOT) }
val variantLowered = variant.name.lowercase(Locale.ROOT)
val outSrcDir = file("$buildDir/generated/source/signInfo/${variantLowered}")
val outSrc = file("$outSrcDir/icu/nullptr/hidemyapplist/Magic.java")
val outSrcDir = layout.buildDirectory.dir("generated/source/signInfo/${variantLowered}")
val outSrc = outSrcDir.get().file("icu/nullptr/hidemyapplist/Magic.java")
val signInfoTask = tasks.register("generate${variantCapped}SignInfo") {
outputs.file(outSrc)
doLast {
val sign = android.buildTypes[variantLowered].signingConfig
outSrc.parentFile.mkdirs()
outSrc.asFile.parentFile.mkdirs()
val certificateInfo = KeystoreHelper.getCertificateInfo(
sign?.storeType,
sign?.storeFile,
@ -40,7 +40,7 @@ afterEvaluate {
sign?.keyPassword,
sign?.keyAlias
)
PrintStream(outSrc).apply {
PrintStream(outSrc.asFile).apply {
println("package icu.nullptr.hidemyapplist;")
println("public final class Magic {")
print("public static final byte[] magicNumbers = {")
@ -51,7 +51,7 @@ afterEvaluate {
}
}
}
variant.registerJavaGeneratingTask(signInfoTask, outSrcDir)
variant.registerJavaGeneratingTask(signInfoTask, outSrcDir.get().asFile)
val kotlinCompileTask = tasks.findByName("compile${variantCapped}Kotlin") as KotlinCompile
kotlinCompileTask.dependsOn(signInfoTask)

View file

@ -1,3 +1,24 @@
-keep class com.github.kyuubiran.ezxhelper.utils.** { *; }
-keep class icu.nullptr.hidemyapplist.xposed.XposedEntry { *; }
-ignorewarnings
-dontwarn java.lang.invoke.StringConcatFactory
-dontwarn android.content.res.XModuleResources
-dontwarn android.content.res.XResources
-dontwarn de.robv.android.xposed.IXposedHookLoadPackage
-dontwarn de.robv.android.xposed.IXposedHookZygoteInit$StartupParam
-dontwarn de.robv.android.xposed.IXposedHookZygoteInit
-dontwarn de.robv.android.xposed.XC_MethodHook$MethodHookParam
-dontwarn de.robv.android.xposed.XC_MethodHook$Unhook
-dontwarn de.robv.android.xposed.XC_MethodHook
-dontwarn de.robv.android.xposed.XC_MethodReplacement
-dontwarn de.robv.android.xposed.XposedBridge
-dontwarn de.robv.android.xposed.XposedHelpers
-dontwarn de.robv.android.xposed.callbacks.XC_LoadPackage$LoadPackageParam
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE

View file

@ -21,8 +21,8 @@ private fun parseLog(level: Int, tag: String, msg: String, cause: Throwable? = n
}
private fun log(level: Int, tag: String, msg: String, cause: Throwable? = null) {
val parsedLog = parseLog(level, tag, msg, cause)
if (level <= Log.DEBUG && HMAService.instance?.config?.detailLog == false) return
val parsedLog = parseLog(level, tag, msg, cause)
HMAService.instance?.addLog(parsedLog)
XposedBridge.log(parsedLog)
}

View file

@ -33,7 +33,7 @@ object Utils {
val result = verifier.verify()
if (!result.isVerified) return false
val mainCert = result.signerCertificates[0]
return Arrays.equals(mainCert.encoded, Magic.magicNumbers)
return mainCert.encoded.contentEquals(Magic.magicNumbers)
}
fun getRecursiveField(entry: Any, list: List<String>): Any? {