Skip to content

Commit

Permalink
Upgrade Calculator samples to 0.76 (#998)
Browse files Browse the repository at this point in the history
## Description
Upgrades cppwinrt, csharp and fabric Calculator samples to 0.76.

### Why
Part of the 0.76 release.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/react-native-windows-samples/pull/998)
  • Loading branch information
Yajur-Grover authored Dec 11, 2024
1 parent 9046ff5 commit 28016ce
Show file tree
Hide file tree
Showing 69 changed files with 17,631 additions and 7,002 deletions.
2 changes: 1 addition & 1 deletion samples/Calculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This sample showcases the usage of React Native for Windows to build a simple calculator. It includes implementations in C# and C++/WinRT.

It currently targets React Native Windows 0.73.
It currently targets React Native Windows 0.76.

### Setup
First, make sure you've met the [React Native Windows System Requirements](https://microsoft.github.io/react-native-windows/docs/rnw-dependencies).
Expand Down
925 changes: 0 additions & 925 deletions samples/Calculator/cppwinrt/.yarn/releases/yarn-stable-temp.cjs

This file was deleted.

1 change: 1 addition & 0 deletions samples/Calculator/cppwinrt/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ ruby ">= 2.6.10"
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
4 changes: 2 additions & 2 deletions samples/Calculator/cppwinrt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ See [../README.md](../README.md) for details of this sample.

See [../csharp/](../csharp/) for a C# version of this sample.

It currently targets React Native Windows 0.75.
It currently targets React Native Windows 0.76.

### Setup
See [../README.md#Setup](../README.md#Setup).
Expand Down Expand Up @@ -54,5 +54,5 @@ To upgrade this sample to the latest version of RNW:
```
npx @react-native-community/cli@latest run-windows
```
9. Look at windows/Calculators/Package.appxmanifast and change the publisher name to "CN=React Native Windows Sample".
9. Look at the Package.appxmanifast and change the publisher name to "CN=React Native Windows Sample". Revert all changes made to GUID values in the project and solution files.
10. Update this readme with the new major version at the top.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {
Expand All @@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {

override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
Expand Down
6 changes: 3 additions & 3 deletions samples/Calculator/cppwinrt/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
Expand Down
2 changes: 1 addition & 1 deletion samples/Calculator/cppwinrt/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion samples/Calculator/cppwinrt/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions samples/Calculator/cppwinrt/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
"$(inherited)",
);
INFOPLIST_FILE = CalculatorTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -444,7 +444,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = CalculatorTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -470,6 +470,7 @@
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Calculator/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -496,6 +497,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = Calculator/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -562,7 +564,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
Expand Down Expand Up @@ -628,7 +630,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
Expand Down
4 changes: 2 additions & 2 deletions samples/Calculator/cppwinrt/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const config = {
//
resolver: {
blockList: exclusionList([
// This stops "react-native run-windows" from causing the metro server to crash if its already running
// This stops "npx @react-native-community/cli run-windows" from causing the metro server to crash if its already running
new RegExp(
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
),
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
// This prevents "npx @react-native-community/cli run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
new RegExp(`${rnwPath}/build/.*`),
new RegExp(`${rnwPath}/target/.*`),
/.*\.ProjectImports\.zip/,
Expand Down
34 changes: 22 additions & 12 deletions samples/Calculator/cppwinrt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,42 @@
"lint": "eslint .",
"start": "react-native start",
"test": "jest",
"windows": "react-native run-windows"
"windows": "npx @react-native-community/cli run-windows"
},
"dependencies": {
"react": "18.3.1",
"react-native": "0.75.2",
"react-native-windows": "0.75.0"
"react-native": "0.76.3",
"react-native-windows": "^0.76.2"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.75.2",
"@react-native/eslint-config": "0.75.2",
"@react-native/metro-config": "0.75.2",
"@react-native/typescript-config": "0.75.2",
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.3",
"@react-native/eslint-config": "0.76.3",
"@react-native/metro-config": "0.76.3",
"@react-native/typescript-config": "0.76.3",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"metro-config": "^0.80.10",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
"typescript": "5.0.4",
"metro-config": "^0.81.0"
},
"engines": {
"node": ">=18"
},
"react-native-windows": {
"init-windows": {
"name": "Calculator",
"namespace": "Calculator",
"template": "old/uwp-cpp-app"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AutolinkedNativeModules.g.cpp contents generated by "react-native autolink-windows"
// AutolinkedNativeModules.g.cpp contents generated by "npx @react-native-community/cli autolink-windows"
// clang-format off
#include "pch.h"
#include "AutolinkedNativeModules.g.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// AutolinkedNativeModules.g.h contents generated by "react-native autolink-windows"
// AutolinkedNativeModules.g.h contents generated by "npx @react-native-community/cli autolink-windows"
// clang-format off
#pragma once

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- AutolinkedNativeModules.g.props contents generated by "react-native autolink-windows" -->
<!-- AutolinkedNativeModules.g.props contents generated by "npx @react-native-community/cli autolink-windows" -->
<PropertyGroup>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- AutolinkedNativeModules.g.targets contents generated by "react-native autolink-windows" -->
<!-- AutolinkedNativeModules.g.targets contents generated by "npx @react-native-community/cli autolink-windows" -->
<ItemGroup>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This project was created with react-native-windows 0.75.0 -->
<!-- This project was created with react-native-windows 0.76.2 -->
<Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\ExperimentalFeatures.props" Condition="Exists('$(SolutionDir)\ExperimentalFeatures.props')" />
<PropertyGroup Label="Globals">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
-->
<UseHermes>true</UseHermes>

<!--
Changes compilation to assume use of WinUI 3 instead of System XAML.
Requires creation of new project.
See https://microsoft.github.io/react-native-windows/docs/winui3
-->
<UseWinUI3>false</UseWinUI3>

<!--
Changes compilation to assume use of Microsoft.ReactNative NuGet packages
instead of building the framework from source.
Expand Down
1 change: 1 addition & 0 deletions samples/Calculator/cppwinrt/windows/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</config>
<packageSources>
<clear />
<add key="react-native" value="https://pkgs.dev.azure.com/ms/react-native/_packaging/react-native-public/nuget/v3/index.json" />
<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources>
Expand Down
Loading

0 comments on commit 28016ce

Please sign in to comment.