diff --git a/packages/react-native-aztec/android/build.gradle b/packages/react-native-aztec/android/build.gradle index e98616cef2b334..41e40c63c9e152 100644 --- a/packages/react-native-aztec/android/build.gradle +++ b/packages/react-native-aztec/android/build.gradle @@ -161,14 +161,14 @@ def addDependenciesToPom(pom) { def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies') // Iterate over the implementation dependencies, adding a node for each - configurations.implementation.allDependencies.findAll { it instanceof ExternalDependency }.each { - if (it.name != 'unspecified') { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', it.group) - dependencyNode.appendNode('artifactId', it.name) - dependencyNode.appendNode('version', it.version) - } - } + configurations.implementation.allDependencies + .findAll { it instanceof ExternalDependency && it.name != 'unspecified' } + .each { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', it.group) + dependencyNode.appendNode('artifactId', it.name) + dependencyNode.appendNode('version', it.version) + } } } diff --git a/packages/react-native-bridge/android/build.gradle b/packages/react-native-bridge/android/build.gradle index bbbe66fc2f8e4f..8cfc502b6587e6 100644 --- a/packages/react-native-bridge/android/build.gradle +++ b/packages/react-native-bridge/android/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - willPublishReactNativeBridgeBinary = gradle.ext.willPublishReactNativeBridgeBinary + willPublishReactNativeBridgeBinary = properties["publishReactNativeBridgeVersion"]?.trim() as boolean } repositories { jcenter() diff --git a/packages/react-native-bridge/android/hermes-debug/build.gradle b/packages/react-native-bridge/android/hermes-debug/build.gradle deleted file mode 100644 index 9837644fdd88c1..00000000000000 --- a/packages/react-native-bridge/android/hermes-debug/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -configurations.maybeCreate("default") -artifacts.add("default", file('../vendor/hermes-engine/hermes-debug.aar')) diff --git a/packages/react-native-bridge/android/hermes-release/build.gradle b/packages/react-native-bridge/android/hermes-release/build.gradle deleted file mode 100644 index c5c1c271d28309..00000000000000 --- a/packages/react-native-bridge/android/hermes-release/build.gradle +++ /dev/null @@ -1,2 +0,0 @@ -configurations.maybeCreate("default") -artifacts.add("default", file('../vendor/hermes-engine/hermes-release.aar')) diff --git a/packages/react-native-bridge/android/react-native-bridge/build.gradle b/packages/react-native-bridge/android/react-native-bridge/build.gradle index f3a5c77e3461a9..2d7de665e67351 100644 --- a/packages/react-native-bridge/android/react-native-bridge/build.gradle +++ b/packages/react-native-bridge/android/react-native-bridge/build.gradle @@ -67,10 +67,9 @@ android { repositories { google() jcenter() - maven { - url "https://dl.bintray.com/wordpress-mobile/maven" - } + maven { url "https://dl.bintray.com/wordpress-mobile/maven" } maven { url "https://jitpack.io" } + maven { url "https://a8c-libs.s3.amazonaws.com/android" } } dependencies { @@ -95,6 +94,7 @@ dependencies { implementation "com.github.wordpress-mobile:react-native-screens:${readHashedVersion('../../../react-native-editor/package.json', 'react-native-screens', 'dependencies')}" implementation "com.github.wordpress-mobile:react-native-safe-area-context:${readHashedVersion('../../../react-native-editor/package.json', 'react-native-safe-area-context', 'dependencies')}" implementation "com.github.wordpress-mobile:react-native-reanimated:${readHashedVersion('../../../react-native-editor/package.json', 'react-native-reanimated', 'dependencies')}" + runtimeOnly "org.wordpress-mobile:hermes-release-mirror:0.61.5" } else { api 'com.facebook.react:react-native:+' api project(':@wordpress_react-native-aztec') @@ -108,8 +108,8 @@ dependencies { api project(':react-native-screens') api project(':react-native-safe-area-context') api project(':react-native-reanimated') - debugRuntimeOnly project(":hermes-debug") - releaseRuntimeOnly project(":hermes-release") + debugRuntimeOnly "org.wordpress-mobile:hermes-debug-mirror:0.61.5" + releaseRuntimeOnly "org.wordpress-mobile:hermes-release-mirror:0.61.5" } } @@ -164,14 +164,21 @@ def addDependenciesToPom(pom) { pom.withXml { def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies') - // Iterate over the implementation dependencies, adding a node for each - configurations.implementation.allDependencies.findAll { it instanceof ExternalDependency }.each { - if (it.name != 'unspecified') { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', it.group) - dependencyNode.appendNode('artifactId', it.name) - dependencyNode.appendNode('version', it.version) - } + def addDependencies = { configuration, addExtraNode = {} -> + configuration.allDependencies + .findAll { it instanceof ExternalDependency && it.name != 'unspecified' } + .each { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', it.group) + dependencyNode.appendNode('artifactId', it.name) + dependencyNode.appendNode('version', it.version) + addExtraNode(dependencyNode) + } + } + + addDependencies(configurations.implementation) + addDependencies(configurations.runtimeOnly) { dependencyNode -> + dependencyNode.appendNode('scope', 'runtime') } } } diff --git a/packages/react-native-bridge/android/settings.gradle b/packages/react-native-bridge/android/settings.gradle index a129a5be41dbde..cbabc35ea7026b 100644 --- a/packages/react-native-bridge/android/settings.gradle +++ b/packages/react-native-bridge/android/settings.gradle @@ -10,48 +10,28 @@ include ':react-native-bridge' include ':@wordpress_react-native-aztec' project(':@wordpress_react-native-aztec').projectDir = new File(rootProject.projectDir, '../../react-native-aztec/android') -def publishReactNativeBridgeVersion = properties["publishReactNativeBridgeVersion"] -gradle.ext.willPublishReactNativeBridgeBinary = publishReactNativeBridgeVersion?.trim() as boolean +assert file("../../../node_modules").exists() : "node_modules folder is missing. Please run `npm install` from the root Gutenberg project" -// Only add these modules/projects if we are not building to publish a binary. -// TODO: This is a very fragile check. Since the `settings.gradle` file is part of initialization, -// it'll not work for even simple tasks such as `./gradlew clean` unless the -// `publishReactNativeBridgeVersion` property is passed. It's a necessary check for the moment, -// however by moving the Hermes binary to remote and maybe using dependency substitution for the -// included projects, we can get rid of it. -if (!gradle.ext.willPublishReactNativeBridgeBinary) { - /* - IMPORTANT: DO NOT add hermes modules if we are building a binary to publish. - If these modules are added, it'll cause the `com.facebook.hermes.BuildConfig` file to be - included in the binary which will then result in a duplicate class error. - This seems to happen even if these modules are not added as a dependency. - */ - include ':hermes-debug' - include ':hermes-release' - - assert file("../../../node_modules").exists() : "node_modules folder is missing. Please run `npm install` from the root Gutenberg project" - - include ':react-native-linear-gradient' - project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-linear-gradient/android') - include ':react-native-svg' - project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-svg/android') - include ':react-native-aztec' - project(':react-native-aztec').projectDir = new File(rootProject.projectDir, '../../../packages/react-native-aztec/android') - include ':react-native-video' - project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-video/android-exoplayer') - include ':@react-native-community_slider' - project(':@react-native-community_slider').projectDir = new File(rootProject.projectDir, '../../../node_modules/@react-native-community/slider/src/android') - include ':react-native-get-random-values' - project(':react-native-get-random-values').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-get-random-values/android') - include ':@react-native-community_masked-view' - project(':@react-native-community_masked-view').projectDir = new File(rootProject.projectDir, '../../../node_modules/@react-native-community/masked-view/android') - include ':react-native-gesture-handler' - project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-gesture-handler/android') - include ':react-native-screens' - project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-screens/android') - include ':react-native-safe-area-context' - project(':react-native-safe-area-context').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-safe-area-context/android') - include ':react-native-reanimated' - project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-reanimated/android') -} +include ':react-native-linear-gradient' +project(':react-native-linear-gradient').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-linear-gradient/android') +include ':react-native-svg' +project(':react-native-svg').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-svg/android') +include ':react-native-aztec' +project(':react-native-aztec').projectDir = new File(rootProject.projectDir, '../../../packages/react-native-aztec/android') +include ':react-native-video' +project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-video/android-exoplayer') +include ':@react-native-community_slider' +project(':@react-native-community_slider').projectDir = new File(rootProject.projectDir, '../../../node_modules/@react-native-community/slider/src/android') +include ':react-native-get-random-values' +project(':react-native-get-random-values').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-get-random-values/android') +include ':@react-native-community_masked-view' +project(':@react-native-community_masked-view').projectDir = new File(rootProject.projectDir, '../../../node_modules/@react-native-community/masked-view/android') +include ':react-native-gesture-handler' +project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-gesture-handler/android') +include ':react-native-screens' +project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-screens/android') +include ':react-native-safe-area-context' +project(':react-native-safe-area-context').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-safe-area-context/android') +include ':react-native-reanimated' +project(':react-native-reanimated').projectDir = new File(rootProject.projectDir, '../../../node_modules/react-native-reanimated/android') diff --git a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-cppruntime-debug.aar b/packages/react-native-bridge/android/vendor/hermes-engine/hermes-cppruntime-debug.aar deleted file mode 100644 index 3a2ad8cf05a57c..00000000000000 Binary files a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-cppruntime-debug.aar and /dev/null differ diff --git a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-cppruntime-release.aar b/packages/react-native-bridge/android/vendor/hermes-engine/hermes-cppruntime-release.aar deleted file mode 100644 index 5256ff80d55df3..00000000000000 Binary files a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-cppruntime-release.aar and /dev/null differ diff --git a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-debug.aar b/packages/react-native-bridge/android/vendor/hermes-engine/hermes-debug.aar deleted file mode 100644 index 74bd4ae5cba723..00000000000000 Binary files a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-debug.aar and /dev/null differ diff --git a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-release.aar b/packages/react-native-bridge/android/vendor/hermes-engine/hermes-release.aar deleted file mode 100644 index cc208310ea2d54..00000000000000 Binary files a/packages/react-native-bridge/android/vendor/hermes-engine/hermes-release.aar and /dev/null differ