Skip to content

Commit 5fb6950

Browse files
mganandrajacoates-ms
authored andcommitted
Fixing the publish task (#225)
1 parent 495ca4d commit 5fb6950

File tree

4 files changed

+67
-16
lines changed

4 files changed

+67
-16
lines changed

.ado/android-pr.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ jobs:
7474
#verbosityPack: 'Detailed' # Options: quiet, normal, detailed
7575
#arguments: # Required when command == Custom
7676

77+
- task: CmdLine@2
78+
displayName: Setup Build Dependencies
79+
inputs:
80+
script: .ado\setup_droid_deps.bat
81+
7782
- task: CmdLine@2
7883
displayName: Remove RNTesterApp.android.bundle
7984
inputs:
@@ -86,6 +91,8 @@ jobs:
8691

8792
- task: Gradle@1
8893
displayName: gradlew installArchives
94+
env:
95+
REACT_NATIVE_DEPENDENCIES: $(System.DefaultWorkingDirectory)\build_deps
8996
inputs:
9097
gradleWrapperFile: gradlew
9198
# workingDirectory: src\react-native\

.ado/publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,15 @@ jobs:
8181
#verbosityPack: 'Detailed' # Options: quiet, normal, detailed
8282
#arguments: # Required when command == Custom
8383

84+
- task: CmdLine@2
85+
displayName: Setup Build Dependencies
86+
inputs:
87+
script: .ado\setup_droid_deps.bat
88+
8489
- task: Gradle@1
8590
displayName: gradlew installArchives
91+
env:
92+
REACT_NATIVE_DEPENDENCIES: $(System.DefaultWorkingDirectory)\build_deps
8693
inputs:
8794
gradleWrapperFile: gradlew
8895
# workingDirectory: src\react-native\

.ado/setup_droid_deps.bat

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@if "%DEBUG%" == "" @echo off
2+
3+
REM Assuming the script is run from the root directory of a local clone of Microsoft fork of react-native. i.e. http:\\github.com\Microsoft\react-native
4+
5+
set BUILD_DEPS_DIR=build_deps
6+
7+
IF EXIST %BUILD_DEPS_DIR% (
8+
rmdir /s /q %BUILD_DEPS_DIR%
9+
if errorlevel 1 echo "Cleaning up the build dependency directory failed !" 1>&2
10+
)
11+
12+
mkdir %BUILD_DEPS_DIR%
13+
14+
mklink /D /J %BUILD_DEPS_DIR%\boost ReactAndroid\packages\boost.1.68.0.0\lib\native\include\boost
15+
mklink /D /J %BUILD_DEPS_DIR%\double-conversion double-conversion\double-conversion
16+
mklink /D /J %BUILD_DEPS_DIR%\Folly Folly\
17+
mklink /D /J %BUILD_DEPS_DIR%\glog glog
18+
19+
REM When setting up locally, set the environement variable as follows.
20+
REM set REACT_NATIVE_DEPENDENCIES=%CD%\%BUILD_DEPS_DIR%

ReactAndroid/build.gradle

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import de.undercouch.gradle.tasks.download.Download
1313
import org.apache.tools.ant.taskdefs.condition.Os
1414
import org.apache.tools.ant.filters.ReplaceTokens
1515

16-
// In FB react-native, we are downloading all third dependencies source code during build time and then build and consume it.
17-
// We got rid of this due to anti-compliance and other requirements like building on other environment like clang.
18-
// Now we have all third party dependencies as separate git repo which are then sub modules of react-native.
19-
// For boost, we are getting source though nuget. After this we are following the same approach.
16+
// We download various C++ open-source dependencies into downloads.
2017
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
2118
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.
2219

@@ -35,19 +32,15 @@ def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")
3532
// The Boost library is a very large download (>100MB).
3633
// If Boost is already present on your system, define the REACT_NATIVE_BOOST_PATH env variable
3734
// and the build will use that.
38-
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH") ?: 'packages/boost.1.68.0.0/lib/native/include'
35+
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")
3936

40-
def DoubleConversionPath = '../double-conversion'
41-
def FollyPath = '..'
42-
def GlogPath = '..'
4337
def V8Path = 'packages/ReactNative.V8.Android.7.0.276.32-v1'
4438

4539
task createNativeDepsDirectories {
4640
downloadsDir.mkdirs()
4741
thirdPartyNdkDir.mkdirs()
4842
}
4943

50-
// For GitHub CI - we use this task
5144
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
5245
src("https://github.com/react-native-community/boost-for-react-native/releases/download/v${BOOST_VERSION.replace("_", ".")}-0/boost_${BOOST_VERSION}.tar.gz")
5346
onlyIfNewer(true)
@@ -68,27 +61,48 @@ task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
6861
// }
6962
}
7063

71-
task prepareDoubleConversion(dependsOn: createNativeDepsDirectories, type: Copy) {
72-
from(DoubleConversionPath)
64+
task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
65+
src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
66+
onlyIfNewer(true)
67+
overwrite(false)
68+
dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
69+
}
70+
71+
task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
72+
from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
7373
from("src/main/jni/third-party/double-conversion/Android.mk")
7474
include 'double-conversion/**/*', 'Android.mk'
7575
includeEmptyDirs = false
7676
into("$thirdPartyNdkDir/double-conversion")
7777
}
7878

79-
task prepareFolly(dependsOn: createNativeDepsDirectories, type: Copy) {
80-
from(FollyPath)
79+
task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
80+
src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
81+
onlyIfNewer(true)
82+
overwrite(false)
83+
dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
84+
}
85+
86+
task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
87+
from(dependenciesPath ?: tarTree(downloadFolly.dest))
8188
from("src/main/jni/third-party/folly/Android.mk")
8289
include("Folly/folly/**/*", "Android.mk")
8390
eachFile {fname -> fname.path = (fname.path - "Folly/")}
8491
includeEmptyDirs = false
8592
into("$thirdPartyNdkDir/folly")
8693
}
8794

95+
task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
96+
src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
97+
onlyIfNewer(true)
98+
overwrite(false)
99+
dest(new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz"))
100+
}
101+
88102
// Prepare glog sources to be compiled, this task will perform steps that normally should've been
89103
// executed by automake. This way we can avoid dependencies on make/automake
90-
task prepareGlog(dependsOn: createNativeDepsDirectories, type: Copy) {
91-
from(GlogPath)
104+
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
105+
from(dependenciesPath ?: tarTree(downloadGlog.dest))
92106
from("src/main/jni/third-party/glog/")
93107
include("glog/src/**/*", "Android.mk", "config.h")
94108
includeEmptyDirs = false
@@ -153,6 +167,9 @@ task downloadNdkBuildDependencies {
153167
if (!boostPath) {
154168
dependsOn(downloadBoost)
155169
}
170+
dependsOn(downloadDoubleConversion)
171+
dependsOn(downloadFolly)
172+
dependsOn(downloadGlog)
156173
}
157174

158175
def getNdkBuildName() {
@@ -216,7 +233,7 @@ def getNdkBuildFullPath() {
216233
return ndkBuildFullPath
217234
}
218235

219-
task buildReactNdkLib(dependsOn: [prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
236+
task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) {
220237
inputs.dir("$projectDir/../ReactCommon")
221238
inputs.dir("src/main/jni")
222239
outputs.dir("$buildDir/react-ndk/all")

0 commit comments

Comments
 (0)