From 2f47456a2dbb3580e6d6cd56e48189d53f43559f Mon Sep 17 00:00:00 2001 From: Dylan Oliver Date: Mon, 19 Sep 2022 14:32:13 -0400 Subject: [PATCH] chore: indirect aar dependency --- android/build.gradle | 53 +++++++++++++++++--------------- android/gradle.properties | 8 +++-- example/android/app/build.gradle | 3 +- example/android/build.gradle | 10 +++--- example/ios/Podfile.lock | 4 +-- example/package.json | 1 + example/yarn.lock | 10 ++++++ package.json | 2 +- 8 files changed, 55 insertions(+), 36 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 168c509..8a15251 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,21 +1,32 @@ buildscript { - // Buildscript is evaluated before everything else so we can't use getExtOrDefault - def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['ReactNative_kotlinVersion'] - repositories { - google() - mavenCentral() + ext.getExtOrDefault = { name -> + return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNative_' + name] } - dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' - // noinspection DifferentKotlinGradleVersion - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + if (project == rootProject) { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath 'com.android.tools.build:gradle:7.0.4' + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}") + } + } else { + repositories { + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}") + } } } def isNewArchitectureEnabled() { - return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" + return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" } apply plugin: 'com.android.library' @@ -55,6 +66,7 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } + buildToolsVersion ReactNative_buildToolsVersion } repositories { @@ -68,10 +80,7 @@ repositories { if (rootProject.ext.has('reactNativeAndroidRoot')) { defaultDir = rootProject.ext.get('reactNativeAndroidRoot') } else { - defaultDir = new File( - projectDir, - '/../../../node_modules/react-native/android' - ) + defaultDir = new File( projectDir, '/../../../node_modules/react-native/android' ) } if (defaultDir.exists()) { @@ -89,15 +98,9 @@ repositories { if (found) return true parentDir = parentDir.parentFile - def androidSourcesDir = new File( - parentDir, - 'node_modules/react-native' - ) + def androidSourcesDir = new File( parentDir, 'node_modules/react-native' ) - def androidPrebuiltBinaryDir = new File( - parentDir, - 'node_modules/react-native/android' - ) + def androidPrebuiltBinaryDir = new File( parentDir, 'node_modules/react-native/android' ) if (androidPrebuiltBinaryDir.exists()) { maven { @@ -122,7 +125,7 @@ repositories { if (!found) { throw new GradleException( "${project.name}: unable to locate React Native android sources. " + - "Ensure you have you installed React Native as a dependency in your project and try again." + "Ensure you have you installed React Native as a dependency in your project and try again." ) } } @@ -133,8 +136,8 @@ dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation files('libs/gowaku.aar') -// From node_modules + compileOnly files('libs/gowaku.aar') + // From node_modules } if (isNewArchitectureEnabled()) { diff --git a/android/gradle.properties b/android/gradle.properties index c307ca3..e02f951 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,9 @@ -ReactNative_kotlinVersion=1.7.0 +ReactNative_kotlinVersion=1.6.0 ReactNative_minSdkVersion=21 ReactNative_targetSdkVersion=31 ReactNative_compileSdkVersion=31 -ReactNative_ndkversion=21.4.7075529 +ReactNative_ndkversion=24.0.8215888 +ReactNative_buildToolsVersion=31.0.0 +android.useAndroidX=true +android.enableJetifier=true +org.gradle.jvmargs=-XX:+UseParallelGC diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index d1dd0b1..3fc4309 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -260,8 +260,7 @@ android { } dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - + implementation fileTree(dir: "../../../android/libs", include: ["*.aar", "*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules diff --git a/example/android/build.gradle b/example/android/build.gradle index 5dfc68a..8039e74 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -22,17 +22,19 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:7.0.4") + classpath("com.android.tools.build:gradle:7.0.4") classpath("com.facebook.react:react-native-gradle-plugin") - classpath("de.undercouch:gradle-download-task:4.1.2") - // NOTE: Do not place your application dependencies here; they belong + // classpath("de.undercouch:gradle-download-task:4.1.2") + classpath("de.undercouch:gradle-download-task:5.0.1") + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { - maven { + // maven { url("$rootDir/../android/gowaku") } + maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 15f0707..6624d81 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -366,7 +366,7 @@ PODS: - React-logger (= 0.68.2) - React-perflogger (= 0.68.2) - SocketRocket (0.6.0) - - waku-react-native (0.0.4): + - waku-react-native (0.0.5): - React-Core - Yoga (1.14.0) - YogaKit (1.18.1): @@ -567,7 +567,7 @@ SPEC CHECKSUMS: React-runtimeexecutor: b960b687d2dfef0d3761fbb187e01812ebab8b23 ReactCommon: 095366164a276d91ea704ce53cb03825c487a3f2 SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 - waku-react-native: 569e0f4efd02ca2ddea2db168365841891db973c + waku-react-native: 0d820d39e9348de21d150d4a258b4e24edb65d97 Yoga: 99652481fcd320aefa4a7ef90095b95acd181952 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/example/package.json b/example/package.json index 9994982..5469a6a 100644 --- a/example/package.json +++ b/example/package.json @@ -11,6 +11,7 @@ "postinstall": "patch-package" }, "dependencies": { + "@waku/react-native": "../", "react": "17.0.2", "react-native": "0.68.2" }, diff --git a/example/yarn.lock b/example/yarn.lock index 86f9ab3..806a70d 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -1027,6 +1027,11 @@ dependencies: "@types/yargs-parser" "*" +"@waku/react-native@../": + version "0.0.5" + dependencies: + base-64 "^1.0.0" + "@yarnpkg/lockfile@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" @@ -1274,6 +1279,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base-64@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/base-64/-/base-64-1.0.0.tgz#09d0f2084e32a3fd08c2475b973788eee6ae8f4a" + integrity sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg== + base64-js@^1.1.2, base64-js@^1.3.1, base64-js@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" diff --git a/package.json b/package.json index 4b22345..3ded3ac 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "pod-install": "^0.1.0", "prettier": "^2.0.5", "react": "17.0.2", - "react-native": "0.68.2", + "react-native": "^0.69", "react-native-builder-bob": "^0.18.3", "release-it": "^15.0.0", "typescript": "^4.5.2"