@norcy/react-native-toolkit 0.1.152 → 0.1.153

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.
@@ -1,42 +1,56 @@
1
1
  /**
2
2
  * Norcy Toolkit - Common Android Build Configuration
3
- *
4
3
  * 提供通用的 Android 构建配置和依赖管理函数
5
- * 包含 React Native 基础依赖、AndroidX、友盟统计等
6
4
  */
7
5
 
8
- /**
9
- * 应用通用依赖
10
- *
11
- * @param targetProject 当前项目
12
- * @param enableHermes 是否启用 Hermes 引擎
13
- * @param jscFlavor JSC 的 flavor (如果不使用 Hermes)
14
- */
6
+ ext.applyNorcyDefaultConfig = { targetProject, options = [:] ->
7
+ def enableSeparateBuildPerCPUArchitecture = options.enableSeparateBuildPerCPUArchitecture ?: false
8
+ def abiFiltersList = options.abiFilters ?: ["armeabi-v7a", "arm64-v8a"]
9
+
10
+ targetProject.android {
11
+ defaultConfig {
12
+ multiDexEnabled true
13
+ ndk {
14
+ abiFilters(*abiFiltersList)
15
+ }
16
+ }
17
+
18
+ splits {
19
+ abi {
20
+ reset()
21
+ enable enableSeparateBuildPerCPUArchitecture
22
+ universalApk true
23
+ include(*abiFiltersList)
24
+ }
25
+ }
26
+
27
+ signingConfigs {
28
+ debug {
29
+ storeFile targetProject.file('debug.keystore')
30
+ storePassword 'android'
31
+ keyAlias 'androiddebugkey'
32
+ keyPassword 'android'
33
+ }
34
+ }
35
+ }
36
+ }
37
+
15
38
  ext.applyNorcyCommonDependencies = { targetProject, enableHermes, jscFlavor ->
16
39
  targetProject.dependencies {
17
- // 基础依赖
18
40
  implementation fileTree(dir: "libs", include: ["*.jar"])
19
41
 
20
- // React Native 核心
21
42
  //noinspection GradleDynamicVersion
22
- implementation "com.facebook.react:react-native:0.62.2.9.1" // From node_modules
23
-
24
- // AndroidX
43
+ implementation "com.facebook.react:react-native:0.62.2.9.1"
25
44
  implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
26
-
27
- // MultiDex
28
45
  implementation 'com.android.support:multidex:2.0.1'
29
46
 
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' // 高级运营分析功能依赖库
47
+ implementation 'com.umeng.umsdk:common:9.6.3'
48
+ implementation 'com.umeng.umsdk:asms:1.8.0'
49
+ implementation 'com.umeng.umsdk:uyumao:1.1.2'
34
50
 
35
- // Toolkit 相关的通用项目依赖
36
51
  implementation targetProject.project(':react-native-splash-screen')
37
52
  implementation targetProject.project(':react-native-blob-util')
38
53
 
39
- // JavaScript 引擎依赖
40
54
  if (enableHermes) {
41
55
  def hermesPath = "../../node_modules/hermes-engine/android/"
42
56
  debugImplementation files(hermesPath + "hermes-debug.aar")
@@ -47,21 +61,13 @@ ext.applyNorcyCommonDependencies = { targetProject, enableHermes, jscFlavor ->
47
61
  }
48
62
  }
49
63
 
50
- /**
51
- * 应用通用的 Android 配置
52
- * 包括 compileOptions, packagingOptions, lintOptions 等
53
- *
54
- * @param targetProject 当前项目
55
- */
56
64
  ext.applyNorcyCommonAndroidConfig = { targetProject ->
57
65
  targetProject.android {
58
- // Java 编译选项
59
66
  compileOptions {
60
67
  sourceCompatibility JavaVersion.VERSION_1_8
61
68
  targetCompatibility JavaVersion.VERSION_1_8
62
69
  }
63
70
 
64
- // 解决 libc++ 冲突
65
71
  packagingOptions {
66
72
  pickFirst "lib/armeabi-v7a/libc++_shared.so"
67
73
  pickFirst "lib/arm64-v8a/libc++_shared.so"
@@ -69,17 +75,15 @@ ext.applyNorcyCommonAndroidConfig = { targetProject ->
69
75
  pickFirst "lib/x86_64/libc++_shared.so"
70
76
  }
71
77
 
72
- // Lint 配置
73
78
  lintOptions {
74
79
  checkReleaseBuilds false
75
80
  }
76
81
 
77
- // 为不同 ABI 设置不同的版本码
78
82
  applicationVariants.all { variant ->
79
83
  variant.outputs.each { output ->
80
84
  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
85
+ def abi = output.getFilter("ABI")
86
+ if (abi != null) {
83
87
  output.versionCodeOverride =
84
88
  versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
85
89
  }
@@ -87,7 +91,6 @@ ext.applyNorcyCommonAndroidConfig = { targetProject ->
87
91
  }
88
92
  }
89
93
 
90
- // 添加 BUCK 支持的 task
91
94
  targetProject.tasks.create('copyDownloadableDepsToLibs', Copy) {
92
95
  from targetProject.configurations.compile
93
96
  into 'libs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norcy/react-native-toolkit",
3
- "version": "0.1.152",
3
+ "version": "0.1.153",
4
4
  "description": "My Toolkit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",