Skip to content

Commit

Permalink
Merge pull request #523 from DataDog/louiszawadzki/migrate-ios-sdk-v2
Browse files Browse the repository at this point in the history
Migrate native SDKs to v2
  • Loading branch information
louiszawadzki authored Sep 21, 2023
2 parents f2333b8 + e2ef306 commit 1157f6d
Show file tree
Hide file tree
Showing 43 changed files with 2,005 additions and 1,419 deletions.
9 changes: 9 additions & 0 deletions example-new-architecture/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ dependencies {
} else {
implementation jscFlavor
}

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
46 changes: 35 additions & 11 deletions example-new-architecture/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
PODS:
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- DatadogSDK (1.22.0)
- DatadogSDKCrashReporting (1.22.0):
- DatadogSDK (= 1.22.0)
- PLCrashReporter (~> 1.11.0)
- DatadogCore (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogCrashReporting (2.2.1):
- DatadogInternal (= 2.2.1)
- PLCrashReporter (~> 1.11.1)
- DatadogInternal (2.2.1)
- DatadogLogs (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogRUM (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogSDKReactNative (1.8.5):
- DatadogSDK (~> 1.22.0)
- DatadogSDKCrashReporting (~> 1.22.0)
- DatadogCore (~> 2.2.1)
- DatadogCrashReporting (~> 2.2.1)
- DatadogLogs (~> 2.2.1)
- DatadogRUM (~> 2.2.1)
- DatadogTrace (~> 2.2.1)
- DatadogWebViewTracking (~> 2.2.1)
- RCT-Folly (= 2021.07.22.00)
- RCTRequired
- RCTTypeSafety
Expand All @@ -16,6 +26,10 @@ PODS:
- React-RCTFabric
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- DatadogTrace (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogWebViewTracking (2.2.1):
- DatadogInternal (= 2.2.1)
- DoubleConversion (1.1.6)
- FBLazyVector (0.71.10)
- FBReactNativeSpec (0.71.10):
Expand Down Expand Up @@ -839,8 +853,13 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- CocoaAsyncSocket
- DatadogSDK
- DatadogSDKCrashReporting
- DatadogCore
- DatadogCrashReporting
- DatadogInternal
- DatadogLogs
- DatadogRUM
- DatadogTrace
- DatadogWebViewTracking
- Flipper
- Flipper-Boost-iOSX
- Flipper-DoubleConversion
Expand Down Expand Up @@ -940,9 +959,14 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DatadogSDK: 46e1a7363bc3130fae151ec4aedf11ea291517c5
DatadogSDKCrashReporting: 24a0e6ec6db905cdeb174721962a7941b2f8a9d2
DatadogSDKReactNative: f5aebd969f859454689ca16326520c65a4eb3725
DatadogCore: 12218dd1bed5db394c5e26ec59dd793413ae55b9
DatadogCrashReporting: d094c1eb1ecce59dbb6b1062b2e524dfa6579fc9
DatadogInternal: bfa2b823bd47511425d696d36a1bc77c4d06b2f4
DatadogLogs: a0eafa7bd2103511eac07bcd2ff95c851123e29b
DatadogRUM: 1e027ccfe4ba1eb81a185f3c58e0909bb12811be
DatadogSDKReactNative: 1c9c8a495f19bc77059c4d131d5b3be91b34bb7e
DatadogTrace: 74dc91a7a80e746dc4ef1af6d0db1735b5bfd993
DatadogWebViewTracking: 9ca93299a2c900c68ba080f6e800fae1fa3c6b61
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ddb55c55295ea51ed98aa7e2e08add2f826309d5
FBReactNativeSpec: 33a87f65f1a467d5f63d11d0cc106a10d3b0639d
Expand Down
32 changes: 32 additions & 0 deletions example-new-architecture/metro.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
const path = require('path');
const exclusionList = require('metro-config/src/defaults/exclusionList');
const escape = require('escape-string-regexp');
const pakCore = require('../packages/core/package.json');

const root = path.resolve(__dirname, '..');

const modules = Object.keys({
...pakCore.peerDependencies,
});

module.exports = {
projectRoot: __dirname,
watchFolders: [root],

// We need to make sure that only one version is loaded for peerDependencies
// So we blacklist them at the root, and alias them to the versions in example's node_modules
// This block is very important, because otherwise things like React can be packed multiple times
// while it should be only one React instance in the runtime. exclusionList relies on the modules which are
// declared as peer dependencies in the core package.
resolver: {
blacklistRE: exclusionList(
modules.map(
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
),
),

extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
}, {}),
},

transformer: {
getTransformOptions: async () => ({
transform: {
Expand Down
9 changes: 9 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ dependencies {
} else {
implementation jscFlavor
}

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
3 changes: 1 addition & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

buildscript {
ext {
RNNKotlinVersion = "1.5.31"
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
Expand All @@ -16,7 +15,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21"
classpath("com.android.tools.build:gradle:7.3.1")
classpath("com.facebook.react:react-native-gradle-plugin")
}
Expand Down
4 changes: 3 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ if linkage != nil
end

target 'ddSdkReactnativeExample' do
pod 'DatadogSDKReactNative', :path => '../../packages/core/DatadogSDKReactNative.podspec', :testspecs => ['Tests']

config = use_native_modules!

# Flags change depending on the env values.
Expand Down Expand Up @@ -59,7 +61,7 @@ target 'ddSdkReactnativeExample' do
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
# Enable `DD_SDK_COMPILED_FOR_TESTING` condition when compiling `DatadogSDK` dependency:
datadog_sdk_target = installer.pods_project.targets.detect {|t| t.name == "DatadogSDK" }
datadog_sdk_target = installer.pods_project.targets.detect {|t| ["DatadogCore", "DatadogRUM", "DatadogLogs", "DatadogInternal", "DatadogTrace", "DatadogCrashReporting"].include?(t.name) }
datadog_sdk_target.build_configurations.each do |config|
config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = '$(inherited) DD_SDK_COMPILED_FOR_TESTING'
end
Expand Down
61 changes: 47 additions & 14 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
PODS:
- boost (1.76.0)
- DatadogSDK (1.22.0)
- DatadogSDKCrashReporting (1.22.0):
- DatadogSDK (= 1.22.0)
- PLCrashReporter (~> 1.11.0)
- DatadogCore (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogCrashReporting (2.2.1):
- DatadogInternal (= 2.2.1)
- PLCrashReporter (~> 1.11.1)
- DatadogInternal (2.2.1)
- DatadogLogs (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogRUM (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogSDKReactNative (1.8.5):
- DatadogSDK (~> 1.22.0)
- DatadogSDKCrashReporting (~> 1.22.0)
- DatadogCore (~> 2.2.1)
- DatadogCrashReporting (~> 2.2.1)
- DatadogLogs (~> 2.2.1)
- DatadogRUM (~> 2.2.1)
- DatadogTrace (~> 2.2.1)
- DatadogWebViewTracking (~> 2.2.1)
- React-Core
- DatadogSDKReactNative/Tests (1.8.5):
- DatadogCore (~> 2.2.1)
- DatadogCrashReporting (~> 2.2.1)
- DatadogLogs (~> 2.2.1)
- DatadogRUM (~> 2.2.1)
- DatadogTrace (~> 2.2.1)
- DatadogWebViewTracking (~> 2.2.1)
- React-Core
- DatadogTrace (2.2.1):
- DatadogInternal (= 2.2.1)
- DatadogWebViewTracking (2.2.1):
- DatadogInternal (= 2.2.1)
- DoubleConversion (1.1.6)
- FBLazyVector (0.71.10)
- FBReactNativeSpec (0.71.10):
Expand Down Expand Up @@ -387,7 +409,8 @@ PODS:

DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- "DatadogSDKReactNative (from `../node_modules/@datadog/mobile-react-native`)"
- DatadogSDKReactNative (from `../../packages/core/DatadogSDKReactNative.podspec`)
- DatadogSDKReactNative/Tests (from `../../packages/core/DatadogSDKReactNative.podspec`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
Expand Down Expand Up @@ -433,8 +456,13 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- DatadogSDK
- DatadogSDKCrashReporting
- DatadogCore
- DatadogCrashReporting
- DatadogInternal
- DatadogLogs
- DatadogRUM
- DatadogTrace
- DatadogWebViewTracking
- fmt
- HMSegmentedControl
- libevent
Expand All @@ -444,7 +472,7 @@ EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
DatadogSDKReactNative:
:path: "../node_modules/@datadog/mobile-react-native"
:path: "../../packages/core/DatadogSDKReactNative.podspec"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
Expand Down Expand Up @@ -528,9 +556,14 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
DatadogSDK: 46e1a7363bc3130fae151ec4aedf11ea291517c5
DatadogSDKCrashReporting: 24a0e6ec6db905cdeb174721962a7941b2f8a9d2
DatadogSDKReactNative: 1cd2c5ca0673e9fc83ad4b44b2c14f90cce9d53c
DatadogCore: 12218dd1bed5db394c5e26ec59dd793413ae55b9
DatadogCrashReporting: d094c1eb1ecce59dbb6b1062b2e524dfa6579fc9
DatadogInternal: bfa2b823bd47511425d696d36a1bc77c4d06b2f4
DatadogLogs: a0eafa7bd2103511eac07bcd2ff95c851123e29b
DatadogRUM: 1e027ccfe4ba1eb81a185f3c58e0909bb12811be
DatadogSDKReactNative: 6f16f15e8b3d5a60c5799d604843a0feb2010c9b
DatadogTrace: 74dc91a7a80e746dc4ef1af6d0db1735b5bfd993
DatadogWebViewTracking: 9ca93299a2c900c68ba080f6e800fae1fa3c6b61
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ddb55c55295ea51ed98aa7e2e08add2f826309d5
FBReactNativeSpec: 90fc1a90b4b7a171e0a7c20ea426c1bf6ce4399c
Expand Down Expand Up @@ -576,6 +609,6 @@ SPEC CHECKSUMS:
RNScreens: f7ad633b2e0190b77b6a7aab7f914fad6f198d8d
Yoga: e7ea9e590e27460d28911403b894722354d73479

PODFILE CHECKSUM: ffc581c91d71c08d4a9374af21697b3d934fc7cf
PODFILE CHECKSUM: 59a4878659fbb7b053887dd9eec3df44ca9e0b28

COCOAPODS: 1.12.1
4 changes: 2 additions & 2 deletions example/ios/PodfileForTests
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ target 'ddSdkReactnativeExample' do
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

target 'ddSdkReactnativeExampleTests' do
inherit! :complete
# Pods for testing
Expand All @@ -59,7 +59,7 @@ target 'ddSdkReactnativeExample' do
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
# Enable `DD_SDK_COMPILED_FOR_TESTING` condition when compiling `DatadogSDK` dependency:
datadog_sdk_target = installer.pods_project.targets.detect {|t| t.name == "DatadogSDK" }
datadog_sdk_target = installer.pods_project.targets.detect {|t| ["DatadogCore", "DatadogRUM", "DatadogLogs", "DatadogInternal", "DatadogTrace", "DatadogCrashReporting"].include?(t.name) }
datadog_sdk_target.build_configurations.each do |config|
config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = '$(inherited) DD_SDK_COMPILED_FOR_TESTING'
end
Expand Down
10 changes: 7 additions & 3 deletions packages/core/DatadogSDKReactNative.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ Pod::Spec.new do |s|
s.source_files = "ios/Sources/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency 'DatadogSDK', '~> 1.22.0'
s.dependency 'DatadogSDKCrashReporting', '~> 1.22.0'

s.dependency 'DatadogCore', '~> 2.2.1'
s.dependency 'DatadogLogs', '~> 2.2.1'
s.dependency 'DatadogTrace', '~> 2.2.1'
s.dependency 'DatadogRUM', '~> 2.2.1'
s.dependency 'DatadogCrashReporting', '~> 2.2.1'
s.dependency 'DatadogWebViewTracking', '~> 2.2.1'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'ios/Tests/*.swift'
end
Expand Down
8 changes: 5 additions & 3 deletions packages/core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.2.2'
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.1"
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.1"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.0"
classpath 'com.github.bjoernq:unmockplugin:0.7.9'
}
Expand Down Expand Up @@ -159,7 +159,10 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly "com.squareup.okhttp3:okhttp:3.12.13"

implementation "com.datadoghq:dd-sdk-android:1.19.2"
implementation "com.datadoghq:dd-sdk-android-rum:2.0.0"
implementation "com.datadoghq:dd-sdk-android-logs:2.0.0"
implementation "com.datadoghq:dd-sdk-android-trace:2.0.0"
implementation "com.datadoghq:dd-sdk-android-webview:2.0.0"
testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.6.2"
Expand Down Expand Up @@ -204,7 +207,6 @@ ktlint {
outputToConsole.set(true)
ignoreFailures.set(false)
enableExperimentalRules.set(false)
additionalEditorconfigFile.set(file("${project.rootDir}/script/config/.editorconfig"))
filter {
exclude("**/generated/**")
include("**/kotlin/**")
Expand Down
2 changes: 1 addition & 1 deletion packages/core/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DdSdkReactNative_kotlinVersion=1.6.21
DdSdkReactNative_kotlinVersion=1.7.21
DdSdkReactNative_compileSdkVersion=31
DdSdkReactNative_buildToolsVersion=31.0.0
DdSdkReactNative_targetSdkVersion=31
Expand Down
Loading

0 comments on commit 1157f6d

Please sign in to comment.