6.6.1 - Alpha - 提升构建脚本兼容性; 优化脚本项目识别
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
{
|
{
|
||||||
"$data": {
|
"$data": {
|
||||||
|
"v6.6.1": {
|
||||||
|
"released_date": "2024/12/03",
|
||||||
|
"fix": [
|
||||||
|
"部分环境因回退版本过低而无法正常编译项目的问题"
|
||||||
|
],
|
||||||
|
"improvement": [
|
||||||
|
"脚本项目识别在 project.json 损坏情况下尽可能还原关键信息"
|
||||||
|
]
|
||||||
|
},
|
||||||
"v6.6.0": {
|
"v6.6.0": {
|
||||||
"released_date": "2024/12/02",
|
"released_date": "2024/12/02",
|
||||||
"released_hint": "内置模块重写, 谨慎升级",
|
"released_hint": "内置模块重写, 谨慎升级",
|
||||||
|
|||||||
@@ -805,15 +805,15 @@ class Versions(filePath: String) {
|
|||||||
javaVersionInfoSuffix += " [fallback]"
|
javaVersionInfoSuffix += " [fallback]"
|
||||||
}
|
}
|
||||||
|
|
||||||
val platformVersion = gradle.extra["platformVersion"] as String
|
if (gradle.extra.has("gradleVersionToCoerceJavaVersion")) {
|
||||||
val platformAbbr = gradle.extra["platformAbbr"] as String
|
(gradle.extra["gradleVersionToCoerceJavaVersion"] as? String)?.let {
|
||||||
|
val maxGradleVersion = getMaxSupportedJavaVersion(it)
|
||||||
javaVersionCeilMap[platformAbbr]?.get(platformVersion)?.let { ceil: Int ->
|
if (niceVersionInt > maxGradleVersion) {
|
||||||
if (niceVersionInt > ceil) {
|
niceVersionInt = maxGradleVersion
|
||||||
niceVersionInt = ceil
|
|
||||||
javaVersionInfoSuffix += " [coerced]"
|
javaVersionInfoSuffix += " [coerced]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (niceVersionInt > currentVersionInt) {
|
if (niceVersionInt > currentVersionInt) {
|
||||||
niceVersionInt = currentVersionInt
|
niceVersionInt = currentVersionInt
|
||||||
@@ -831,23 +831,6 @@ class Versions(filePath: String) {
|
|||||||
Date().time - (it as String).toLong() > minBuildTimeGap
|
Date().time - (it as String).toLong() > minBuildTimeGap
|
||||||
} == true
|
} == true
|
||||||
|
|
||||||
private fun appendToTask(project: Project, flavorName: String, buildType: String) {
|
|
||||||
project.tasks.getByName(Utils.getAssembleTaskName(flavorName, buildType)).doLast {
|
|
||||||
updateProperties()
|
|
||||||
println()
|
|
||||||
showInfo()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateProperties() {
|
|
||||||
if (isBuildGapEnough) {
|
|
||||||
properties["VERSION_BUILD"] = "${appVersionCode + 1}"
|
|
||||||
isBuildNumberAutoIncremented = true
|
|
||||||
}
|
|
||||||
properties["BUILD_TIME"] = "${Date().time}"
|
|
||||||
properties.store(file.writer(), null)
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (currentVersionInt < javaVersionMinSuggested) {
|
if (currentVersionInt < javaVersionMinSuggested) {
|
||||||
logger.error(
|
logger.error(
|
||||||
@@ -901,6 +884,67 @@ class Versions(filePath: String) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun appendToTask(project: Project, flavorName: String, buildType: String) {
|
||||||
|
project.tasks.getByName(Utils.getAssembleTaskName(flavorName, buildType)).doLast {
|
||||||
|
updateProperties()
|
||||||
|
println()
|
||||||
|
showInfo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateProperties() {
|
||||||
|
if (isBuildGapEnough) {
|
||||||
|
properties["VERSION_BUILD"] = "${appVersionCode + 1}"
|
||||||
|
isBuildNumberAutoIncremented = true
|
||||||
|
}
|
||||||
|
properties["BUILD_TIME"] = "${Date().time}"
|
||||||
|
properties.store(file.writer(), null)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getMaxSupportedJavaVersion(gradleVersion: String): Int {
|
||||||
|
|
||||||
|
/* https://docs.gradle.org/current/userguide/compatibility.html . */
|
||||||
|
val presetVersionMap = listOf(
|
||||||
|
17 to "7.3",
|
||||||
|
18 to "7.5",
|
||||||
|
19 to "7.6",
|
||||||
|
20 to "8.3",
|
||||||
|
21 to "8.5",
|
||||||
|
22 to "8.8",
|
||||||
|
23 to "8.10",
|
||||||
|
)
|
||||||
|
|
||||||
|
fun parseVersion(version: String) = version.split(Regex("[.-]")).map { it.toIntOrNull() ?: 0 }
|
||||||
|
|
||||||
|
val inputGradleVersionInts = parseVersion(gradleVersion)
|
||||||
|
|
||||||
|
var maxJavaVersion: Int = presetVersionMap.first().first
|
||||||
|
|
||||||
|
for ((presetJavaVersion, presetGradleVersion) in presetVersionMap) {
|
||||||
|
val presetGradleVersionInts: List<Int> = parseVersion(presetGradleVersion)
|
||||||
|
|
||||||
|
for (i in presetGradleVersionInts.indices) {
|
||||||
|
when {
|
||||||
|
i > inputGradleVersionInts.lastIndex -> {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
inputGradleVersionInts[i] > presetGradleVersionInts[i] -> {
|
||||||
|
maxJavaVersion = presetJavaVersion
|
||||||
|
break
|
||||||
|
}
|
||||||
|
inputGradleVersionInts[i] < presetGradleVersionInts[i] -> {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
i == presetGradleVersionInts.lastIndex -> {
|
||||||
|
maxJavaVersion = presetJavaVersion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return maxJavaVersion
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object Utils {
|
object Utils {
|
||||||
|
|||||||
@@ -9,13 +9,19 @@ import com.google.gson.GsonBuilder;
|
|||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import org.autojs.autojs.model.explorer.ExplorerPage;
|
import org.autojs.autojs.model.explorer.ExplorerPage;
|
||||||
import org.autojs.autojs.pio.PFiles;
|
import org.autojs.autojs.pio.PFiles;
|
||||||
|
import org.autojs.autojs.util.JsonUtils;
|
||||||
|
import org.intellij.lang.annotations.Language;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Stardust on Jan 24, 2018.
|
* Created by Stardust on Jan 24, 2018.
|
||||||
@@ -42,7 +48,7 @@ public class ProjectConfig {
|
|||||||
private String mMainScriptFile;
|
private String mMainScriptFile;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@SerializedName("assets")
|
@SerializedName(value = "assets", alternate = {"asset", "assetList"})
|
||||||
private List<String> mAssets = new ArrayList<>();
|
private List<String> mAssets = new ArrayList<>();
|
||||||
|
|
||||||
@SerializedName("launchConfig")
|
@SerializedName("launchConfig")
|
||||||
@@ -65,7 +71,7 @@ public class ProjectConfig {
|
|||||||
@SerializedName("scripts")
|
@SerializedName("scripts")
|
||||||
private final Map<String, ScriptConfig> mScriptConfigs = new HashMap<>();
|
private final Map<String, ScriptConfig> mScriptConfigs = new HashMap<>();
|
||||||
|
|
||||||
@SerializedName("useFeatures")
|
@SerializedName(value = "useFeatures", alternate = {"useFeature", "useFeatureList"})
|
||||||
private List<String> mFeatures = new ArrayList<>();
|
private List<String> mFeatures = new ArrayList<>();
|
||||||
|
|
||||||
public static ProjectConfig fromJson(String json) {
|
public static ProjectConfig fromJson(String json) {
|
||||||
@@ -105,15 +111,151 @@ public class ProjectConfig {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ProjectConfig fromFile(String path) {
|
public static ProjectConfig fromFile(String path) {
|
||||||
|
String fileContents = null;
|
||||||
try {
|
try {
|
||||||
return fromJson(PFiles.read(path));
|
fileContents = PFiles.read(path);
|
||||||
} catch (Exception e) {
|
return fromJson(fileContents);
|
||||||
return null;
|
} catch (Exception e1) {
|
||||||
|
if (fileContents == null) return null;
|
||||||
|
try {
|
||||||
|
return fromJson(JsonUtils.repairJson(fileContents));
|
||||||
|
} catch (Exception e2) {
|
||||||
|
return tryReadCrucialData(fileContents, path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ProjectConfig tryReadCrucialData(String s, String jsonFilePath) {
|
||||||
|
ProjectConfig config = new ProjectConfig();
|
||||||
|
BuildInfo buildInfo = new BuildInfo();
|
||||||
|
ScriptConfig scriptConfig = new ScriptConfig();
|
||||||
|
LaunchConfig launchConfig = new LaunchConfig();
|
||||||
|
|
||||||
|
Pattern namePattern = Pattern.compile(stringPattern("name"));
|
||||||
|
Pattern versionNamePattern = Pattern.compile(stringPattern("versionName"));
|
||||||
|
Pattern versionCodePattern = Pattern.compile(numberPattern("versionCode"));
|
||||||
|
Pattern packageNamePattern = Pattern.compile(stringPattern("packageName"));
|
||||||
|
Pattern mainPattern = Pattern.compile(stringPattern("main"));
|
||||||
|
Pattern iconPattern = Pattern.compile(stringPattern("icon"));
|
||||||
|
|
||||||
|
Pattern assetsPattern = Pattern.compile(listPattern("asset"));
|
||||||
|
Pattern abisPattern = Pattern.compile(listPattern("abi"));
|
||||||
|
Pattern libsPattern = Pattern.compile(listPattern("lib"));
|
||||||
|
Pattern useFeaturesPattern = Pattern.compile(listPattern("useFeature"));
|
||||||
|
|
||||||
|
Pattern buildTimePattern = Pattern.compile(numberPattern("buildTime"));
|
||||||
|
Pattern buildNumberPattern = Pattern.compile(numberPattern("buildNumber"));
|
||||||
|
Pattern buildIdPattern = Pattern.compile(stringPattern("buildId"));
|
||||||
|
|
||||||
|
Pattern launchConfigPattern = Pattern.compile(booleanPattern("hideLogs"));
|
||||||
|
|
||||||
|
Pattern scriptsUiModePattern = Pattern.compile(booleanPattern("uiMode"));
|
||||||
|
|
||||||
|
setFieldIfMatches(namePattern, s, config::setName);
|
||||||
|
setFieldIfMatches(versionNamePattern, s, config::setVersionName);
|
||||||
|
setFieldForIntIfMatches(versionCodePattern, s, config::setVersionCode);
|
||||||
|
setFieldIfMatches(packageNamePattern, s, config::setPackageName);
|
||||||
|
setFieldIfMatches(mainPattern, s, config::setMainScriptFile);
|
||||||
|
setFieldIfMatches(iconPattern, s, config::setIcon);
|
||||||
|
|
||||||
|
setListIfMatches(assetsPattern, s, config::setAssets);
|
||||||
|
setListIfMatches(abisPattern, s, config::setAbis);
|
||||||
|
setListIfMatches(libsPattern, s, config::setLibs);
|
||||||
|
setListIfMatches(useFeaturesPattern, s, config::setFeatures);
|
||||||
|
|
||||||
|
setFieldForIntIfMatches(buildTimePattern, s, buildInfo::setBuildTime);
|
||||||
|
setFieldForIntIfMatches(buildNumberPattern, s, buildInfo::setBuildNumber);
|
||||||
|
setFieldIfMatches(buildIdPattern, s, buildInfo::setBuildId);
|
||||||
|
|
||||||
|
setFieldForBooleanIfMatches(launchConfigPattern, s, launchConfig::setHideLogs);
|
||||||
|
|
||||||
|
setFieldForBooleanIfMatches(scriptsUiModePattern, s, scriptConfig::setUiMode);
|
||||||
|
|
||||||
|
if (config.getName() == null || config.getName().isBlank()) {
|
||||||
|
if (jsonFilePath.endsWith(CONFIG_FILE_NAME)) {
|
||||||
|
File parentFile = new File(jsonFilePath).getParentFile();
|
||||||
|
if (parentFile != null) {
|
||||||
|
config.setName(parentFile.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Language("RegExp")
|
||||||
|
private static String listPattern(String name) {
|
||||||
|
return "\"" + parseNamePattern(name) + "(s|List)?\"\\s*:\\s*\\[([^\"]*)]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Language("RegExp")
|
||||||
|
private static String numberPattern(String name) {
|
||||||
|
return "\"" + parseNamePattern(name) + "\"\\s*:\\s*\"?(\\d+)\"?";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Language("RegExp")
|
||||||
|
private static String booleanPattern(String name) {
|
||||||
|
return "\"" + parseNamePattern(name) + "\"\\s*:\\s*\"?(true|false)\"?";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Language("RegExp")
|
||||||
|
private static String stringPattern(String name) {
|
||||||
|
return "\"" + parseNamePattern(name) + "\"\\s*:\\s*\"((?:[^\"]|(?<=\\\\)\")*?)(?<!\\\\)\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private static String parseNamePattern(String name) {
|
||||||
|
return Pattern.quote(name.replaceAll("(?<=[a-z])([A-Z]+)", "(?:$1|_$1)"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setFieldIfMatches(Pattern pattern, String s, java.util.function.Consumer<String> setter) {
|
||||||
|
Matcher matcher = pattern.matcher(s);
|
||||||
|
if (matcher.find()) {
|
||||||
|
setter.accept(matcher.group(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setFieldForIntIfMatches(Pattern pattern, String s, java.util.function.IntConsumer setter) {
|
||||||
|
Matcher matcher = pattern.matcher(s);
|
||||||
|
if (matcher.find()) {
|
||||||
|
setter.accept(Integer.parseInt(matcher.group(1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setFieldForBooleanIfMatches(Pattern pattern, String s, java.util.function.Consumer<Boolean> setter) {
|
||||||
|
Matcher matcher = pattern.matcher(s);
|
||||||
|
if (matcher.find()) {
|
||||||
|
setter.accept(Boolean.getBoolean(matcher.group(1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setListIfMatches(Pattern pattern, String s, java.util.function.Consumer<List<String>> setter) {
|
||||||
|
Matcher matcher = pattern.matcher(s);
|
||||||
|
if (matcher.find()) {
|
||||||
|
String content = matcher.group(1);
|
||||||
|
if (content == null) {
|
||||||
|
setter.accept(Collections.emptyList());
|
||||||
|
} else {
|
||||||
|
List<String> list = Arrays.asList(content.split("\\s*,\\s*"));
|
||||||
|
setter.accept(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isProject(ExplorerPage page) {
|
public static boolean isProject(ExplorerPage page) {
|
||||||
return fromProjectDir(page.getPath()) != null;
|
// @Hint by SuperMonster003 on Dec 2, 2024.
|
||||||
|
// ! It is considered a valid project regardless of whether project.json
|
||||||
|
// ! contains the necessary information or can be parsed correctly.
|
||||||
|
// ! zh-CN: 无论 project.json 是否包含必要信息或是否可以正常解析, 都认为是一个有效项目.
|
||||||
|
// !
|
||||||
|
// # return fromProjectDir(page.getPath()) != null;
|
||||||
|
String path = page.getPath();
|
||||||
|
String pathname = configFileOfDir(path);
|
||||||
|
return new File(pathname).exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -232,18 +374,26 @@ public class ProjectConfig {
|
|||||||
|
|
||||||
public List<String> getAbis() {
|
public List<String> getAbis() {
|
||||||
if (mAbis == null) {
|
if (mAbis == null) {
|
||||||
mAbis = Collections.emptyList();
|
setAbis(Collections.emptyList());
|
||||||
}
|
}
|
||||||
return mAbis;
|
return mAbis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAbis(@Nullable List<String> abis) {
|
||||||
|
mAbis = abis;
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getLibs() {
|
public List<String> getLibs() {
|
||||||
if (mLibs == null) {
|
if (mLibs == null) {
|
||||||
mLibs = Collections.emptyList();
|
setLibs(Collections.emptyList());
|
||||||
}
|
}
|
||||||
return mLibs;
|
return mLibs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLibs(@Nullable List<String> libs) {
|
||||||
|
mLibs = libs;
|
||||||
|
}
|
||||||
|
|
||||||
public String getBuildDir() {
|
public String getBuildDir() {
|
||||||
return "build";
|
return "build";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ object FileUtils {
|
|||||||
val CODE = TypeData(IconData("⌗", toTop = 1), TYPE.IDENTITY_TEXT_EDITABLE)
|
val CODE = TypeData(IconData("⌗", toTop = 1), TYPE.IDENTITY_TEXT_EDITABLE)
|
||||||
val COMPILE = TypeData(IconData("☍"))
|
val COMPILE = TypeData(IconData("☍"))
|
||||||
val ARCHIVE = TypeData(IconData("❒", toTop = 3, toEnd = 0.5))
|
val ARCHIVE = TypeData(IconData("❒", toTop = 3, toEnd = 0.5))
|
||||||
val FIRMWARE = TypeData(IconData("ꘈ", size = 23, toStart = 0.5, toTop = 0.5))
|
val FIRMWARE = TypeData(IconData("⩩", size = 22, toStart = 0.5, toTop = 1))
|
||||||
val EXECUTABLE = TypeData(IconData("⧉", size = 17, toStart = 0.5, toTop = 2))
|
val EXECUTABLE = TypeData(IconData("⧉", size = 17, toStart = 0.5, toTop = 2))
|
||||||
val CERTIFICATE = TypeData(IconData("⩮", size = 27))
|
val CERTIFICATE = TypeData(IconData("⩮", size = 27))
|
||||||
val LICENSE = TypeData(IconData("≚", size = 27), TYPE.IDENTITY_TEXT_EDITABLE)
|
val LICENSE = TypeData(IconData("≚", size = 27), TYPE.IDENTITY_TEXT_EDITABLE)
|
||||||
@@ -100,7 +100,7 @@ object FileUtils {
|
|||||||
val VIDEO = TypeData(IconData("ᐅ", size = 23, toTop = 0.5, toEnd = 3.5), TYPE.IDENTITY_MEDIA_PLAYABLE)
|
val VIDEO = TypeData(IconData("ᐅ", size = 23, toTop = 0.5, toEnd = 3.5), TYPE.IDENTITY_MEDIA_PLAYABLE)
|
||||||
val VIDEO_PLAYLIST = TypeData(VIDEO.iconData, TYPE.IDENTITY_MEDIA_PLAYABLE or TYPE.IDENTITY_TEXT_EDITABLE)
|
val VIDEO_PLAYLIST = TypeData(VIDEO.iconData, TYPE.IDENTITY_MEDIA_PLAYABLE or TYPE.IDENTITY_TEXT_EDITABLE)
|
||||||
val SUBTITLE = TypeData(IconData("⩸", size = 21, toTop = 1), TYPE.IDENTITY_TEXT_EDITABLE)
|
val SUBTITLE = TypeData(IconData("⩸", size = 21, toTop = 1), TYPE.IDENTITY_TEXT_EDITABLE)
|
||||||
val MEDIA_MENU = TypeData(IconData("⩩", size = 22, toStart = 0.5, toTop = 1), TYPE.IDENTITY_MEDIA_MENU)
|
val MEDIA_MENU = TypeData(IconData("ꘈ", size = 19, toStart = 0.5, toTop = 0.5), TYPE.IDENTITY_MEDIA_MENU)
|
||||||
val ENCRYPTED_MEDIA = TypeData(IconData("☊", size = 23, toEnd = 0.5))
|
val ENCRYPTED_MEDIA = TypeData(IconData("☊", size = 23, toEnd = 0.5))
|
||||||
val GAME = TypeData(IconData("ⵘ", size = 26, toTop = 1))
|
val GAME = TypeData(IconData("ⵘ", size = 26, toTop = 1))
|
||||||
val FONT = TypeData(IconData("ꭲ", size = 23, toTop = 3.5, excludeFontPadding = true))
|
val FONT = TypeData(IconData("ꭲ", size = 23, toTop = 3.5, excludeFontPadding = true))
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import android.app.Application
|
|||||||
|
|
||||||
object LeakCanarySetup {
|
object LeakCanarySetup {
|
||||||
|
|
||||||
fun setup(application: Application) {
|
fun setup(@Suppress("UNUSED_PARAMETER") application: Application) {
|
||||||
println("${LeakCanarySetup::class.java.simpleName}: LeakCanary won't be included and set up in \"release\" build variant")
|
println("${LeakCanarySetup::class.java.simpleName}: LeakCanary won't be included and set up in \"release\" build variant")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,14 +64,15 @@ pluginManagement {
|
|||||||
?: System.getProperty("java.vendor")
|
?: System.getProperty("java.vendor")
|
||||||
?: System.getProperty("java.vm.vendor")
|
?: System.getProperty("java.vm.vendor")
|
||||||
val concerns: List<String> by lazy {
|
val concerns: List<String> by lazy {
|
||||||
val concernedKeyWords = setOf("name", "vendor", "version", "platform", "paths")
|
val concernedKeyWords = setOf("name", "vendor", "version", "platform", "paths", "os")
|
||||||
val unconcernedKeyWords = setOf("url", "user", "runtime", "specification", "os", "date")
|
val unconcernedKeyWords = setOf("url", "user", "runtime", "specification", "date")
|
||||||
val unconcernedKeys = setOf(
|
val unconcernedKeys = setOf(
|
||||||
"java.class.version",
|
"java.class.version",
|
||||||
"java.vm.name",
|
"java.vm.name",
|
||||||
"java.vm.version",
|
"java.vm.version",
|
||||||
"java.version",
|
"java.version",
|
||||||
"platform.random.idempotence.check.rate",
|
"platform.random.idempotence.check.rate",
|
||||||
|
"sun.os.patch.level",
|
||||||
)
|
)
|
||||||
System.getProperties().filterKeys { key ->
|
System.getProperties().filterKeys { key ->
|
||||||
return@filterKeys key is String
|
return@filterKeys key is String
|
||||||
@@ -80,6 +81,7 @@ pluginManagement {
|
|||||||
&& key.split(Regex("\\W")).none { it in unconcernedKeyWords }
|
&& key.split(Regex("\\W")).none { it in unconcernedKeyWords }
|
||||||
}.map { (key, value) -> "[ $key: $value ]" }
|
}.map { (key, value) -> "[ $key: $value ]" }
|
||||||
}
|
}
|
||||||
|
var isConcernsAlreadyPrinted = false
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Classpath(val id: String, val version: String)
|
data class Classpath(val id: String, val version: String)
|
||||||
@@ -114,9 +116,17 @@ pluginManagement {
|
|||||||
/* Print concerned info by `System.getProperties()`. */
|
/* Print concerned info by `System.getProperties()`. */
|
||||||
val isShowConcernedSystemProperties = true
|
val isShowConcernedSystemProperties = true
|
||||||
|
|
||||||
|
/* https://docs.gradle.org/current/userguide/compatibility.html . */
|
||||||
|
val isJavaVersionCoercedByGradleVersion = true
|
||||||
|
|
||||||
val isCleanupPaddleOcr = false
|
val isCleanupPaddleOcr = false
|
||||||
val isCleanupRapidOcr = false
|
val isCleanupRapidOcr = false
|
||||||
|
|
||||||
|
val fallbackGradleVersion = "8.0.2"
|
||||||
|
val fallbackKotlinVersion = "1.9.22"
|
||||||
|
val recommendedMinGradleVersion = "8.5.2"
|
||||||
|
val recommendedMinKotlinVersion = "1.9.24"
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val platforms = object {
|
val platforms = object {
|
||||||
|
|
||||||
@@ -132,19 +142,13 @@ pluginManagement {
|
|||||||
"2022.3" to "8.1.4", /* Mar 31, 2024. */
|
"2022.3" to "8.1.4", /* Mar 31, 2024. */
|
||||||
"2022.2" to "8.0.2", /* May 26, 2023. */
|
"2022.2" to "8.0.2", /* May 26, 2023. */
|
||||||
"2022.1" to "7.4.2", /* Mar 25, 2023. */
|
"2022.1" to "7.4.2", /* Mar 25, 2023. */
|
||||||
consts.IDENTIFIER_FALLBACK to "8.0.2", /* Jan 21, 2024. */
|
consts.IDENTIFIER_FALLBACK to fallbackGradleVersion,
|
||||||
),
|
),
|
||||||
kotlinVersionMap = mapOf(
|
kotlinVersionMap = mapOf(
|
||||||
"2024.3" to "2.1.0", /* Nov 29, 2024. */
|
"2024.3" to "2.1.0", /* Nov 29, 2024. */
|
||||||
"2024.2" to "2.1.0", /* Nov 29, 2024. */
|
"2024.2" to "2.1.0", /* Nov 29, 2024. */
|
||||||
"2024.1" to "2.0.0", /* Aug 13, 2024. */
|
"2024.1" to "2.0.0", /* Aug 13, 2024. */
|
||||||
"2023.3" to "1.9.20-RC2", /* Jan 21, 2024. */
|
consts.IDENTIFIER_FALLBACK to fallbackKotlinVersion,
|
||||||
"2023.2" to "1.9.20-RC2", /* Jan 21, 2024. */
|
|
||||||
"2023.1" to "1.9.20-RC2", /* Oct 25, 2023. */
|
|
||||||
"2022.3" to "1.9.0-RC", /* Jul 3, 2023. */
|
|
||||||
"2022.2" to "1.8.20-RC2", /* Mar 23, 2023. */
|
|
||||||
"2022.1" to "1.8.0-RC2", /* Dec 20, 2022. */
|
|
||||||
consts.IDENTIFIER_FALLBACK to "1.8.0", /* Aug 17, 2023. */
|
|
||||||
),
|
),
|
||||||
codenameVersionMap = mapOf(
|
codenameVersionMap = mapOf(
|
||||||
"2024.3" to "M", /* Nov 29, 2024. */
|
"2024.3" to "M", /* Nov 29, 2024. */
|
||||||
@@ -200,18 +204,14 @@ pluginManagement {
|
|||||||
"2023.3" to "8.2.2", /* Jan 19, 2024. */
|
"2023.3" to "8.2.2", /* Jan 19, 2024. */
|
||||||
"2023.1" to "7.4.2", /* May 26, 2023. */
|
"2023.1" to "7.4.2", /* May 26, 2023. */
|
||||||
"2022.3" to "7.4.0-beta02", /* Mar 25, 2023. */
|
"2022.3" to "7.4.0-beta02", /* Mar 25, 2023. */
|
||||||
consts.IDENTIFIER_FALLBACK to "8.1.2", /* Jan 21, 2024. */
|
consts.IDENTIFIER_FALLBACK to fallbackGradleVersion,
|
||||||
),
|
),
|
||||||
kotlinVersionMap = mapOf(
|
kotlinVersionMap = mapOf(
|
||||||
"2024.2.3" to "2.0.21", /* Oct 17, 2024. */
|
"2024.2.3" to "2.0.21", /* Oct 17, 2024. */
|
||||||
"2024.2" to "2.0.21-RC", /* Sep 27, 2024. */
|
"2024.2" to "2.0.21-RC", /* Sep 27, 2024. */
|
||||||
"2024.1.2" to "1.9.24", /* Apr 24, 2024. */
|
"2024.1" to "1.9.24", /* Dec 3, 2024. */
|
||||||
"2024.1" to "1.9.23", /* Apr 6, 2024. */
|
|
||||||
"2023.3" to "1.9.23", /* Mar 29, 2024. */
|
"2023.3" to "1.9.23", /* Mar 29, 2024. */
|
||||||
"2023.2" to "1.9.21", /* Dec 2, 2023. */
|
consts.IDENTIFIER_FALLBACK to fallbackKotlinVersion,
|
||||||
"2023.1" to "1.8.21", /* Apr 25, 2023. */
|
|
||||||
"2022.3" to "1.8.21", /* Apr 25, 2023. */
|
|
||||||
consts.IDENTIFIER_FALLBACK to "1.8.21", /* May 3, 2023. */
|
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
override val weight = 10
|
override val weight = 10
|
||||||
@@ -223,11 +223,11 @@ pluginManagement {
|
|||||||
name = "Temurin", vendor = "temurin", abbr = "Adoptium", /* More common as "Eclipse Adoptium". */
|
name = "Temurin", vendor = "temurin", abbr = "Adoptium", /* More common as "Eclipse Adoptium". */
|
||||||
androidVersionMap = mapOf(
|
androidVersionMap = mapOf(
|
||||||
"20.0.2+9" to "8.2.2", /* Dec 2, 2024. */
|
"20.0.2+9" to "8.2.2", /* Dec 2, 2024. */
|
||||||
consts.IDENTIFIER_FALLBACK to "8.2.2", /* Dec 2, 2024. */
|
consts.IDENTIFIER_FALLBACK to recommendedMinGradleVersion,
|
||||||
),
|
),
|
||||||
kotlinVersionMap = mapOf(
|
kotlinVersionMap = mapOf(
|
||||||
"20.0.2+9" to "1.9.24", /* Dec 2, 2024. */
|
"20.0.2+9" to "1.9.24", /* Dec 2, 2024. */
|
||||||
consts.IDENTIFIER_FALLBACK to "1.9.24", /* Dec 2, 2024. */
|
consts.IDENTIFIER_FALLBACK to recommendedMinKotlinVersion,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
override val weight = 5
|
override val weight = 5
|
||||||
@@ -236,10 +236,10 @@ pluginManagement {
|
|||||||
val unknown = object : Platform(
|
val unknown = object : Platform(
|
||||||
name = "Unknown", abbr = consts.IDENTIFIER_UNKNOWN, vendor = consts.IDENTIFIER_UNKNOWN,
|
name = "Unknown", abbr = consts.IDENTIFIER_UNKNOWN, vendor = consts.IDENTIFIER_UNKNOWN,
|
||||||
androidVersionMap = mapOf(
|
androidVersionMap = mapOf(
|
||||||
consts.IDENTIFIER_FALLBACK to "8.1.2", /* Oct 30, 2023. */
|
consts.IDENTIFIER_FALLBACK to recommendedMinGradleVersion,
|
||||||
),
|
),
|
||||||
kotlinVersionMap = mapOf(
|
kotlinVersionMap = mapOf(
|
||||||
consts.IDENTIFIER_FALLBACK to "1.8.21", /* Oct 30, 2023. */
|
consts.IDENTIFIER_FALLBACK to recommendedMinKotlinVersion,
|
||||||
),
|
),
|
||||||
) {
|
) {
|
||||||
fun declare() = systemProperties.platform?.let {
|
fun declare() = systemProperties.platform?.let {
|
||||||
@@ -248,7 +248,7 @@ pluginManagement {
|
|||||||
"Current platform is unknown",
|
"Current platform is unknown",
|
||||||
systemProperties.concerns,
|
systemProperties.concerns,
|
||||||
"However, here are some props may be useful for determining platform info",
|
"However, here are some props may be useful for determining platform info",
|
||||||
).print()
|
).print().also { systemProperties.isConcernsAlreadyPrinted = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun determine(): Platform {
|
fun determine(): Platform {
|
||||||
@@ -260,7 +260,10 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return when {
|
return when {
|
||||||
candidates.isEmpty() -> unknown.also { it.declare() }
|
candidates.isEmpty() -> when (val osName = System.getProperty("os.name")) {
|
||||||
|
is String -> unknown.also { it.name = osName }
|
||||||
|
else -> unknown.also { it.declare() }
|
||||||
|
}
|
||||||
candidates.size > 1 -> candidates.maxBy { it.weight }
|
candidates.size > 1 -> candidates.maxBy { it.weight }
|
||||||
else -> candidates.first()
|
else -> candidates.first()
|
||||||
}.also {
|
}.also {
|
||||||
@@ -332,11 +335,11 @@ pluginManagement {
|
|||||||
"1.8.20-RC2" to "1.0.9", /* Aug 16, 2023. */
|
"1.8.20-RC2" to "1.0.9", /* Aug 16, 2023. */
|
||||||
"1.8.0" to "1.0.9", /* Aug 16, 2023. */
|
"1.8.0" to "1.0.9", /* Aug 16, 2023. */
|
||||||
"1.8.0-RC2" to "1.0.8", /* Aug 16, 2023. */
|
"1.8.0-RC2" to "1.0.8", /* Aug 16, 2023. */
|
||||||
consts.IDENTIFIER_FALLBACK to "1.8.0-1.0.9", /* Aug 16, 2023. */
|
consts.IDENTIFIER_FALLBACK to "1.9.24-1.0.20", /* Dec 3, 2024. */
|
||||||
)
|
)
|
||||||
|
|
||||||
abstract inner class Platform(
|
abstract inner class Platform(
|
||||||
val name: String,
|
var name: String,
|
||||||
val abbr: String,
|
val abbr: String,
|
||||||
val vendor: String,
|
val vendor: String,
|
||||||
val androidVersionMap: Map<String, String>,
|
val androidVersionMap: Map<String, String>,
|
||||||
@@ -345,11 +348,13 @@ pluginManagement {
|
|||||||
val codenameMap: Map<String, String>? = null,
|
val codenameMap: Map<String, String>? = null,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
open val fullName: String = uppercaseFirstChar(name)
|
|
||||||
open val gradleSettingsName: String? = null
|
open val gradleSettingsName: String? = null
|
||||||
open val weight: Int = -Int.MAX_VALUE
|
open val weight: Int = -Int.MAX_VALUE
|
||||||
open var version: String = consts.DEFAULT_VERSION
|
open var version: String = consts.DEFAULT_VERSION
|
||||||
|
|
||||||
|
open val fullName
|
||||||
|
get() = uppercaseFirstChar(name)
|
||||||
|
|
||||||
open fun matchEnvironment() = systemProperties.platform?.startsWith(name) == true
|
open fun matchEnvironment() = systemProperties.platform?.startsWith(name) == true
|
||||||
|| systemProperties.vendorName?.contains(vendor, true) == true
|
|| systemProperties.vendorName?.contains(vendor, true) == true
|
||||||
|
|
||||||
@@ -410,12 +415,14 @@ pluginManagement {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val platform = config.platforms.determine()
|
||||||
|
|
||||||
val console = object {
|
val console = object {
|
||||||
|
|
||||||
val versionInfo = mutableListOf<String>()
|
val versionInfo = mutableListOf<String>()
|
||||||
|
|
||||||
fun printConcernedSystemPropertiesIfNeeded() {
|
fun printConcernedSystemPropertiesIfNeeded() {
|
||||||
if (config.isShowConcernedSystemProperties) {
|
if (config.isShowConcernedSystemProperties && !systemProperties.isConcernsAlreadyPrinted) {
|
||||||
Formatted("Information for concerned system properties", systemProperties.concerns).print(true)
|
Formatted("Information for concerned system properties", systemProperties.concerns).print(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,8 +433,6 @@ pluginManagement {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val platform = config.platforms.determine()
|
|
||||||
|
|
||||||
platform.ensureMinimalGradleJdkVersion()
|
platform.ensureMinimalGradleJdkVersion()
|
||||||
platform.prependConsoleInformation(console.versionInfo)
|
platform.prependConsoleInformation(console.versionInfo)
|
||||||
|
|
||||||
@@ -486,6 +491,9 @@ pluginManagement {
|
|||||||
suffix += identifier.specifiedSuffix
|
suffix += identifier.specifiedSuffix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (config.isJavaVersionCoercedByGradleVersion && it.id == "com.android.tools.build:gradle") {
|
||||||
|
gradle.extra.set("gradleVersionToCoerceJavaVersion", version)
|
||||||
|
}
|
||||||
"${it.id}:$version".also { notation ->
|
"${it.id}:$version".also { notation ->
|
||||||
console.versionInfo += "Classpath: \"$notation\"$suffix"
|
console.versionInfo += "Classpath: \"$notation\"$suffix"
|
||||||
}
|
}
|
||||||
@@ -606,8 +614,6 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gradle.extra.apply {
|
gradle.extra.apply {
|
||||||
set("platformVersion", platform.version)
|
|
||||||
set("platformAbbr", platform.abbr)
|
|
||||||
set("isCleanupPaddleOcr", config.isCleanupPaddleOcr)
|
set("isCleanupPaddleOcr", config.isCleanupPaddleOcr)
|
||||||
set("isCleanupRapidOcr", config.isCleanupRapidOcr)
|
set("isCleanupRapidOcr", config.isCleanupRapidOcr)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#Mon Dec 02 18:24:43 CST 2024
|
#Tue Dec 03 21:27:01 CST 2024
|
||||||
BUILD_TIME=1733135083804
|
BUILD_TIME=1733232421738
|
||||||
COMPILE_SDK_VERSION=34
|
COMPILE_SDK_VERSION=34
|
||||||
JAVA_VERSION=23
|
JAVA_VERSION=23
|
||||||
JAVA_VERSION_MIN_RADICAL=0
|
JAVA_VERSION_MIN_RADICAL=0
|
||||||
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
|
|||||||
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
|
||||||
TARGET_SDK_VERSION=34
|
TARGET_SDK_VERSION=34
|
||||||
TARGET_SDK_VERSION_INRT=29
|
TARGET_SDK_VERSION_INRT=29
|
||||||
VERSION_BUILD=2884
|
VERSION_BUILD=2888
|
||||||
VERSION_NAME=6.6.0
|
VERSION_NAME=6.6.1 Alpha
|
||||||
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
VSCODE_EXT_REQUIRED_VERSION=1.0.8
|
||||||
|
|||||||
Reference in New Issue
Block a user