Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UWP support to BabylonReactNative #137

Merged
merged 80 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3256064
setup react windows project
Oct 26, 2020
6e55b8c
start on cmake definition for babylon react native for uwp
Oct 26, 2020
1e96682
cache some helper logic
Oct 26, 2020
0c3b117
change setup to x64 for local testing
Oct 26, 2020
7cb9a19
add source files
Oct 26, 2020
f8cb2b1
add some needed files
Oct 26, 2020
e5c243c
working winrt plugin initialization
Nov 12, 2020
5500b7d
more windows work
Nov 20, 2020
740cdd1
complete merge
Nov 20, 2020
6e0642b
failing during linker
Nov 23, 2020
f46a5d4
add options to vcxproj to try and unblock debug builds
Nov 23, 2020
ba04d8d
move to use jsi
Nov 24, 2020
321625f
fix modules
Nov 30, 2020
6d7eec3
add react-native-windows dependency
Nov 30, 2020
344aa12
merge master
Nov 30, 2020
0c3cbd6
working compilation
Dec 1, 2020
2d9ef2d
current state
Dec 11, 2020
5e18391
current proto changes
Dec 11, 2020
4c5778f
working native input compilation
Dec 14, 2020
f0bed54
fix playground solution
Dec 14, 2020
d98762d
close to working
Dec 16, 2020
fd3335e
working windows logic
Dec 16, 2020
c28b098
hacked app setup to support working windows logic
Dec 16, 2020
07b127f
working vr
Dec 17, 2020
9ac1c23
move BabylonNative dll definition and add arm64 support
Dec 18, 2020
0fe138a
fix babylonnative to build in module folder
Jan 4, 2021
b8c0384
fix submodule declarations
Jan 4, 2021
7962233
remove unneeded build scripts
Jan 4, 2021
0d7e725
add clean solution
Jan 4, 2021
4adc50c
working build
Jan 5, 2021
caa66e4
working build
Jan 5, 2021
8498e69
typescript content needs cleaned up
Jan 6, 2021
a6c8486
things need cleaned up but we will try a clean repo
Jan 6, 2021
4abc4f8
fix package.json definition
Jan 6, 2021
ba05041
remove debug logic
Jan 6, 2021
09b0090
get metro to play nice with new exclusion list
Jan 6, 2021
9b012f2
add x86, arm build support
Jan 6, 2021
6055788
revert files
Jan 6, 2021
6339293
packages working
Jan 6, 2021
ce79ce9
complete merge
Jan 6, 2021
d3d9413
add reset function and allow babylonnative to build from modules folder
Jan 7, 2021
910f79f
fix package path resolution for react native windows
Jan 7, 2021
e2b0e98
prepare for draft review
Jan 7, 2021
1b7f62a
comment out slider, needs work to fix
Jan 7, 2021
fd740a8
move to newest babylonnative and fix gitmodule repo
Jan 7, 2021
4442fac
remove unneeded package-lock
Jan 7, 2021
2aeeb7f
remove untrue comments
Jan 7, 2021
37f80fe
remove unneeded comments
Jan 7, 2021
8e92ef3
fix namespace comment names
Jan 7, 2021
e2e5086
avoid checking in bin log
Jan 7, 2021
d89f4e0
revert unneeded metro.config.js changes
Jan 7, 2021
0300c5d
get npm install working vs using yarn
Jan 7, 2021
1ae6ee7
get project to work with npm install
Jan 7, 2021
efa7fb4
add readme tips
Jan 7, 2021
130874b
fix permissions and slider initialization issues
Jan 13, 2021
cd326b3
add step value to fix windows slider usage
Jan 13, 2021
af82b5a
rename babylon native component to avoid lib collisions
Jan 13, 2021
a775a06
rename to BabylonReactNative
Jan 13, 2021
72606db
complete merge
Jan 14, 2021
af5f0b6
ready for review
Jan 14, 2021
90daed8
update build steps
Jan 14, 2021
d6050ba
cleanup some unneeded changes
Jan 14, 2021
1a33cf9
avoid moving to new commit
Jan 14, 2021
ecc21cb
add event revokers
Jan 14, 2021
98e1d5d
add uwp build logic
Jan 15, 2021
5585d9f
revert settings file
Jan 19, 2021
6d9b1bb
Merge branch 'uwpPackage' into uwp
Jan 19, 2021
0dc287a
remove files and update documentation
Jan 19, 2021
3f2a26b
address review comments
Jan 19, 2021
466f94d
address more review comments
Jan 19, 2021
874dbc3
Update Modules/@babylonjs/react-native/EngineHook.ts
chrisfromwork Jan 19, 2021
3ec80d2
address review comments
Jan 19, 2021
910c952
Merge branch 'uwp' of https://github.com/chrisfromwork/BabylonReactNa…
Jan 19, 2021
465d9c3
move hmd render behaviors to enginehook
Jan 19, 2021
336535f
remove unneeded dev dependencies
Jan 19, 2021
874fa7f
move engine logic into engineview
Jan 20, 2021
78b388a
Update Modules/@babylonjs/react-native/EngineHook.ts
chrisfromwork Jan 20, 2021
4515879
address review comments
Jan 21, 2021
d211e8f
remove unneeded reference
Jan 21, 2021
5a5e093
Update Apps/Playground/App.tsx
chrisfromwork Jan 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Apps/Playground/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ buck-out/

# CocoaPods
/ios/Pods/

