From 2e8893fb5be0c877e0818d04264d75fa92ae0f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Tue, 31 Aug 2021 05:22:01 -0700 Subject: [PATCH 1/5] Replace envvars with required params in codegen script and add Fabric output overrides Summary: The codegen script now takes parameters for any necessary configuration. Now, there are three *required* parameters: JS_SRCS_DIR, LIBRARY_NAME, and OUTPUT_DIR. By default, all modules and components output will be copied to the OUTPUT_DIR under a single LIBRARY_NAME. If a fourth argument is provided, this COMPONENT_LIBRARY_NAME will be used for the component library name. If a fifth argument is provided, this COMPONENT_OUTPUT_DIR will be used as the output directory for the component library. These last two arguments are used to build the core FBReactNativeSpec modules and rncore components libraries. Eventually, all module and component output will be part of a single library, but for the time being we need to keep these apart for the core modules and components. The script will output usage instructions if no argument is provided: ``` ./scripts/generate-specs.sh NAME ./scripts/generate-specs.sh -- generate specs SYNOPSIS ./scripts/generate-specs.sh javascript_sources_directory specs_library_name output_directory ./scripts/generate-specs.sh javascript_sources_directory specs_library_name output_directory component_library_name [component_output_directory] DESCRIPTION In the first synopsis form, this script collects native module and native component JavaScript spec definitions in javascript_sources_directory, then uses react-native-codegen to generate the native interface code into a library named specs_library_name, which is copied to the destination output_directory. In the second synopsis form, the component_library_name will be used as the name of the component native interface code library. If provided, the component output will be copied to the component_output_directory, otherwise it will be copied to the output_directory. ``` With these changes, `codegen.js` became redundant and has been removed. Changelog: [Internal] - Codegen script interface changes. Reviewed By: fkgozali Differential Revision: D30626294 fbshipit-source-id: 475c29242497db5f93213aa64ca9b7c480140d55 --- .../FBReactNativeSpec.podspec | 14 ++- scripts/codegen.js | 54 ----------- scripts/generate-specs.sh | 95 +++++++++++++------ scripts/react_native_pods.rb | 56 +++++------ 4 files changed, 104 insertions(+), 115 deletions(-) delete mode 100644 scripts/codegen.js diff --git a/React/FBReactNativeSpec/FBReactNativeSpec.podspec b/React/FBReactNativeSpec/FBReactNativeSpec.podspec index 32a4bf8cb4..bdbf102331 100644 --- a/React/FBReactNativeSpec/FBReactNativeSpec.podspec +++ b/React/FBReactNativeSpec/FBReactNativeSpec.podspec @@ -4,7 +4,9 @@ # LICENSE file in the root directory of this source tree. require "json" -require_relative "../../scripts/react_native_pods.rb" + +react_native_path = "../.." +require_relative "#{react_native_path}/scripts/react_native_pods.rb" package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) version = package['version'] @@ -46,5 +48,13 @@ Pod::Spec.new do |s| s.dependency "React-jsi", version s.dependency "ReactCommon/turbomodule/core", version - use_react_native_codegen! (s) + use_react_native_codegen!(s, { + :react_native_path => react_native_path, + :js_srcs_dir => "#{react_native_path}/Libraries", + :library_name => "FBReactNativeSpec", + :output_dir => "#{react_native_path}/React/FBReactNativeSpec", + :component_library_name => "rncore", + # TODO: component_output_dir should be programmatically specified, and may change with use_frameworks! support. + :component_output_dir => "#{react_native_path}/ReactCommon/react/renderer/components/" + }) end diff --git a/scripts/codegen.js b/scripts/codegen.js deleted file mode 100644 index 12ff0917dd..0000000000 --- a/scripts/codegen.js +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env node -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -require('shelljs/global'); -const yargs = require('yargs'); -const execSync = require('child_process').execSync; - -let argv = yargs.option('srcs', { - alias: 'srcs_dir', - type: 'string', - description: 'Path to JavaScript sources', -}).option('modules_library_name', { - type: 'string', - description: 'Native modules interfaces library name', -}).option('modules_output_dir', { - type: 'string', - description: 'Native modules interfaces output dir', -}).option('components_library_name', { - type: 'string', - description: 'Native components interfaces library name', -}).option('components_output_dir', { - type: 'string', - description: 'Native components interfaces output dir', -}).argv; - -let env_vars = []; -const { srcs_dir, modules_library_name, modules_output_dir, components_library_name, components_output_dir } = argv; - -if (srcs_dir) { - env_vars.push(`SRCS_DIR=${srcs_dir}`); -} -if (modules_library_name) { - env_vars.push(`MODULES_LIBRARY_NAME=${modules_library_name}`); -} -if (modules_output_dir) { - env_vars.push(`MODULES_OUTPUT_DIR=${modules_output_dir}`); -} -if (components_library_name) { - env_vars.push(`COMPONENTS_LIBRARY_NAME=${components_library_name}`); -} -if (components_output_dir) { - env_vars.push(`COMPONENTS_OUTPUT_DIR=${components_output_dir}`); -} - -execSync(`${env_vars.join(' ')} ./generate-specs.sh`); diff --git a/scripts/generate-specs.sh b/scripts/generate-specs.sh index 4456557dfb..d3ea448e17 100755 --- a/scripts/generate-specs.sh +++ b/scripts/generate-specs.sh @@ -4,20 +4,12 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -# This script collects the JavaScript spec definitions for core +# This script collects the JavaScript spec definitions for # native modules and components, then uses react-native-codegen # to generate native code. # -# Optionally, set these envvars to override defaults: -# - SRCS_DIR: Path to JavaScript sources -# - MODULES_LIBRARY_NAME: Defaults to FBReactNativeSpec -# - MODULES_OUTPUT_DIR: Defaults to React/$MODULES_LIBRARY_NAME/$MODULES_LIBRARY_NAME -# - COMPONENTS_LIBRARY_NAME: Defaults to rncore -# - COMPONENTS_OUTPUT_DIR: Defaults to ReactCommon/react/renderer/components/$COMPONENTS_LIBRARY_NAME -# # Usage: # ./scripts/generate-specs.sh -# SRCS_DIR=myapp/js MODULES_LIBRARY_NAME=MySpecs MODULES_OUTPUT_DIR=myapp/MySpecs ./scripts/generate-specs.sh # # shellcheck disable=SC2038 @@ -44,27 +36,45 @@ describe () { printf "\\n\\n>>>>> %s\\n\\n\\n" "$1" >&2 } +print_usage () { + printf "\\nNAME\\n\\t%s -- generate specs\\n" "$1" >&2 + printf "\\nSYNOPSIS\\n" >&2 + printf "\\t%s javascript_sources_directory specs_library_name output_directory\\n" "$1" >&2 + printf "\\t%s javascript_sources_directory specs_library_name output_directory component_library_name [component_output_directory]\\n" "$1" >&2 + printf "\\n\\nDESCRIPTION\\n\\tIn the first synopsis form, this script collects native module and native component JavaScript spec definitions in javascript_sources_directory, then uses react-native-codegen to generate the native interface code into a library named specs_library_name, which is copied to the destination output_directory.\\n" >&2 + printf "\\n\\tIn the second synopsis form, the component_library_name will be used as the name of the component native interface code library. If provided, the component output will be copied to the component_output_directory, otherwise it will be copied to the output_directory.\\n" >&2 +} + main() { - SRCS_DIR=${SRCS_DIR:-$(cd "$RN_DIR/Libraries" && pwd)} - MODULES_LIBRARY_NAME=${MODULES_LIBRARY_NAME:-FBReactNativeSpec} - - COMPONENTS_LIBRARY_NAME=${COMPONENTS_LIBRARY_NAME:-rncore} - MODULES_OUTPUT_DIR=${MODULES_OUTPUT_DIR:-"$RN_DIR/React/$MODULES_LIBRARY_NAME/$MODULES_LIBRARY_NAME"} - # TODO: $COMPONENTS_PATH should be programmatically specified, and may change with use_frameworks! support. - COMPONENTS_PATH="ReactCommon/react/renderer/components" - COMPONENTS_OUTPUT_DIR=${COMPONENTS_OUTPUT_DIR:-"$RN_DIR/$COMPONENTS_PATH/$COMPONENTS_LIBRARY_NAME"} - - TEMP_OUTPUT_DIR="$TEMP_DIR/out" - SCHEMA_FILE="$TEMP_DIR/schema.json" - - CODEGEN_REPO_PATH="$RN_DIR/packages/react-native-codegen" - CODEGEN_NPM_PATH="$RN_DIR/../react-native-codegen" + MIN_ARG_NUM=3 + if [ "$#" -eq 0 ]; then + print_usage "$0" + exit 1 + fi if [ -z "$NODE_BINARY" ]; then echo "Error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable." 1>&2 exit 1 fi + if [ "$#" -lt "$MIN_ARG_NUM" ]; then + echo "Error: Expected $MIN_ARG_NUM arguments, got $# instead. Run $0 with no arguments to learn more." 1>&2 + exit 1 + fi + + SRCS_DIR=$1 + LIBRARY_NAME=$2 + OUTPUT_DIR=$3 + COMPONENT_LIBRARY_NAME_OVERRIDE=$4 + COMPONENT_OUTPUT_DIR_OVERRIDE=$5 + + PLATFORM="ios" + TEMP_OUTPUT_DIR="$TEMP_DIR/out" + SCHEMA_FILE="$TEMP_DIR/schema.json" + + CODEGEN_REPO_PATH="$RN_DIR/packages/react-native-codegen" + CODEGEN_NPM_PATH="$RN_DIR/../react-native-codegen" + if [ -d "$CODEGEN_REPO_PATH" ]; then CODEGEN_PATH=$(cd "$CODEGEN_REPO_PATH" && pwd) elif [ -d "$CODEGEN_NPM_PATH" ]; then @@ -82,15 +92,38 @@ main() { describe "Generating schema from Flow types" "$NODE_BINARY" "$CODEGEN_PATH/lib/cli/combine/combine-js-to-schema-cli.js" "$SCHEMA_FILE" "$SRCS_DIR" - describe "Generating native code from schema (iOS)" - pushd "$RN_DIR" >/dev/null || exit 1 - "$NODE_BINARY" scripts/generate-specs-cli.js ios "$SCHEMA_FILE" "$TEMP_OUTPUT_DIR" "$MODULES_LIBRARY_NAME" - popd >/dev/null || exit 1 + describe "Generating native code from schema ($PLATFORM)" + pushd "$RN_DIR" >/dev/null + "$NODE_BINARY" scripts/generate-specs-cli.js "$PLATFORM" "$SCHEMA_FILE" "$TEMP_OUTPUT_DIR" "$LIBRARY_NAME" + popd >/dev/null - mkdir -p "$COMPONENTS_OUTPUT_DIR" "$MODULES_OUTPUT_DIR" - cp -R "$TEMP_OUTPUT_DIR/$MODULES_LIBRARY_NAME.h" "$TEMP_OUTPUT_DIR/$MODULES_LIBRARY_NAME-generated.mm" "$MODULES_OUTPUT_DIR" || exit 1 - find "$TEMP_OUTPUT_DIR" -type f | xargs sed -i.bak "s/$MODULES_LIBRARY_NAME/$COMPONENTS_LIBRARY_NAME/g" || exit 1 - find "$TEMP_OUTPUT_DIR" -type f -not -iname "$MODULES_LIBRARY_NAME*" -exec cp '{}' "$COMPONENTS_OUTPUT_DIR/" ';' || exit 1 + + mkdir -p "$OUTPUT_DIR" + + if [ -z "$COMPONENT_LIBRARY_NAME_OVERRIDE" ]; then + # Copy all output to output_dir + cp -R "$TEMP_OUTPUT_DIR/" "$OUTPUT_DIR" + echo >&2 "$LIBRARY_NAME output has been written to $OUTPUT_DIR:" + ls -1 "$OUTPUT_DIR" 2>&1 + else + # Copy modules output to output_dir + cp "$TEMP_OUTPUT_DIR/$LIBRARY_NAME.h" "$TEMP_OUTPUT_DIR/$LIBRARY_NAME-generated.mm" "$OUTPUT_DIR" + echo >&2 "$LIBRARY_NAME output has been written to $OUTPUT_DIR:" + ls -1 "$OUTPUT_DIR" 2>&1 + + # Rename library name used in components output files + find "$TEMP_OUTPUT_DIR" -type f | xargs sed -i.bak "s/$LIBRARY_NAME/$COMPONENT_LIBRARY_NAME_OVERRIDE/g" + + if [ -n "$COMPONENT_OUTPUT_DIR_OVERRIDE" ]; then + # Components codegen output to be moved to separate directory + mkdir -p "$COMPONENT_OUTPUT_DIR_OVERRIDE" + OUTPUT_DIR="$COMPONENT_OUTPUT_DIR_OVERRIDE" + fi + + find "$TEMP_OUTPUT_DIR" -type f -not -iname "$LIBRARY_NAME.h" -not -iname "$LIBRARY_NAME-generated.mm" -not -iname "*.bak" -exec cp '{}' "$OUTPUT_DIR/" ';' + echo >&2 "$COMPONENT_LIBRARY_NAME_OVERRIDE output has been written to $OUTPUT_DIR:" + ls -1 "$OUTPUT_DIR" 2>&1 + fi echo >&2 'Done.' } diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index a4131f3ec2..02b04e1e4f 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -161,38 +161,38 @@ def use_react_native_codegen!(spec, options={}) js_srcs = options[:js_srcs_dir] ||= "#{prefix}/Libraries" # Library name (e.g. FBReactNativeSpec) - modules_library_name = options[:library_name] ||= spec.name + library_name = options[:library_name] ||= "#{spec.name}Spec" # Output dir, relative to podspec that invoked this method - modules_output_dir = options[:modules_output_dir] ||= "#{prefix}/React/#{modules_library_name}/#{modules_library_name}" + output_dir = options[:output_dir] ||= "#{prefix}/React/#{library_name}" - generated_dirs = [ modules_output_dir ] - generated_filenames = [ "#{modules_library_name}.h", "#{modules_library_name}-generated.mm" ] - generated_files = generated_filenames.map { |filename| "#{modules_output_dir}/#{filename}" } + generated_dirs = [ "#{output_dir}/#{library_name}" ] + generated_filenames = [ "#{library_name}.h", "#{library_name}-generated.mm" ] + generated_files = generated_filenames.map { |filename| "#{output_dir}/#{library_name}/#{filename}" } # Run the codegen as part of the Xcode build pipeline. - env_vars = "SRCS_DIR='${PODS_TARGET_SRCROOT}/#{js_srcs}'" - env_vars += " MODULES_OUTPUT_DIR='${PODS_TARGET_SRCROOT}/#{modules_output_dir}'" - env_vars += " MODULES_LIBRARY_NAME='#{modules_library_name}'" + codegen_script_args = [ "'${PODS_TARGET_SRCROOT}/#{js_srcs}'" ] + codegen_script_args.push "'#{library_name}'" + codegen_script_args.push "'${PODS_TARGET_SRCROOT}/#{output_dir}/#{library_name}'" - if ENV['USE_FABRIC'] == '1' - # We use a different library name for components, as well as an additional set of files. - # Eventually, we want these to be part of the same library as #{modules_library_name} above. - components_output_dir = options[:components_output_dir] ||= "#{prefix}/ReactCommon/react/renderer/components/rncore/" - generated_dirs.push components_output_dir - env_vars += " COMPONENTS_OUTPUT_DIR='${PODS_TARGET_SRCROOT}/#{components_output_dir}'" - components_generated_filenames = [ - "ComponentDescriptors.h", - "EventEmitters.cpp", - "EventEmitters.h", - "Props.cpp", - "Props.h", - "RCTComponentViewHelpers.h", - "ShadowNodes.cpp", - "ShadowNodes.h" - ] - generated_files = generated_files.concat(components_generated_filenames.map { |filename| "#{components_output_dir}/#{filename}" }) - end + # We use a different library name for components, as well as an additional set of files. + # Eventually, we want these to be part of the same library as #{library_name} above. + component_library_name = options[:component_library_name] ||= library_name + component_output_dir = options[:component_output_dir] ||= output_dir + generated_dirs.push "#{component_output_dir}/#{component_library_name}" + codegen_script_args.push "'#{component_library_name}'" + codegen_script_args.push "'${PODS_TARGET_SRCROOT}/#{component_output_dir}/#{component_library_name}'" + components_generated_filenames = [ + "ComponentDescriptors.h", + "EventEmitters.cpp", + "EventEmitters.h", + "Props.cpp", + "Props.h", + "RCTComponentViewHelpers.h", + "ShadowNodes.cpp", + "ShadowNodes.h" + ] + generated_files = generated_files.concat(components_generated_filenames.map { |filename| "#{component_output_dir}/#{component_library_name}/#{filename}" }) # Prepare filesystem by creating empty files that will be picked up as references by CocoaPods. prepare_command = "mkdir -p #{generated_dirs.join(" ")} && touch -a #{generated_files.join(" ")}" @@ -202,11 +202,11 @@ def use_react_native_codegen!(spec, options={}) spec.script_phase = { :name => 'Generate Specs', :input_files => [ "${PODS_TARGET_SRCROOT}/#{js_srcs}" ], # This also needs to be relative to Xcode - :output_files => ["${DERIVED_FILE_DIR}/codegen-#{modules_library_name}.log"].concat(generated_files.map { |filename| " ${PODS_TARGET_SRCROOT}/#{filename}"} ), + :output_files => ["${DERIVED_FILE_DIR}/codegen-#{library_name}.log"].concat(generated_files.map { |filename| " ${PODS_TARGET_SRCROOT}/#{filename}"} ), # The final generated files will be created when this script is invoked at Xcode build time. :script => %{set -o pipefail -bash -l -c '#{env_vars} $\{PODS_TARGET_SRCROOT\}/#{prefix}/scripts/generate-specs.sh' 2>&1 | tee "${SCRIPT_OUTPUT_FILE_0}" +bash -l -c '$\{PODS_TARGET_SRCROOT\}/#{prefix}/scripts/generate-specs.sh #{codegen_script_args.join(" ")}' 2>&1 | tee "${SCRIPT_OUTPUT_FILE_0}" }, :execution_position => :before_compile, :show_env_vars_in_log => true From 24a9ef7384b776ff0ab75be043e934591bb8d319 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 31 Aug 2021 09:51:58 -0700 Subject: [PATCH 2/5] Suppressing bad file descriptor errors on native builds Summary: When running native builds, we experience a lot of bad file descriptor warnings. This diff is suppressing the issue on local builds (on Mac). Changelog: [Internal] [Changed] - Suppressed bad file descriptor on native builds Reviewed By: ShikaSD Differential Revision: D30487098 fbshipit-source-id: 8199fb8f2f18d19543d2861f1f2f852fff6ae73b --- ReactAndroid/build.gradle | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index edadad219f..8db3196c6b 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -362,7 +362,8 @@ def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) { inputs.dir("src/main/java/com/facebook/react/turbomodule/core/jni") inputs.dir("src/main/java/com/facebook/react/modules/blob") outputs.dir("$buildDir/react-ndk/all") - commandLine(getNdkBuildFullPath(), + def commandLineArgs = [ + getNdkBuildFullPath(), "APP_ABI=${reactNativeArchitectures()}", "NDK_DEBUG=" + (nativeBuildType.equalsIgnoreCase("debug") ? "1" : "0"), "NDK_PROJECT_PATH=null", @@ -375,7 +376,12 @@ def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) { "REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react", "-C", file("src/main/jni/react/jni").absolutePath, "--jobs", project.findProperty("jobs") ?: Runtime.runtime.availableProcessors() - ) + ] + if (Os.isFamily(Os.FAMILY_MAC)) { + // This flag will suppress "fcntl(): Bad file descriptor" warnings on local builds. + commandLineArgs.add("--output-sync=none") + } + commandLine(commandLineArgs) } def cleanReactNdkLib = tasks.register("cleanReactNdkLib", Exec) { From 85249cafe8870ab8f47c38569b106555ce2f8527 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 31 Aug 2021 12:48:55 -0700 Subject: [PATCH 3/5] Update project to build on Gradle 7.0.2 (#32073) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/32073 This Diff bumps the version of Gradle used to build the project to 7.0.2. Ideally we could bump to 7.2.x directly, but I'll do one minor version at a time to exclude potential build problems. This diff is addressing all the extra build warnings that got raised by the new version. Changelog: [Android][Changed] - Bumped Gradle project version to 7.0.2 Reviewed By: ShikaSD Differential Revision: D30486612 fbshipit-source-id: 70e0f7d18e547013ca7b1d12f8dd64a633df5870 --- ReactAndroid/build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew.bat | 178 +++++++++--------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../react-native-codegen/android/gradlew.bat | 178 +++++++++--------- .../react/tasks/BundleJsAndAssetsTask.kt | 7 +- .../facebook/react/tasks/HermesBinaryTask.kt | 6 +- packages/rn-tester/android/app/build.gradle | 1 + 8 files changed, 191 insertions(+), 185 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 8db3196c6b..7d2e903790 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -56,7 +56,6 @@ task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) { from(boostPath ?: tarTree(resources.gzip(downloadBoost.dest))) - from("src/main/jni/third-party/boost/Android.mk") from("src/main/jni/third-party/boost") include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp", "asm/**/*.S") includeEmptyDirs = false @@ -171,6 +170,7 @@ task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) { // Prepare glog sources to be compiled, this task will perform steps that normally should've been // executed by automake. This way we can avoid dependencies on make/automake task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) { + duplicatesStrategy("warn") from(dependenciesPath ?: tarTree(downloadGlog.dest)) from("src/main/jni/third-party/glog/") include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h") diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7665b0fa93..29e4134576 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew.bat b/gradlew.bat index 107acd32c4..ac1b06f938 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,89 @@ -@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 -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties index 7665b0fa93..29e4134576 100644 --- a/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-codegen/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-codegen/android/gradlew.bat b/packages/react-native-codegen/android/gradlew.bat index 107acd32c4..ac1b06f938 100644 --- a/packages/react-native-codegen/android/gradlew.bat +++ b/packages/react-native-codegen/android/gradlew.bat @@ -1,89 +1,89 @@ -@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 -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt index 086f2515f9..300774a48a 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt @@ -11,13 +11,16 @@ import java.io.File import org.gradle.api.DefaultTask import org.gradle.api.file.FileTree import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.InputFiles +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction open class BundleJsAndAssetsTask : DefaultTask() { - internal lateinit var reactRoot: File + + @get:Internal internal lateinit var reactRoot: File @get:InputFiles @Suppress("UNUSED") // used to invalidate caches @@ -25,7 +28,7 @@ open class BundleJsAndAssetsTask : DefaultTask() { @get:Input internal lateinit var execCommand: List @get:Input internal lateinit var bundleCommand: String @get:Input internal var devEnabled: Boolean = true - @get:Input internal lateinit var entryFile: File + @get:InputFile internal lateinit var entryFile: File @get:Input internal var extraArgs: List = emptyList() @get:OutputDirectory internal lateinit var jsBundleDir: File diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt index 0e641dea7a..af3ae0fe5e 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt @@ -11,18 +11,20 @@ import java.io.File import org.gradle.api.DefaultTask import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction open class HermesBinaryTask : DefaultTask() { - internal lateinit var reactRoot: File + + @get:Internal internal lateinit var reactRoot: File @get:Input internal lateinit var hermesCommand: String @get:Input internal var hermesFlags: List = emptyList() @get:InputFile internal lateinit var jsBundleFile: File @get:Input internal lateinit var composeSourceMapsCommand: List - @get:Input internal lateinit var jsPackagerSourceMapFile: File + @get:InputFile internal lateinit var jsPackagerSourceMapFile: File @get:OutputFile internal lateinit var jsCompilerSourceMapFile: File @get:OutputFile internal lateinit var jsOutputSourceMapFile: File diff --git a/packages/rn-tester/android/app/build.gradle b/packages/rn-tester/android/app/build.gradle index 7f04213604..503ada4fd8 100644 --- a/packages/rn-tester/android/app/build.gradle +++ b/packages/rn-tester/android/app/build.gradle @@ -288,6 +288,7 @@ if (enableCodegen) { def packageReactNdkLibs = tasks.register("packageReactNdkLibs", Copy) { // TODO: handle extracting .so from prebuilt :ReactAndroid. dependsOn(":ReactAndroid:packageReactNdkLibs") + dependsOn("generateCodegenSchemaFromJavaScript") from("$reactAndroidBuildDir/react-ndk/exported") into("$buildDir/react-ndk/exported") } From 13107fa3d0bcb41d1e91d676f2886c575c599bc2 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 31 Aug 2021 12:48:55 -0700 Subject: [PATCH 4/5] Import template/android/ as part of the top level build (#32124) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/32124 This Diff adds `template/android/` as part of the top level build as an included build. This means that the Android template will be loaded inside Android studio and it will be easier to invoke tasks directly there. I'm also bumping Gradle to 7.0.2 for the template. Please note that the template relies on the `template/node_modules` folder to work correctly, as the Gradle build is loading a file from there. Therefore I've added a check to verify that we import the build only if `node_modules` is available. Changelog: [Internal] [Changed] - Load template/android/ inside the build. Reviewed By: ShikaSD Differential Revision: D30672845 fbshipit-source-id: 7253296b54e1fde7448e0e170d59b244ed9ec8fb --- .gitignore | 2 + settings.gradle.kts | 7 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- template/android/gradlew.bat | 178 +++++++++--------- 4 files changed, 99 insertions(+), 90 deletions(-) diff --git a/.gitignore b/.gitignore index de6bcc3d45..ecfa96ceaa 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ project.xcworkspace /ReactAndroid/gradle/ /ReactAndroid/gradlew /ReactAndroid/gradlew.bat +/template/android/app/build/ +/template/android/build/ # Buck .buckd diff --git a/settings.gradle.kts b/settings.gradle.kts index 1d838685e2..f804e186f9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,3 +22,10 @@ include( // Include this to enable codegen Gradle plugin. includeBuild("packages/react-native-codegen/android") includeBuild("packages/react-native-gradle-plugin/") + +// Include this to build the Android template as well and make sure is not broken. +if (File("template/node_modules/").exists()) { + includeBuild("template/android/") { + name = "template-android" + } +} diff --git a/template/android/gradle/wrapper/gradle-wrapper.properties b/template/android/gradle/wrapper/gradle-wrapper.properties index 7665b0fa93..29e4134576 100644 --- a/template/android/gradle/wrapper/gradle-wrapper.properties +++ b/template/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/template/android/gradlew.bat b/template/android/gradlew.bat index 107acd32c4..ac1b06f938 100644 --- a/template/android/gradlew.bat +++ b/template/android/gradlew.bat @@ -1,89 +1,89 @@ -@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 -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From ed20a851522ba88d0f7108bb8516f62cad383839 Mon Sep 17 00:00:00 2001 From: Matt Oakes Date: Tue, 31 Aug 2021 15:52:20 -0700 Subject: [PATCH 5/5] Bump the version of @react-native-community/eslint-config (#32117) Summary: The version of this package needs to be bumped for me to release the changes from https://github.com/facebook/react-native/issues/28637 to NPM. ## Changelog [Internal] [Added] - Bump react-native-community/eslint-config version Pull Request resolved: https://github.com/facebook/react-native/pull/32117 Test Plan: N/A Reviewed By: cortinico Differential Revision: D30663708 Pulled By: yungsters fbshipit-source-id: f433c324f12663d76e55c9395630cd642955b25e --- packages/eslint-config-react-native-community/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-config-react-native-community/package.json b/packages/eslint-config-react-native-community/package.json index 5c59f9ead2..bf80d29677 100644 --- a/packages/eslint-config-react-native-community/package.json +++ b/packages/eslint-config-react-native-community/package.json @@ -1,6 +1,6 @@ { "name": "@react-native-community/eslint-config", - "version": "3.0.0", + "version": "3.0.1", "description": "ESLint config for React Native", "main": "index.js", "license": "MIT",