diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 0000000000..8f22f52ca9 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,9 @@ +{ + $schema: 'https://docs.renovatebot.com/renovate-schema.json', + extends: [ + 'config:recommended', + ], + labels: [ + 'Update', + ], +} diff --git a/.github/workflows/update-dependencies.yaml b/.github/workflows/update-dependencies.yaml index 355f0fd395..63ce81ac2b 100644 --- a/.github/workflows/update-dependencies.yaml +++ b/.github/workflows/update-dependencies.yaml @@ -60,7 +60,7 @@ jobs: - name: Create Pull Request id: cpr - uses: peter-evans/create-pull-request@v6 + uses: peter-evans/create-pull-request@v8 with: token: ${{ steps.generate-token.outputs.token }} commit-message: Update Dependencies diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5272b86afb..473e9bd4da 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,5 @@ +import com.android.build.api.variant.FilterConfiguration +import org.gradle.kotlin.dsl.androidComponents import java.net.URL import java.nio.file.Files import java.nio.file.StandardCopyOption @@ -8,6 +10,21 @@ plugins { id("com.android.application") } +androidComponents { + onVariants(selector().withBuildType("release")) { variant -> + variant.outputs.forEach { output -> + // TODO: https://github.com/android/gradle-recipes/blob/cbe7c7dea2a3f5b1764756f24bf453d1235c80e2/listenToArtifacts/README.md + with(output as com.android.build.api.variant.impl.VariantOutputImpl) { + val abiName = output.filters + .find { it.filterType == FilterConfiguration.FilterType.ABI } + ?.identifier ?: "universal" + val newApkName = "cmfa-${versionName.get()}-meta-${abiName}-${variant.buildType}.apk" + outputFileName = newApkName + } + } + } +} + dependencies { compileOnly(project(":hideapi")) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index bdc9a3ad81..0d5ce2d4cf 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -31,29 +31,3 @@ public static void checkParameterIsNotNull(...); public static void checkNotNullParameter(...); } - -# Kotlin Coroutine -# Allow R8 to optimize away the FastServiceLoader. -# Together with ServiceLoader optimization in R8 -# this results in direct instantiation when loading Dispatchers.Main --assumenosideeffects class kotlinx.coroutines.internal.MainDispatcherLoader { - boolean FAST_SERVICE_LOADER_ENABLED return false; -} - --assumenosideeffects class kotlinx.coroutines.internal.FastServiceLoaderKt { - boolean ANDROID_DETECTED return true; -} - --keep class kotlinx.coroutines.android.AndroidDispatcherFactory {*;} - -# Disable support for "Missing Main Dispatcher", since we always have Android main dispatcher --assumenosideeffects class kotlinx.coroutines.internal.MainDispatchersKt { - boolean SUPPORT_MISSING return false; -} - -# Statically turn off all debugging facilities and assertions --assumenosideeffects class kotlinx.coroutines.DebugKt { - boolean getASSERTIONS_ENABLED() return false; - boolean getDEBUG() return false; - boolean getRECOVER_STACK_TRACES() return false; -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 1b5e1dd67e..84d1a6230e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -55,7 +55,8 @@ subprojects { else "com.github.kr328.clash.$name" } - minSdk = 21 + minSdk = 23 + compileSdkVersion(36) targetSdk = 35 versionName = "2.11.23" @@ -76,15 +77,11 @@ subprojects { if (!isApp) { consumerProguardFiles("consumer-rules.pro") - } else { - setProperty("archivesBaseName", "cmfa-$versionName") } } ndkVersion = "29.0.14206865" - compileSdkVersion(defaultConfig.targetSdk!!) - if (isApp) { packagingOptions { resources { @@ -203,15 +200,3 @@ subprojects { task("clean", type = Delete::class) { delete(rootProject.buildDir) } - -tasks.wrapper { - distributionType = Wrapper.DistributionType.ALL - - doLast { - val sha256 = URL("$distributionUrl.sha256").openStream() - .use { it.reader().readText().trim() } - - file("gradle/wrapper/gradle-wrapper.properties") - .appendText("distributionSha256Sum=$sha256") - } -} \ No newline at end of file diff --git a/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt b/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt index f418e488d9..24a797f93d 100644 --- a/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt +++ b/design/src/main/java/com/github/kr328/clash/design/MainDesign.kt @@ -81,7 +81,7 @@ class MainDesign(context: Context) : Design(context) { init { binding.self = this - binding.colorClashStarted = context.resolveThemedColor(com.google.android.material.R.attr.colorPrimary) + binding.colorClashStarted = context.resolveThemedColor(android.R.attr.colorPrimary) binding.colorClashStopped = context.resolveThemedColor(R.attr.colorClashStopped) } diff --git a/design/src/main/java/com/github/kr328/clash/design/adapter/PopupListAdapter.kt b/design/src/main/java/com/github/kr328/clash/design/adapter/PopupListAdapter.kt index 19d60ba9bf..a7bab371a3 100644 --- a/design/src/main/java/com/github/kr328/clash/design/adapter/PopupListAdapter.kt +++ b/design/src/main/java/com/github/kr328/clash/design/adapter/PopupListAdapter.kt @@ -15,9 +15,9 @@ class PopupListAdapter( private val texts: List, private val selected: Int, ) : BaseAdapter() { - private val colorPrimary = context.resolveThemedColor(com.google.android.material.R.attr.colorPrimary) + private val colorPrimary = context.resolveThemedColor(android.R.attr.colorPrimary) private val colorOnPrimary = context.resolveThemedColor(com.google.android.material.R.attr.colorOnPrimary) - private val colorControlNormal = context.resolveThemedColor(com.google.android.material.R.attr.colorControlNormal) + private val colorControlNormal = context.resolveThemedColor(android.R.attr.colorControlNormal) override fun getCount(): Int { return texts.size diff --git a/design/src/main/java/com/github/kr328/clash/design/component/ProxyViewConfig.kt b/design/src/main/java/com/github/kr328/clash/design/component/ProxyViewConfig.kt index 0426e44567..bf869725a6 100644 --- a/design/src/main/java/com/github/kr328/clash/design/component/ProxyViewConfig.kt +++ b/design/src/main/java/com/github/kr328/clash/design/component/ProxyViewConfig.kt @@ -14,7 +14,7 @@ class ProxyViewConfig(val context: Context, var proxyLine: Int) { context.resolveThemedResourceId(android.R.attr.selectableItemBackground) val selectedControl = context.resolveThemedColor(com.google.android.material.R.attr.colorOnPrimary) - val selectedBackground = context.resolveThemedColor(com.google.android.material.R.attr.colorPrimary) + val selectedBackground = context.resolveThemedColor(android.R.attr.colorPrimary) val unselectedControl = context.resolveThemedColor(com.google.android.material.R.attr.colorOnSurface) val unselectedBackground: Int diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3190850eff..b9a82e3505 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,23 +1,23 @@ [versions] -agp = "8.8.0" -kotlin = "2.1.0" -ksp = "2.1.0-1.0.29" +agp = "8.13.2" +kotlin = "2.3.10" +ksp = "2.3.6" golang = "1.0.4" -coroutine = "1.10.1" -coreKtx = "1.8.0" -activity = "1.5.0" -fragment = "1.5.0" -appcompat = "1.4.2" -coordinator = "1.2.0" -recyclerview = "1.2.1" -viewpager = "1.0.0" -material = "1.6.1" -serialization = "1.3.3" +coroutine = "1.10.2" +coreKtx = "1.17.0" +activity = "1.12.4" +fragment = "1.8.9" +appcompat = "1.7.1" +coordinator = "1.3.0" +recyclerview = "1.4.0" +viewpager = "1.1.0" +material = "1.13.0" +serialization = "1.10.0" kaidl = "1.15" -room = "2.4.2" +room = "2.8.4" multiprocess = "1.0.0" quickie = "1.11.0" -androidx-activity-ktx = "1.9.0" +androidx-activity-ktx = "1.12.4" [libraries] build-android = { module = "com.android.tools.build:gradle", version.ref = "agp" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index afba109285..1b33c55baa 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b4eae46630..9db51cd5be 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,8 @@ -#Tue Jan 14 14:06:42 CST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=b266d5ff6b90eada6dc3b20cb090e3731302e553a27c5d3e4df1f0d76beaff06 \ No newline at end of file diff --git a/gradlew b/gradlew index 65dcd68d65..23d15a9367 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,10 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# 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"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -114,7 +114,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -133,10 +133,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. @@ -144,7 +147,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 @@ -152,7 +155,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 @@ -197,16 +200,20 @@ if "$cygwin" || "$msys" ; then done fi -# 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. + +# 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 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" \ -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f13..db3a6ac207 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,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,22 +59,22 @@ 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 :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 5db72dd6a9..0000000000 --- a/renovate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended" - ] -} diff --git a/service/build.gradle.kts b/service/build.gradle.kts index 1c33c111a7..a36ddd16d2 100644 --- a/service/build.gradle.kts +++ b/service/build.gradle.kts @@ -19,7 +19,7 @@ dependencies { implementation(libs.androidx.room.ktx) implementation(libs.kaidl.runtime) implementation(libs.rikkax.multiprocess) - implementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0")) + implementation(platform("com.squareup.okhttp3:okhttp-bom:5.3.2")) // define any required OkHttp artifacts without version implementation("com.squareup.okhttp3:okhttp")