-
Notifications
You must be signed in to change notification settings - Fork 68
Binary package build #44
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
Conversation
…e libs we care about into a single build directory
Create binary podspec Update PackageTest app to use binary package
Clean up gulpfile
Remove Build.sh Update Readme regarding creating packages
bghgary
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't say I understand everything that is going on in this PR, but looks good to me.
| await exec('npm pack', {cwd: 'Assembled'}); | ||
| }; | ||
|
|
||
| const copyFiles = gulp.parallel(copyCommonFiles, copyIOSFiles, copyAndroidFiles); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the difference between gulp.parallel and Promise.all. Why use one vs. the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gulp functions/tasks can return Promises, but they can also return a variety of other objects representing asynchronous work (such as those using the src/pipe/dest stuff). gulp.parallel understands all these, and also makes it so gulp understands the task hierarchy and can display reasonable command line output for the tasks that it is running.
| await new Promise(resolve => { | ||
| gulp.src('Android/build.gradle') | ||
| .pipe(gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/src**/main/AndroidManifest.xml')) | ||
| .pipe(gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/src**/main/java/**/*')) | ||
| .pipe(gulp.dest('Assembled/android')) | ||
| .on('end', resolve); | ||
| }); | ||
|
|
||
| await new Promise(resolve => { | ||
| gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/build/intermediates/library_and_local_jars_jni/release/jni/**/*') | ||
| .pipe(gulp.dest('Assembled/android/src/main/jniLibs/')) | ||
| .on('end', resolve); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is using new Promise really necessary here? Seems like you can use gulp.parallel like below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, if i use gulp.parallel, then Gulp treats these as individual atomic "tasks." I think it makes more sense to have these grouped together in a single "logical task."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean use gulp.parallel on the "tasks" returned by each section of the gulp.pipe.pipe:
| await new Promise(resolve => { | |
| gulp.src('Android/build.gradle') | |
| .pipe(gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/src**/main/AndroidManifest.xml')) | |
| .pipe(gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/src**/main/java/**/*')) | |
| .pipe(gulp.dest('Assembled/android')) | |
| .on('end', resolve); | |
| }); | |
| await new Promise(resolve => { | |
| gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/build/intermediates/library_and_local_jars_jni/release/jni/**/*') | |
| .pipe(gulp.dest('Assembled/android/src/main/jniLibs/')) | |
| .on('end', resolve); | |
| }); | |
| gulp.parallel( | |
| gulp.src('Android/build.gradle') | |
| .pipe(gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/src**/main/AndroidManifest.xml')) | |
| .pipe(gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/src**/main/java/**/*')) | |
| .pipe(gulp.dest('Assembled/android')), | |
| gulp.src('../Apps/Playground/node_modules/@babylonjs/react-native/android/build/intermediates/library_and_local_jars_jni/release/jni/**/*') | |
| .pipe(gulp.dest('Assembled/android/src/main/jniLibs/')) | |
| ); |
Does this work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that will create two nodes in the task hierarchy named "anonymous function" (or something like that). Talked offline, leaving as is.
This change supports building an NPM package with pre-compiled binaries. Notable pieces of this change:
gulp buildIOSandgulp buildAndroidin parallel, and have the CI build that doesgulp(invokes the default function) to build both iOS and Android and then publish the package. These PR/CI build changes will come in a later PR.libBabylonNative.sofiles for different architectures, plus some Android specific interop source code files that are compiled into the consuming app.build.gradlethat is exactly what is generated by the React Native CLI tools for new packages (which is compatible with React Native consuming apps), plus two additions: 1) It produces a build error if the min SDK version is less than 18 (required for GLES3), 2) it adds a dependency on ARCore.lipotool to combine the different architectures for each lib into a set of "universal libs" for all supported architectures. This makes them compatible with CocoaPods, where we do not have the ability to specify different static libs for different architectures. The "universal libs" plus some iOS specific interop source code files are copied over to the precompiled package directory.podspecthat includes all the static libs, plus the loose source files that the consuming app needs to compile.Other smaller changes included in this PR:
${CMAKE_CURRENT_LIST_DIR}since paths are relative to the CMakeLists.txt file itself. Without specifying this, paths are relative to the "top level" CMakeLists.txt (in this case, the one in the Package directory that includes this CMakeLists.txt.