diff --git a/.github/actions/cache_cargo/action.yml b/.github/actions/cache_cargo/action.yml
index 27c5d66..656a3e0 100644
--- a/.github/actions/cache_cargo/action.yml
+++ b/.github/actions/cache_cargo/action.yml
@@ -5,10 +5,12 @@ runs:
steps:
# Fix timestamps
+ - uses: cargo-bins/cargo-binstall@main
- name: restore timestamps
uses: chetan/git-restore-mtime-action@v2
- - name: Cache cargo registry
- uses: actions/cache@v2
+ - name: Cache cargo registry pc-test
+ if: runner.prefix == 'pc-test'
+ uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
@@ -16,8 +18,34 @@ runs:
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- restore-keys: ${{ runner.os }}-cargo-
+ key: ${{ runner.os }}-${{ runner.version }}-${{ runner.prefix }}-${{ runner.target }}-${{ runner.api-level }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+ restore-keys: ${{ runner.os }}-${{ runner.version }}-${{ runner.prefix }}-${{ runner.target }}-${{ runner.api-level }}-cargo-
+ - name: Cache cargo registry pc-run
+ uses: actions/cache@v3
+ with:
+ path: |
+ ~/.cargo/bin/
+ ~/.cargo/registry/index/
+ ~/.cargo/registry/cache/
+ ~/.cargo/git/db/
+ examples/pc/target/
+ key: ${{ runner.os }}-${{ runner.version }}-${{ runner.prefix }}-${{ runner.target }}-${{ runner.api-level }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+ restore-keys: ${{ runner.os }}-${{ runner.version }}-${{ runner.prefix }}-${{ runner.target }}-${{ runner.api-level }}-cargo-
+
+jobs:
+ post:
+ - name: Clear the cargo caches powershell
+ if: runner.os == 'windows-latest'
+ shell: powershell
+ run: |
+ cargo install cargo-cache --no-default-features --features ci-autoclean --force --debug
+ cargo-cache
+ - name: Clear the cargo caches bash
+ if: runner.os != 'windows-latest'
+ shell: bash
+ run: |
+ cargo install cargo-cache --no-default-features --features ci-autoclean --force --debug
+ cargo-cache
# https://zenn.dev/naokifujita/articles/c890954165c21f
# https://zenn.dev/kt3k/articles/d557cc874961ab
diff --git a/.github/actions/install_rust_by_version/action.yml b/.github/actions/install_rust_by_version/action.yml
new file mode 100644
index 0000000..b6de653
--- /dev/null
+++ b/.github/actions/install_rust_by_version/action.yml
@@ -0,0 +1,10 @@
+name: install_rust_by_version
+description: install rust by version
+runs:
+ using: composite
+
+ steps:
+ - name: Install Rust (${{ matrix.version }})
+ uses: actions-rust-lang/setup-rust-toolchain@v1.5.0
+ with:
+ toolchain: ${{ matrix.version }}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..defc324
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,349 @@
+on: [push, pull_request]
+
+jobs:
+ build_cache_pc_tier1:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [pc_test_target_tier1]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ steps:
+ - uses: actions/checkout@v3
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - name: build
+ run: |
+ cargo build
+ cargo build --release
+ - name: build linux
+ if: matrix.os == 'ubuntu-latest'
+ run: |
+ target=("aarch64-unknown-linux-gnu" "i686-unknown-linux-gnu" "x86_64-unknown-linux-gnu")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ done
+ - name: build macos
+ if: matrix.os == 'macos-latest'
+ run: |
+ target=("x86_64-apple-darwin")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ done
+ - name: build windows
+ if: matrix.os == 'windows-latest'
+ run: |
+ $target = @("i686-pc-windows-gnu", "i686-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-pc-windows-msvc")
+ foreach ($v in $target) {
+ rustup target add $v
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ }
+
+ fmt_pc:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [pc_test_target_tier1]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ needs: build_cache_pc_tier1
+ steps:
+ - uses: actions/checkout@v3
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - run: rustup component add rustfmt
+ - name: fmt
+ run: cargo fmt --all -- --check
+
+ clippy_pc_tier1:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [pc_test]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ needs: build_cache_pc_tier1
+ steps:
+ - uses: actions/checkout@v3
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - run: rustup component add clippy
+ - name: clippy
+ run: |
+ cargo clippy --all-targets --all-features -- -D warnings
+ - name: clippy linux
+ if: matrix.os == 'ubuntu-latest'
+ run: |
+ target=("aarch64-unknown-linux-gnu" "i686-unknown-linux-gnu" "x86_64-unknown-linux-gnu")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo clippy --target ${v} --all-targets --all-features -- -D warnings
+ done
+ - name: clippy macos
+ if: matrix.os == 'macos-latest'
+ run: |
+ target=("x86_64-apple-darwin")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo clippy --target ${v} --all-targets --all-features -- -D warnings
+ done
+ - name: clippy windows
+ if: matrix.os == 'windows-latest'
+ run: |
+ $target = @("i686-pc-windows-gnu", "i686-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-pc-windows-msvc")
+ foreach ($v in $target) {
+ rustup target add $v
+ cargo clippy --target ${v} --all-targets --all-features -- -D warnings
+ }
+
+ test_pc_tier1:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [pc_test]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ needs: build_cache_pc_tier1
+ steps:
+ - uses: actions/checkout@v3
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - name: test
+ run: |
+ cargo test --all -- --nocapture
+ cargo test --all --release -- --nocapture
+ - name: test linux aarch64
+ if: matrix.os == 'ubuntu-latest'
+ # && matrix.version != '1.68.0'
+ uses: uraimo/run-on-arch-action@v2
+ with:
+ arch: aarch64
+ distro: ubuntu_latest
+ # Not required, but speeds up builds by reusing the cache from the previous job
+ # githubToken: ${{ github.token }}
+ run: |
+ apt-get update -q -y
+ apt-get install -y -q curl gcc
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ matrix.version }} --profile minimal
+ source "$HOME/.cargo/env"
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo test --all --target aarch64-unknown-linux-gnu -- --nocapture
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo test --all --target aarch64-unknown-linux-gnu --release -- --nocapture
+ - name: test linux i686
+ if: matrix.os == 'ubuntu-latest'
+ # until merged https://github.com/uraimo/run-on-arch-action/pull/94
+ uses: lalten/run-on-arch-action@amd64-support
+ with:
+ arch: i686
+ distro: ubuntu_latest
+ run: |
+ apt-get update -q -y
+ apt-get install -q -y curl gcc
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${{ matrix.version }} --profile minimal
+ source "$HOME/.cargo/env"
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo test --all --target i686-unknown-linux-gnu -- --nocapture
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse cargo test --all --target i686-unknown-linux-gnu --release -- --nocapture
+ - name: test linux
+ if: matrix.os == 'ubuntu-latest'
+ # cargo test can only real platform
+ run: |
+ target=("x86_64-unknown-linux-gnu")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo test --all --target ${v} -- --nocapture
+ cargo test --all --release --target ${v} -- --nocapture
+ done
+ - name: test macos
+ if: matrix.os == 'macos-latest'
+ run: |
+ target=("x86_64-apple-darwin")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo test --all --target ${v} -- --nocapture
+ cargo test --all --release --target ${v} -- --nocapture
+ done
+ - name: test windows
+ if: matrix.os == 'windows-latest'
+ run: |
+ $target = @("i686-pc-windows-gnu", "i686-pc-windows-msvc", "x86_64-pc-windows-gnu", "x86_64-pc-windows-msvc")
+ foreach ($v in $target) {
+ rustup target add $v
+ cargo test --all --target $v -- --nocapture
+ cargo test --all --release --target $v -- --nocapture
+ }
+
+ build_target_tier2:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [pc_test_target_tier2]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ steps:
+ - uses: actions/checkout@v3
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - name: build linux
+ if: matrix.os == 'ubuntu-latest'
+ # note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
+ # "loongarch64-unknown-linux-gnu"
+ run: |
+ target=("aarch64-unknown-linux-musl" "arm-unknown-linux-gnueabi" "arm-unknown-linux-gnueabihf" "armv7-unknown-linux-gnueabihf" "powerpc-unknown-linux-gnu" "powerpc64-unknown-linux-gnu" "powerpc64le-unknown-linux-gnu" "riscv64gc-unknown-linux-gnu" "s390x-unknown-linux-gnu" "x86_64-unknown-freebsd" "x86_64-unknown-illumos" "x86_64-unknown-linux-musl" "x86_64-unknown-netbsd")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ done
+ - name: build linux loongarch64
+ if: matrix.os == 'ubuntu-latest' && matrix.version != '1.68.0'
+ run: |
+ rustup target add loongarch64-unknown-linux-gnu
+ cargo build --target loongarch64-unknown-linux-gnu
+ cargo build --target loongarch64-unknown-linux-gnu --release
+ - name: build macos
+ if: matrix.os == 'macos-latest'
+ run: |
+ target=("aarch64-apple-darwin")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ done
+ - name: build windows
+ if: matrix.os == 'windows-latest'
+ run: |
+ $target = @("aarch64-pc-windows-msvc")
+ foreach ($v in $target) {
+ rustup target add $v
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ }
+
+ build_cache_android:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [android_test]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - name: build android
+ run: |
+ target=("aarch64-linux-android" "arm-linux-androideabi" "armv7-linux-androideabi" "i686-linux-android" "x86_64-linux-android")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo build --target ${v}
+ cargo build --target ${v} --release
+ done
+ - name: build
+ run: cargo build
+
+ clippy_android:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [android_test]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ needs: build_cache_android
+ steps:
+ - uses: actions/checkout@v3
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - run: rustup component add clippy
+ - name: clippy
+ run: |
+ cargo clippy --all-targets --all-features -- -D warnings
+ - name: clippy linux
+ run: |
+ target=("aarch64-linux-android" "arm-linux-androideabi" "armv7-linux-androideabi" "i686-linux-android" "x86_64-linux-android")
+ for v in "${target[@]}"; do
+ rustup target add ${v}
+ cargo clippy --target ${v} --all-targets --all-features -- -D warnings
+ done
+
+ test_android:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ version: [1.68.0, stable, beta, nightly]
+ api-level: [24, 30, 33]
+ prefix: [android_test]
+ fail-fast: false
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ needs: build_cache_android
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 1
+ - uses: ./.github/actions/cache_cargo
+ - uses: ./.github/actions/install_rust_by_version
+ - name: install rust_android_ndk
+ # run: rustup target add aarch64-linux-android arm-linux-androideabi armv7-linux-androideabi i686-linux-android x86_64-linux-android
+ run: rustup target add x86_64-linux-android
+ - name: install dinghy
+ run: |
+ if [ ${{matrix.version}} == "1.68.0" ]; then
+ if [ ${{matrix.os}} == "macos-latest" ]; then
+ cargo binstall -q --no-confirm --force --pkg-url="https://github.com/sonos/dinghy/releases/download/0.6.5/cargo-dinghy-macos-0.6.5.tgz" cargo-dinghy@0.6.5
+ else
+ cargo binstall -q --no-confirm --force --pkg-url="https://github.com/sonos/dinghy/releases/download/0.6.5/cargo-dinghy-linux-0.6.5.tgz" cargo-dinghy@0.6.5
+ fi
+ else
+ cargo binstall -q --no-confirm --force cargo-dinghy
+ fi
+ - name: start android emulator
+ uses: ReactiveCircus/android-emulator-runner@v2
+ with:
+ api-level: ${{ matrix.api-level }}
+ target: default
+ arch: x86_64
+ profile: pixel_2
+ emulator-boot-timeout: 900
+ script: |
+ cargo dinghy --platform auto-android-x86_64 test
+
+# https://zenn.dev/naokifujita/articles/c890954165c21f
+# https://github.com/actix/actix-web/blob/master/.github/workflows/ci.yml
+# https://github.com/rust-lang/cargo/issues/10781
+# https://doc.rust-lang.org/cargo/reference/registries.html
diff --git a/.github/workflows/ci_linux.yml b/.github/workflows/ci_linux.yml
deleted file mode 100644
index d1373e5..0000000
--- a/.github/workflows/ci_linux.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-on: [push, pull_request]
-
-jobs:
- build_cache:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - uses: ./.github/actions/cache_cargo
- - name: build
- run: cargo build
- working-directory: .
-
- fmt:
- runs-on: ubuntu-latest
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - run: rustup component add rustfmt
- - uses: ./.github/actions/cache_cargo
- - name: fmt
- run: cargo fmt --all -- --check
- working-directory: .
-
- clippy:
- runs-on: ubuntu-latest
- env:
- RUSTC_FORCE_INCREMENTAL: 1
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - run: rustup component add clippy
- - uses: ./.github/actions/cache_cargo
- - name: clippy
- run: cargo clippy --all-targets --all-features -- -D warnings
- working-directory: .
-
- test:
- runs-on: ubuntu-latest
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - uses: ./.github/actions/cache_cargo
- - name: test
- run: cargo test --all -- --nocapture
- working-directory: .
-# https://zenn.dev/naokifujita/articles/c890954165c21f
diff --git a/.github/workflows/ci_mac.yml b/.github/workflows/ci_mac.yml
deleted file mode 100644
index a0edc0f..0000000
--- a/.github/workflows/ci_mac.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-on: [push, pull_request]
-
-jobs:
- build_cache:
- runs-on: macOS-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - uses: ./.github/actions/cache_cargo
- - name: build
- run: cargo build
- working-directory: .
-
- fmt:
- runs-on: macOS-latest
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - run: rustup component add rustfmt
- - uses: ./.github/actions/cache_cargo
- - name: fmt
- run: cargo fmt --all -- --check
- working-directory: .
-
- clippy:
- runs-on: macOS-latest
- env:
- RUSTC_FORCE_INCREMENTAL: 1
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - run: rustup component add clippy
- - uses: ./.github/actions/cache_cargo
- - name: clippy
- run: cargo clippy --all-targets --all-features -- -D warnings
- working-directory: .
-
- test:
- runs-on: macOS-latest
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - uses: ./.github/actions/cache_cargo
- - name: test
- run: cargo test --all -- --nocapture
- working-directory: .
-# https://zenn.dev/naokifujita/articles/c890954165c21f
diff --git a/.github/workflows/ci_windows.yml b/.github/workflows/ci_windows.yml
deleted file mode 100644
index 9a0feff..0000000
--- a/.github/workflows/ci_windows.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-on: [push, pull_request]
-
-jobs:
- build_cache:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 0
- - uses: ./.github/actions/cache_cargo
- - name: build
- run: cargo build
- working-directory: .
-
- fmt:
- runs-on: windows-latest
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - run: rustup component add rustfmt
- - uses: ./.github/actions/cache_cargo
- - name: fmt
- run: cargo fmt --all -- --check
- working-directory: .
-
- clippy:
- runs-on: windows-latest
- env:
- RUSTC_FORCE_INCREMENTAL: 1
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - run: rustup component add clippy
- - uses: ./.github/actions/cache_cargo
- - name: clippy
- run: cargo clippy --all-targets --all-features -- -D warnings
- working-directory: .
-
- test:
- runs-on: windows-latest
- needs: build_cache
- steps:
- - uses: actions/checkout@v3
- - uses: ./.github/actions/cache_cargo
- - name: test
- run: cargo test --all -- --nocapture
- working-directory: .
-# https://zenn.dev/naokifujita/articles/c890954165c21f
diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml
new file mode 100644
index 0000000..6f854fa
--- /dev/null
+++ b/.github/workflows/run.yml
@@ -0,0 +1,152 @@
+on: [push, pull_request]
+
+jobs:
+ run_pc:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ version: [1.68.0, stable, beta, nightly]
+ prefix: [pc_run]
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+ - uses: ./.github/actions/install_rust_by_version
+ - uses: ./.github/actions/cache_cargo
+ - name: run windows release
+ if: matrix.os == 'windows-latest'
+ run: |
+ cargo build --release
+ cargo run --release > ${{ matrix.os }}-${{ matrix.version }}-release-run.log
+ cargo build
+ cargo run > ${{ matrix.os }}-${{ matrix.version }}-debug-run.log
+ working-directory: ./examples/common
+ - name: run release
+ if: matrix.os != 'windows-latest'
+ run: |
+ cargo build --release
+ sudo target/release/pc > ${{ matrix.os }}-${{ matrix.version }}-release-run.log
+ cargo build
+ sudo target/debug/pc > ${{ matrix.os }}-${{ matrix.version }}-debug-run.log
+ working-directory: ./examples/common
+ - name: Upload log release on run
+ uses: actions/upload-artifact@v3
+ with:
+ name: run-log
+ path: ./examples/common/${{ matrix.os }}-${{ matrix.version }}-release-run.log
+ - name: Upload log on run
+ uses: actions/upload-artifact@v3
+ with:
+ name: run-log
+ path: ./examples/common/${{ matrix.os }}-${{ matrix.version }}-debug-run.log
+
+ run_android:
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ api-level: [24, 30, 33]
+ prefix: [android_run]
+ fail-fast: false
+ # https://github.com/ReactiveCircus/android-emulator-runner/issues/46#issuecomment-1474555282
+ # https://github.com/ReactiveCircus/android-emulator-runner/issues/15
+ runs-on: ${{ matrix.os }}
+ env:
+ CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ RUSTC_FORCE_INCREMENTAL: 1
+ steps:
+ - uses: actions/checkout@v3
+ - name: install target
+ # run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android arm-linux-androideabi
+ run: rustup target add x86_64-linux-android
+ - uses: cargo-bins/cargo-binstall@main
+ - name: install rust android
+ run: cargo binstall -q --no-confirm --force cargo-apk
+ - name: logcat
+ run: adb logcat RustStdoutStderr:D '*:S' > android-${{ matrix.api-level }}-run.log &
+ - name: start android emulator
+ uses: ReactiveCircus/android-emulator-runner@v2
+ with:
+ api-level: ${{ matrix.api-level }}
+ target: default
+ arch: x86_64
+ profile: pixel_2
+ emulator-boot-timeout: 900
+ script: bash ../../workflow/android/run.sh
+ working-directory: ./examples/android/
+ - name: Upload log on cargo-apk
+ uses: actions/upload-artifact@v3
+ with:
+ name: run-log
+ path: android-${{ matrix.api-level }}-run.log
+
+ # not initialize ndk_context
+ # run_android_dinghy:
+ # strategy:
+ # matrix:
+ # os: [ubuntu-latest]
+ # api-level: [24, 30, 33]
+ # prefix: [android_run]
+ # fail-fast: false
+ # # https://github.com/ReactiveCircus/android-emulator-runner/issues/46#issuecomment-1474555282
+ # # https://github.com/ReactiveCircus/android-emulator-runner/issues/15
+ # runs-on: ${{ matrix.os }}
+ # env:
+ # CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
+ # RUSTC_FORCE_INCREMENTAL: 1
+ # steps:
+ # - uses: actions/checkout@v3
+ # - name: install target
+ # # run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android arm-linux-androideabi
+ # run: rustup target add x86_64-linux-android
+ # - name: install rust android
+ # run: cargo install cargo-dinghy --force
+ # - name: start android emulator
+ # uses: ReactiveCircus/android-emulator-runner@v2
+ # with:
+ # api-level: ${{ matrix.api-level }}
+ # target: default
+ # arch: x86_64
+ # profile: pixel_2
+ # emulator-boot-timeout: 900
+ # script: |
+ # cargo dinghy --platform auto-android-x86_64 build
+ # cargo dinghy --platform auto-android-x86_64 run > android-dinghy-${{ matrix.api-level }}-run.log
+ # cargo dinghy --platform auto-android-x86_64 build --release
+ # cargo dinghy --platform auto-android-x86_64 run --release > android-dinghy-${{ matrix.api-level }}-run.log
+ # working-directory: ./examples/common/
+ # - name: Upload log on cargo-apk
+ # uses: actions/upload-artifact@v3
+ # with:
+ # name: run-log
+ # path: ./examples/common/android-dinghy-${{ matrix.api-level }}-run.log
+
+ concat_logs:
+ runs-on: ubuntu-latest
+ needs: [run_pc, run_android]
+ steps:
+ - name: Download artifacts on run
+ uses: actions/download-artifact@v3
+ with:
+ name: run-log
+ path: artifacts
+ - name: Concatenate logs
+ run: |
+ directory="artifacts"
+ echo "" > all-logs.txt
+ for file in "$directory"/*; do
+ echo "================ ${file} ================" >> all-logs.txt
+ cat "$file" >> all-logs.txt
+ done
+ - name: Upload concatenated log
+ uses: actions/upload-artifact@v3
+ with:
+ name: run-log
+ path: all-logs.txt
+# https://zenn.dev/takeyaqa/articles/github-actions-appium-android-emulator
+# https://stackoverflow.com/questions/3152681/android-emulator-5554-offline
+
+# https://github.com/kiwix/kiwix-android/blob/develop/.github/workflows/ci.yml
diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml
deleted file mode 100644
index 419cacd..0000000
--- a/.github/workflows/test_android.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-on: [push, pull_request]
-
-jobs:
- test:
- name: test
- strategy:
- matrix:
- api-level: [24, 30, 33]
- fail-fast: false
- runs-on: macOS-11
- steps:
- - uses: actions/checkout@v3
- with:
- fetch-depth: 1
- - name: Set up JDK 11
- uses: actions/setup-java@v3
- with:
- distribution: temurin
- java-version: 11
- - name: install target
- run: rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
- - name: install rust android
- run: cargo install cargo-apk
- - name: logcat
- run: adb logcat RustStdoutStderr:D '*:S' > cargo-apk-${{ matrix.api-level }}.log &
- - name: create instrumentation coverage
- uses: ReactiveCircus/android-emulator-runner@v2
- env:
- GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
- if: ${{ matrix.api-level != 33 }}
- with:
- api-level: ${{ matrix.api-level }}
- target: default
- arch: x86_64
- profile: pixel_2
- ram-size: "4096M"
- disk-size: "14G"
- sdcard-path-or-size: "1000M"
- disable-animations: false
- script: bash ../../workflow/android/run.sh
- working-directory: ./examples/android/
- continue-on-error: true
- - name: create instrumentation coverage on google_apis for android 33
- uses: ReactiveCircus/android-emulator-runner@v2
- env:
- GRADLE_OPTS: "-Dorg.gradle.internal.http.connectionTimeout=60000 -Dorg.gradle.internal.http.socketTimeout=60000 -Dorg.gradle.internal.network.retry.max.attempts=6 -Dorg.gradle.internal.network.retry.initial.backOff=2000"
- if: ${{ matrix.api-level == 33 }}
- with:
- api-level: ${{ matrix.api-level }}
- target: google_apis
- arch: x86_64
- profile: pixel_2
- heap-size: "512M"
- ram-size: "4096M"
- disk-size: "14G"
- sdcard-path-or-size: "4096M"
- disable-animations: false
- script: bash ../../workflow/android/run.sh
- working-directory: ./examples/android/
- continue-on-error: true
- - name: Upload log on cargo-apk
- uses: actions/upload-artifact@v1
- with:
- name: cargo-apk-${{ matrix.api-level }}.log
- path: cargo-apk-${{ matrix.api-level }}.log
-# https://zenn.dev/takeyaqa/articles/github-actions-appium-android-emulator
-# https://stackoverflow.com/questions/3152681/android-emulator-5554-offline
-
-# https://github.com/kiwix/kiwix-android/blob/develop/.github/workflows/ci.yml
diff --git a/.github/workflows/test_iphone.yml b/.github/workflows/test_iphone.yml
new file mode 100644
index 0000000..66c4b9c
--- /dev/null
+++ b/.github/workflows/test_iphone.yml
@@ -0,0 +1,67 @@
+on: [push, pull_request]
+
+jobs:
+ dinghy:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Install stable rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ target: x86_64-apple-ios
+ override: true
+ # - name: install target
+ # run: rustup target add aarch64-apple-ios x86_64-apple-ios aarch64-apple-ios-sim
+ - uses: cargo-bins/cargo-binstall@main
+ - name: install cargo-dinghy
+ run: cargo binstall -q --no-confirm --force cargo-dinghy
+ - name: start simulator
+ uses: futureware-tech/simulator-action@v3
+ with:
+ model: "iPhone 8"
+ - name: Dinghy test
+ run: cargo dinghy --platform auto-ios-x86_64 test
+ working-directory: ./examples/iphone/
+
+ bundle:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Install stable rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ target: x86_64-apple-ios
+ override: true
+ - run: rustup target add x86_64-apple-ios
+ - uses: cargo-bins/cargo-binstall@main
+ - name: install rust iphone
+ run: cargo binstall -q --no-confirm --force cargo-bundle
+ - name: move target dir
+ run: |
+ cp -r ./examples/iphone /tmp/
+ cp -r ../. /tmp/
+ ls -al /tmp/
+ cd /tmp/iphone/
+ sed -i.bak 's|path = "../../"|path = "../nickname"|' Cargo.toml
+ - name: build
+ run: cargo bundle --format ios --target x86_64-apple-ios --release
+ working-directory: /tmp/iphone/
+ - name: start simulator
+ uses: futureware-tech/simulator-action@v3
+ # https://github.com/futureware-tech/simulator-action/wiki/Devices-macos-latest
+ with:
+ model: "iPhone 11"
+ shutdown_after_job: false
+ - name: pre drive
+ run: |
+ ls -al target/x86_64-apple-ios/release/bundle/ios/nickname-ios-test-app.app
+ cat target/x86_64-apple-ios/release/bundle/ios/nickname-ios-test-app.app/Info.plist
+ xcrun simctl install booted target/x86_64-apple-ios/release/bundle/ios/nickname-ios-test-app.app &
+ working-directory: /tmp/iphone/
+ - name: drive
+ run: bash /tmp/nickname/workflow/iphone/run.sh
+# https://github.com/simlay/uikit-sys/blob/master/.github/workflows/rust.yml
diff --git a/.vscode/settings.json b/.vscode/settings.json
index edb15a0..b7f5240 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,19 +1,23 @@
{
"rust-analyzer.linkedProjects": [
- ".\\Cargo.toml",
".\\Cargo.toml",
".\\examples\\android\\Cargo.toml",
- ".\\examples\\pc\\Cargo.toml",
+ ".\\examples\\iphone\\Cargo.toml",
+ ".\\examples\\common\\Cargo.toml"
],
- "rust-analyzer.cargo.target": "aarch64-linux-android",
+ // "rust-analyzer.cargo.target": "aarch64-linux-android",
+ "rust-analyzer.cargo.target": "x86_64-apple-ios",
// "rust-analyzer.cargo.target": "x86_64-unknown-linux-gnu",
// "rust-analyzer.cargo.target": "wasm32-wasi",
"cSpell.words": [
+ "binstall",
"COMPUTERNAME",
"gethostname",
"libc",
+ "objc",
"sysinfoapi",
"thiserror",
+ "wasi",
"winapi",
"winbase"
],
diff --git a/Cargo.toml b/Cargo.toml
index 8def31b..6edef92 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ cfg-if = "1"
[target.'cfg(target_os = "android")'.dependencies]
jni = "0.21"
-ndk-context = "0.1.1"
+ndk-context = "0.1"
[target.'cfg(target_os = "windows")'.dependencies]
winapi = { version = "0.3", features = [
@@ -35,9 +35,8 @@ winapi = { version = "0.3", features = [
"iptypes",
] }
-[target.'cfg(target_os = "ios")'.dependencies]
-cocoa = "0.25"
-objc = "0.2"
+[target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies]
+objc = { version = "0.4.1", package = "objc2" }
-[target.'cfg(any(unix, target_os = "redox", target_os = "wasi"))'.dependencies]
+[target.'cfg(any(unix, target_os = "redox", target_os = "macos", target_os = "wasi"))'.dependencies]
libc = "0.2"
diff --git a/README.md b/README.md
index 5af7b02..ce5fdf7 100644
--- a/README.md
+++ b/README.md
@@ -17,20 +17,26 @@ https://github.com/WebAssembly/wasi-libc/issues/196
- get
- set
-## rust target
+# rust target
https://doc.rust-lang.org/nightly/rustc/platform-support.html
-## build
+# build
look README.md on example
-## next
-### android
+# next
+## android
get nickname from bluetooth
-## extension function
-### android
+# extension function
+## android
- finish
call finishAndRemoveTask()
- get_device_api_level
get api_level
call VERSION.SDK_INT
+
+# github actions test on mobile
+## android
+- api-level 24: `error: "API level 25 or higher is required"`
+- api-level 30: `Android SDK built for x86_64`
+- api-level 33: `sdk_gphone_x86_64`
diff --git a/build.rs b/build.rs
new file mode 100644
index 0000000..5573771
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,12 @@
+fn main() {
+ #[cfg(target_os = "ios")]
+ {
+ println!("cargo:rustc-link-lib=framework=Foundation");
+
+ println!("cargo:rustc-link-lib=framework=UIKit");
+
+ println!("cargo:rustc-link-lib=framework=CoreGraphics");
+ println!("cargo:rustc-link-lib=framework=QuartzCore");
+ println!("cargo:rustc-link-lib=framework=Security");
+ }
+}
diff --git a/examples/android/Cargo.lock b/examples/android/Cargo.lock
index 35b276f..d78db72 100644
--- a/examples/android/Cargo.lock
+++ b/examples/android/Cargo.lock
@@ -18,7 +18,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "052ad56e336bcc615a214bffbeca6c181ee9550acec193f0327e0b103b033a4d"
dependencies = [
"android-properties",
- "bitflags 2.4.1",
+ "bitflags",
"cc",
"cesu8",
"jni",
@@ -56,24 +56,12 @@ dependencies = [
"once_cell",
]
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
-[[package]]
-name = "block"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
-
[[package]]
name = "bytes"
version = "1.5.0"
@@ -101,36 +89,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-[[package]]
-name = "cocoa"
-version = "0.25.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
-dependencies = [
- "bitflags 1.3.2",
- "block",
- "cocoa-foundation",
- "core-foundation",
- "core-graphics",
- "foreign-types",
- "libc",
- "objc",
-]
-
-[[package]]
-name = "cocoa-foundation"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
-dependencies = [
- "bitflags 1.3.2",
- "block",
- "core-foundation",
- "core-graphics-types",
- "libc",
- "objc",
-]
-
[[package]]
name = "combine"
version = "4.6.6"
@@ -141,46 +99,6 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "core-foundation"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
-
-[[package]]
-name = "core-graphics"
-version = "0.23.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "core-graphics-types",
- "foreign-types",
- "libc",
-]
-
-[[package]]
-name = "core-graphics-types"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "libc",
-]
-
[[package]]
name = "env_logger"
version = "0.10.1"
@@ -211,33 +129,6 @@ dependencies = [
"nick-name",
]
-[[package]]
-name = "foreign-types"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
-dependencies = [
- "foreign-types-macros",
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-macros"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
-
[[package]]
name = "hashbrown"
version = "0.14.2"
@@ -288,15 +179,6 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
-[[package]]
-name = "malloc_buf"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "memchr"
version = "2.6.4"
@@ -309,7 +191,7 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7"
dependencies = [
- "bitflags 2.4.1",
+ "bitflags",
"jni-sys",
"log",
"ndk-sys",
@@ -338,11 +220,10 @@ name = "nick-name"
version = "0.1.0"
dependencies = [
"cfg-if",
- "cocoa",
"jni",
"libc",
"ndk-context",
- "objc",
+ "objc2",
"thiserror",
"winapi",
]
@@ -369,14 +250,27 @@ dependencies = [
]
[[package]]
-name = "objc"
-version = "0.2.7"
+name = "objc-sys"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845"
+
+[[package]]
+name = "objc2"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d"
dependencies = [
- "malloc_buf",
+ "objc-sys",
+ "objc2-encode",
]
+[[package]]
+name = "objc2-encode"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666"
+
[[package]]
name = "once_cell"
version = "1.18.0"
diff --git a/examples/android/README.md b/examples/android/README.md
index 166fc83..20e5e15 100644
--- a/examples/android/README.md
+++ b/examples/android/README.md
@@ -17,4 +17,5 @@ cargo apk run
```
cargo install cargo-apk
+cargo install dinghy
```
diff --git a/examples/android/src/lib.rs b/examples/android/src/lib.rs
index a87e4e2..8ceaaad 100644
--- a/examples/android/src/lib.rs
+++ b/examples/android/src/lib.rs
@@ -22,5 +22,5 @@ fn android_main(_app: AndroidApp) {
nick_name::finish().unwrap();
- eprintln!("__finish__");
+ println!("__finish__");
}
diff --git a/examples/pc/Cargo.lock b/examples/common/Cargo.lock
similarity index 71%
rename from examples/pc/Cargo.lock
rename to examples/common/Cargo.lock
index ba33520..cd9bbd5 100644
--- a/examples/pc/Cargo.lock
+++ b/examples/common/Cargo.lock
@@ -2,18 +2,6 @@
# It is not intended for manual editing.
version = 3
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "block"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
-
[[package]]
name = "bytes"
version = "1.5.0"
@@ -32,36 +20,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-[[package]]
-name = "cocoa"
-version = "0.25.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c"
-dependencies = [
- "bitflags",
- "block",
- "cocoa-foundation",
- "core-foundation",
- "core-graphics",
- "foreign-types",
- "libc",
- "objc",
-]
-
-[[package]]
-name = "cocoa-foundation"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7"
-dependencies = [
- "bitflags",
- "block",
- "core-foundation",
- "core-graphics-types",
- "libc",
- "objc",
-]
-
[[package]]
name = "combine"
version = "4.6.6"
@@ -72,73 +30,6 @@ dependencies = [
"memchr",
]
-[[package]]
-name = "core-foundation"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
-
-[[package]]
-name = "core-graphics"
-version = "0.23.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212"
-dependencies = [
- "bitflags",
- "core-foundation",
- "core-graphics-types",
- "foreign-types",
- "libc",
-]
-
-[[package]]
-name = "core-graphics-types"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
-dependencies = [
- "bitflags",
- "core-foundation",
- "libc",
-]
-
-[[package]]
-name = "foreign-types"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
-dependencies = [
- "foreign-types-macros",
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-macros"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
-
[[package]]
name = "jni"
version = "0.21.1"
@@ -173,15 +64,6 @@ version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
-[[package]]
-name = "malloc_buf"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "memchr"
version = "2.6.4"
@@ -199,22 +81,41 @@ name = "nick-name"
version = "0.1.0"
dependencies = [
"cfg-if",
- "cocoa",
"jni",
"libc",
"ndk-context",
- "objc",
+ "objc2",
"thiserror",
"winapi",
]
[[package]]
-name = "objc"
-version = "0.2.7"
+name = "objc-sys"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845"
+
+[[package]]
+name = "objc2"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d"
+dependencies = [
+ "objc-sys",
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2-encode"
+version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666"
+
+[[package]]
+name = "pc"
+version = "0.1.0"
dependencies = [
- "malloc_buf",
+ "nick-name",
]
[[package]]
@@ -322,13 +223,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-[[package]]
-name = "windows"
-version = "0.1.0"
-dependencies = [
- "nick-name",
-]
-
[[package]]
name = "windows-sys"
version = "0.45.0"
diff --git a/examples/pc/Cargo.toml b/examples/common/Cargo.toml
similarity index 92%
rename from examples/pc/Cargo.toml
rename to examples/common/Cargo.toml
index c0e45d6..b617855 100644
--- a/examples/pc/Cargo.toml
+++ b/examples/common/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "windows"
+name = "pc"
version = "0.1.0"
edition = "2021"
diff --git a/examples/common/README.md b/examples/common/README.md
new file mode 100644
index 0000000..b135b45
--- /dev/null
+++ b/examples/common/README.md
@@ -0,0 +1,25 @@
+# run
+## windows
+```bash
+cargo run
+```
+## macos
+```bash
+cargo run
+```
+## linux
+```bash
+cargo run
+```
+## android
+```bash
+cargo dinghy -p auto-android-aarch64 run
+```
+This is failed
+## iphone
+```bash
+cargo dinghy --platform auto-ios-aarch64 run
+```
+
+if failed:
+ change target auto-android-i686, auto-android-x86_64
diff --git a/examples/common/src/main.rs b/examples/common/src/main.rs
new file mode 100644
index 0000000..ece2c69
--- /dev/null
+++ b/examples/common/src/main.rs
@@ -0,0 +1,15 @@
+fn main() {
+ let nickname = nick_name::NickName::new().unwrap();
+ let device_name = nickname.get().unwrap();
+ println!("{device_name}");
+
+ #[cfg(not(any(target_os = "ios", target_os = "android")))]
+ {
+ let set = nickname.set("oligami-pc");
+ println!("{:?}", set);
+ ();
+
+ let device_name = nickname.get().unwrap();
+ println!("{device_name}");
+ }
+}
diff --git a/examples/iphone/Cargo.lock b/examples/iphone/Cargo.lock
new file mode 100644
index 0000000..b7d2f0d
--- /dev/null
+++ b/examples/iphone/Cargo.lock
@@ -0,0 +1,535 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "bitmask-enum"
+version = "2.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9990737a6d5740ff51cdbbc0f0503015cb30c390f6623968281eb214a520cfc0"
+dependencies = [
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "block"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
+
+[[package]]
+name = "bytes"
+version = "1.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
+
+[[package]]
+name = "cacao"
+version = "0.4.0-beta2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6de2bcb2324367ffb6ea53f977fab8234fa59e9a57e88f0f7be1ad7cb425c7b9"
+dependencies = [
+ "bitmask-enum",
+ "block",
+ "core-foundation",
+ "core-graphics",
+ "dispatch",
+ "lazy_static",
+ "libc",
+ "objc",
+ "objc_id",
+ "os_info",
+ "url",
+]
+
+[[package]]
+name = "cesu8"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "combine"
+version = "4.6.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
+dependencies = [
+ "bytes",
+ "memchr",
+]
+
+[[package]]
+name = "core-foundation"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
+
+[[package]]
+name = "core-graphics"
+version = "0.23.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212"
+dependencies = [
+ "bitflags",
+ "core-foundation",
+ "core-graphics-types",
+ "foreign-types",
+ "libc",
+]
+
+[[package]]
+name = "core-graphics-types"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
+dependencies = [
+ "bitflags",
+ "core-foundation",
+ "libc",
+]
+
+[[package]]
+name = "dispatch"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
+
+[[package]]
+name = "foreign-types"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965"
+dependencies = [
+ "foreign-types-macros",
+ "foreign-types-shared",
+]
+
+[[package]]
+name = "foreign-types-macros"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "foreign-types-shared"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
+
+[[package]]
+name = "form_urlencoded"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
+dependencies = [
+ "percent-encoding",
+]
+
+[[package]]
+name = "idna"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
+dependencies = [
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "jni"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97"
+dependencies = [
+ "cesu8",
+ "cfg-if",
+ "combine",
+ "jni-sys",
+ "log",
+ "thiserror",
+ "walkdir",
+ "windows-sys",
+]
+
+[[package]]
+name = "jni-sys"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.150"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
+
+[[package]]
+name = "log"
+version = "0.4.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+
+[[package]]
+name = "malloc_buf"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "memchr"
+version = "2.6.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
+
+[[package]]
+name = "ndk-context"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b"
+
+[[package]]
+name = "nick-name"
+version = "0.1.0"
+dependencies = [
+ "cfg-if",
+ "jni",
+ "libc",
+ "ndk-context",
+ "objc2",
+ "thiserror",
+ "winapi",
+]
+
+[[package]]
+name = "nickname-ios-test-app"
+version = "0.1.0"
+dependencies = [
+ "cacao",
+ "nick-name",
+]
+
+[[package]]
+name = "objc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+dependencies = [
+ "malloc_buf",
+]
+
+[[package]]
+name = "objc-sys"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845"
+
+[[package]]
+name = "objc2"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d"
+dependencies = [
+ "objc-sys",
+ "objc2-encode",
+]
+
+[[package]]
+name = "objc2-encode"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666"
+
+[[package]]
+name = "objc_id"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
+dependencies = [
+ "objc",
+]
+
+[[package]]
+name = "os_info"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e"
+dependencies = [
+ "log",
+ "serde",
+ "winapi",
+]
+
+[[package]]
+name = "percent-encoding"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.33"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "same-file"
+version = "1.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
+dependencies = [
+ "winapi-util",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.192"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.192"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "syn"
+version = "2.0.39"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "thiserror"
+version = "1.0.50"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "1.0.50"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
+
+[[package]]
+name = "unicode-bidi"
+version = "0.3.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
+
+[[package]]
+name = "unicode-normalization"
+version = "0.1.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "url"
+version = "2.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "percent-encoding",
+]
+
+[[package]]
+name = "walkdir"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
+[[package]]
+name = "windows-sys"
+version = "0.45.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+dependencies = [
+ "windows-targets",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
diff --git a/examples/iphone/Cargo.toml b/examples/iphone/Cargo.toml
new file mode 100644
index 0000000..514378e
--- /dev/null
+++ b/examples/iphone/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "nickname-ios-test-app"
+version = "0.1.0"
+edition = "2021"
+description = "A simple iPhone app"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+cacao = { version = "0.4.0-beta2", features = [
+ "uikit",
+ "autolayout",
+], default-features = false }
+
+# this library
+nick-name = { path = "../../" }
+
+[package.metadata.bundle]
+identifier = "com.oligami.nickname-ios-test"
diff --git a/examples/iphone/README.md b/examples/iphone/README.md
new file mode 100644
index 0000000..9d13a38
--- /dev/null
+++ b/examples/iphone/README.md
@@ -0,0 +1,6 @@
+cargo install cargo-bundle
+cargo bundle --target x86_64-apple-ios
+xcrun simctl install booted target/x86_64-apple-ios/debug/examples/bundle/ios/ios-beta.app
+xcrun simctl launch --console booted com.cacao.ios-test
+
+https://github.com/ryanmcgrath/cacao/tree/trunk/examples/ios-beta
diff --git a/examples/iphone/src/main.rs b/examples/iphone/src/main.rs
new file mode 100644
index 0000000..b988398
--- /dev/null
+++ b/examples/iphone/src/main.rs
@@ -0,0 +1,87 @@
+use std::sync::RwLock;
+
+use cacao::uikit::{
+ App, AppDelegate, Scene, SceneConfig, SceneConnectionOptions, SceneSession, Window,
+ WindowSceneDelegate,
+};
+
+use cacao::layout::LayoutConstraint;
+use cacao::view::{View, ViewController, ViewDelegate};
+
+#[derive(Default)]
+struct TestApp;
+
+impl AppDelegate for TestApp {
+ fn config_for_scene_session(
+ &self,
+ session: SceneSession,
+ _options: SceneConnectionOptions,
+ ) -> SceneConfig {
+ SceneConfig::new("Default Configuration", session.role())
+ }
+}
+
+pub struct RootView {
+ pub green: View,
+ pub blue: View,
+}
+
+impl Default for RootView {
+ fn default() -> Self {
+ RootView {
+ green: View::new(),
+ blue: View::new(),
+ }
+ }
+}
+
+impl ViewDelegate for RootView {
+ const NAME: &'static str = "RootView";
+
+ fn did_load(&mut self, _view: View) {
+ LayoutConstraint::activate(&[]);
+ std::thread::spawn(|| {
+ launch_handle();
+ });
+ }
+}
+
+#[derive(Default)]
+pub struct WindowScene {
+ pub window: RwLock