Skip to content

Commit

Permalink
Merge remote-tracking branch 'microsoft/main' into feat/cursor
Browse files Browse the repository at this point in the history
# Conflicts:
#	Libraries/Components/Touchable/TouchableBounce.js
#	Libraries/Components/Touchable/TouchableHighlight.js
#	Libraries/Components/Touchable/TouchableOpacity.js
#	Libraries/Components/View/ReactNativeViewViewConfigMacOS.js
#	Libraries/Components/View/ViewPropTypes.js
#	Libraries/StyleSheet/StyleSheetTypes.js
#	React/Views/RCTView.h
#	React/Views/RCTViewManager.m
  • Loading branch information
Shawn Dempsey authored and ryanlntn committed Aug 9, 2022
1 parent 1a3abaa commit 2c8eff0
Show file tree
Hide file tree
Showing 7,039 changed files with 336,320 additions and 1,021,457 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
67 changes: 35 additions & 32 deletions .ado/android-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ trigger: none # will disable CI builds entirely
pr:
branches:
include:
- master
- main
- '*-stable'
paths:
exclude:
- '*.md'

variables:
- template: variables/vars.yml

jobs:
- job: AndroidRNPR
displayName: Android React Native PR
pool:
vmImage: ubuntu-18.04
pool: cxe-ubuntu-20-04-large
timeoutInMinutes: 90 # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
steps:
Expand All @@ -27,34 +29,15 @@ jobs:
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch

- template: templates/android-build-office.yml

- task: CmdLine@2
displayName: Remove RNTesterApp.android.bundle
inputs:
script: rm -f RNTesterApp.android.bundle

- task: CmdLine@2
displayName: Create RNTester bundle
inputs:
script: node cli.js bundle --entry-file ./RNTester/js/RNTesterApp.android.js --bundle-output RNTesterApp.android.bundle --platform android

- task: CmdLine@2
displayName: gradlew installArchives
inputs:
script: REACT_NATIVE_BOOST_PATH=$(System.DefaultWorkingDirectory)/build_deps ./gradlew installArchives -Pparam="excludeLibs"
- template: templates/android-build-office-setup.yml

- template: templates\prep-android-nuget.yml
- template: templates/android-build-office.yml

# Very similar to the default pack task .. but appends 'ndk21' to the nuget pack version
- task: CmdLine@2
displayName: 'Verify NuGet can be packed'
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)
- template: templates/download-android-dependencies.yml
parameters:
artifact_feed: react-native/react-native-public

# 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 ]'
# displayName: Verify that NuGet was actually created
- template: templates/android-nuget-pack.yml

- task: CmdLine@2
displayName: 'Npm pack'
Expand All @@ -65,9 +48,29 @@ jobs:
BUILD_SOURCESDIRECTORY: $(Build.SourcesDirectory)
BUILD_SOURCEBRANCH: $(Build.SourceBranch)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
githubApiToken: $(githubApiToken)
githubApiToken: $(githubAuthToken)

- task: CmdLine@2
displayName: gradlew clean
# In RN64 "clean" task tries to run the build again. It is reproing in 0.64-stable branch but fixed in 0.65-stable.
# I can't zero on the exact cause .. but turns out the issue is with rntester clean task.
#
# mganandraj@RNDroid:~/github/rnm-64$ ./gradlew :packages:rn-tester:android:app:clean --dry-run
# :packages:react-native-codegen:android:buildCodegenCLI SKIPPED
# :packages:rn-tester:android:app:generateCodegenSchemaFromJavaScript SKIPPED
# :packages:rn-tester:android:app:generateCodegenArtifactsFromSchema SKIPPED
# :ReactAndroid:extractAARHeaders SKIPPED
# :ReactAndroid:extractJNIFiles SKIPPED
# :ReactAndroid:generateCodegenSchemaFromJavaScript SKIPPED
# :ReactAndroid:generateCodegenArtifactsFromSchema SKIPPED
# :ReactAndroid:prepareBoost SKIPPED
# :ReactAndroid:createNativeDepsDirectories SKIPPED
# ..
# - task: CmdLine@2
# displayName: gradlew clean
# inputs:
# script: ./gradlew clean

