Skip to content

Commit 02d8438

Browse files
committed
Merge branch 'master' of github.com:microsoft/react-native-macos into upstream-pressable-hover
2 parents a23a1f1 + f88f01a commit 02d8438

File tree

30 files changed

+390
-153
lines changed

30 files changed

+390
-153
lines changed

.ado/android-pr.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,24 @@ jobs:
7474
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
7575
githubApiToken: $(githubApiToken)
7676

77-
- task: CmdLine@2
78-
displayName: gradlew clean
79-
inputs:
80-
script: ./gradlew clean
77+
# In RN64 "clean" task tries to run the build again. It is reproing in 0.64-stable branch but fixed in 0.65-stable.
78+
# I can't zero on the exact cause .. but turns out the issue is with rntester clean task.
79+
#
80+
# mganandraj@RNDroid:~/github/rnm-64$ ./gradlew :packages:rn-tester:android:app:clean --dry-run
81+
# :packages:react-native-codegen:android:buildCodegenCLI SKIPPED
82+
# :packages:rn-tester:android:app:generateCodegenSchemaFromJavaScript SKIPPED
83+
# :packages:rn-tester:android:app:generateCodegenArtifactsFromSchema SKIPPED
84+
# :ReactAndroid:extractAARHeaders SKIPPED
85+
# :ReactAndroid:extractJNIFiles SKIPPED
86+
# :ReactAndroid:generateCodegenSchemaFromJavaScript SKIPPED
87+
# :ReactAndroid:generateCodegenArtifactsFromSchema SKIPPED
88+
# :ReactAndroid:prepareBoost SKIPPED
89+
# :ReactAndroid:createNativeDepsDirectories SKIPPED
90+
# ..
91+
# - task: CmdLine@2
92+
# displayName: gradlew clean
93+
# inputs:
94+
# script: ./gradlew clean
8195

8296
- task: PublishBuildArtifacts@1
8397
displayName: 'Publish final artifacts'

.ado/apple-integration.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Integrate $(Date:yyyyMMdd).$(Rev:.r)
2+
variables:
3+
- template: variables/mac.yml
4+
trigger:
5+
branches:
6+
include:
7+
- master
8+
- '*-stable'
9+
paths:
10+
exclude:
11+
- '*.md'
12+
pr:
13+
branches:
14+
include:
15+
- master
16+
- '*-stable'
17+
paths:
18+
exclude:
19+
- '*.md'
20+
jobs:
21+
- job: react_native_test_app
22+
displayName: react-native-test-app
23+
pool:
24+
vmImage: $(VmImage)
25+
demands: ['npm', 'sh', 'xcode']
26+
workspace:
27+
clean: all
28+
timeoutInMinutes: 60
29+
cancelTimeoutInMinutes: 5
30+
steps:
31+
- template: templates/apple-node-setup.yml
32+
- template: templates/apple-xcode-select.yml
33+
parameters:
34+
slice_name: $(slice_name)
35+
xcode_version: $(xcode_version)
36+
- bash: |
37+
echo "##vso[task.setvariable variable=package_version]$(cat package.json | jq .version | awk '{ print substr($0, 2, length($0) - 2) }')"
38+
echo "##vso[task.setvariable variable=react_version]$(cat package.json | jq .peerDependencies.react)"
39+
echo "##vso[task.setvariable variable=rncli_version]$(cat package.json | jq '.dependencies."@react-native-community/cli"')"
40+
displayName: 'Determine react-native-macos version'
41+
- bash: |
42+
npm pack
43+
displayName: 'Pack react-native-macos'
44+
- bash: |
45+
git clone --progress https://github.com/microsoft/react-native-test-app.git
46+
displayName: Checkout react-native-test-app
47+
- bash: |
48+
set -eo pipefail
49+
cat package.json |
50+
jq '.devDependencies["react"] = $(react_version)' |
51+
jq '.devDependencies["react-native"] = "^0.64"' |
52+
jq '.devDependencies["react-native-macos"] = "../react-native-macos-$(package_version).tgz"' |
53+
jq 'del(.devDependencies["@react-native-community/cli"])' |
54+
jq 'del(.devDependencies["@react-native-community/cli-platform-android"])' |
55+
jq 'del(.devDependencies["@react-native-community/cli-platform-ios"])' |
56+
jq 'del(.devDependencies["react-native-windows"])' > .package.json
57+
mv .package.json package.json
58+
cat package.json | jq .devDependencies
59+
displayName: Modify react-native-test-app dependencies
60+
workingDirectory: react-native-test-app
61+
- bash: |
62+
set -eo pipefail
63+
cat package.json |
64+
jq '.devDependencies["@react-native-community/cli"] = $(rncli_version)' |
65+
jq '.devDependencies["@react-native-community/cli-platform-android"] = $(rncli_version)' |
66+
jq '.devDependencies["@react-native-community/cli-platform-ios"] = $(rncli_version)' |
67+
jq '.devDependencies["react"] = $(react_version)' |
68+
jq '.devDependencies["react-native"] = "^0.64"' |
69+
jq '.devDependencies["react-native-macos"] = "../../react-native-macos-$(package_version).tgz"' |
70+
jq 'del(.devDependencies["react-native-windows"])' > .package.json
71+
mv .package.json package.json
72+
cat package.json | jq .devDependencies
73+
displayName: Modify example app dependencies
74+
workingDirectory: react-native-test-app/example
75+
- bash: |
76+
yarn --no-immutable
77+
displayName: Install npm dependencies
78+
workingDirectory: react-native-test-app
79+
- bash: |
80+
yarn build:macos || yarn build:macos
81+
displayName: Bundle JavaScript
82+
workingDirectory: react-native-test-app/example
83+
- bash: |
84+
pod install --project-directory=macos
85+
displayName: Install Pods
86+
workingDirectory: react-native-test-app/example
87+
- bash: |
88+
set -eo pipefail
89+
../scripts/xcodebuild.sh macos/Example.xcworkspace build
90+
displayName: Build Intel
91+
workingDirectory: react-native-test-app/example
92+
- bash: |
93+
set -eo pipefail
94+
../scripts/xcodebuild.sh macos/Example.xcworkspace clean
95+
../scripts/xcodebuild.sh macos/Example.xcworkspace build ARCHS=arm64
96+
displayName: Build ARM
97+
workingDirectory: react-native-test-app/example

