@norcy/react-native-toolkit 0.1.151 → 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
- * Norcy Toolkit - Common Android Dependencies
3
- *
4
- * 提供通用的 Android 依赖管理函数
5
- * 包含 React Native 基础依赖、AndroidX、友盟统计等
2
+ * Norcy Toolkit - Common Android Build Configuration
3
+ * 提供通用的 Android 构建配置和依赖管理函数
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,3 +61,39 @@ ext.applyNorcyCommonDependencies = { targetProject, enableHermes, jscFlavor ->
47
61
  }
48
62
  }
49
63
 
64
+ ext.applyNorcyCommonAndroidConfig = { targetProject ->
65
+ targetProject.android {
66
+ compileOptions {
67
+ sourceCompatibility JavaVersion.VERSION_1_8
68
+ targetCompatibility JavaVersion.VERSION_1_8
69
+ }
70
+
71
+ packagingOptions {
72
+ pickFirst "lib/armeabi-v7a/libc++_shared.so"
73
+ pickFirst "lib/arm64-v8a/libc++_shared.so"
74
+ pickFirst "lib/x86/libc++_shared.so"
75
+ pickFirst "lib/x86_64/libc++_shared.so"
76
+ }
77
+
78
+ lintOptions {
79
+ checkReleaseBuilds false
80
+ }
81
+
82
+ applicationVariants.all { variant ->
83
+ variant.outputs.each { output ->
84
+ def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
85
+ def abi = output.getFilter("ABI")
86
+ if (abi != null) {
87
+ output.versionCodeOverride =
88
+ versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ targetProject.tasks.create('copyDownloadableDepsToLibs', Copy) {
95
+ from targetProject.configurations.compile
96
+ into 'libs'
97
+ }
98
+ }
99
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norcy/react-native-toolkit",
3
- "version": "0.1.151",
3
+ "version": "0.1.153",
4
4
  "description": "My Toolkit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",