Packing RN dependencies, hermes and ignoring javadoc failure, (#852)

* Ignore javadoc failure

* Bringing few more changes from 0.63-stable

* Fixing a patch in engine selection

* Fixing a patch in nuget spec

* Fixing the output directory of nuget pack

* Packaging dependencies in the nuget
This commit is contained in:
Anandraj 2021-10-13 10:22:26 -07:00 коммит произвёл GitHub
Родитель c8ecfc82a8
Коммит 0cf2b3d6ee
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 718 добавлений и 316 удалений

Просмотреть файл

@ -46,11 +46,18 @@ jobs:
- template: templates\prep-android-nuget.yml - template: templates\prep-android-nuget.yml
# Verify depenendencies can be enumerated and downloaded ..
- task: CmdLine@2
displayName: 'Verify Dependencies can be enumerated'
inputs:
script: sudo apt-get install python3-pip && sudo apt-get install python3-setuptools && pip3 install BeautifulSoup4 && pip3 install wheel && pip3 install wget && python3 android-patches/scripts/downloadDependencies.py $(Build.SourcesDirectory) && tree $(Build.SourcesDirectory)/android
# Very similar to the default pack task .. but appends 'ndk21' to the nuget pack version # Very similar to the default pack task .. but appends 'ndk21' to the nuget pack version
- task: CmdLine@2 - task: CmdLine@2
displayName: 'Verify NuGet can be packed' displayName: 'Verify NuGet can be packed'
inputs: inputs:
script: NDK=ndk`cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | awk '{ print $3}' | awk -F. '{ print $1 }'`; mono $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe pack $(System.DefaultWorkingDirectory)/ReactAndroid/ReactAndroid.nuspec -OutputDirectory $(System.DefaultWorkingDirectory) -Properties buildNumber=$(buildNumber)-$NDK;commitId=$(Build.SourceVersion) script: NDK=ndk`cat ${ANDROID_SDK_ROOT}/ndk-bundle/source.properties 2>&1 | grep Pkg.Revision | awk '{ print $3}' | awk -F. '{ print $1 }'`; mono $(System.DefaultWorkingDirectory)/nuget-bin/nuget.exe pack $(System.DefaultWorkingDirectory)/ReactAndroid/ReactAndroid.nuspec -OutputDirectory $(Build.StagingDirectory)/final -Properties buildNumber=$(buildNumber)-$NDK;commitId=$(Build.SourceVersion)
# Android CI doesn't create a nuget now, but this check is failing builds. Quickest fix to unblock builds is to disable the check... but we need to find the root cause and fix it and enable this again. # Android CI doesn't create a nuget now, but this check is failing builds. Quickest fix to unblock builds is to disable the check... but we need to find the root cause and fix it and enable this again.
# - script: '[ -f $(System.DefaultWorkingDirectory)/*.nupkg ]' # - script: '[ -f $(System.DefaultWorkingDirectory)/*.nupkg ]'
@ -70,4 +77,10 @@ jobs:
- task: CmdLine@2 - task: CmdLine@2
displayName: gradlew clean displayName: gradlew clean
inputs: inputs:
script: ./gradlew clean script: ./gradlew clean
- task: PublishBuildArtifacts@1
displayName: 'Publish final artifacts'
inputs:
PathtoPublish: '$(Build.StagingDirectory)/final'
ArtifactName: 'ReactNative-Final'

Просмотреть файл

@ -144,6 +144,13 @@ jobs:
- template: templates\prep-android-nuget.yml - template: templates\prep-android-nuget.yml
# Enumerate and download all dependencies ..
- task: CmdLine@2
displayName: 'Verify Dependencies can be enumerated'
inputs:
script: sudo apt-get install python3-pip && sudo apt-get install python3-setuptools && pip3 install BeautifulSoup4 && pip3 install wheel && pip3 install wget && python3 android-patches/scripts/downloadDependencies.py $(Build.SourcesDirectory) && tree $(Build.SourcesDirectory)/android
# Very similar to the default pack task .. but appends 'ndk21b' to the nuget pack version # Very similar to the default pack task .. but appends 'ndk21b' to the nuget pack version
- task: CmdLine@2 - task: CmdLine@2
displayName: 'NuGet pack' displayName: 'NuGet pack'

Просмотреть файл

@ -1,6 +1,6 @@
--- "E:\\github\\rnm-63-fresh\\ReactAndroid\\ReactAndroid.nuspec" 1969-12-31 16:00:00.000000000 -0800 --- "E:\\gh\\react-native-macos2\\ReactAndroid\\ReactAndroid.nuspec" 1969-12-31 16:00:00.000000000 -0800
+++ "E:\\github\\rnm-63\\ReactAndroid\\ReactAndroid.nuspec" 2020-10-27 20:20:54.071789900 -0700 +++ "E:\\gh\\react-native-macos\\ReactAndroid\\ReactAndroid.nuspec" 2021-10-12 19:48:38.934480100 -0700
@@ -0,0 +1,130 @@ @@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> +<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <metadata> + <metadata>
@ -64,6 +64,41 @@
+ <file src="build\react-ndk\all\armeabi-v7a\libyoga.so" target="lib\droidarm"/> + <file src="build\react-ndk\all\armeabi-v7a\libyoga.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libyoga.so" target="lib\droidx86"/> + <file src="build\react-ndk\all\x86\libyoga.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libyoga.so" target="lib\droidarm64"/> + <file src="build\react-ndk\all\arm64-v8a\libyoga.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libhermes-executor-common-debug.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libhermes-executor-common-debug.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libhermes-executor-common-debug.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libhermes-executor-common-debug.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libhermes-executor-common-release.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libhermes-executor-common-release.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libhermes-executor-common-release.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libhermes-executor-common-release.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libhermes-executor-debug.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libhermes-executor-debug.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libhermes-executor-debug.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libhermes-executor-debug.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libhermes-executor-release.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libhermes-executor-release.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libhermes-executor-release.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libhermes-executor-release.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libhermes-inspector.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libhermes-inspector.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libhermes-inspector.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libhermes-inspector.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libjsijniprofiler.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libjsijniprofiler.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libjsijniprofiler.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libjsijniprofiler.so" target="lib\droidarm64"/>
+
+ <file src="build\react-ndk\all\x86_64\libfolly_futures.so" target="lib\droidx64"/>
+ <file src="build\react-ndk\all\armeabi-v7a\libfolly_futures.so" target="lib\droidarm"/>
+ <file src="build\react-ndk\all\x86\libfolly_futures.so" target="lib\droidx86"/>
+ <file src="build\react-ndk\all\arm64-v8a\libfolly_futures.so" target="lib\droidarm64"/>
+ +
+ <!-- Unstripped binaries --> + <!-- Unstripped binaries -->
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libfb.so" target="lib\droidx64\unstripped"/> + <file src="build\tmp\buildReactNdkLib\local\x86_64\libfb.so" target="lib\droidx64\unstripped"/>
@ -116,6 +151,40 @@
+ <file src="build\tmp\buildReactNdkLib\local\x86\libyoga.so" target="lib\droidx86\unstripped"/> + <file src="build\tmp\buildReactNdkLib\local\x86\libyoga.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libyoga.so" target="lib\droidarm64\unstripped"/> + <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libyoga.so" target="lib\droidarm64\unstripped"/>
+ +
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libhermes-executor-common-debug.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libhermes-executor-common-debug.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libhermes-executor-common-debug.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libhermes-executor-common-debug.so" target="lib\droidarm64\unstripped"/>
+
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libhermes-executor-common-release.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libhermes-executor-common-release.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libhermes-executor-common-release.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libhermes-executor-common-release.so" target="lib\droidarm64\unstripped"/>
+
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libhermes-executor-debug.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libhermes-executor-debug.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libhermes-executor-debug.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libhermes-executor-debug.so" target="lib\droidarm64\unstripped"/>
+
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libhermes-executor-release.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libhermes-executor-release.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libhermes-executor-release.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libhermes-executor-release.so" target="lib\droidarm64\unstripped"/>
+
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libhermes-inspector.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libhermes-inspector.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libhermes-inspector.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libhermes-inspector.so" target="lib\droidarm64\unstripped"/>
+
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libjsijniprofiler.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libjsijniprofiler.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libjsijniprofiler.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libjsijniprofiler.so" target="lib\droidarm64\unstripped"/>
+
+ <file src="build\tmp\buildReactNdkLib\local\x86_64\libfolly_futures.so" target="lib\droidx64\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\armeabi-v7a\libfolly_futures.so" target="lib\droidarm\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\x86\libfolly_futures.so" target="lib\droidx86\unstripped"/>
+ <file src="build\tmp\buildReactNdkLib\local\arm64-v8a\libfolly_futures.so" target="lib\droidarm64\unstripped"/>
+ <!-- AAR and POM --> + <!-- AAR and POM -->
+ <file src="..\android\com\facebook\react\react-native\*\react-native-*.aar" target="lib"/> + <file src="..\android\com\facebook\react\react-native\*\react-native-*.aar" target="lib"/>
+ <file src="..\android\com\facebook\react\react-native\*\react-native-*.pom" target="lib"/> + <file src="..\android\com\facebook\react\react-native\*\react-native-*.pom" target="lib"/>
@ -128,6 +197,7 @@
+ <file src="..\ReactCommon\cxxreact\**\*.h" target="inc\cxxreact"/> + <file src="..\ReactCommon\cxxreact\**\*.h" target="inc\cxxreact"/>
+ <file src="..\ReactCommon\jsi\**\*.h" target="inc\jsi"/> + <file src="..\ReactCommon\jsi\**\*.h" target="inc\jsi"/>
+ <file src="..\ReactCommon\yoga\yoga\**\*.h" target="inc\Yoga"/> + <file src="..\ReactCommon\yoga\yoga\**\*.h" target="inc\Yoga"/>
+ <file src="..\android\dependencies\**\*.*" target="dependencies"/>
+ </files> + </files>
+</package> +</package>
+ +

Просмотреть файл

@ -0,0 +1,10 @@
--- /home/mganandraj/github/rnm-64-vanilla/ReactAndroid/release.gradle 2021-10-11 17:51:44.286455263 -0700
+++ /home/mganandraj/github/rnm-64/ReactAndroid/release.gradle 2021-10-07 16:35:28.636536900 -0700
@@ -74,6 +74,7 @@
afterEvaluate { project ->
task androidJavadoc(type: Javadoc) {
+ failOnError false
source = android.sourceSets.main.java.srcDirs
classpath += files(android.bootClasspath)
classpath += files(project.getConfigurations().getByName("compile").asList())

Просмотреть файл

@ -1,11 +1,21 @@
--- "E:\\github\\rnm-63-fresh\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\bridge\\ReactBridge.java" 2020-10-27 20:26:16.762190600 -0700 --- "E:\\gh\\react-native-macos2\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\bridge\\ReactBridge.java" 2021-10-12 13:35:49.124099000 -0700
+++ "E:\\github\\rnm-63\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\bridge\\ReactBridge.java" 2020-10-13 21:38:04.995797000 -0700 +++ "E:\\gh\\react-native-macos\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\bridge\\ReactBridge.java" 2021-10-12 13:22:46.508704400 -0700
@@ -31,6 +31,14 @@ @@ -31,6 +31,24 @@
Systrace.beginSection( Systrace.beginSection(
TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni"); TRACE_TAG_REACT_JAVA_BRIDGE, "ReactBridge.staticInit::load:reactnativejni");
ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_START); ReactMarker.logMarker(ReactMarkerConstants.LOAD_REACT_NATIVE_SO_FILE_START);
+ +
+ SoLoader.loadLibrary("v8jsi"); + // JS Engine is configurable .. And we expect only one packaged.
+ // Hence ignore failure.
+
+ try {
+ SoLoader.loadLibrary("hermes");
+ } catch (UnsatisfiedLinkError jscE) {}
+
+ try {
+ SoLoader.loadLibrary("v8jsi");
+ } catch (UnsatisfiedLinkError jscE) {}
+
+ SoLoader.loadLibrary("glog_init"); + SoLoader.loadLibrary("glog_init");
+ SoLoader.loadLibrary("fb"); + SoLoader.loadLibrary("fb");
+ SoLoader.loadLibrary("fbjni"); + SoLoader.loadLibrary("fbjni");

Просмотреть файл

@ -1,5 +1,5 @@
--- "E:\\github\\rnm-63-fresh\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\ReactInstanceManagerBuilder.java" 2020-10-27 20:26:16.728167300 -0700 --- "E:\\gh\\react-native-macos2\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\ReactInstanceManagerBuilder.java" 2021-10-12 13:33:12.881732000 -0700
+++ "E:\\github\\rnm-63\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\ReactInstanceManagerBuilder.java" 2020-10-13 21:27:45.535631600 -0700 +++ "E:\\gh\\react-native-macos\\ReactAndroid\\src\\main\\java\\com\\facebook\\react\\ReactInstanceManagerBuilder.java" 2021-10-12 13:26:43.722189600 -0700
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.devsupport.interfaces.DevSupportManager;
@ -8,21 +8,69 @@
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
import com.facebook.react.packagerconnection.RequestHandler; import com.facebook.react.packagerconnection.RequestHandler;
import com.facebook.react.uimanager.UIImplementationProvider; import com.facebook.react.uimanager.UIImplementationProvider;
@@ -291,7 +292,8 @@ @@ -59,8 +60,21 @@
private @Nullable JSIModulePackage mJSIModulesPackage;
private @Nullable Map<String, RequestHandler> mCustomPackagerCommandHandlers;
+ public enum JSEngine {
+ Hermes,
+ V8
+ }
+
+ private JSEngine mJSEngine = JSEngine.V8;
+
/* package protected */ ReactInstanceManagerBuilder() {}
+ public ReactInstanceManagerBuilder setJSEngine(
+ JSEngine jsEngine) {
+ mJSEngine = jsEngine;
+ return this;
+ }
+
/** Sets a provider of {@link UIImplementation}. Uses default provider if null is passed. */
public ReactInstanceManagerBuilder setUIImplementationProvider(
@Nullable UIImplementationProvider uiImplementationProvider) {
@@ -291,40 +305,10 @@
private JavaScriptExecutorFactory getDefaultJSExecutorFactory( private JavaScriptExecutorFactory getDefaultJSExecutorFactory(
String appName, String deviceName, Context applicationContext) { String appName, String deviceName, Context applicationContext) {
- try { - try {
- // If JSC is included, use it as normal
- initializeSoLoaderIfNecessary(applicationContext);
- SoLoader.loadLibrary("jscexecutor");
- return new JSCExecutorFactory(appName, deviceName);
- } catch (UnsatisfiedLinkError jscE) {
- // https://github.com/facebook/hermes/issues/78 shows that
- // people who aren't trying to use Hermes are having issues.
- // https://github.com/facebook/react-native/issues/25923#issuecomment-554295179
- // includes the actual JSC error in at least one case.
- //
- // So, if "__cxa_bad_typeid" shows up in the jscE exception
- // message, then we will assume that's the failure and just
- // throw now.
-
- if (jscE.getMessage().contains("__cxa_bad_typeid")) {
- throw jscE;
- }
-
- // Otherwise use Hermes
- try {
+ if(mJSEngine == JSEngine.V8) {
+ return new V8ExecutorFactory(appName, deviceName); + return new V8ExecutorFactory(appName, deviceName);
+/* try { + } else {
// If JSC is included, use it as normal return new HermesExecutorFactory();
initializeSoLoaderIfNecessary(applicationContext); - } catch (UnsatisfiedLinkError hermesE) {
SoLoader.loadLibrary("jscexecutor"); - // If we get here, either this is a JSC build, and of course
@@ -325,6 +327,6 @@ - // Hermes failed (since it's not in the APK), or it's a Hermes
hermesE.printStackTrace(); - // build, and Hermes had a problem.
throw jscE; -
- // We suspect this is a JSC issue (it's the default), so we
- // will throw that exception, but we will print hermesE first,
- // since it could be a Hermes issue and we don't want to
- // swallow that.
- hermesE.printStackTrace();
- throw jscE;
} }
- } - }
+ } */
} }
} }

Просмотреть файл

@ -1,296 +0,0 @@
from bs4 import BeautifulSoup
import os
import re
import shlex
import shutil
from subprocess import Popen, PIPE
import sys
import wget
import urllib2
import glob
if len(sys.argv) != 2:
print "Please provide RN repo path as argument"
sys.exit()
root_dir = sys.argv[1]
dependency_dir = os.path.join(root_dir, "android_dependencies_downloaded2")
dependency_list_file_path = os.path.join(
root_dir, "gradle_dependency_list.txt"
)
# maven_repo_url = "http://central.maven.org/maven2/"
maven_repo_url = "https://repo1.maven.org/maven2/"
# desired_ndk = "androidndk.12.2.0"
desired_sdk = "androidsdk.29.0.1"
# desired_jdk = "jdk.1.8.2"
def create_folder(folder_path):
"""Create folder if it does not exist
Parameters
----------
folder_path : str
folder path to be checked
"""
if not os.path.exists(folder_path):
print('Trying to create ' + folder_path)
os.makedirs(folder_path)
def set_env_variables():
"""
Sets the NDK, SDK, JAVA_HOME, ANDROID_HOME vars
if they are not set
"""
if 'NugetMachineInstallRoot' not in os.environ:
print "Nuget cache not defined, do you have an office enlistment in this machine?"
sys.exit()
nugetcache_path = os.environ['NugetMachineInstallRoot']
# desired_ndk_path = os.path.join(nugetcache_path, desired_ndk)
# desired_sdk_path = os.path.join(nugetcache_path, desired_sdk)
# desired_jdk_path = os.path.join(nugetcache_path, desired_jdk, "x64")#
#set_env_variable("ANDROID_NDK", desired_ndk_path)
#set_env_variable("ANDOIRD_SDK", desired_sdk_path)
#set_env_variable("ANDROID_HOME", desired_sdk_path)
#set_env_variable("JAVA_HOME", desired_jdk_path)
set_env_variable("ANDROID_NDK", "E:\\devtools\\android-ndk-r17c")
set_env_variable("ANDOIRD_SDK", "D:\\nugetcache\\androidsdk.29.0.1")
set_env_variable("ANDROID_HOME", "D:\\nugetcache\\androidsdk.29.0.1")
set_env_variable("JAVA_HOME", "D:\\nugetcache\\jdk.1.8.3\\x64")
def set_env_variable(key, value):
"""Set env variable given key and value
Parameters
-------------
key : str
enivronment key name
value : str
desired value for key
"""
os.environ[key] = value
def list_dependencies():
""" Write all gradle dependencies to file
"""
os.chdir(root_dir)
# Note: Likely we need a union of releaseCompileClasspath & releaseRuntimeClasspath & debugCompileClasspath & debugRuntimeClasspath
gradle_command = "gradlew.bat ReactAndroid:dependencies --configuration releaseCompileClasspath"
gradle_command = gradle_command + " > " + \
"\"" + dependency_list_file_path + "\""
command_args = shlex.split(gradle_command)
process = Popen(command_args, stdout=PIPE)
(output, err) = process.communicate()
exit_code = process.wait()
def parse_dependencies(filepath):
""" Parse gradle dependencies and return list
Parameters
-----------
filepath : str
file containing gradle dependency list
Returns
-----------
dependency_list : list
list of dependecies in maven format
"""
infile = open(filepath, "r")
dependency_list = []
dependency_regex = "\S+:\S+:\S+"
omit_dependency_delim = "(*)"
for line in infile:
if line.endswith(omit_dependency_delim):
continue
regex_matches = re.search(dependency_regex, line)
if regex_matches != None:
dependency = regex_matches.group(0)
if dependency not in dependency_list:
dependency_list.append(dependency)
return dependency_list
def create_dependency_folder_structure(dependency):
""" Takes dependency in maven format and creates
folder structure required for download.
Returns the path where it should be downloaded
Parameters
----------
dependency : str
name in maven format
Returns
----------
path : str
folder depth path where dependencies
will be downloaded
"""
group_id, artifact, version = dependency.split(":")
folder_chain = []
for group in group_id.split("."):
folder_chain.append(group)
folder_chain.append(artifact)
folder_chain.append(version)
parent_dir = dependency_dir
for folder in folder_chain:
child_dir = os.path.join(parent_dir, folder)
create_folder(child_dir)
parent_dir = child_dir
return parent_dir
def download_dependencies(dependency_list):
"""Creates the directory structure
and downloads the maven dependecies
and saves it in the same format
Parameters
-----------
dependency_list : list
list of dependencies in maven format
"""
for dependency in dependency_list:
download_dir = create_dependency_folder_structure(dependency)
relative_dir = os.path.relpath(download_dir, dependency_dir)
relative_url = relative_dir.replace("\\", "/")
download_url = maven_repo_url + relative_url
group_id, artifact, version = dependency.split(":")
file_type = artifact + "-" + version + "."
dependency_pom_path = os.path.join(download_dir, file_type + "pom")
try:
html_source = urllib2.urlopen(download_url).read()
except:
print "[ERROR downloading ] " + download_url
print "Attempting to pull from local sdk"
copy_deps_from_local_sdk(download_dir, relative_dir)
dependency_list.extend(
get_parent_node_dep_list_from_pom(dependency_pom_path)
)
continue
soup = BeautifulSoup(html_source, "html.parser")
for link in soup.find_all('a'):
if file_type in link['href']:
file_name = link['href']
if not os.path.exists(os.path.join(download_dir, file_name)):
wget.download(download_url + "/" + file_name, download_dir)
print "Downloaded " + file_name
dependency_list.extend(
get_parent_node_dep_list_from_pom(dependency_pom_path)
)
def get_parent_node_dep_list_from_pom(pom_file_path):
"""Reads a pom file and gets parent node deps.
Parent node deps are not resolved by gradle deps,
hence resolving them as well.
Parameters
---------------
pom_file_path : str
pom file to be parsed
Returns
--------------
parent_dependency_list : list
List of parent node dependencies
"""
namespace = "http://maven.apache.org/POM/4.0.0"
if not os.path.exists(pom_file_path):
print "POM file " + pom_file_path + " does not exist"
print "Continuing..."
return []
pom_file_content = open(pom_file_path, "r").read()
soup = BeautifulSoup(pom_file_content, "html.parser")
parents = soup.find_all("parent")
parent_dependency_list = []
for parent in parents:
groupId = artifactId = version = ""
if (parent.find("groupid") is None or
parent.find("artifactid") is None or
parent.find("version") is None):
continue
groupId = parent.find("groupid").text
artifactId = parent.find("artifactid").text
version = parent.find("version").text
parent_dependency_list.append(":".join([groupId, artifactId, version]))
return parent_dependency_list
def copy_deps_from_local_sdk(target_dir, relative_dir):
""" Copies dependency files from nuget cache sdk
to target directory in this case download dependency directory
Parameters
--------------
target_dir : str
directory created for download of dependency
relative_dir : str
maven directory structure of dependency
"""
nugetcache_path = os.environ['NugetMachineInstallRoot']
if not os.path.exists(nugetcache_path):
print "Nuget cache does not exist. Continuing."
return
desired_sdk_path = os.path.join(nugetcache_path, desired_sdk)
if not os.path.exists(desired_sdk_path):
print "Desired android sdk " + desired_sdk + " not found in nuget cache. Continuing."
return
source_dir = os.path.join(
desired_sdk_path, "extras", "android", "m2repository")
source_dir = os.path.join(source_dir, relative_dir)
if not os.path.exists(source_dir):
print "Dependecy not present in nuget cache android sdk. Continuing."
return
src_files = os.listdir(source_dir)
for file_name in src_files:
src_file = os.path.join(source_dir, file_name)
if os.path.isfile(src_file):
if not os.path.exists(os.path.join(target_dir, file_name)):
shutil.copy(src_file, target_dir)
print "Copied file : " + file_name
else:
print file_name + " already present"
def parse_and_download_dependencies(filepath):
""" Parse and download gradle dependencies
Parameters
-----------
filepath : str
file containing gradle dependency list
"""
dependency_list = parse_dependencies(filepath)
download_dependencies(dependency_list)
def main():
create_folder(dependency_dir)
set_env_variables()
list_dependencies()
parse_and_download_dependencies(dependency_list_file_path)
if __name__ == '__main__':
main()

Просмотреть файл

@ -0,0 +1,540 @@
from bs4 import BeautifulSoup
import os
import re
import shlex
import shutil
from subprocess import Popen, PIPE, STDOUT
import sys
import wget
from urllib.request import urlopen
import glob
import zipfile
import time
import sys
import logging
import xml.etree.ElementTree as ET
import json
# Note: This list of repo needs to be kept current manually.
maven_repos = ["https://repo1.maven.org/maven2/", "https://jcenter.bintray.com/"]
desired_sdk = os.getenv("ANDROID_SDK_ROOT")
if not desired_sdk:
logging.error("Envrionment variable ANDROID_SDK_ROOT must be set.")
exit(-1)
if os.getenv("ANDROID_NDK"):
desired_ndk = os.getenv("ANDROID_NDK")
elif os.path.exists(os.path.join(desired_sdk, "ndk-bundle")):
desired_ndk = os.path.join(desired_sdk, "ndk-bundle")
elif os.path.exists(os.path.join(desired_sdk, "ndk")):
desired_ndk = os.path.join(desired_sdk, "ndk")
else:
logging.error("Envrionment variable ANDROID_NDK must be set.")
exit(-1)
desired_jdk = os.getenv("JAVA_HOME")
if not desired_jdk:
logging.error("Envrionment variable JAVA_HOME must be set.")
exit(-1)
def create_folder(folder_path):
"""Create folder if it does not exist
Parameters
----------
folder_path : str
folder path to be checked
"""
if not os.path.exists(folder_path):
try:
os.makedirs(folder_path)
except Exception as inst:
logging.error("Error while creating directory: " + inst)
def list_dependencies(react_native_dir, output_file_path):
""" Write all gradle dependencies to file
"""
os.chdir(react_native_dir)
env = dict(os.environ)
env['ANDROID_SDK_ROOT']=desired_sdk
env['ANDROID_NDK']=desired_ndk
env['JAVA_HOME']=desired_jdk
logging.debug("desired_jdk:" + desired_jdk)
gradle_command = "./gradlew :ReactAndroid:dependencies --configuration api"
with open(output_file_path, "w+") as output_file:
try:
process = Popen(shlex.split(gradle_command), stdout=output_file, stderr=PIPE, env=env)
output, err = process.communicate()
if err:
logging.error("Dependency enumeration failed !")
logging.error(err)
exit(1)
exit_code = process.wait()
if exit_code < 0:
logging.error("Dependency enumeration failed with error code: " + exit_code + " !")
exit(1)
except Exception as e:
logging.error("Dependency enumeration failed with exception: " + str(e))
exit(1)
def parse_dependencies(filepath):
""" Parse gradle dependencies and return list
Parameters
-----------
filepath : str
file containing gradle dependency list
Returns
-----------
dependency_list : list
list of dependecies in maven format
"""
infile = open(filepath, "r")
dependency_list = []
dependency_regex = "[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+"
omit_dependency_delim = "(*)"
for line in infile:
if line.endswith(omit_dependency_delim):
continue
regex_matches = re.search(dependency_regex, line)
if regex_matches != None:
dependency = regex_matches.group(0)
if dependency not in dependency_list:
dependency_list.append(dependency)
logging.info("Identified library: " + line)
else:
logging.info("Ignored entry: " + line)
return dependency_list
def create_dependency_folder_structure(dependency_dir_maven, dependency):
""" Takes dependency in maven format and creates
folder structure required for download.
Returns the path where it should be downloaded
Parameters
----------
dependency : str
name in maven format
Returns
----------
path : str
folder depth path where dependencies
will be downloaded
"""
group_id, artifact, version = dependency.split(":")
folder_chain = []
for group in group_id.split("."):
folder_chain.append(group)
folder_chain.append(artifact)
folder_chain.append(version)
parent_dir = dependency_dir_maven
for folder in folder_chain:
child_dir = os.path.join(parent_dir, folder)
create_folder(child_dir)
parent_dir = child_dir
return parent_dir
def try_download_dependency(download_dir, relative_url, file_type, dependency, repo_url):
logging.debug("Attempting to download " + dependency)
download_url = repo_url + relative_url
try:
html_source = urlopen(download_url).read()
soup = BeautifulSoup(html_source, "html.parser")
for link in soup.find_all('a'):
if file_type in link['href']:
file_name = link['href']
if not os.path.exists(os.path.join(download_dir, file_name)):
wget.download(download_url + "/" + file_name, download_dir)
logging.info("Downloaded " + file_name)
return True # either the file exists (previously downloaded) or the download succeeded (i.e. without exception).
except Exception as inst:
logging.info("Exception while downloading: " + str(inst))
return False
return False
def get_office_platform(platform):
switcher = {'arm64-v8a':'droidarm64', 'armeabi-v7a':'droidarm', 'x86':'droidx86','x86_64':'droidx64'}
return switcher.get(platform,"")
def extract_so(original_file_root, native_dir, original_file_name):
logging.info("Attempting to extract native libraries from " + original_file_name)
archive_filename_without_ext, archive_file_extension = os.path.splitext(original_file_name)
original_file_path = os.path.join(original_file_root, original_file_name)
zip_filepath = os.path.join(original_file_root, original_file_name + ".zip")
shutil.move(original_file_path, zip_filepath)
# Extract the archive
with zipfile.ZipFile(zip_filepath) as zip_file:
zip_target_folder = os.path.join(original_file_root, archive_filename_without_ext)
zip_file.extractall(zip_target_folder)
# Extract native libraries.
for candidate_so_root, dirsi, candidate_so_files in os.walk(zip_target_folder):
for candidate_so_file in candidate_so_files:
if candidate_so_file.endswith(".so"):
logging.info("Found native library " + candidate_so_file)
so_path = os.path.join(candidate_so_root, candidate_so_file)
lib_platform = os.path.basename(candidate_so_root)
lib_office_platform = get_office_platform(lib_platform)
if not lib_office_platform:
logging.error("Invalid platform for native library: " + candidate_so_file)
exit(1)
so_target_dir = os.path.join(native_dir, lib_office_platform)
create_folder(so_target_dir)
shutil.move(so_path, so_target_dir)
# Re-zip back to original file name.
new_zip_filepath = os.path.join(original_file_root, archive_filename_without_ext + "_rezipped.zip")
with zipfile.ZipFile(new_zip_filepath, 'w', zipfile.ZIP_DEFLATED) as zip_file:
for rootz, dirsz, filesz in os.walk(zip_target_folder):
for filez in filesz:
dest_path = os.path.join(rootz, filez)
# rel_path = os.path.relpath(dest_path, os.path.join(zip_target_folder, '..'))
rel_path = os.path.relpath(dest_path, zip_target_folder)
zip_file.write(dest_path, rel_path)
# Rename the rezipped file to original file name.
shutil.move(new_zip_filepath, os.path.join(original_file_root, original_file_name))
# Remove the originally renamed archive and extracted folder.
shutil.rmtree(zip_target_folder)
os.remove(zip_filepath)
def extract_sos(maven_dir, native_dir):
logging.debug("Attempting to extract native libraries")
for original_file_root, dirs, original_files in os.walk(maven_dir):
for original_file_name in original_files:
archive_filename_without_ext, archive_file_extension = os.path.splitext(original_file_name)
if(archive_file_extension in ['.jar', '.aar']):
extract_so(original_file_root, native_dir, original_file_name)
def download_dependencies(dependency_dir_maven, dependency_list):
"""Creates the directory structure
and downloads the maven dependecies
and saves it in the same format
Parameters
-----------
dependency_list : list
list of dependencies in maven format
"""
parent_list = []
for dependency in dependency_list:
download_dir = create_dependency_folder_structure(dependency_dir_maven, dependency)
relative_dir = os.path.relpath(download_dir, dependency_dir_maven)
relative_url = relative_dir.replace("\\", "/")
group_id, artifact, version = dependency.split(":")
file_type = artifact + "-" + version + "."
dependency_pom_path = os.path.join(download_dir, file_type + "pom")
succeeded = False
for repo_url in maven_repos:
succeeded = try_download_dependency(download_dir, relative_url, file_type, dependency, repo_url)
if (succeeded):
break
if not succeeded:
logging.error("[ERROR downloading ] " + relative_url + " from the listed maven repos.")
logging.error("Attempting to pull from local sdk")
succeeded = copy_deps_from_local_sdk(download_dir, relative_dir)
if not succeeded:
logging.error("[Failed to download ] " + dependency)
else:
additional_dependency_list = get_dependency_node_dep_list_from_pom(dependency_pom_path)
for additional_dependency in additional_dependency_list:
if (additional_dependency not in dependency_list):
dependency_list.append(additional_dependency)
parent_dependency_list = get_parent_node_dep_list_from_pom(dependency_pom_path)
for parent_dependency in parent_dependency_list:
if ((parent_dependency not in parent_list) and (parent_dependency not in dependency_list)):
parent_list.append(parent_dependency)
for dependency in parent_list:
download_dir = create_dependency_folder_structure(dependency_dir_maven, dependency)
relative_dir = os.path.relpath(download_dir, dependency_dir_maven)
relative_url = relative_dir.replace("\\", "/")
group_id, artifact, version = dependency.split(":")
file_type = artifact + "-" + version + "."
dependency_pom_path = os.path.join(download_dir, file_type + "pom")
succeeded = False
for repo_url in maven_repos:
succeeded = try_download_dependency(download_dir, relative_url, file_type, dependency, repo_url)
if (succeeded):
break
if not succeeded:
logging.error("[ERROR downloading ] " + relative_url + " from the listed maven repos.")
logging.error("Attempting to pull from local sdk")
succeeded = copy_deps_from_local_sdk(download_dir, relative_dir)
if not succeeded:
logging.error("[Failed to download ] " + dependency)
# Don't recurse down for parent dependencies
def get_dependency_node_dep_list_from_pom(pom_file_path):
"""Reads a pom file and gets parent node deps.
Parent node deps are not resolved by gradle deps,
hence resolving them as well.
Parameters
---------------
pom_file_path : str
pom file to be parsed
Returns
--------------
parent_dependency_list : list
List of parent node dependencies
"""
namespace = "http://maven.apache.org/POM/4.0.0"
if not os.path.exists(pom_file_path):
logging.info("POM file " + pom_file_path + " does not exist")
logging.info("Continuing...")
return []
dependency_dependency_list = []
tree = ET.parse(pom_file_path)
for dependency in tree.getroot().findall('.//{http://maven.apache.org/POM/4.0.0}dependency'):
groupId = dependency.find('.//{http://maven.apache.org/POM/4.0.0}groupId')
artifactId = dependency.find('.//{http://maven.apache.org/POM/4.0.0}artifactId')
version = dependency.find('.//{http://maven.apache.org/POM/4.0.0}version')
scope = dependency.find('.//{http://maven.apache.org/POM/4.0.0}scope')
if groupId is None or artifactId is None or version is None:
break
if(scope is None or scope.text in ['compile', 'runtime']):
if scope is not None:
logging.info("[" + scope.text + "]")
logging.info(groupId.text + ":" + artifactId.text + ":" + version.text)
dependency_dependency_list.append(":".join([groupId.text, artifactId.text, version.text]))
return dependency_dependency_list
def get_parent_node_dep_list_from_pom(pom_file_path):
"""Reads a pom file and gets parent node deps.
Parent node deps are not resolved by gradle deps,
hence resolving them as well.
Parameters
---------------
pom_file_path : str
pom file to be parsed
Returns
--------------
parent_dependency_list : list
List of parent node dependencies
"""
namespace = "http://maven.apache.org/POM/4.0.0"
if not os.path.exists(pom_file_path):
logging.info("POM file " + pom_file_path + " does not exist")
logging.info("Continuing...")
return []
parent_dependency_list = []
tree = ET.parse(pom_file_path)
# TODO: Share code with last block
for dependency in tree.getroot().findall('.//{http://maven.apache.org/POM/4.0.0}parent'):
groupId = dependency.find('.//{http://maven.apache.org/POM/4.0.0}groupId')
artifactId = dependency.find('.//{http://maven.apache.org/POM/4.0.0}artifactId')
version = dependency.find('.//{http://maven.apache.org/POM/4.0.0}version')
scope = dependency.find('.//{http://maven.apache.org/POM/4.0.0}scope')
if groupId is None or artifactId is None or version is None:
break
if(scope is None or scope.text in ['compile', 'runtime']):
if scope is not None:
logging.info("[" + scope.text + "]")
logging.info(groupId.text + ":" + artifactId.text + ":" + version.text)
parent_dependency_list.append(":".join([groupId.text, artifactId.text, version.text]))
# pom_file_content = open(pom_file_path, "r").read()
# soup = BeautifulSoup(pom_file_content, "html.parser")
# parents = soup.find_all("parent")
# parent_dependency_list = []
# for parent in parents:
# groupId = artifactId = version = ""
# if (parent.find("groupid") is None or
# parent.find("artifactid") is None or
# parent.find("version") is None):
# continue
# groupId = parent.find("groupid").text
# artifactId = parent.find("artifactid").text
# version = parent.find("version").text
# parent_dependency_list.append(":".join([groupId, artifactId, version]))
return parent_dependency_list
def copy_deps_from_local_sdk(target_dir, relative_dir):
""" Copies dependency files from nuget cache sdk
to target directory in this case download dependency directory
Parameters
--------------
target_dir : str
directory created for download of dependency
relative_dir : str
maven directory structure of dependency
"""
# nugetcache_path = os.environ['NugetMachineInstallRoot']
# if not os.path.exists(nugetcache_path):
# logging.info("Nuget cache does not exist. Continuing.")
# return False
# desired_sdk_path = os.path.join(nugetcache_path, desired_sdk)
# if not os.path.exists(desired_sdk_path):
# logging.info("Desired android sdk " + desired_sdk + " not found in nuget cache. Continuing.")
# return False
source_dir = os.path.join(
desired_sdk, "extras", "android", "m2repository")
source_dir = os.path.join(source_dir, relative_dir)
if not os.path.exists(source_dir):
logging.info("Dependecy not present in nuget cache android sdk. Continuing.")
return False
src_files = os.listdir(source_dir)
for file_name in src_files:
src_file = os.path.join(source_dir, file_name)
if os.path.isfile(src_file):
if not os.path.exists(os.path.join(target_dir, file_name)):
shutil.copy(src_file, target_dir)
logging.info("Copied file : " + file_name)
else:
logging.info(file_name + " already present")
return True
return False
def parse_and_download_dependencies(dependency_dir_maven, dependency_list_filepath):
""" Parse and download gradle dependencies
Parameters
-----------
filepath : str
file containing gradle dependency list
"""
dependency_list = parse_dependencies(dependency_list_filepath)
download_dependencies(dependency_dir_maven, dependency_list)
def ensure_output_dir(output_dir_path):
# Move out if already exists.
if os.path.exists(output_dir_path):
logging.debug(output_dir_path + " exists ! Trying to move it.")
output_dir_path_copy = output_dir_path + '-' + time.strftime("%Y%m%d-%H%M%S")
shutil.move(output_dir_path, output_dir_path_copy )
# If it still exists, fail the execution.
if os.path.exists(output_dir_path):
logging.error("Unable to cleanup existing dependency directory: " + output_dir_path)
logging.error("Move it away manually and rerun the script.")
exit(1)
# Create a fresh directory for output.
create_folder(output_dir_path)
def main():
if len(sys.argv) == 2:
react_native_dir = sys.argv[1]
else:
react_native_dir = os.getcwd()
# Some smoke checks to ensure that we have a valid react-native checkout.
packageJsonFile = os.path.join(react_native_dir, "package.json")
with open(packageJsonFile) as packageJsonText:
packageJson = json.load(packageJsonText)
if(packageJson[u'name'] != u'react-native' and packageJson[u'name'] != u'react-native-macos'):
logging.info("Not a valid RN repo path!")
exit(-1)
if (not os.path.join(react_native_dir, "ReactAndroid", "build.gradle")):
logging.info("Not a valid RN repo path!")
exit(-1)
dependency_dir_root = os.path.join(react_native_dir, "android", "dependencies")
dependency_dir_maven = os.path.join(dependency_dir_root, "cross", "cross", "x-none", "maven")
dependency_dir_native = dependency_dir_root
dependency_dir_hermes = os.path.join(dependency_dir_root, "hermes")
dependency_list_file_path = os.path.join(dependency_dir_root, "gradle_dependencies.txt")
log_file_path = os.path.join(react_native_dir, "android", "log_" + time.strftime("%Y%m%d-%H%M%S") + ".txt" )
if(not os.path.exists(os.path.join(react_native_dir, "android"))):
os.mkdir(os.path.join(react_native_dir, "android"))
logging.basicConfig(level = logging.DEBUG, filename = log_file_path)
logging.info("react_native_dir: " + react_native_dir)
logging.info("Maven dependency path: " + dependency_dir_maven)
logging.info("Native dependency path: " + dependency_dir_native)
logging.info("Dependency list file path: " + dependency_list_file_path)
# Ensure we have an output directory
ensure_output_dir(dependency_dir_root)
# List gradle dependencies to file.
list_dependencies(react_native_dir, dependency_list_file_path)
# download dependencies to maven root
parse_and_download_dependencies(dependency_dir_maven, dependency_list_file_path)
# Extract the native libraries from maven packages
extract_sos(dependency_dir_maven, dependency_dir_native)
# Copy and extract hermes.
dependency_dir_hermes_android_aar_path = os.path.join(dependency_dir_hermes, "android")
hermes_engine_node_modules_path = os.path.join(react_native_dir, "node_modules", "hermes-engine")
shutil.copytree(os.path.join(hermes_engine_node_modules_path, "android"), dependency_dir_hermes_android_aar_path)
shutil.copytree(os.path.join(hermes_engine_node_modules_path, "linux64-bin"), os.path.join(dependency_dir_hermes, "linux64-bin"))
shutil.copytree(os.path.join(hermes_engine_node_modules_path, "win64-bin"), os.path.join(dependency_dir_hermes, "win64-bin"))
shutil.copytree(os.path.join(hermes_engine_node_modules_path, "osx-bin"), os.path.join(dependency_dir_hermes, "osx-bin"))
shutil.copy(os.path.join(hermes_engine_node_modules_path, "package.json"), dependency_dir_hermes)
dependency_dir_hermes_android_native_debug = os.path.join(dependency_dir_hermes_android_aar_path, "debug")
dependency_dir_hermes_android_native_release = os.path.join(dependency_dir_hermes_android_aar_path, "release")
extract_so(dependency_dir_hermes_android_aar_path, dependency_dir_hermes_android_native_debug, "hermes-debug.aar")
extract_so(dependency_dir_hermes_android_aar_path, dependency_dir_hermes_android_native_debug, "hermes-cppruntime-debug.aar")
extract_so(dependency_dir_hermes_android_aar_path, dependency_dir_hermes_android_native_release, "hermes-release.aar")
extract_so(dependency_dir_hermes_android_aar_path, dependency_dir_hermes_android_native_release, "hermes-cppruntime-release.aar")
# Copy log file into the dependency root folder.
shutil.copy(log_file_path, os.path.join(dependency_dir_root))
with open(log_file_path, "r") as fin:
print(fin.read())
if __name__ == '__main__':
main()