@datadog/mobile-react-native 1.8.4 → 1.9.0

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.
@@ -84,6 +84,16 @@ def getExtOrIntegerDefault(name) {
84
84
  android {
85
85
  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
86
86
  buildToolsVersion getExtOrDefault('buildToolsVersion')
87
+ def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
88
+ if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
89
+ namespace = "com.datadog.reactnative"
90
+ }
91
+ if (agpVersion.tokenize('.')[0].toInteger() >= 8) {
92
+ buildFeatures {
93
+ buildConfig = true
94
+ }
95
+ }
96
+
87
97
  defaultConfig {
88
98
  minSdkVersion 21
89
99
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
@@ -26,11 +26,10 @@ afterEvaluate {
26
26
  " define versionName property in the application/variant config.")
27
27
  }
28
28
 
29
- // locations and names are defined in "../../node_modules/react-native/react.gradle"
30
- def targetName = variant.name.capitalize() // e.g. Release
31
- def targetPath = variant.dirName // e.g. release
29
+ def reactConfig = getReactConfig(buildDir, variant)
30
+ def targetName = reactConfig["targetName"]
31
+ def targetPath = reactConfig["targetPath"]
32
32
 
33
- def reactConfig = getReactConfig(buildDir, targetName, targetPath)
34
33
  def reactRoot = file(reactConfig.root)
35
34
 
36
35
  def bundleTask = tasks.findByName(reactConfig.bundleTaskName)
@@ -58,8 +57,7 @@ afterEvaluate {
58
57
 
59
58
  def execCommand = { jsBundleFile ->
60
59
  return [
61
- "yarn",
62
- "datadog-ci",
60
+ "$reactConfig.root/node_modules/.bin/datadog-ci",
63
61
  "react-native",
64
62
  "upload",
65
63
  "--platform",
@@ -88,7 +86,6 @@ afterEvaluate {
88
86
  }
89
87
 
90
88
  runShellCommand(execCommand(jsBundleFile), reactRoot)
91
-
92
89
  }
93
90
  }
94
91
 
@@ -105,7 +102,7 @@ afterEvaluate {
105
102
  private def getBundleFileResolver(String[] jsBundleDirs, String bundleAssetName) {
106
103
  def resolver = { ->
107
104
  return jsBundleDirs.collect {
108
- file("$it/$bundleAssetName")
105
+ file("$it/$bundleAssetName")
109
106
  }.find {
110
107
  it.exists()
111
108
  }
@@ -121,34 +118,50 @@ private def getBundleFileResolver(String[] jsBundleDirs, String bundleAssetName)
121
118
  * (and then "$buildDir/generated/assets/createBundle${targetPath}JsAndAssets" with the release of Android Gradle Plugin 7.4, see https://github.com/facebook/react-native/issues/35439)
122
119
  * - config was in "project.react" and is now in "project.extensions.react"
123
120
  * - accessing parameters values requires calling a getter
121
+ * - target path changed from variant.dirName to variant.name
124
122
  */
125
- private def getReactConfig(File buildDir, String targetName, String targetPath) {
123
+ private def getReactConfig(File buildDir, variant) {
126
124
  def reactConfig = [:]
127
125
 
128
126
  if (project.extensions.findByName("react")) {
129
127
  // From RN 0.71
128
+ // Locations and names are defined in "node_modules/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt"
130
129
  def bundleAssetName = project.extensions.react.bundleAssetName.get() ?: "index.android.bundle"
130
+ def targetName = variant.name.capitalize()
131
+ def targetPath = variant.name
131
132
  reactConfig['bundleTaskName'] = "createBundle${targetName}JsAndAssets"
132
133
  reactConfig['bundleFileResolver'] = getBundleFileResolver([
133
134
  "$buildDir/ASSETS/createBundle${targetName}JsAndAssets", // Android Gradle Plugin 7.3
134
135
  "$buildDir/generated/assets/createBundle${targetName}JsAndAssets" // Android Gradle Plugin 7.4 and up
135
136
  ] as String[], bundleAssetName)
136
137
  reactConfig['bundleAssetName'] = bundleAssetName
138
+ reactConfig['targetPath'] = targetPath
139
+ reactConfig['targetName'] = targetName
137
140
  reactConfig['root'] = project.extensions.react.root.get() ?: "../../"
138
141
  } else if (project.hasProperty("react")) {
139
142
  // WARNING: on RN 0.71, `project.react` is an empty map, so this `if` must go after the previous one.
140
143
  // Legacy way, before RN 0.71
144
+ // Locations and names are defined in "node_modules/react-native/react.gradle"
145
+ def targetName = variant.name.capitalize()
146
+ def targetPath = variant.dirName
141
147
  def bundleAssetName = project.react.bundleAssetName ?: "index.android.bundle"
142
148
  reactConfig['bundleTaskName'] = "bundle${targetName}JsAndAssets"
143
149
  reactConfig['bundleFileResolver'] = getBundleFileResolver(["$buildDir/generated/assets/react/${targetPath}"] as String[], bundleAssetName)
144
150
  reactConfig['bundleAssetName'] = bundleAssetName
151
+ reactConfig['targetPath'] = targetPath
152
+ reactConfig['targetName'] = targetName
145
153
  reactConfig['root'] = project.react.root ?: "../../"
146
154
  } else {
147
155
  // We assume this cannot happen with RN >= 0.71, so we use the legacy default values
156
+ // Locations and names are defined in "node_modules/react-native/react.gradle"
157
+ def targetName = variant.name.capitalize()
158
+ def targetPath = variant.dirName
148
159
  def bundleAssetName = "index.android.bundle"
149
160
  reactConfig['bundleTaskName'] = "bundle${targetName}JsAndAssets"
150
161
  reactConfig['bundleFileResolver'] = getBundleFileResolver(["$buildDir/generated/assets/react/${targetPath}"] as String[], bundleAssetName)
151
162
  reactConfig['bundleAssetName'] = bundleAssetName
163
+ reactConfig['targetPath'] = targetPath
164
+ reactConfig['targetName'] = targetName
152
165
  reactConfig['root'] = "../../"
153
166
  }
154
167
 
@@ -44,14 +44,13 @@ public class DdTraceImplementation: NSObject {
44
44
  public func finishSpan(spanId: NSString, context: NSDictionary, timestampMs: Double, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
45
45
  objc_sync_enter(self)
46
46
  let optionalSpan = spanDictionary.removeValue(forKey: spanId)
47
- objc_sync_exit(self)
48
-
49
47
  if let span = optionalSpan {
50
48
  set(tags: castAttributesToSwift(context).mergeWithGlobalAttributes(), to: span)
51
49
  let timeIntervalSince1970: TimeInterval = timestampMs / 1_000
52
50
  span.finish(at: Date(timeIntervalSince1970: timeIntervalSince1970))
53
51
  }
54
-
52
+ objc_sync_exit(self)
53
+
55
54
  resolve(nil)
56
55
  }
57
56
 
package/jest/mock.js CHANGED
@@ -18,6 +18,7 @@ const actualDatadog = jest.requireActual('@datadog/mobile-react-native');
18
18
  const DatadogProviderMock = ({ children }) => {
19
19
  return <>{children}</>;
20
20
  };
21
+ DatadogProviderMock.initialize = jest.fn().mockResolvedValue();
21
22
 
22
23
  module.exports = {
23
24
  ...actualDatadog,
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = '1.8.4';
8
+ const version = '1.9.0';
9
9
  exports.version = version;
10
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.8.4';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.9.0';\n"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '1.8.4';
2
+ export const version = '1.9.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.8.4';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.9.0';\n"]}
@@ -1 +1 @@
1
- export declare const version = "1.8.4";
1
+ export declare const version = "1.9.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "1.8.4",
3
+ "version": "1.9.0",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -86,5 +86,5 @@
86
86
  "javaPackageName": "com.datadog.reactnative"
87
87
  }
88
88
  },
89
- "gitHead": "f1a99e7f43ace289d107f38d94e265d413d07bac"
89
+ "gitHead": "83bae8e19d5a0a84fd57bdeea2b0b49009cdbeb5"
90
90
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '1.8.4';
2
+ export const version = '1.9.0';