@norcy/react-native-toolkit 0.1.151 → 0.1.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/dependencies.gradle +49 -2
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
/**
|
2
|
-
* Norcy Toolkit - Common Android
|
2
|
+
* Norcy Toolkit - Common Android Build Configuration
|
3
3
|
*
|
4
|
-
* 提供通用的 Android
|
4
|
+
* 提供通用的 Android 构建配置和依赖管理函数
|
5
5
|
* 包含 React Native 基础依赖、AndroidX、友盟统计等
|
6
6
|
*/
|
7
7
|
|
@@ -47,3 +47,50 @@ ext.applyNorcyCommonDependencies = { targetProject, enableHermes, jscFlavor ->
|
|
47
47
|
}
|
48
48
|
}
|
49
49
|
|
50
|
+
/**
|
51
|
+
* 应用通用的 Android 配置
|
52
|
+
* 包括 compileOptions, packagingOptions, lintOptions 等
|
53
|
+
*
|
54
|
+
* @param targetProject 当前项目
|
55
|
+
*/
|
56
|
+
ext.applyNorcyCommonAndroidConfig = { targetProject ->
|
57
|
+
targetProject.android {
|
58
|
+
// Java 编译选项
|
59
|
+
compileOptions {
|
60
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
61
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
62
|
+
}
|
63
|
+
|
64
|
+
// 解决 libc++ 冲突
|
65
|
+
packagingOptions {
|
66
|
+
pickFirst "lib/armeabi-v7a/libc++_shared.so"
|
67
|
+
pickFirst "lib/arm64-v8a/libc++_shared.so"
|
68
|
+
pickFirst "lib/x86/libc++_shared.so"
|
69
|
+
pickFirst "lib/x86_64/libc++_shared.so"
|
70
|
+
}
|
71
|
+
|
72
|
+
// Lint 配置
|
73
|
+
lintOptions {
|
74
|
+
checkReleaseBuilds false
|
75
|
+
}
|
76
|
+
|
77
|
+
// 为不同 ABI 设置不同的版本码
|
78
|
+
applicationVariants.all { variant ->
|
79
|
+
variant.outputs.each { output ->
|
80
|
+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
81
|
+
def abi = output.getFilter("ABI") // OutputFile.ABI 的值就是字符串 "ABI"
|
82
|
+
if (abi != null) { // null for the universal-debug, universal-release variants
|
83
|
+
output.versionCodeOverride =
|
84
|
+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
// 添加 BUCK 支持的 task
|
91
|
+
targetProject.tasks.create('copyDownloadableDepsToLibs', Copy) {
|
92
|
+
from targetProject.configurations.compile
|
93
|
+
into 'libs'
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|