Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React native composite and binary build support #29488

Merged
merged 17 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8613591
Composite and binary build support for react-native android libraries
oguzkocer Feb 25, 2021
b9e90cc
Improve dependencies for react-native bridge and aztec projects
oguzkocer Mar 1, 2021
7bbfe56
Remove white color resource from bridge
oguzkocer Mar 1, 2021
904a56c
Remove waitForJitpack from react-native-bridge android build file
oguzkocer Mar 4, 2021
4c67a6c
Adds delay between publishing aztec and bridge android binaries
oguzkocer Mar 5, 2021
f1df772
Fix whitespace issues in publish-aztec-and-bridge.sh
oguzkocer Mar 5, 2021
39b06ca
Improve detection for where the publish script is run from
oguzkocer Mar 8, 2021
291441e
Improve error message for publish-aztec-and-bridge.sh
oguzkocer Mar 8, 2021
e58d4d2
Improve the error message for publish script for where it's run from
oguzkocer Mar 9, 2021
d9a4a70
Removes buildGutenbergFromSource parameter from WPAndroidGlueCode
oguzkocer Mar 9, 2021
ff509eb
Add an explanation to react-native-bridge/settings.gradle
oguzkocer Mar 9, 2021
1b97926
react-native-bridge now uses a remote repo for hermes dependency
oguzkocer Mar 10, 2021
38d8430
Cleanup react-native-bridge/settings.gradle
oguzkocer Mar 10, 2021
170b257
Use hermes dependency to mirror and improve pom generation code
oguzkocer Mar 11, 2021
3f5b35d
Merge pull request #3 from oguzkocer/react-native-composite-and-binar…
oguzkocer Mar 12, 2021
17422d3
Merge remote-tracking branch 'upstream/trunk' into react-native-compo…
oguzkocer Mar 25, 2021
2c4f8ef
Add s3 as remote repository to react-native-editor
oguzkocer Mar 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 77 additions & 27 deletions packages/react-native-aztec/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
gradlePluginVersion = '3.4.2'
gradlePluginVersion = '4.0.1'
kotlinVersion = '1.3.61'
supportLibVersion = '28.0.0'
supportLibVersion = '29.0.2'
tagSoupVersion = '1.2.1'
glideVersion = '3.7.0'
picassoVersion = '2.5.2'
Expand All @@ -12,6 +12,7 @@ buildscript {
wordpressUtilsVersion = '1.22'
espressoVersion = '3.0.1'
aztecVersion = 'v1.3.45'
willPublishReactNativeAztecBinary = properties["publishReactNativeAztecVersion"]?.trim() as boolean
oguzkocer marked this conversation as resolved.
Show resolved Hide resolved
}

repositories {
Expand All @@ -26,14 +27,19 @@ buildscript {
}
}

plugins {
id "com.jfrog.bintray"
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven-publish' // this enables publishing via Bintray

group = 'com.github.wordpress-mobile.gutenberg-mobile'
// import the `readReactNativeVersion()` function
apply from: 'https://gist.githubusercontent.com/hypest/742448b9588b3a0aa580a5e80ae95bdf/raw/8eb62d40ee7a5104d2fcaeff21ce6f29bd93b054/readReactNativeVersion.gradle'

// fallback flag value for when lib is compiled individually (e.g. via jitpack)
project.ext.buildGutenbergFromSource = false
group = 'com.github.wordpress-mobile.gutenberg-mobile'

// The sample build uses multiple directories to
// keep boilerplate and common code separate from
Expand Down Expand Up @@ -81,11 +87,10 @@ 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 (willPublishReactNativeAztecBinary) {
maven { url "https://dl.bintray.com/wordpress-mobile/react-native-mirror/" }
} else {
maven { url("$rootDir/../../../node_modules/react-native/android") }
oguzkocer marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -94,31 +99,76 @@ dependencies {
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.wordpress:utils:$wordpressUtilsVersion"

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

implementation 'androidx.appcompat:appcompat:1.0.0'

implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
testImplementation 'junit:junit:4.12'

def reactNativeVersion = reactNativeVersion()
logger.quiet("Using react-native version: $reactNativeVersion")
implementation "com.facebook.react:react-native:$reactNativeVersion"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
testImplementation 'junit:junit:4.13'

if (willPublishReactNativeAztecBinary) {
def rnVersion = readReactNativeVersion('../../../package.json', 'devDependencies')
println "react-native version for react-native-aztec: $rnVersion"
implementation "com.facebook.react:react-native:$rnVersion"
} else {
implementation "com.facebook.react:react-native:+"
}
}

// Returns react-native version based on environment
def reactNativeVersion() {
if (rootProject.ext.buildGutenbergFromSource) {
return '+'
if (willPublishReactNativeAztecBinary) {
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
publications = ['ReactNativeAztecPublication']
publish = true
pkg {
repo = 'maven'
name = 'react-native-aztec'
licenses = ['GPL-2.0']
userOrg = 'wordpress-mobile'
vcsUrl = 'https://github.com/wordpress-mobile/gutenberg-mobile.git'
version {
name = publishReactNativeAztecVersion
released = new Date()
}
}
}

project.afterEvaluate {
publishing {
publications {
ReactNativeAztecPublication(MavenPublication) {
artifact bundleReleaseAar

groupId 'com.github.wordpress-mobile.gutenberg-mobile'
artifactId 'react-native-aztec'
version publishReactNativeAztecVersion

addDependenciesToPom(pom)
}
}
}
}
}

def packageFile = new File("$projectDir/../../../package.json")
def packageContent = new groovy.json.JsonSlurper().parseText(packageFile.text)
return packageContent['devDependencies']['react-native']
// Publication doesn't know about dependencies, so we need to manually add them
def addDependenciesToPom(pom) {
pom.withXml {
def dependenciesNode = asNode().getAt('dependencies')[0] ?: asNode().appendNode('dependencies')

// Iterate over the implementation dependencies, adding a <dependency> 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)
}
}
}
}

2 changes: 2 additions & 0 deletions packages/react-native-aztec/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
org.gradle.jvmargs=-Xmx2g -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
shouldPublishBinary=false

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 17 additions & 1 deletion packages/react-native-aztec/android/gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
18 changes: 17 additions & 1 deletion packages/react-native-aztec/android/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
oguzkocer marked this conversation as resolved.
Show resolved Hide resolved

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
8 changes: 7 additions & 1 deletion packages/react-native-aztec/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
rootProject.name = '@wordpress/react-native-aztec'
pluginManagement {
plugins {
id 'com.jfrog.bintray' version '1.8.5'
oguzkocer marked this conversation as resolved.
Show resolved Hide resolved
}
}

rootProject.name = '@wordpress_react-native-aztec'

Loading