From 800c12102ebdba128b61c86aeed69be5aa2499bd Mon Sep 17 00:00:00 2001 From: Kaweh Ebrahimi-Far Date: Sat, 9 May 2020 13:49:37 +0200 Subject: [PATCH 1/6] Retrieve react-native version from package.json This makes range parameter (+) obsolete. --- react-native-aztec/android/build.gradle | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/react-native-aztec/android/build.gradle b/react-native-aztec/android/build.gradle index 7b20742429..39951408bb 100644 --- a/react-native-aztec/android/build.gradle +++ b/react-native-aztec/android/build.gradle @@ -84,12 +84,12 @@ repositories { maven { url "https://jitpack.io" } - if (!rootProject.ext.buildGutenbergFromSource) { + if (!rootProject.ext.buildGutenbergFromSource) { // if not building from source (where the node_modules dir is used), use a remote RN maven repo def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' println "Will use the RN maven repo at ${reactNativeRepo}" maven { url reactNativeRepo } - } + } } dependencies { @@ -109,13 +109,14 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' - if (rootProject.ext.buildGutenbergFromSource) { - implementation "com.facebook.react:react-native:+" // From node_modules. - } else { + def reactNativeVersion = reactNativeVersion() + logger.quiet("Using react-native version: $reactNativeVersion") + implementation "com.facebook.react:react-native:$reactNativeVersion" +} - // FIXME Temporary fix to get Jitpack builds to green while I work on a solution without hardcoded values. - //def rnVersion = readReactNativeVersion('../package.json', 'peerDependencies') - def rnVersion = '0.61.5' - implementation "com.facebook.react:react-native:${rnVersion}" // From Maven repo - } +// Returns react-native version from root package.json +def reactNativeVersion() { + def packageFile = new File("$projectDir/../../package.json") + def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text) + return packageContent['dependencies']['react-native'] } From adac1a25b968dce10522b0fa61cfcfc45aea39cf Mon Sep 17 00:00:00 2001 From: Kaweh Ebrahimi-Far Date: Sat, 9 May 2020 13:51:30 +0200 Subject: [PATCH 2/6] Delete external dependency Removed duplicate functionality from an extranal host. --- react-native-aztec/android/build.gradle | 3 --- 1 file changed, 3 deletions(-) diff --git a/react-native-aztec/android/build.gradle b/react-native-aztec/android/build.gradle index 39951408bb..f212881573 100644 --- a/react-native-aztec/android/build.gradle +++ b/react-native-aztec/android/build.gradle @@ -31,9 +31,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'com.github.dcendents.android-maven' -// import the `readReactNativeVersion()` function -apply from: 'https://gist.githubusercontent.com/hypest/742448b9588b3a0aa580a5e80ae95bdf/raw/8eb62d40ee7a5104d2fcaeff21ce6f29bd93b054/readReactNativeVersion.gradle' - group='com.github.wordpress-mobile.gutenberg-mobile' // fallback flag value for when lib is compiled individually (e.g. via jitpack) From 7d2114bb816c6339a23bea5f99313f02f4466465 Mon Sep 17 00:00:00 2001 From: Kaweh Ebrahimi-Far Date: Sat, 9 May 2020 16:50:02 +0200 Subject: [PATCH 3/6] Return react-native version based on environment Use local source via range parameter if we are not on Jitpack --- react-native-aztec/android/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/react-native-aztec/android/build.gradle b/react-native-aztec/android/build.gradle index f212881573..8e80256f59 100644 --- a/react-native-aztec/android/build.gradle +++ b/react-native-aztec/android/build.gradle @@ -111,8 +111,12 @@ dependencies { implementation "com.facebook.react:react-native:$reactNativeVersion" } -// Returns react-native version from root package.json +// Returns react-native version based on environment def reactNativeVersion() { + if(rootProject.ext.buildGutenbergFromSource) { + return '+' + } + def packageFile = new File("$projectDir/../../package.json") def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text) return packageContent['dependencies']['react-native'] From 8bef3f0aed6b58d27b3ba725f8d7d00359d31752 Mon Sep 17 00:00:00 2001 From: Kaweh Ebrahimi-Far Date: Sat, 9 May 2020 17:16:27 +0200 Subject: [PATCH 4/6] Refactored codestyle --- react-native-aztec/android/build.gradle | 35 ++++++++++++------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/react-native-aztec/android/build.gradle b/react-native-aztec/android/build.gradle index 8e80256f59..8668a67f48 100644 --- a/react-native-aztec/android/build.gradle +++ b/react-native-aztec/android/build.gradle @@ -11,7 +11,6 @@ buildscript { jSoupVersion = '1.10.3' wordpressUtilsVersion = '1.22' espressoVersion = '3.0.1' - aztecVersion = 'v1.3.42' } @@ -31,7 +30,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'com.github.dcendents.android-maven' -group='com.github.wordpress-mobile.gutenberg-mobile' +group = 'com.github.wordpress-mobile.gutenberg-mobile' // fallback flag value for when lib is compiled individually (e.g. via jitpack) project.ext.buildGutenbergFromSource = false @@ -81,19 +80,19 @@ repositories { maven { url "https://jitpack.io" } - if (!rootProject.ext.buildGutenbergFromSource) { - // if not building from source (where the node_modules dir is used), use a remote RN maven repo - def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' - println "Will use the RN maven repo at ${reactNativeRepo}" - maven { url reactNativeRepo } - } + if (!rootProject.ext.buildGutenbergFromSource) { + // if not building from source (where the node_modules dir is used), use a remote RN maven repo + def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' + println "Will use the RN maven repo at ${reactNativeRepo}" + maven { url reactNativeRepo } + } } dependencies { - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:$aztecVersion") - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-shortcodes:$aztecVersion") - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-comments:$aztecVersion") - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:glide-loader:$aztecVersion") + api "com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:$aztecVersion" + api "com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-shortcodes:$aztecVersion" + api "com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-comments:$aztecVersion" + api "com.github.wordpress-mobile.WordPress-Aztec-Android:glide-loader:$aztecVersion" api "org.wordpress:utils:$wordpressUtilsVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" @@ -113,11 +112,11 @@ dependencies { // Returns react-native version based on environment def reactNativeVersion() { - if(rootProject.ext.buildGutenbergFromSource) { - return '+' - } + if (rootProject.ext.buildGutenbergFromSource) { + return '+' + } - def packageFile = new File("$projectDir/../../package.json") - def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text) - return packageContent['dependencies']['react-native'] + def packageFile = new File("$projectDir/../../package.json") + def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text) + return packageContent['dependencies']['react-native'] } From 2932bdb02e9ea3200d27ebbee072ae2538eb38da Mon Sep 17 00:00:00 2001 From: Kaweh Ebrahimi-Far Date: Mon, 11 May 2020 16:26:12 +0200 Subject: [PATCH 5/6] Reverted back to original Checking to see if CI goes green. --- react-native-aztec/android/build.gradle | 43 ++++++++++++------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/react-native-aztec/android/build.gradle b/react-native-aztec/android/build.gradle index 8668a67f48..7b20742429 100644 --- a/react-native-aztec/android/build.gradle +++ b/react-native-aztec/android/build.gradle @@ -11,6 +11,7 @@ buildscript { jSoupVersion = '1.10.3' wordpressUtilsVersion = '1.22' espressoVersion = '3.0.1' + aztecVersion = 'v1.3.42' } @@ -30,7 +31,10 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'com.github.dcendents.android-maven' -group = 'com.github.wordpress-mobile.gutenberg-mobile' +// import the `readReactNativeVersion()` function +apply from: 'https://gist.githubusercontent.com/hypest/742448b9588b3a0aa580a5e80ae95bdf/raw/8eb62d40ee7a5104d2fcaeff21ce6f29bd93b054/readReactNativeVersion.gradle' + +group='com.github.wordpress-mobile.gutenberg-mobile' // fallback flag value for when lib is compiled individually (e.g. via jitpack) project.ext.buildGutenbergFromSource = false @@ -81,18 +85,18 @@ repositories { maven { url "https://jitpack.io" } if (!rootProject.ext.buildGutenbergFromSource) { - // if not building from source (where the node_modules dir is used), use a remote RN maven repo - def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' - println "Will use the RN maven repo at ${reactNativeRepo}" - maven { url reactNativeRepo } - } + // if not building from source (where the node_modules dir is used), use a remote RN maven repo + def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' + println "Will use the RN maven repo at ${reactNativeRepo}" + maven { url reactNativeRepo } + } } dependencies { - api "com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:$aztecVersion" - api "com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-shortcodes:$aztecVersion" - api "com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-comments:$aztecVersion" - api "com.github.wordpress-mobile.WordPress-Aztec-Android:glide-loader:$aztecVersion" + api ("com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:$aztecVersion") + api ("com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-shortcodes:$aztecVersion") + api ("com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-comments:$aztecVersion") + api ("com.github.wordpress-mobile.WordPress-Aztec-Android:glide-loader:$aztecVersion") api "org.wordpress:utils:$wordpressUtilsVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" @@ -105,18 +109,13 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' - def reactNativeVersion = reactNativeVersion() - logger.quiet("Using react-native version: $reactNativeVersion") - implementation "com.facebook.react:react-native:$reactNativeVersion" -} - -// Returns react-native version based on environment -def reactNativeVersion() { if (rootProject.ext.buildGutenbergFromSource) { - return '+' - } + implementation "com.facebook.react:react-native:+" // From node_modules. + } else { - def packageFile = new File("$projectDir/../../package.json") - def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text) - return packageContent['dependencies']['react-native'] + // FIXME Temporary fix to get Jitpack builds to green while I work on a solution without hardcoded values. + //def rnVersion = readReactNativeVersion('../package.json', 'peerDependencies') + def rnVersion = '0.61.5' + implementation "com.facebook.react:react-native:${rnVersion}" // From Maven repo + } } From c7af6cadef024463d1b72a08b7ea297faf505cf6 Mon Sep 17 00:00:00 2001 From: Kaweh Ebrahimi-Far Date: Thu, 21 May 2020 08:20:00 +0200 Subject: [PATCH 6/6] Reverted back to '8bef3f0' --- react-native-aztec/android/build.gradle | 43 +++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/react-native-aztec/android/build.gradle b/react-native-aztec/android/build.gradle index 7b20742429..8668a67f48 100644 --- a/react-native-aztec/android/build.gradle +++ b/react-native-aztec/android/build.gradle @@ -11,7 +11,6 @@ buildscript { jSoupVersion = '1.10.3' wordpressUtilsVersion = '1.22' espressoVersion = '3.0.1' - aztecVersion = 'v1.3.42' } @@ -31,10 +30,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' apply plugin: 'com.github.dcendents.android-maven' -// import the `readReactNativeVersion()` function -apply from: 'https://gist.githubusercontent.com/hypest/742448b9588b3a0aa580a5e80ae95bdf/raw/8eb62d40ee7a5104d2fcaeff21ce6f29bd93b054/readReactNativeVersion.gradle' - -group='com.github.wordpress-mobile.gutenberg-mobile' +group = 'com.github.wordpress-mobile.gutenberg-mobile' // fallback flag value for when lib is compiled individually (e.g. via jitpack) project.ext.buildGutenbergFromSource = false @@ -85,18 +81,18 @@ repositories { maven { url "https://jitpack.io" } if (!rootProject.ext.buildGutenbergFromSource) { - // if not building from source (where the node_modules dir is used), use a remote RN maven repo - def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' - println "Will use the RN maven repo at ${reactNativeRepo}" - maven { url reactNativeRepo } - } + // if not building from source (where the node_modules dir is used), use a remote RN maven repo + def reactNativeRepo = 'https://dl.bintray.com/wordpress-mobile/react-native-mirror/' + println "Will use the RN maven repo at ${reactNativeRepo}" + maven { url reactNativeRepo } + } } dependencies { - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:$aztecVersion") - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-shortcodes:$aztecVersion") - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-comments:$aztecVersion") - api ("com.github.wordpress-mobile.WordPress-Aztec-Android:glide-loader:$aztecVersion") + api "com.github.wordpress-mobile.WordPress-Aztec-Android:aztec:$aztecVersion" + api "com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-shortcodes:$aztecVersion" + api "com.github.wordpress-mobile.WordPress-Aztec-Android:wordpress-comments:$aztecVersion" + api "com.github.wordpress-mobile.WordPress-Aztec-Android:glide-loader:$aztecVersion" api "org.wordpress:utils:$wordpressUtilsVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" @@ -109,13 +105,18 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' - if (rootProject.ext.buildGutenbergFromSource) { - implementation "com.facebook.react:react-native:+" // From node_modules. - } else { + def reactNativeVersion = reactNativeVersion() + logger.quiet("Using react-native version: $reactNativeVersion") + implementation "com.facebook.react:react-native:$reactNativeVersion" +} - // FIXME Temporary fix to get Jitpack builds to green while I work on a solution without hardcoded values. - //def rnVersion = readReactNativeVersion('../package.json', 'peerDependencies') - def rnVersion = '0.61.5' - implementation "com.facebook.react:react-native:${rnVersion}" // From Maven repo +// Returns react-native version based on environment +def reactNativeVersion() { + if (rootProject.ext.buildGutenbergFromSource) { + return '+' } + + def packageFile = new File("$projectDir/../../package.json") + def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text) + return packageContent['dependencies']['react-native'] }