-
Notifications
You must be signed in to change notification settings - Fork 40
feat: platform visionOS #42
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
Open
thymikee
wants to merge
10
commits into
main
Choose a base branch
from
feat/visionos
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d1ae05c
feat: platform visionOS
thymikee bb6d42c
update to 77
thymikee db8092f
fix version and config command that expects ios platform to be presen…
thymikee e5ce7d7
use cli 16
thymikee 5feefef
use version not workspace
thymikee e6ecd7a
remove assets
thymikee d349da1
remove TestAction form xcscheme
thymikee 7eb4002
set files in package.json
thymikee 2c35ca8
update package name
thymikee 9d868c5
Merge branch 'main' into feat/visionos
szymonrybczak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # plugin-platform-visionos | ||
|
|
||
| This library was generated with [Nx](https://nx.dev). | ||
|
|
||
| ## Building | ||
|
|
||
| Run `nx build plugin-platform-visionos` to build the library. | ||
|
|
||
| ## Running unit tests | ||
|
|
||
| Run `nx test plugin-platform-visionos` to execute the unit tests via [Vitest](https://vitest.dev/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import baseConfig from '../../eslint.config.js'; | ||
|
|
||
| export default baseConfig; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| { | ||
| "name": "@rnef/plugin-platform-visionos", | ||
| "version": "0.0.1", | ||
| "type": "module", | ||
| "exports": { | ||
| "types": "./dist/src/index.d.ts", | ||
| "import": "./dist/src/index.js" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "src", | ||
| "template", | ||
| "react-native.config.ts" | ||
| ], | ||
| "scripts": { | ||
| "clean-dist": "rm -f dist/package.json", | ||
| "publish:verdaccio": "npm publish --registry http://localhost:4873 --userconfig ../../.npmrc" | ||
| }, | ||
| "dependencies": { | ||
| "@react-native-community/cli-config-apple": "^16.0.2", | ||
| "tslib": "^2.3.0", | ||
| "@callstack/rnef-plugin-platform-apple": "^0.0.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@callstack/rnef-config": "^0.0.1" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "plugin-platform-visionos", | ||
| "$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
| "sourceRoot": "packages/plugin-platform-visionos/src", | ||
| "projectType": "library", | ||
| "tags": [], | ||
| "targets": { | ||
| "build": { | ||
| "executor": "@nx/js:tsc", | ||
| "outputs": ["{options.outputPath}"], | ||
| "options": { | ||
| "outputPath": "packages/plugin-platform-visionos/dist", | ||
| "main": "packages/plugin-platform-visionos/src/index.ts", | ||
| "tsConfig": "packages/plugin-platform-visionos/tsconfig.lib.json" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { | ||
| getProjectConfig, | ||
| getDependencyConfig, | ||
| } from '@react-native-community/cli-config-apple'; | ||
|
|
||
| export default { | ||
| platforms: { | ||
| visionos: { | ||
| projectConfig: getProjectConfig({ platformName: 'visionos' }), | ||
| dependencyConfig: getDependencyConfig({ platformName: 'visionos' }), | ||
| }, | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './lib/pluginPlatformVisionOS.js'; |
5 changes: 5 additions & 0 deletions
5
packages/plugin-platform-visionos/src/lib/__tests__/dummy.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { test, expect } from 'vitest'; | ||
|
|
||
| test('dummy test', () => { | ||
| expect(true).toBe(true); | ||
| }); |
58 changes: 58 additions & 0 deletions
58
packages/plugin-platform-visionos/src/lib/pluginPlatformVisionOS.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import type { PluginOutput, PluginApi } from '@callstack/rnef-config'; | ||
| import { | ||
| createBuild, | ||
| createRun, | ||
| getRunOptions, | ||
| getBuildOptions, | ||
| RunFlags, | ||
| BuildFlags, | ||
| } from '@callstack/rnef-plugin-platform-apple'; | ||
| import { getProjectConfig } from '@react-native-community/cli-config-apple'; | ||
|
|
||
| const projectConfig = getProjectConfig({ platformName: 'visionos' }); | ||
| const buildOptions = getBuildOptions({ platformName: 'visionos' }); | ||
| const runOptions = getRunOptions({ platformName: 'visionos' }); | ||
thymikee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const pluginPlatformVisionOS = | ||
| () => | ||
| (api: PluginApi): PluginOutput => { | ||
| api.registerCommand({ | ||
| name: 'build:visionos', | ||
| description: 'Build visionOS app.', | ||
| action: async (args) => { | ||
| const projectRoot = api.getProjectRoot(); | ||
| const config = projectConfig(projectRoot, {}); | ||
|
|
||
| if (config) { | ||
| await createBuild('visionos', config, args as BuildFlags); | ||
| } else { | ||
| throw new Error('visionOS project not found.'); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i see that we have v similar errors across codebase when we can't find config. we should find a nice way or do a writeup in docs how to proceed with such case |
||
| } | ||
| }, | ||
| options: buildOptions, | ||
| }); | ||
|
|
||
| api.registerCommand({ | ||
| name: 'run:visionos', | ||
| description: 'Run visionOS app.', | ||
| action: async (args) => { | ||
| const projectRoot = api.getProjectRoot(); | ||
| const config = projectConfig(projectRoot, {}); | ||
|
|
||
| if (config) { | ||
| await createRun('visionos', config, args as RunFlags, projectRoot); | ||
| } else { | ||
| throw new Error('visionOS project not found.'); | ||
| } | ||
| }, | ||
| // @ts-expect-error: fix `simulator` is not defined in `RunFlags` | ||
| options: runOptions, | ||
| }); | ||
|
|
||
| return { | ||
| name: 'plugin-platform-visionos', | ||
| description: 'RNEF plugin for everything visionOS.', | ||
| }; | ||
| }; | ||
|
|
||
| export default pluginPlatformVisionOS; | ||
103 changes: 103 additions & 0 deletions
103
...s/plugin-platform-visionos/template/.github/actions/rnef-remote-build-visionos/action.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: 'RNEF Remote Build - visionOS Simulator' | ||
| description: 'Github implementation of the RNEF Remote Build for visionOS Simulator' | ||
|
|
||
| inputs: | ||
| github-token: | ||
| description: "GitHub Token" | ||
| required: false | ||
| default: ${{ github.token }} | ||
| scheme: | ||
| description: The workspace scheme to build | ||
| required: false | ||
| default: "HelloWorld" | ||
| architectures: | ||
| description: The architectures to build for | ||
| required: false | ||
| default: "arm64 x86_64" | ||
|
|
||
| outputs: | ||
| artifact-url: | ||
| description: 'URL of the relevant visionOS Simulator build artifact (could be cached)' | ||
| value: ${{ steps.cached-url.outcome == 'success' && steps.cached-url.outputs.artifact-url || steps.upload-artifact.outputs.artifact-url }} | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Native Fingerprint | ||
| id: fingerprint | ||
| uses: ./.github/actions/rnef-native-fingerprint | ||
| with: | ||
| platforms: visionos | ||
|
|
||
| - name: Set variables | ||
| run: | | ||
| echo "ARTIFACT_NAME=${{inputs.scheme}}-${{inputs.architectures}}-${{ steps.fingerprint.outputs.hash}}.tar.gz" >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| - name: Find artifact URL | ||
| id: cached-url | ||
| uses: ./.github/actions/find-artifact | ||
| with: | ||
| name: ${{ env.ARTIFACT_NAME }} | ||
|
|
||
| - name: Post Cached Build (if found) | ||
| if: steps.cached-url.outputs.artifact-url | ||
| uses: ./.github/actions/rnef-post-build | ||
| with: | ||
| platform: visionOS Simulator | ||
| artifact-url: ${{ steps.cached-url.outputs.artifact-url }} | ||
|
|
||
| - name: Install Pods | ||
| if: ${{ !steps.cached-url.outputs.artifact-url }} | ||
| run: | | ||
| cd visionos | ||
| pod install --verbose | ||
| shell: bash | ||
|
|
||
| - name: Build visionOS | ||
| if: ${{ !steps.cached-url.outputs.artifact-url }} | ||
| # Taken from: https://github.com/microsoft/rnx-kit/blob/ac1cfa362ace6172a020d2b4bcdd63c398527c17/incubator/build/scripts/build-apple.sh#L49 | ||
| # @TODO replace with RNEF CLI call. | ||
| run: | | ||
| cd visionos | ||
| xcworkspace=$(find . -maxdepth 1 -name '*.xcworkspace' -type d | head -1) | ||
| xcodebuild \ | ||
| -workspace "${xcworkspace}" \ | ||
| -scheme "${{inputs.scheme}}" \ | ||
| -destination "generic/platform=visionOS Simulator" \ | ||
| -configuration Debug \ | ||
| -derivedDataPath DerivedData \ | ||
| ARCHS="${{inputs.architectures}}" \ | ||
| CODE_SIGNING_ALLOWED=NO \ | ||
| CLANG_ADDRESS_SANITIZER=NO \ | ||
| CLANG_UNDEFINED_BEHAVIOR_SANITIZER=NO \ | ||
| OTHER_CFLAGS='$(inherited) -fno-sanitize=undefined -fno-sanitize=bounds -fstack-protector-strong' \ | ||
| OTHER_LDFLAGS='$(inherited) -fno-sanitize=undefined -fno-sanitize=bounds -fstack-protector-strong' \ | ||
| COMPILER_INDEX_STORE_ENABLE=NO \ | ||
| build | ||
| shell: bash | ||
|
|
||
| - name: Prepare Artifact | ||
| if: ${{ !steps.cached-url.outputs.artifact-url }} | ||
| run: | | ||
| app=$(find visionos/DerivedData/Build/Products/Debug-iphonesimulator -maxdepth 1 -name '*.app' -type d | head -1) | ||
| app_dir=$(dirname "${app}") | ||
| app_name=$(basename "${app}") | ||
| tar -C "${app_dir}" -czvf "${{ env.ARTIFACT_NAME }}" "${app_name}" | ||
| shell: bash | ||
|
|
||
| - name: Upload IPA | ||
| id: upload-artifact | ||
| if: ${{ !steps.cached-url.outputs.artifact-url }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ env.ARTIFACT_NAME }} | ||
| path: ${{ env.ARTIFACT_NAME }} | ||
| if-no-files-found: error | ||
|
|
||
| - name: Post Build | ||
| if: ${{ !steps.cached-url.outputs.artifact-url }} | ||
| uses: ./.github/actions/rnef-post-build | ||
| with: | ||
| platform: visionOS Simulator | ||
| artifact-url: ${{ steps.upload-artifact.outputs.artifact-url }} |
35 changes: 35 additions & 0 deletions
35
packages/plugin-platform-visionos/template/.github/workflows/remote-build-visionos.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: Remote Build visionOS Simulator | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
|
||
| concurrency: | ||
| group: remote-build-visionos-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: macos-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: RNEF Remote Build - visionOS Simulator | ||
| uses: ./.github/actions/rnef-remote-build-visionos | ||
| with: | ||
| architectures: arm64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "name": "rnef-plugin-platform-visionos-template", | ||
| "scripts": { | ||
| "visionos": "rnef run:visionos" | ||
| }, | ||
| "devDependencies": { | ||
| "@callstack/rnef-plugin-platform-visionos": "^0.0.1", | ||
| "@callstack/react-native-visionos": "^0.77.0-rc.0" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.