.ado/gitTagRelease.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function doPublish() {
2828
exec(`git config --global user.email "53619745+rnbot@users.noreply.github.com"`);
2929
exec(`git config --global user.name "React-Native Bot"`);
3030

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

.ado/npmOfficePack.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function doPublish(fakeMode) {
2828
if (!onlyTagSource) {
2929
// -------- Generating Android Artifacts with JavaDoc
3030
const depsEnvPrefix = "REACT_NATIVE_BOOST_PATH=" + path.join(process.env.BUILD_SOURCESDIRECTORY, "build_deps");
31-
const gradleCommand = path.join(process.env.BUILD_SOURCESDIRECTORY, "gradlew") + " installArchives";
31+
const gradleCommand = path.join(process.env.BUILD_SOURCESDIRECTORY, "gradlew") + " installArchives -Pparam=\"excludeLibs\"";
3232
exec( depsEnvPrefix + " " + gradleCommand );
3333

3434
// undo uncommenting javadoc setting

.ado/publish.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ trigger:
1616

1717
pr: none
1818

19+
variables:
20+
- template: variables/mac.yml
21+
1922
jobs:
2023
- job: RNGithubNpmJSPublish
2124
displayName: React-Native GitHub Publish to npmjs.org
2225
pool:
23-
vmImage: vs2017-win2016
26+
vmImage: $(VmImage)
2427
timeoutInMinutes: 90 # how long to run the job before automatically cancelling
2528
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
2629
steps:
@@ -47,6 +50,8 @@ jobs:
4750
displayName: Set dist-tag to v0.x-stable
4851
condition: and(ne(variables['Build.SourceBranchName'], 'master'), ne(variables['Build.SourceBranchName'], variables.latestStableBranch))
4952

53+
- template: templates/apple-node-setup.yml
54+
5055
- task: CmdLine@2
5156
displayName: yarn install
5257
inputs:
@@ -56,17 +61,37 @@ jobs:
5661
displayName: Bump stable package version
5762
inputs:
5863
script: node .ado/bumpFileVersions.js
59-
condition: ne(variables['Build.SourceBranchName'], 'master')
64+
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master'))
65+
66+
- task: CmdLine@2
67+
displayName: pod update React-TurboModuleCxx-RNW
68+
inputs:
69+
script: |
70+
cd packages/rn-tester
71+
pod update React-TurboModuleCxx-RNW
72+
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master'))
6073

6174
- task: CmdLine@2
6275
displayName: Bump canary package version
6376
inputs:
6477
script: node scripts/bump-oss-version.js --nightly
65-
condition: eq(variables['Build.SourceBranchName'], 'master')
78+
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
79+
80+
# Publish will fail if package.json is marked as private
81+
- task: CmdLine@2
82+
displayName: Remove workspace config from package.json
83+
inputs:
84+
script: node .ado/removeWorkspaceConfig.js
6685

6786
- script: npm publish --tag $(npmDistTag) --registry https://registry.npmjs.org/ --//registry.npmjs.org/:_authToken=$(npmAuthToken)
6887
displayName: Publish react-native-macos to npmjs.org
6988

89+
# Put the private flag back so that the removal does not get committed by the tag release step
90+
- task: CmdLine@2
91+
displayName: Restore package.json workspace config
92+
inputs:
93+
script: node .ado/restoreWorkspaceConfig.js
94+
7095
- task: CmdLine@2
7196
displayName: 'Tag published release'
7297
inputs:
@@ -76,7 +101,7 @@ jobs:
76101
BUILD_SOURCEBRANCH: $(Build.SourceBranch)
77102
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
78103
githubApiToken: $(githubApiToken)
79-
condition: ne(variables['Build.SourceBranchName'], 'master')
104+
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master'))
80105

81106

82107
- job: RNMacOSInitNpmJSPublish
@@ -137,6 +162,12 @@ jobs:
137162
inputs:
138163
script: node .ado/bumpOfficeFileVersions.js
139164

165+
# Publish will fail if package.json is marked as private
166+
- task: CmdLine@2
167+
displayName: Remove workspace config from package.json
168+
inputs:
169+
script: node .ado/removeWorkspaceConfig.js
170+
140171
- task: CmdLine@2
141172
displayName: gradlew installArchives
142173
inputs:

.ado/removeWorkspaceConfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// @ts-check
2+
const {removeWorkspaceConfig} = require('./versionUtils');
3+
removeWorkspaceConfig();

.ado/restoreWorkspaceConfig.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// @ts-check
2+
const {restoreWorkspaceConfig} = require('./versionUtils');
3+
restoreWorkspaceConfig();

.ado/templates/android-build-office.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,29 @@ steps:
3030
inputs:
3131
script: yarn install --frozen-lockfile
3232

33+
# scripts/bump-oss-version.js
34+
#
35+
# update the following files to the commit id.
36+
# package.json (-> npm package version)
37+
# gradle.properties (-> aar version)
38+
# gradle.properties (-> aar version)
39+
#
40+
# The following files are updated for runtime version checking.
41+
# ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java
42+
# React/Base/RCTVersion.m
43+
# ReactCommon/cxxreact/ReactNativeVersion.h
44+
# Libraries/Core/ReactNativeVersion.js
45+
#
46+
# --nightly => version = `0.0.0-${currentCommit.slice(0, 9)}`;
47+
# When on master branch or non-stable branch.
3348
- task: CmdLine@2
3449
displayName: Bump canary package version
3550
inputs:
3651
script: node scripts/bump-oss-version.js --nightly
37-
condition: eq(variables['Build.SourceBranchName'], 'master')
38-
52+
condition: or(eq(variables['Build.SourceBranchName'], 'master'), not(contains(variables['Build.SourceBranchName'], '-stable')))
53+
54+
# TODO: We don't seem to be running bump-oss-version.js for stable branches, hence we would end up publishing using the values in the repository.
55+
3956
- task: CmdLine@2
4057
displayName: nuget restore
4158
inputs:

.ado/templates/apple-droid-node-patching.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ steps:
55
- task: CmdLine@2
66
displayName: Apply Android specific patches for Office consumption
77
inputs:
8-
script: node $(System.DefaultWorkingDirectory)/android-patches/bundle/bundle.js patch $(System.DefaultWorkingDirectory) Build OfficeRNHost V8 Focus --patch-store $(System.DefaultWorkingDirectory)/android-patches/patches --log-folder $(System.DefaultWorkingDirectory)/android-patches/logs --confirm ${{ parameters.apply_office_patches }}
8+
script: node $(System.DefaultWorkingDirectory)/android-patches/bundle/bundle.js patch $(System.DefaultWorkingDirectory) Build OfficeRNHost V8 Focus MAC ImageColor --patch-store $(System.DefaultWorkingDirectory)/android-patches/patches --log-folder $(System.DefaultWorkingDirectory)/android-patches/logs --confirm ${{ parameters.apply_office_patches }}

.ado/versionUtils.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
const fs = require("fs");
33
const path = require("path");
44
const semver = require('semver');
5+
const {execSync} = require('child_process');
56

67
const pkgJsonPath = path.resolve(__dirname, "../package.json");
78
let publishBranchName = '';
@@ -41,15 +42,34 @@ function updateVersionsInFiles(patchVersionPrefix) {
4142
}
4243

4344
pkgJson.version = releaseVersion;
44-
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
45-
console.log(`Updating package.json to version ${releaseVersion}`);
46-
45+
console.log(`Bumping files to version ${releaseVersion}`);
46+
execSync(`node ./scripts/bump-oss-version.js --rnmpublish ${releaseVersion}`, {stdio: 'inherit', env: process.env});
47+
4748
return {releaseVersion, branchVersionSuffix};
4849
}
4950

51+
const workspaceJsonPath = path.resolve(require('os').tmpdir(), 'rnpkg.json');
52+
53+
function removeWorkspaceConfig() {
54+
let {pkgJson} = gatherVersionInfo();
55+
fs.writeFileSync(workspaceJsonPath, JSON.stringify(pkgJson, null, 2));
56+
delete pkgJson.private;
57+
delete pkgJson.workspaces;
58+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
59+
console.log(`Removing workspace config from package.json to prepare to publish.`);
60+
}
61+
62+
function restoreWorkspaceConfig() {
63+
let pkgJson = JSON.parse(fs.readFileSync(workspaceJsonPath, "utf8"));
64+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
65+
console.log(`Restoring workspace config from package.json`);
66+
}
67+
5068
module.exports = {
5169
gatherVersionInfo,
5270
publishBranchName,
5371
pkgJsonPath,
72+
removeWorkspaceConfig,
73+
restoreWorkspaceConfig,
5474
updateVersionsInFiles
5575
}

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ensure scripts always have Unix newlines, even on Windows.
2+
*.command text eol=lf
3+
*.sh text eol=lf
4+
# Windows files should use crlf line endings
5+
# https://help.github.com/articles/dealing-with-line-endings/
6+
*.bat text eol=crlf

Libraries/Image/RCTImageLoader.mm

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -966,15 +966,13 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)data
966966
UIImage *image = RCTDecodeImageWithData(data, size, scale, resizeMode);
967967

968968
#if !TARGET_OS_OSX && RCT_DEV // TODO(macOS GH#774)
969-
if ([[self->_bridge devSettings] isDevModeEnabled]) { // TODO(OSS Candidate ISS#2710739)
970-
CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774)
971-
CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale());
972-
if (imagePixelSize.width * imagePixelSize.height >
973-
screenPixelSize.width * screenPixelSize.height) {
974-
RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger "
975-
"than the screen size %@", NSStringFromCGSize(imagePixelSize),
976-
NSStringFromCGSize(screenPixelSize));
977-
}
969+
CGSize imagePixelSize = RCTSizeInPixels(image.size, UIImageGetScale(image)); // TODO(macOS GH#774)
970+
CGSize screenPixelSize = RCTSizeInPixels(RCTScreenSize(), RCTScreenScale());
971+
if (imagePixelSize.width * imagePixelSize.height >
972+
screenPixelSize.width * screenPixelSize.height) {
973+
RCTLogInfo(@"[PERF ASSETS] Loading image at size %@, which is larger "
974+
"than the screen size %@", NSStringFromCGSize(imagePixelSize),
975+
NSStringFromCGSize(screenPixelSize));
978976
}
979977
#endif
980978