- task: PublishBuildArtifacts@1
displayName: 'Publish final artifacts'
inputs:
script: ./gradlew clean
PathtoPublish: '$(Build.StagingDirectory)/final'
ArtifactName: 'ReactNative-Final'
104 changes: 104 additions & 0 deletions .ado/apple-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Integrate $(Date:yyyyMMdd).$(Rev:.r)
variables:
- template: variables/vars.yml
trigger:
branches:
include:
- main
- '*-stable'
paths:
exclude:
- '*.md'
pr:
branches:
include:
- main
- '*-stable'
paths:
exclude:
- '*.md'
jobs:
- job: react_native_test_app
displayName: react-native-test-app
pool:
vmImage: $(VmImageApple)
demands: ['npm', 'sh', 'xcode']
workspace:
clean: all
timeoutInMinutes: 60
cancelTimeoutInMinutes: 5
steps:
- template: templates/apple-node-setup.yml
- template: templates/apple-xcode-select.yml
parameters:
slice_name: $(slice_name)
xcode_version: $(xcode_version)
- bash: |
echo "##vso[task.setvariable variable=package_version]$(cat package.json | jq .version | awk '{ print substr($0, 2, length($0) - 2) }')"
echo "##vso[task.setvariable variable=react_version]$(cat package.json | jq .peerDependencies.react)"
echo "##vso[task.setvariable variable=rncli_version]$(cat package.json | jq '.dependencies."@react-native-community/cli"')"
echo "##vso[task.setvariable variable=rncli_android_version]$(cat package.json | jq '.dependencies."@react-native-community/cli-platform-android"')"
echo "##vso[task.setvariable variable=rncli_ios_version]$(cat package.json | jq '.dependencies."@react-native-community/cli-platform-ios"')"
displayName: 'Determine react-native-macos version'
- bash: |
npm pack
displayName: 'Pack react-native-macos'
- bash: |
git clone --progress https://github.com/microsoft/react-native-test-app.git
displayName: Checkout react-native-test-app
- bash: |
set -eo pipefail
cat package.json |
jq '.devDependencies["react"] = $(react_version)' |
jq '.devDependencies["react-native"] = "^0.64"' |
jq '.devDependencies["react-native-macos"] = "../react-native-macos-$(package_version).tgz"' |
jq 'del(.devDependencies["@react-native-community/cli"])' |
jq 'del(.devDependencies["@react-native-community/cli-platform-android"])' |
jq 'del(.devDependencies["@react-native-community/cli-platform-ios"])' |
jq 'del(.devDependencies["react-native-windows"])' > .package.json
mv .package.json package.json
cat package.json | jq .devDependencies
displayName: Modify react-native-test-app dependencies
workingDirectory: react-native-test-app
- bash: |
set -eo pipefail
cat package.json |
jq '.devDependencies["@react-native-community/cli"] = $(rncli_version)' |
jq '.devDependencies["@react-native-community/cli-platform-android"] = $(rncli_android_version)' |
jq '.devDependencies["@react-native-community/cli-platform-ios"] = $(rncli_ios_version)' |
jq '.devDependencies["react"] = $(react_version)' |
jq '.devDependencies["react-native"] = "^0.64"' |
jq '.devDependencies["react-native-macos"] = "../../react-native-macos-$(package_version).tgz"' |
jq 'del(.devDependencies["react-native-windows"])' > .package.json
mv .package.json package.json
cat package.json | jq .devDependencies
displayName: Modify example app dependencies
workingDirectory: react-native-test-app/example
- bash: |
yarn --no-immutable
displayName: Install npm dependencies
workingDirectory: react-native-test-app
- bash: |
yarn build:macos || yarn build:macos
displayName: Bundle JavaScript
workingDirectory: react-native-test-app/example
- bash: |
rm macos/Podfile.lock
pod install --project-directory=macos
displayName: Install Pods
workingDirectory: react-native-test-app/example
- bash: |
set -eo pipefail
../scripts/xcodebuild.sh macos/Example.xcworkspace build
displayName: Build Intel
workingDirectory: react-native-test-app/example
env:
CCACHE_DISABLE: 1
- bash: |
set -eo pipefail
../scripts/xcodebuild.sh macos/Example.xcworkspace clean
../scripts/xcodebuild.sh macos/Example.xcworkspace build ARCHS=arm64
displayName: Build ARM
workingDirectory: react-native-test-app/example
env:
CCACHE_DISABLE: 1
14 changes: 7 additions & 7 deletions .ado/apple-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
name: $(Date:yyyyMMdd).$(Rev:.r)

variables:
- template: variables/mac.yml
- template: variables/vars.yml

trigger: none # will disable CI builds entirely

