upgrade AGP

This commit is contained in:
dyhkwong
2024-01-05 23:03:06 +08:00
parent 175261920c
commit b13997b4ca
50 changed files with 175 additions and 195 deletions

View File

@@ -63,6 +63,12 @@ jobs:
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Setup Java
uses: actions/setup-java@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: 'zulu'
java-version: 17
- name: Release Build
env:
BUILD_PLUGIN: none

View File

@@ -58,6 +58,12 @@ jobs:
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Setup Java
uses: actions/setup-java@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: 'zulu'
java-version: 17
- name: Release Build
env:
SKIP_BUILD: on

View File

@@ -58,6 +58,12 @@ jobs:
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Setup Java
uses: actions/setup-java@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: 'zulu'
java-version: 17
- name: Release Build
env:
SKIP_BUILD: on

View File

@@ -58,6 +58,12 @@ jobs:
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Setup Java
uses: actions/setup-java@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: 'zulu'
java-version: 17
- name: Release Build
env:
SKIP_BUILD: on

View File

@@ -89,7 +89,13 @@ jobs:
with:
path: ~/.gradle
key: native-${{ hashFiles('**/*.gradle.kts') }}
- name: Native Build
- name: Setup Java
uses: actions/setup-java@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: 'zulu'
java-version: 17
- name: Release Build
env:
SKIP_BUILD: on
BUILD_PLUGIN: naive

View File

@@ -61,6 +61,12 @@ jobs:
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle.kts') }}
- name: Setup Java
uses: actions/setup-java@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
distribution: 'zulu'
java-version: 17
- name: Release Build
env:
SKIP_BUILD: on

2
.idea/compiler.xml generated
View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
<bytecodeTargetLevel target="17" />
</component>
</project>

12
.idea/vcs.xml generated
View File

@@ -7,17 +7,11 @@
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/external/editorkit" vcs="Git" />
<mapping directory="$PROJECT_DIR$/external/preferencex" vcs="Git" />
<mapping directory="$PROJECT_DIR$/external/termux-view" vcs="Git" />
<mapping directory="$PROJECT_DIR$/library/core" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/brook/src/main/go/brook" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/hysteria/src/main/go/hysteria" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/mieru/src/main/go/mieru" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/hysteria2/src/main/go/hysteria2" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/mieru2/src/main/go/mieru2" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/naive/src/main/jni/naiveproxy" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/pingtunnel/src/main/go/pingtunnel" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/relaybaton/src/main/go/relaybaton" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/trojan-go/src/main/go/trojan-go" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/tuic/src/main/rust/tuic" vcs="Git" />
<mapping directory="$PROJECT_DIR$/plugin/shadowtls/src/main/rust/shadowtls" vcs="Git" />
</component>
</project>

View File