React/Base/RCTDefines.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
#if DEBUG
4343
#define RCT_DEV 1
4444
#else
45-
// Dev Mode is now enabled or disabled at runtime via the -[RCTDevSettings isDevModeEnabled] property
46-
#define RCT_DEV 1
45+
#define RCT_DEV 0
4746
#endif
4847
#endif
4948

React/Base/RCTJSInvokerModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
@protocol RCTJSInvokerModule
1313

1414
@property (nonatomic, copy, nonnull) void (^invokeJS)(NSString * _Nullable module, NSString * _Nullable method, NSArray * _Nullable args); // TODO(macOS GH#774)
15-
@property (nonatomic, copy) void (^invokeJSWithModuleDotMethod)(NSString *moduleDotMethod, NSArray *args);
15+
@property (nonatomic, copy, nonnull) void (^invokeJSWithModuleDotMethod)(NSString * _Nullable moduleDotMethod, NSArray * _Nullable args); // TODO(macOS GH#774)
1616

1717
@end

React/Base/RCTRootView.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,7 @@ - (NSMenu *)menuForEvent:(NSEvent *)event
467467
{
468468
NSMenu *menu = nil;
469469
#if __has_include("RCTDevMenu.h") && RCT_DEV
470-
if ([[_bridge devSettings] isDevModeEnabled]) {
471-
menu = [[_bridge devMenu] menu];
472-
}
470+
menu = [[_bridge devMenu] menu];
473471
#endif
474472
if (menu == nil) {
475473
menu = [super menuForEvent:event];

0 commit comments

Comments
 (0)