pr:
branches:
include:
- master
- main
- '*-stable'
paths:
exclude:
Expand All @@ -25,7 +25,7 @@ jobs:
public:
apply_office_patches: 'false'
pool:
vmImage: $(VmImage)
vmImage: $(VmImageApple)
demands: ['xcode', 'sh', 'npm']
steps:
- template: templates/apple-job-javascript.yml
Expand All @@ -42,7 +42,7 @@ jobs:
packager_platform: 'ios'
xcode_sdk: iphonesimulator
xcode_scheme: 'RNTester'
xcode_destination: 'platform=iOS Simulator,OS=latest,name=iPhone 8'
xcode_destination: 'platform=iOS Simulator,OS=latest,name=iPhone 12'
xcode_actions_debug: 'build test'
xcode_actions_release: 'build'
apply_office_patches: 'false'
Expand All @@ -58,7 +58,7 @@ jobs:
packager_platform: 'ios'
xcode_sdk: iphonesimulator
xcode_scheme: 'RNTester'
xcode_destination: 'platform=iOS Simulator,OS=latest,name=iPhone 8'
xcode_destination: 'platform=iOS Simulator,OS=latest,name=iPhone 12'
xcode_actions_debug: 'build test'
xcode_actions_release: 'build'
apply_office_patches: 'true'
Expand All @@ -71,7 +71,7 @@ jobs:
xcode_actions_release: 'build'
apply_office_patches: 'true'
pool:
vmImage: $(VmImage)
vmImage: $(VmImageApple)
demands: ['xcode', 'sh', 'npm']
timeoutInMinutes: 60 # how long to run the job before automatically cancelling
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
Expand All @@ -96,7 +96,7 @@ jobs:
MacDebug:
configuration: Debug
pool:
vmImage: $(VmImage)
vmImage: $(VmImageApple)
demands: ['xcode', 'sh', 'npm']
steps:
- template: templates/react-native-macos-init.yml
Expand Down
121 changes: 121 additions & 0 deletions .ado/downloadAndroidDependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import json
import logging
import maven_dependency_utils
import os
import re
import shutil
import subprocess
import sys
import time


desired_sdk = os.getenv("ANDROID_SDK_ROOT")
if not desired_sdk:
logging.error("Environment 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("Environment variable ANDROID_NDK must be set.")
exit(-1)

desired_jdk = os.getenv("JAVA_HOME")
if not desired_jdk:
logging.error("Environment variable JAVA_HOME must be set.")
exit(-1)

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.")

## Returns a list of strings, where the strings correspond to standard maven artifacts, i.e. groupId:artifactId:version
def get_dependencies(react_native_dir):
result = subprocess.run('./gradlew :ReactAndroid:dependencies --configuration api', stderr=subprocess.PIPE, stdout=subprocess.PIPE, cwd=react_native_dir, shell=True)
if (result.returncode == 0):
return re.findall(r'^\S---\s+(\S*)', result.stdout.decode('utf-8'), re.MULTILINE)
else:
logging.error('Failed to get dependencies. Printing gradle output: ')
logging.error(result.stderr.decode('utf-8'))
exit(-1)

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")
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)

# Ensure we have an output directory
ensure_output_dir(dependency_dir_root)

# Download a transitive dependency closure of the ReactAndroid project
dependencies = get_dependencies(react_native_dir);
maven_dependency_utils.download_transitive_closure(artifacts=dependencies, output_directory_path=dependency_dir_maven, gradle_path='gradlew', ignore_metadata_redirection=True, resolve_to_single_version=False)

# Extract the native libraries from maven packages
office_abi_mappings = {'arm64-v8a':'droidarm64', 'armeabi-v7a':'droidarm', 'x86':'droidx86','x86_64':'droidx64'}
maven_dependency_utils.extract_native_modules(dependency_dir_maven, dependency_dir_native, office_abi_mappings)

# 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, "ship")
maven_dependency_utils.extract_native_modules_from_archive(os.path.join(dependency_dir_hermes_android_aar_path, "hermes-debug.aar"), dependency_dir_hermes_android_native_debug, office_abi_mappings)
maven_dependency_utils.extract_native_modules_from_archive(os.path.join(dependency_dir_hermes_android_aar_path, "hermes-cppruntime-debug.aar"), dependency_dir_hermes_android_native_debug, office_abi_mappings)

maven_dependency_utils.extract_native_modules_from_archive(os.path.join(dependency_dir_hermes_android_aar_path, "hermes-release.aar"), dependency_dir_hermes_android_native_release, office_abi_mappings)
maven_dependency_utils.extract_native_modules_from_archive(os.path.join(dependency_dir_hermes_android_aar_path, "hermes-cppruntime-release.aar"), dependency_dir_hermes_android_native_release, office_abi_mappings)

# 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()
2 changes: 1 addition & 1 deletion .ado/gitTagRelease.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function doPublish() {
exec(`git config --global user.email "53619745+rnbot@users.noreply.github.com"`);
exec(`git config --global user.name "React-Native Bot"`);

exec(`git add ${pkgJsonPath}`);
exec(`git add .`);
exec(`git commit -m "Applying package update to ${releaseVersion} ***NO_CI***"`);
exec(`git tag v${releaseVersion}`);
exec(`git push origin HEAD:${tempPublishBranch} --follow-tags --verbose`);
Expand Down
Loading

0 comments on commit 2c8eff0

Please sign in to comment.