@norcy/react-native-toolkit 0.1.150 → 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.
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Norcy Toolkit - Common Android Build Configuration
3
+ *
4
+ * 提供通用的 Android 构建配置和依赖管理函数
5
+ * 包含 React Native 基础依赖、AndroidX、友盟统计等
6
+ */
7
+
8
+ /**
9
+ * 应用通用依赖
10
+ *
11
+ * @param targetProject 当前项目
12
+ * @param enableHermes 是否启用 Hermes 引擎
13
+ * @param jscFlavor JSC 的 flavor (如果不使用 Hermes)
14
+ */
15
+ ext.applyNorcyCommonDependencies = { targetProject, enableHermes, jscFlavor ->
16
+ targetProject.dependencies {
17
+ // 基础依赖
18
+ implementation fileTree(dir: "libs", include: ["*.jar"])
19
+
20
+ // React Native 核心
21
+ //noinspection GradleDynamicVersion
22
+ implementation "com.facebook.react:react-native:0.62.2.9.1" // From node_modules
23
+
24
+ // AndroidX
25
+ implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
26
+
27
+ // MultiDex
28
+ implementation 'com.android.support:multidex:2.0.1'
29
+
30
+ // 友盟统计
31
+ implementation 'com.umeng.umsdk:common:9.6.3' // 必选
32
+ implementation 'com.umeng.umsdk:asms:1.8.0' // 必选
33
+ implementation 'com.umeng.umsdk:uyumao:1.1.2' // 高级运营分析功能依赖库
34
+
35
+ // Toolkit 相关的通用项目依赖
36
+ implementation targetProject.project(':react-native-splash-screen')
37
+ implementation targetProject.project(':react-native-blob-util')
38
+
39
+ // JavaScript 引擎依赖
40
+ if (enableHermes) {
41
+ def hermesPath = "../../node_modules/hermes-engine/android/"
42
+ debugImplementation files(hermesPath + "hermes-debug.aar")
43
+ releaseImplementation files(hermesPath + "hermes-release.aar")
44
+ } else {
45
+ implementation jscFlavor
46
+ }
47
+ }
48
+ }
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
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norcy/react-native-toolkit",
3
- "version": "0.1.150",
3
+ "version": "0.1.152",
4
4
  "description": "My Toolkit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",