# UWP
build.binlog
deploy.binlog
msbuild.binlog
2 changes: 1 addition & 1 deletion Apps/Playground/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const EngineScreen: FunctionComponent<ViewProps> = (props: ViewProps) => {
</View>
}
<EngineView style={props.style} camera={camera} onInitialized={onInitialized} />
<Slider style={{position: 'absolute', minHeight: 50, margin: 10, left: 0, right: 0, bottom: 0}} minimumValue={0.2} maximumValue={2} value={defaultScale} onValueChange={setScale} />
<Slider style={{position: 'absolute', minHeight: 50, margin: 10, left: 0, right: 0, bottom: 0}} minimumValue={0.2} maximumValue={2} step={0.01} value={defaultScale} onValueChange={setScale} />
<Text style={{fontSize: 12, color: 'yellow', position: 'absolute', margin: 10}}>{trackingStateToString(trackingState)}</Text>
</View>
}
Expand Down
26 changes: 18 additions & 8 deletions Apps/Playground/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*
* @format
*/

const path = require('path');
const fs = require('fs');
const exclusionList = require('metro-config/src/defaults/exclusionList');

// NOTE: The Metro bundler does not support symlinks (see https://github.com/facebook/metro/issues/1), which NPM uses for local packages.
// To work around this, we explicity tell the metro bundler where to find local/linked packages.
Expand Down Expand Up @@ -62,14 +62,24 @@ module.exports = {
resolver: {
// Register an "extra modules proxy" for resolving modules outside of the normal resolution logic.
extraNodeModules: new Proxy(
// Provide the set of known local package mappings.
moduleMappings,
{
// Provide a mapper function, which uses the above mappings for associated package ids,
// otherwise fall back to the standard behavior and just look in the node_modules directory.
get: (target, name) => name in target ? target[name] : path.join(__dirname, `node_modules/${name}`),
},
// Provide the set of known local package mappings.
moduleMappings,
{
// Provide a mapper function, which uses the above mappings for associated package ids,
// otherwise fall back to the standard behavior and just look in the node_modules directory.
get: (target, name) => name in target ? target[name] : path.join(__dirname, `node_modules/${name}`),
},
),

blockList: exclusionList([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does blockList relate to blackListRE, which we used in another project and intended to bring into this project (to match the solution here: react-native-community/cli#1238). @CoPrez do you have any insights?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason react-native-windows moved from blacklists to blocklists in December. I'll reach out to react-native-windows owners to see why


In reply to: 557654635 [](ancestors = 557654635)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talking to some different folks, it sounds like this was a rename in the metro version included with react-native 0.64. It should do the same things as before and is just a rename


In reply to: 560367678 [](ancestors = 560367678,557654635)

// Avoid error EBUSY: resource busy or locked, open 'D:\a\1\s\packages\playground\msbuild.ProjectImports.zip' in pipeline
/.*\.ProjectImports\.zip/,

// This stops "react-native run-windows" from causing the metro server to crash if its already running
new RegExp(
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
),
]),
},

projectRoot: path.resolve(__dirname),
Expand Down
7,758 changes: 4,648 additions & 3,110 deletions Apps/Playground/package-lock.json

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions Apps/Playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"windows": "react-native run-windows --arch x64",
"windows-verbose": "react-native run-windows --arch x64 --logging",
"start": "react-native start",
"test": "jest",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
Expand All @@ -13,28 +15,30 @@
"@babylonjs/core": "^5.0.0-alpha.6",
"@babylonjs/loaders": "^5.0.0-alpha.6",
"@babylonjs/react-native": "file:../../Modules/@babylonjs/react-native",
"@react-native-community/slider": "^2.0.9",
"@react-native-community/slider": "4.0.0-rc.2",
"logkitty": "^0.7.1",
"react": "16.13.1",
"react-native": "0.63.1",
"react-native-permissions": "^2.1.4"
"react": "^17.0.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryantrem are there any limitations to what react/react-native version we can use? What is required for testing when moving to a newer version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have consumers on lower versions of React so we need to be a bit careful not to break them, but I think React 17 had more implementation fixes than API changes, so it's probably ok.

"react-native": "^0.64.0-rc.0",
"react-native-permissions": "^3.0.0",
"react-native-windows": "0.64.0-preview.5"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/cli": "^4.13.0",
"@react-native-community/eslint-config": "^1.1.0",
"@types/jest": "^25.2.3",
"@types/react-native": "0.63.1",
"@types/react": "^16.9.0",
"@types/react-native": "^0.63.18",
"@types/react-test-renderer": "^16.9.2",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"babel-jest": "^25.1.0",
"eslint": "^6.5.1",
"eslint": "7.12.0",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"prettier": "^2.0.4",
"react-test-renderer": "16.13.1",
"react-test-renderer": "^17.0.1",
"typescript": "^3.8.3"
},
"jest": {
Expand Down
92 changes: 92 additions & 0 deletions Apps/Playground/windows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
*AppPackages*
*BundleArtifacts*

#OS junk files
[Tt]humbs.db
*.DS_Store

#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
*.opensdf
*.opendb
*.unsuccessfulbuild
ipch/
[Oo]bj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb

#MonoDevelop
*.pidb
*.userprefs

#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*
*.sass-cache

#Project files
[Bb]uild/

#Subversion files
.svn

# Office Temp Files
~$*

# vim Temp Files
*~

#NuGet
packages/
*.nupkg

#ncrunch
*ncrunch*
*crunch*.local.xml

# visual studio database projects
*.dbmdl

#Test files
*.testsettings

#Other files
*.DotSettings
.vs/
*project.lock.json

#Files generated by the VS build
**/Generated Files/**

Loading