react-native-daro 2.0.2 → 2.0.4-rc.2

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/README.md CHANGED
@@ -54,3 +54,10 @@ module.exports = {
54
54
  },
55
55
  };
56
56
  ```
57
+ If an Android Release build fails in a SafeDK or manifest task with a
58
+ Configuration Cache error, set Boolean `android.safedkConfigurationCacheWorkaround`
59
+ to `true` in the plugin options and rerun prebuild or EAS Build. `false` disables
60
+ the workaround; omission preserves the existing Gradle value. Generated Android
61
+ builds use SDK 2.0.3-rc.2 and Gradle plugin 2.0.4-rc.2. React Native CLI projects can set
62
+ `daro.safedkConfigurationCacheWorkaround=true` in `android/gradle.properties`
63
+ after updating the Gradle plugin to 2.0.4-rc.2.
@@ -33,7 +33,7 @@ apply plugin: "kotlin-android"
33
33
  apply plugin: "com.facebook.react"
34
34
 
35
35
  // 통합 daro-sdk 는 AdMob·MAX 미디에이션을 한 아티팩트에 담는다 — 빌드타임 분기가 없다.
36
- def daroSdkDependency = "so.daro:daro-sdk:2.0.2"
36
+ def daroSdkDependency = "so.daro:daro-sdk:2.0.3-rc.2"
37
37
  def isNewArchitectureEnabled =
38
38
  (project.hasProperty("newArchEnabled") && project.property("newArchEnabled").toString().toBoolean()) ||
39
39
  (project.hasProperty("react.newArchEnabled") && project.property("react.newArchEnabled").toString().toBoolean())
@@ -5,6 +5,8 @@ export type DaroIosProps = {
5
5
  };
6
6
  export type DaroAndroidProps = {
7
7
  daroIntegrationKey: string;
8
+ /** Writes daro.safedkConfigurationCacheWorkaround to gradle.properties when set. */
9
+ safedkConfigurationCacheWorkaround?: boolean;
8
10
  };
9
11
  export type DaroPluginProps = {
10
12
  ios: DaroIosProps;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AA6BF,QAAA,MAAM,QAAQ,EAAE,YAAY,CAAC,eAAe,CAY3C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AA6BF,QAAA,MAAM,QAAQ,EAAE,YAAY,CAAC,eAAe,CAY3C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"withAndroid.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/withAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmJhD,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,CAyInE,CAAC"}
1
+ {"version":3,"file":"withAndroid.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/withAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyNhD,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,CA8KnE,CAAC"}
@@ -5,6 +5,8 @@ export type DaroIosProps = {
5
5
  };
6
6
  export type DaroAndroidProps = {
7
7
  daroIntegrationKey: string;
8
+ /** Writes daro.safedkConfigurationCacheWorkaround to gradle.properties when set. */
9
+ safedkConfigurationCacheWorkaround?: boolean;
8
10
  };
9
11
  export type DaroPluginProps = {
10
12
  ios: DaroIosProps;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AA6BF,QAAA,MAAM,QAAQ,EAAE,YAAY,CAAC,eAAe,CAY3C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oFAAoF;IACpF,kCAAkC,CAAC,EAAE,OAAO,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,YAAY,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;CAC3B,CAAC;AA6BF,QAAA,MAAM,QAAQ,EAAE,YAAY,CAAC,eAAe,CAY3C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"withAndroid.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/withAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAmJhD,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,CAyInE,CAAC"}
1
+ {"version":3,"file":"withAndroid.d.ts","sourceRoot":"","sources":["../../../../../plugin/src/withAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyNhD,eAAO,MAAM,wBAAwB,EAAE,YAAY,CAAC,gBAAgB,CA8KnE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-daro",
3
- "version": "2.0.2",
3
+ "version": "2.0.4-rc.2",
4
4
  "description": "React Native module for the Daro SDK on Android and iOS",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -5,6 +5,8 @@ export type DaroIosProps = {
5
5
  };
6
6
  export type DaroAndroidProps = {
7
7
  daroIntegrationKey: string;
8
+ /** Writes daro.safedkConfigurationCacheWorkaround to gradle.properties when set. */
9
+ safedkConfigurationCacheWorkaround?: boolean;
8
10
  };
9
11
  export type DaroPluginProps = {
10
12
  ios: DaroIosProps;
@@ -10,7 +10,10 @@ const JETIFIER_IGNORELIST_ENTRIES = ['react-android', 'hermes-android'];
10
10
  // 2.2.20 인 이유: Expo 의 Kotlin→KSP 매핑이 지원하는 최신 2.2 계열이다.
11
11
  const KOTLIN_VERSION_KEY = 'android.kotlinVersion';
12
12
  const MIN_KOTLIN_VERSION = '2.2.20';
13
- const DARO_GRADLE_PLUGIN_CLASSPATH = 'so.daro:daro-plugin:2.0.0';
13
+ const DARO_GRADLE_PLUGIN_CLASSPATH = 'so.daro:daro-plugin:2.0.4-rc.2';
14
+ const GRADLE_CLASSPATH_PATTERN = /^classpath\s*(?:\(\s*['"][^'"]+['"]\s*\)|['"][^'"]+['"])/;
15
+ const GRADLE_NON_CODE_PATTERN = /\/\/[^\r\n]*|\/\*[\s\S]*?\*\/|'''[\s\S]*?'''|"""[\s\S]*?"""|'(?:\\[\s\S]|[^'\\])*'|"(?:\\[\s\S]|[^"\\])*"|\$\/(?:\$(?:\$|\/)|(?!\/\$)[\s\S])*\/\$|\/(?:\\\/|[^/])+\//g;
16
+ const SAFEDK_WORKAROUND_KEY = 'daro.safedkConfigurationCacheWorkaround';
14
17
  // 통합 so.daro 플러그인이 release 빌드에 applovin-quality-service 를 스스로 적용한다 —
15
18
  // 그 플러그인 id 가 해석되려면 classpath 와 AppLovin buildscript repo 가 앱에 있어야 한다.
16
19
  const MAX_QUALITY_CLASSPATH = 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:5.5.2';
@@ -33,7 +36,7 @@ const DARO_APP_PLUGIN_LINE = `apply plugin: "${DARO_APP_PLUGIN_ID}"`;
33
36
  // compileOnly 로 물고 compileOnly 는 전이되지 않으므로, 소비자 런타임에 실제로 실리는
34
37
  // 것은 여기서 꽂는 이 좌표 하나뿐이다. 갈리면 우리 Kotlin 이 새 시그니처로 컴파일되어
35
38
  // 옛 아티팩트 위에서 돈다 (DARO-1591 — 복제 자체를 없애는 것은 그 이슈에 남아 있다).
36
- const DARO_SDK_DEPENDENCY = 'so.daro:daro-sdk:2.0.2';
39
+ const DARO_SDK_DEPENDENCY = 'so.daro:daro-sdk:2.0.3-rc.2';
37
40
  const DARO_SDK_DEPENDENCY_LINE_PATTERN = /^\s*(?:implementation|api|compileOnly|runtimeOnly)\s*(?:\(\s*)?['"]so\.daro:daro-(?:[am]|sdk):[^'"]+['"]\s*\)?\s*(?:\/\/.*)?$/gm;
38
41
  function replaceOrThrow(contents, pattern, replacement, target) {
39
42
  if (!pattern.test(contents)) {
@@ -58,6 +61,61 @@ function findClosingBrace(contents, openBraceIndex) {
58
61
  throw new Error('[daro-react-native] Cannot automatically update android/build.gradle. ' +
59
62
  'Expected to find a complete repositories block.');
60
63
  }
64
+ // Keep offsets so examples in comments/strings cannot be
65
+ // mistaken for active declarations or insertion anchors.
66
+ function gradleCode(contents) {
67
+ const tokens = new RegExp(GRADLE_NON_CODE_PATTERN);
68
+ let code = '';
69
+ let end = 0;
70
+ for (let token = tokens.exec(contents); token; token = tokens.exec(contents)) {
71
+ const text = token[0];
72
+ const before = code + contents.slice(end, token.index);
73
+ const comment = text.startsWith('//') || text.startsWith('/*');
74
+ // Groovy permits slashy strings at an expression start, but a slash after
75
+ // a value is division. Retain an opaque value marker for masked strings.
76
+ if (text.startsWith('/') && !comment) {
77
+ const prefix = before.trimEnd();
78
+ const newStatement = /[\r\n]/.test(before.slice(prefix.length)) &&
79
+ !isInsideGradleExpression(before);
80
+ if (!newStatement &&
81
+ /(?:[\w$)\]}]|\+\+|--)$/.test(prefix) &&
82
+ !/\b(?:return|case|throw|assert|in|instanceof|yield)$/.test(prefix)) {
83
+ tokens.lastIndex = token.index + 1;
84
+ continue;
85
+ }
86
+ }
87
+ // Newlines inside tokens do not start a new statement. Put the opaque
88
+ // string value at its closing delimiter, before any following whitespace.
89
+ const blank = text.replace(/[\s\S]/g, ' ');
90
+ code = before + (comment ? blank : `${blank.slice(0, -1)}0`);
91
+ end = token.index + text.length;
92
+ }
93
+ return code + contents.slice(end);
94
+ }
95
+ function isInsideGradleExpression(code) {
96
+ const delimiters = [];
97
+ for (const char of code) {
98
+ if ('([{'.includes(char))
99
+ delimiters.push(char);
100
+ else if (')]}'.includes(char))
101
+ delimiters.pop();
102
+ }
103
+ const last = delimiters[delimiters.length - 1];
104
+ return last === '(' || last === '[';
105
+ }
106
+ function addBuildscriptClasspath(contents, coordinate) {
107
+ const code = gradleCode(contents);
108
+ const buildscript = /\bbuildscript\s*\{/.exec(code);
109
+ const start = buildscript ? buildscript.index + buildscript[0].length : 0;
110
+ const end = buildscript ? findClosingBrace(code, start - 1) : 0;
111
+ const dependencies = /\bdependencies\s*\{/.exec(code.slice(start, end));
112
+ if (!dependencies) {
113
+ throw new Error('[daro-react-native] Cannot automatically update android/build.gradle. ' +
114
+ 'Expected to find a buildscript dependencies block.');
115
+ }
116
+ const insertIndex = start + dependencies.index + dependencies[0].length;
117
+ return `${contents.slice(0, insertIndex)}\n classpath("${coordinate}")\n${contents.slice(insertIndex)}`;
118
+ }
61
119
  function findRepositoriesBlock(contents, pattern, target) {
62
120
  const match = pattern.exec(contents);
63
121
  if (!match) {
@@ -108,11 +166,42 @@ const withAndroidConfiguration = (config, props) => {
108
166
  return gradleConfig;
109
167
  }
110
168
  let contents = gradleConfig.modResults.contents;
111
- if (!contents.includes(DARO_GRADLE_PLUGIN_CLASSPATH)) {
112
- contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n classpath("${DARO_GRADLE_PLUGIN_CLASSPATH}")`, 'a buildscript dependencies block');
169
+ // Update the first declaration in place and remove duplicates so repeated
170
+ // generation preserves classpath order and surrounding customer content.
171
+ let hasDaroClasspath = false;
172
+ let hasQualityClasspath = false;
173
+ const code = gradleCode(contents);
174
+ const changes = [];
175
+ for (const { index } of code.matchAll(/(?<![\w$.])classpath\b/g)) {
176
+ const declaration = GRADLE_CLASSPATH_PATTERN.exec(contents.slice(index));
177
+ if (!declaration)
178
+ continue;
179
+ const match = declaration[0];
180
+ const coordinate = /['"]([^'"]+)['"]/.exec(match)?.[1];
181
+ if (!coordinate)
182
+ continue;
183
+ if (coordinate === MAX_QUALITY_CLASSPATH)
184
+ hasQualityClasspath = true;
185
+ if (!coordinate.startsWith('so.daro:daro-plugin:'))
186
+ continue;
187
+ changes.push({
188
+ index,
189
+ length: match.length,
190
+ replacement: hasDaroClasspath
191
+ ? ''
192
+ : match.replace(coordinate, DARO_GRADLE_PLUGIN_CLASSPATH),
193
+ });
194
+ hasDaroClasspath = true;
195
+ }
196
+ for (const { index, length, replacement } of changes.reverse()) {
197
+ contents =
198
+ contents.slice(0, index) + replacement + contents.slice(index + length);
113
199
  }