@@ -22,6 +22,8 @@ android {
}
}
buildFeatures {
aidl = true
buildConfig = true
viewBinding = true
}
namespace = "io.nekohasekai.sagernet"
@@ -37,25 +39,25 @@ dependencies {
implementation(project(":library:termux:terminal-view"))
implementation(project(":library:termux:terminal-emulator"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.activity:activity-ktx:1.7.0")
implementation("androidx.fragment:fragment-ktx:1.5.6")
implementation("androidx.browser:browser:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.activity:activity-ktx:1.8.2")
implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation("androidx.browser:browser:1.7.0")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
implementation("androidx.navigation:navigation-ui-ktx:2.5.3")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.navigation:navigation-fragment-ktx:2.7.6")
implementation("androidx.navigation:navigation-ui-ktx:2.7.6")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.work:work-runtime-ktx:2.8.1")
implementation("androidx.work:work-multiprocess:2.8.1")
implementation("androidx.work:work-runtime-ktx:2.9.0")
implementation("androidx.work:work-multiprocess:2.9.0")
implementation("com.takisoft.preferencex:preferencex:1.1.0")
implementation("com.takisoft.preferencex:preferencex-simplemenu:1.1.0")
implementation("com.takisoft.preferencex:preferencex-colorpicker:1.1.0")
implementation("com.google.android.material:material:1.8.0")
implementation("com.google.android.material:material:1.9.0")
implementation("cn.hutool:hutool-core:$hutoolVersion")
implementation("cn.hutool:hutool-json:$hutoolVersion")
implementation("com.google.code.gson:gson:2.10.1")
@@ -75,9 +77,9 @@ dependencies {
exclude(group = "androidx.appcompat")
}
implementation("androidx.room:room-runtime:2.5.1")
kapt("androidx.room:room-compiler:2.5.1")
implementation("androidx.room:room-ktx:2.5.1")
implementation("androidx.room:room-runtime:2.6.1")
kapt("androidx.room:room-compiler:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
implementation("com.blacksquircle.ui:editorkit:2.0.0")
implementation("com.blacksquircle.ui:language-json:2.0.0")

View File

@@ -59,7 +59,6 @@
android:autoRevokePermissions="allowed"
android:banner="@mipmap/ic_launcher"
android:dataExtractionRules="@xml/backup_rules"
android:extractNativeLibs="true"
android:fullBackupContent="@xml/backup_descriptor"
android:fullBackupOnly="true"
android:hardwareAccelerated="true"

View File

@@ -163,11 +163,9 @@ class SagerNet : Application(),
updateNotificationChannels()
}
override fun getWorkManagerConfiguration(): WorkConfiguration {
return WorkConfiguration.Builder()
.setDefaultProcessName("${BuildConfig.APPLICATION_ID}:bg")
.build()
}
override val workManagerConfiguration: WorkConfiguration = WorkConfiguration.Builder()
.setDefaultProcessName("${BuildConfig.APPLICATION_ID}:bg")
.build()
@SuppressLint("InlinedApi")
companion object {

View File

@@ -142,7 +142,7 @@ class ServiceNotification(
Theme.apply(app)
Theme.apply(service)
builder.color = service.getColorAttr(R.attr.colorPrimary)
builder.color = service.getColorAttr(androidx.appcompat.R.attr.colorPrimary)
updateCallback(SagerNet.power.isInteractive)
service.registerReceiver(this, IntentFilter().apply {

View File

@@ -31,13 +31,13 @@ fun Context.launchCustomTab(link: String) {
setColorSchemeParams(
CustomTabsIntent.COLOR_SCHEME_LIGHT,
CustomTabColorSchemeParams.Builder().apply {
setToolbarColor(getColorAttr(R.attr.colorPrimary))
setToolbarColor(getColorAttr(androidx.appcompat.R.attr.colorPrimary))
}.build()
)
setColorSchemeParams(
CustomTabsIntent.COLOR_SCHEME_DARK,
CustomTabColorSchemeParams.Builder().apply {
setToolbarColor(getColorAttr(R.attr.colorPrimary))
setToolbarColor(getColorAttr(androidx.appcompat.R.attr.colorPrimary))
}.build()
)
}.build().launchUrl(this, Uri.parse(link))

View File

@@ -185,7 +185,7 @@ class AboutFragment : ToolbarFragment(R.layout.layout_about) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.findViewById<RecyclerView>(R.id.mal_recyclerview).apply {
view.findViewById<RecyclerView>(com.danielstone.materialaboutlibrary.R.id.mal_recyclerview).apply {
overScrollMode = RecyclerView.OVER_SCROLL_NEVER
}
}

View File

@@ -116,7 +116,7 @@ class BackupFragment : NamedFragment(R.layout.layout_backup) {
Intent.EXTRA_STREAM, FileProvider.getUriForFile(
app, BuildConfig.APPLICATION_ID + ".cache", cacheFile
)
), app.getString(R.string.abc_shareactionprovider_share_with)
), app.getString(androidx.appcompat.R.string.abc_shareactionprovider_share_with)
)
)
}

View File

@@ -363,7 +363,7 @@ class GroupFragment : ToolbarFragment(R.layout.layout_group),
val links = profiles.mapNotNull { it.toLink() }.joinToString("\n")
onMainDispatcher {
SagerNet.trySetPrimaryClip(links)
snackbar(getString(R.string.copy_toast_msg)).show()
snackbar(getString(androidx.browser.R.string.copy_toast_msg)).show()
}
}
}

View File

@@ -193,7 +193,7 @@ class LogcatFragment : ToolbarFragment(R.layout.layout_logcat),
Intent.EXTRA_STREAM, FileProvider.getUriForFile(
context, BuildConfig.APPLICATION_ID + ".cache", logFile
)
), context.getString(R.string.abc_shareactionprovider_share_with)
), context.getString(androidx.appcompat.R.string.abc_shareactionprovider_share_with)
)
)
}

