Skip to content

Commit

Permalink
build(deps): integrate Detox as android compile dependency for RN68+
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy committed Apr 27, 2022
1 parent 1153cb6 commit 1363ffd
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
3 changes: 2 additions & 1 deletion RNGoogleMobileAdsExample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ android {
defaultConfig {
testBuildType System.getProperty("testBuildType", "debug")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
missingDimensionStrategy "detox", "full"
applicationId "com.rngooglemobileadsexample"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
Expand Down Expand Up @@ -264,7 +265,7 @@ android {
}

dependencies {
androidTestImplementation("com.wix:detox:+")
androidTestImplementation(project(path: ":detox"))
implementation fileTree(dir: "libs", include: ["*.jar"])

//noinspection GradleDynamicVersion
Expand Down
1 change: 0 additions & 1 deletion RNGoogleMobileAdsExample/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,5 @@ allprojects {
}
google()
maven { url 'https://www.jitpack.io' }
maven { url "$rootDir/../node_modules/detox/Detox-android" }
}
}
2 changes: 2 additions & 0 deletions RNGoogleMobileAdsExample/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'RNGoogleMobileAdsExample'
include ':detox'
project(':detox').projectDir = new File(rootProject.projectDir, '../node_modules/detox/android/detox')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/react-native-gradle-plugin')
Expand Down
2 changes: 1 addition & 1 deletion RNGoogleMobileAdsExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"detox": "^19.6.6",
"detox": "^19.6.7",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"jest-circus": "^28.0.2",
Expand Down
24 changes: 12 additions & 12 deletions RNGoogleMobileAdsExample/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1424,22 +1424,22 @@
chalk "^4.0.0"

"@jridgewell/gen-mapping@^0.1.0":
version "0.1.0"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.0.tgz#b30fd66b5426bb7f44bb6043ab127b20ee404063"
integrity sha512-YH+BnkvuCiPR+MUOY6JIArdTIGrRtsxnLaIxPRy4CpGJ/V6OO6Gq/1J+FJEc4j5e5h6Bcy3/K7prlMrm93BJoA==
version "0.1.1"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996"
integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==
dependencies:
"@jridgewell/set-array" "1.0.0"
"@jridgewell/set-array" "^1.0.0"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@jridgewell/resolve-uri@^3.0.3":
version "3.0.6"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz#4ac237f4dabc8dd93330386907b97591801f7352"
integrity sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==

"@jridgewell/[email protected]":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.0.0.tgz#6a8e62049ab198c5f7daf8047e71947ef46c11c8"
integrity sha512-LcqVnHCjOAj8BTCtjpwYZCMTn4yArusbdObCVRUYvBHhrR5fVLVyENG+UVWM4T4H/ufv7NiBLdprllxWs/5PaQ==
"@jridgewell/set-array@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.0.tgz#1179863356ac8fbea64a5a4bcde93a4871012c01"
integrity sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==

"@jridgewell/sourcemap-codec@^1.4.10":
version "1.4.11"
Expand Down Expand Up @@ -3033,10 +3033,10 @@ detect-newline@^3.0.0:
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==

detox@^19.6.6:
version "19.6.6"
resolved "https://registry.yarnpkg.com/detox/-/detox-19.6.6.tgz#b42af6ba2e07b8489441ed961b769b0d9b305b78"
integrity sha512-klqgpsLiQ7NCfzRth0ERQr0lr74hoSjRhsOKFqBj5yDTy7NrFINa0sKhkkMvKOdxubzGkvS+4kTy85rZ3kjpDA==
detox@^19.6.7:
version "19.6.7"
resolved "https://registry.yarnpkg.com/detox/-/detox-19.6.7.tgz#4b826603c923ced20b6983d2d2c416e453cf405f"
integrity sha512-/ff7I1JQegjVYN569RfITrJkkmAFm/zkj33UFAOL/JD/5GE29lSLetgSzhxli6aSiLkbASBxYng7kqAYoCD4DA==
dependencies:
ajv "^8.6.3"
bunyan "^1.8.12"
Expand Down
7 changes: 4 additions & 3 deletions refresh-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ echo "org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemo

# Detox + Android
echo "Integrating Detox for Android (maven repo, dependency, build config items, kotlin...)"
sed -i -e $'s/maven { url \'https\:\/\/www.jitpack.io\' }/maven { url \'https\:\/\/www.jitpack.io\' }\\\n maven \{ url "$rootDir\/..\/node_modules\/detox\/Detox-android" \}/' android/build.gradle
sed -i -e $'s/ext {/ext {\\\n kotlinVersion = "1.5.30"/' android/build.gradle
sed -i -e $'s/dependencies {/dependencies {\\\n classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"/' android/build.gradle
rm -f android/build.gradle??
sed -i -e $'s/dependencies {/dependencies {\\\n androidTestImplementation("com.wix:detox:+")/' android/app/build.gradle
sed -i -e $'s/defaultConfig {/defaultConfig {\\\n testBuildType System.getProperty("testBuildType", "debug")\\\n testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"/' android/app/build.gradle
sed -i -e $'s/dependencies {/dependencies {\\\n androidTestImplementation(project(path: ":detox"))/' android/app/build.gradle
sed -i -e $'s/defaultConfig {/defaultConfig {\\\n testBuildType System.getProperty("testBuildType", "debug")\\\n testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"\\\n missingDimensionStrategy "detox", "full"/' android/app/build.gradle
rm -f android/app/build.gradle??
sed -i -e $'s/rootProject.name = \'RNGoogleMobileAdsExample\'/rootProject.name = \'RNGoogleMobileAdsExample\'\\\ninclude \':detox\'\\\nproject(\':detox\').projectDir = new File(rootProject.projectDir, \'..\/node_modules\/detox\/android\/detox\')/' android/settings.gradle
rm -f android/settings.gradle??

# React-native builds on iOS are very noisy with warnings in other packages that drown our warnings out. Reduce warnings to just our packages.
sed -i -e $'s/react_native_post_install(installer)/react_native_post_install(installer)\\\n\\\n # quiet non-module warnings - only interested in google-mobile-ads warnings\\\n installer.pods_project.targets.each do |target|\\\n if !target.name.include? "react-native-google-mobile-ads"\\\n target.build_configurations.each do |config|\\\n config.build_settings["GCC_WARN_INHIBIT_ALL_WARNINGS"] = "YES"\\\n end\\\n end\\\n end/' ios/Podfile
Expand Down

0 comments on commit 1363ffd

Please sign in to comment.