114
- if (!contents.includes(MAX_QUALITY_CLASSPATH)) {
115
- contents = replaceOrThrow(contents, /dependencies\s*\{/, (match) => `${match}\n classpath("${MAX_QUALITY_CLASSPATH}")`, 'a buildscript dependencies block');
200
+ if (!hasDaroClasspath) {
201
+ contents = addBuildscriptClasspath(contents, DARO_GRADLE_PLUGIN_CLASSPATH);
202
+ }
203
+ if (!hasQualityClasspath) {
204
+ contents = addBuildscriptClasspath(contents, MAX_QUALITY_CLASSPATH);
116
205
  }
117
206
  contents = addMavenRepositories(contents, /allprojects\s*\{[\s\S]*?repositories\s*\{/, DARO_MAVEN_REPOS, 'an allprojects repositories block');
118
207
  contents = addAppLovinBuildscriptRepository(contents);
@@ -139,6 +228,11 @@ const withAndroidConfiguration = (config, props) => {
139
228
  // 3. gradle.properties: daroIntegrationKey + Jetifier
140
229
  // so.daro 플러그인이 빌드타임에 이 속성을 풀어 manifestPlaceholders 를 채운다.
141
230
  return (0, config_plugins_1.withGradleProperties)(config, (propertiesConfig) => {
231
+ const workaround = props.safedkConfigurationCacheWorkaround;
232
+ if (workaround !== undefined && typeof workaround !== 'boolean') {
233
+ throw new Error('[daro-react-native] "android.safedkConfigurationCacheWorkaround" ' +
234
+ 'must be a boolean (true or false) when provided.');
235
+ }
142
236
  if (!props.daroIntegrationKey?.trim()) {
143
237
  throw new Error('[daro-react-native] "android.daroIntegrationKey" is required. ' +
144
238
  'Set it to the INTEGRATION KEY issued for your Android app.');
@@ -164,6 +258,11 @@ const withAndroidConfiguration = (config, props) => {
164
258
  ...new Set([...existingIgnorelist, ...JETIFIER_IGNORELIST_ENTRIES]),
165
259
  ].join(','),
166
260
  });
261
+ // 명시된 값만 같은 키를 덮어쓴다. 미지정이면 기존 값을 그대로 두고 없으면 만들지 않는다.
262
+ if (workaround !== undefined) {
263
+ propertiesConfig.modResults = propertiesConfig.modResults.filter((item) => !(item.type === 'property' && item.key === SAFEDK_WORKAROUND_KEY));
264
+ entries.push({ key: SAFEDK_WORKAROUND_KEY, value: String(workaround) });
265
+ }
167
266
  for (const { key, value } of entries) {
168
267
  const existingIndex = propertiesConfig.modResults.findIndex((item) => item.type === 'property' && item.key === key);
169
268
  const entry = { type: 'property', key, value };
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
21
21
  ]
22
22
  s.private_header_files = "ios/**/*.h"
23
23
 
24
- s.dependency "DaroAds", "2.0.1"
24
+ s.dependency "DaroAds", "2.0.2-rc.2"
25
25
 
26
26
  install_modules_dependencies(s)
27
27
  end