View File

@@ -136,8 +136,8 @@ class ConfigEditActivity : ThemedActivity() {
}
fun mkTheme(): ColorScheme {
val colorPrimary = getColorAttr(R.attr.colorPrimary)
val colorPrimaryDark = getColorAttr(R.attr.colorPrimaryDark)
val colorPrimary = getColorAttr(androidx.appcompat.R.attr.colorPrimary)
val colorPrimaryDark = getColorAttr(androidx.appcompat.R.attr.colorPrimaryDark)
return ColorScheme(
textColor = colorPrimary,

View File

@@ -77,7 +77,7 @@ object CrashHandler : Thread.UncaughtExceptionHandler {
Intent.EXTRA_STREAM, FileProvider.getUriForFile(
app, BuildConfig.APPLICATION_ID + ".cache", logFile
)
), app.getString(R.string.abc_shareactionprovider_share_with)
), app.getString(androidx.appcompat.R.string.abc_shareactionprovider_share_with)
)
)

View File

@@ -52,7 +52,7 @@ class ColorPickerPreference @JvmOverloads constructor(
}
init {
widgetLayoutResource = R.layout.preference_widget_color_swatch
widgetLayoutResource = com.takisoft.preferencex.colorpicker.R.layout.preference_widget_color_swatch
}
val colors = app.resources.getIntArray(R.array.material_colors)
@@ -68,7 +68,7 @@ class ColorPickerPreference @JvmOverloads constructor(
@SuppressLint("RestrictedApi")
constructor(context: Context, attrs: AttributeSet?) : this(
context, attrs, TypedArrayUtils.getAttr(
context, R.attr.dialogPreferenceStyle,
context, androidx.preference.R.attr.dialogPreferenceStyle,
android.R.attr.dialogPreferenceStyle
)
)
@@ -77,7 +77,7 @@ class ColorPickerPreference @JvmOverloads constructor(
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
colorWidget = holder.findViewById(R.id.color_picker_widget) as ImageView
colorWidget = holder.findViewById(com.takisoft.preferencex.colorpicker.R.id.color_picker_widget) as ImageView
setColorOnWidget(colors[colorIndex])
}
@@ -87,7 +87,7 @@ class ColorPickerPreference @JvmOverloads constructor(
}
val colorDrawable = arrayOf(
ContextCompat.getDrawable(
context, R.drawable.colorpickerpreference_pref_swatch
context, com.takisoft.preferencex.colorpicker.R.drawable.colorpickerpreference_pref_swatch
)
)
colorWidget!!.setImageDrawable(ColorStateDrawable(colorDrawable, color))

View File

@@ -54,7 +54,7 @@ class LinkPreference : EditTextPreference {
defStyleRes: Int,
) : super(context, attrs, defStyleAttr, defStyleRes) {
val a = context.obtainStyledAttributes(
attrs, R.styleable.Preference, defStyleAttr, defStyleRes
attrs, androidx.preference.R.styleable.Preference, defStyleAttr, defStyleRes
)
if (a.hasValue(androidx.preference.R.styleable.Preference_defaultValue)) {
defaultValue = onGetDefaultValue(

View File

@@ -54,7 +54,7 @@ class NonBlackEditTextPreference : EditTextPreference {
defStyleRes: Int,
) : super(context, attrs, defStyleAttr, defStyleRes) {
val a = context.obtainStyledAttributes(
attrs, R.styleable.Preference, defStyleAttr, defStyleRes
attrs, androidx.preference.R.styleable.Preference, defStyleAttr, defStyleRes
)
if (a.hasValue(androidx.preference.R.styleable.Preference_defaultValue)) {
defaultValue = onGetDefaultValue(

View File

@@ -43,7 +43,7 @@ import kotlinx.coroutines.launch
class StatsBar @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null,
defStyleAttr: Int = R.attr.bottomAppBarStyle,
defStyleAttr: Int = com.google.android.material.R.attr.bottomAppBarStyle,
) : BottomAppBar(context, attrs, defStyleAttr) {
private lateinit var statusText: TextView
private lateinit var txText: TextView

View File

@@ -38,7 +38,7 @@ tasks.register<Delete>("clean") {
subprojects {
// skip uploading the mapping to Crashlytics
tasks.whenTaskAdded {
tasks.configureEach {
if (name.contains("uploadCrashlyticsMappingFile")) enabled = false
}
}

View File

@@ -16,12 +16,12 @@ import java.util.*
import kotlin.system.exitProcess
private val Project.android
get() = extensions.getByName<CommonExtension<BuildFeatures, BuildType, DefaultConfig, ProductFlavor>>(
get() = extensions.getByName<CommonExtension<BuildFeatures, BuildType, DefaultConfig, ProductFlavor, AndroidResources>>(
"android"
)
private val Project.androidApp get() = android as ApplicationExtension
private val javaVersion = JavaVersion.VERSION_1_8
private val javaVersion = JavaVersion.VERSION_17
private lateinit var metadata: Properties
private lateinit var localProperties: Properties
private lateinit var flavor: String
@@ -78,7 +78,7 @@ fun Project.requireTargetAbi(): String {
var targetAbi = ""
if (gradle.startParameter.taskNames.isNotEmpty()) {
if (gradle.startParameter.taskNames.size == 1) {
val targetTask = gradle.startParameter.taskNames[0].toLowerCase(Locale.ROOT).trim()
val targetTask = gradle.startParameter.taskNames[0].lowercase(Locale.ROOT).trim()
when {
targetTask.contains("arm64") -> targetAbi = "arm64-v8a"
targetTask.contains("arm") -> targetAbi = "armeabi-v7a"
@@ -92,8 +92,8 @@ fun Project.requireTargetAbi(): String {
fun Project.setupCommon() {
android.apply {
buildToolsVersion = "33.0.2"
compileSdk = 33
buildToolsVersion = "34.0.0"
compileSdk = 34
defaultConfig {
minSdk = 21
}
@@ -114,7 +114,7 @@ fun Project.setupCommon() {
textOutput = project.file("build/lint.txt")
htmlOutput = project.file("build/lint.html")
}
packagingOptions {
packaging {
resources {
excludes.addAll(
listOf(
@@ -132,7 +132,7 @@ fun Project.setupCommon() {
)
}
}
packagingOptions {
packaging {
jniLibs.useLegacyPackaging = true
}
(this as? AbstractAppExtension)?.apply {
@@ -192,26 +192,6 @@ fun Project.setupNdkLibrary() {
}
}
fun Project.setupCMakeLibrary() {
setupCommon()
setupNdk()
android.apply {
defaultConfig {
externalNativeBuild.cmake {
val targetAbi = requireTargetAbi()
if (targetAbi.isNotBlank()) {
abiFilters(targetAbi)
} else {
abiFilters("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
}
arguments("-j${Runtime.getRuntime().availableProcessors()}")
}
}
externalNativeBuild.cmake.path("src/main/cpp/CMakeLists.txt")
}
}
fun Project.setupAppCommon() {
setupKotlinCommon()
@@ -286,7 +266,7 @@ fun Project.setupAppCommon() {
dependsOn("package${requireFlavor()}")
}
val assemble = "assemble${requireFlavor()}"
tasks.whenTaskAdded {
tasks.configureEach {
if (name == assemble) dependsOn(calculateTaskName)
}
}
@@ -294,8 +274,8 @@ fun Project.setupAppCommon() {
}
fun Project.setupPlugin(projectName: String) {
val propPrefix = projectName.toUpperCase(Locale.ROOT)
val projName = projectName.toLowerCase(Locale.ROOT)
val propPrefix = projectName.uppercase(Locale.ROOT)
val projName = projectName.lowercase(Locale.ROOT)
val verName = requireMetadata().getProperty("${propPrefix}_VERSION_NAME").trim()
val verCode = requireMetadata().getProperty("${propPrefix}_VERSION").trim().toInt() * 5
androidApp.defaultConfig {
@@ -330,6 +310,9 @@ fun Project.setupPlugin(projectName: String) {
if (targetAbi.isNotBlank()) {
reset()
include(targetAbi)
} else {
reset()
include("x86", "x86_64", "armeabi-v7a", "arm64-v8a")
}
}
@@ -346,7 +329,7 @@ fun Project.setupPlugin(projectName: String) {
workingDir(rootProject.projectDir)
}
tasks.whenTaskAdded {
tasks.configureEach {
if (name.startsWith("merge") && name.endsWith("JniLibFolders")) {
dependsOn("externalBuild")
}
@@ -369,7 +352,7 @@ fun Project.setupPlugin(projectName: String) {
workingDir(rootProject.projectDir)
dependsOn("externalBuild")
}
tasks.whenTaskAdded {
tasks.configureEach {
if (name.startsWith("merge") && name.endsWith("JniLibFolders")) {
dependsOn("externalBuildEnd")
}
@@ -428,6 +411,9 @@ fun Project.setupApp() {
if (targetAbi.isNotBlank()) {
reset()
include(targetAbi)
} else {
reset()
include("x86", "x86_64", "armeabi-v7a", "arm64-v8a")
}
}
@@ -456,7 +442,7 @@ fun Project.setupApp() {
downloadAssets()
}
}
tasks.whenTaskAdded {
tasks.configureEach {
if (name == "pre${requireFlavor()}Build") {
dependsOn("downloadAssets")
}

View File

@@ -37,7 +37,7 @@ fun Project.downloadAssets() {
.string()
.trim()
.substringBefore(" ")
.toUpperCase(Locale.ROOT)
.uppercase(Locale.ROOT)
var count = 0
while (true) {
@@ -55,11 +55,11 @@ fun Project.downloadAssets() {
geoipFile.outputStream().use { out -> it.copyTo(out) }
}
val fileSha256 = DigestUtil.sha256Hex(geoipFile).toUpperCase(Locale.ROOT)
val fileSha256 = DigestUtil.sha256Hex(geoipFile).uppercase(Locale.ROOT)
if (fileSha256 != checksum) {
System.err.println(
"Error verifying ${geoipFile.name}: \nLocal: ${
fileSha256.toUpperCase(
fileSha256.uppercase(
Locale.ROOT
)
}\nRemote: $checksum"
@@ -103,7 +103,7 @@ fun Project.downloadAssets() {
.string()
.trim()
.substringBefore(" ")
.toUpperCase(Locale.ROOT)
.uppercase(Locale.ROOT)
var count = 0
@@ -122,11 +122,11 @@ fun Project.downloadAssets() {
geositeFile.outputStream().use { out -> it.copyTo(out) }
}
val fileSha256 = DigestUtil.sha256Hex(geositeFile).toUpperCase(Locale.ROOT)
val fileSha256 = DigestUtil.sha256Hex(geositeFile).uppercase(Locale.ROOT)
if (fileSha256 != checksum) {
System.err.println(
"Error verifying ${geositeFile.name}: \nLocal: ${
fileSha256.toUpperCase(
fileSha256.uppercase(
Locale.ROOT
)
}\nRemote: $checksum"

Binary file not shown.

View File

@@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionSha256Sum=cb87f222c5585bd46838ad4db78463a5c5f3d336e5e2b98dc7c0c586527351c2
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3

30
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,10 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# 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"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,22 +130,29 @@ 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.
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
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
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
@@ -205,6 +213,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

15
gradlew.bat vendored
View File

@@ -14,7 +14,7 @@
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

View File

@@ -5,7 +5,7 @@ plugins {
setupCommon()
dependencies {
implementation("androidx.annotation:annotation:1.6.0")
implementation("androidx.annotation:annotation:1.7.1")
}
android {
namespace = "com.android.stub"

View File

@@ -1,66 +0,0 @@
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.nio.charset;
/**
* Constant definitions for the standard {@link Charset Charsets}. These
* charsets are guaranteed to be available on every implementation of the Java
* platform.
*
* @see <a href="Charset#standard">Standard Charsets</a>
* @since 1.7
*/
public final class StandardCharsets {
private StandardCharsets() {
throw new AssertionError("No java.nio.charset.StandardCharsets instances for you!");
}
/**
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
* Unicode character set
*/
public static final Charset US_ASCII = Charset.forName("US-ASCII");
/**
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
*/
public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
/**
* Eight-bit UCS Transformation Format
*/
public static final Charset UTF_8 = Charset.forName("UTF-8");
/**
* Sixteen-bit UCS Transformation Format, big-endian byte order
*/
public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
/**
* Sixteen-bit UCS Transformation Format, little-endian byte order
*/
public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
/**
* Sixteen-bit UCS Transformation Format, byte order identified by an
* optional byte-order mark
*/
public static final Charset UTF_16 = Charset.forName("UTF-16");
}

View File

@@ -1,3 +0,0 @@
package java.nio.file;
public interface Path {}

View File

@@ -8,12 +8,12 @@ plugins {
setupKotlinCommon()
val protobufVersion = "3.19.1"
val protobufVersion = "3.25.1"
dependencies {
protobuf(project(":library:proto"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
api("com.google.protobuf:protobuf-java:$protobufVersion")
}
android {

View File

@@ -26,7 +26,7 @@ android {
namespace = "com.termux.terminal"
defaultConfig {
minSdkVersion(21)
minSdk = 21
}
buildTypes {
@@ -46,7 +46,7 @@ android {
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.8.0")
implementation("com.google.android.material:material:1.9.0")
}

View File

@@ -26,7 +26,7 @@ android {
namespace = "com.termux.view"
defaultConfig {
minSdkVersion(21)
minSdk = 21
}
buildTypes {
@@ -39,8 +39,8 @@ android {
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.8.0")
implementation("com.google.android.material:material:1.9.0")
implementation(project(":library:termux:terminal-emulator"))
}

View File

@@ -26,11 +26,11 @@ class GestureAndScaleRecognizer(context: Context?, val mListener: Listener) {
init {
mGestureDetector = GestureDetector(context, object : SimpleOnGestureListener() {
override fun onScroll(e1: MotionEvent, e2: MotionEvent, dx: Float, dy: Float): Boolean {
override fun onScroll(e1: MotionEvent?, e2: MotionEvent, dx: Float, dy: Float): Boolean {
return mListener.onScroll(e2, dx, dy)
}
override fun onFling(e1: MotionEvent, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
return mListener.onFling(e2, velocityX, velocityY)
}

View File

@@ -135,8 +135,8 @@ class TerminalView(context: Context, attributes: AttributeSet?) : View(context,
override fun finishComposingText(): Boolean {
if (TERMINAL_VIEW_KEY_LOGGING_ENABLED) mClient!!.logInfo(LOG_TAG, "IME: finishComposingText()")
super.finishComposingText()
sendTextToTerminal(editable)
editable.clear()
sendTextToTerminal(editable.toString())
editable?.clear()
return true
}
@@ -147,8 +147,8 @@ class TerminalView(context: Context, attributes: AttributeSet?) : View(context,
super.commitText(text, newCursorPosition)
if (mEmulator == null) return true
val content = editable
sendTextToTerminal(content)
content.clear()
sendTextToTerminal(content.toString())
content?.clear()
return true
}

View File

@@ -2,4 +2,8 @@ plugins {
id("com.android.application")
}
android {
namespace = "io.nekohasekai.sagernet.plugin.brook"
}
setupPlugin("brook")

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="io.nekohasekai.sagernet.plugin.brook"
android:installLocation="internalOnly"
tools:ignore="MissingLeanbackLauncher">

View File

@@ -2,4 +2,8 @@ plugins {
id("com.android.application")
}
android {
namespace = "io.nekohasekai.sagernet.plugin.hysteria2"
}
setupPlugin("hysteria2")

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="io.nekohasekai.sagernet.plugin.hysteria2"
android:installLocation="internalOnly"
tools:ignore="MissingLeanbackLauncher">

View File

@@ -2,4 +2,8 @@ plugins {
id("com.android.application")
}
android {
namespace = "io.nekohasekai.sagernet.plugin.mieru2"
}
setupPlugin("mieru2")

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="io.nekohasekai.sagernet.plugin.mieru2"
android:installLocation="internalOnly"
tools:ignore="MissingLeanbackLauncher">

View File

@@ -2,4 +2,8 @@ plugins {
id("com.android.application")
}
android {
namespace = "io.nekohasekai.sagernet.plugin.naive"
}
setupPlugin("naive")

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="io.nekohasekai.sagernet.plugin.naive"
android:installLocation="internalOnly"
tools:ignore="MissingLeanbackLauncher">

View File

@@ -2,4 +2,8 @@ plugins {
id("com.android.application")
}
android {
namespace = "io.nekohasekai.sagernet.plugin.shadowtls"
}
setupPlugin("shadowtls")

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="io.nekohasekai.sagernet.plugin.shadowtls"
android:installLocation="internalOnly">
<application

View File

@@ -1,5 +1,5 @@
rootProject.extra.apply {
set("androidPluginVersion", "7.4.2")
set("androidPluginVersion", "8.2.1")
set("kotlinVersion", "1.9.22")
set("hutoolVersion", "5.8.24")
}