diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b4b1c88639..5d3bc2b967 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -103,7 +103,7 @@ jobs: # ref https://betterprogramming.pub/test-flutter-apps-on-android-with-github-actions-abdba2137b4 flutter_android_test: name: Flutter (Android) integration test - runs-on: macOS-latest # "betterprogramming.pub" says must be macOS + runs-on: macos-latest strategy: matrix: @@ -130,7 +130,7 @@ jobs: java-version: '8.x' # "betterprogramming.pub" says must be java "8" - name: Install cargo ndk - run: cargo install cargo-ndk && rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android i686-linux-android + run: cargo install cargo-ndk && rustup target add x86_64-linux-android - name: Install Flutter dependencies working-directory: ./frb_example/with_flutter @@ -139,7 +139,7 @@ jobs: - name: Build Rust lib working-directory: ./frb_example/with_flutter/rust # NOTE since run on simulator, need -t to be x86_64. For real devices, of course arm-like ones. - run: cargo ndk -t armeabi-v7a -t arm64-v8a -t x86 -t x86_64 -o ../android/app/src/main/jniLibs build && find ../android/app/src/main/jniLibs + run: cargo ndk -t x86_64 -o ../android/app/src/main/jniLibs build - name: Run Flutter integration tests id: run_flutter_integration_test @@ -148,6 +148,8 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 with: api-level: 29 + arch: x86_64 + profile: ${{ matrix.device }} script: | cd frb_example/with_flutter && flutter test integration_test/main.dart --verbose @@ -161,6 +163,8 @@ jobs: uses: reactivecircus/android-emulator-runner@v2 with: api-level: 29 + arch: x86_64 + profile: ${{ matrix.device }} script: | cd frb_example/with_flutter && flutter test integration_test/main.dart --verbose @@ -203,8 +207,6 @@ jobs: run: flutter test -d windows integration_test/main.dart --verbose flutter_macos_test: - # Disabled due to issues mentioned in https://github.com/fzyzcjy/flutter_rust_bridge/pull/211 - if: false name: Flutter (macOS) integration test runs-on: macos-11 @@ -233,10 +235,8 @@ jobs: run: flutter test -d macos integration_test/main.dart --verbose flutter_linux_test: - # Disabled due to issues running Linux GUI applications in CI - if: false name: Flutter (Linux) integration test - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -248,9 +248,9 @@ jobs: toolchain: stable # From Flutter Gallery CI - - uses: subosito/flutter-action@4389e6cbc6cb8a4b18c628ff96ff90be0e926aa8 + - uses: subosito/flutter-action@v1 with: - channel: master + channel: 'stable' - name: Install Flutter build tools run: sudo apt-get -y install clang cmake ninja-build pkg-config libgtk-3-dev libglu1-mesa @@ -262,6 +262,9 @@ jobs: - run: flutter pub get working-directory: ./frb_example/with_flutter + - name: Setup headless display + uses: pyvista/setup-headless-display-action@v1 + - name: Run Flutter integration tests working-directory: ./frb_example/with_flutter run: flutter test -d linux integration_test/main.dart --verbose diff --git a/book/src/integrate/desktop.md b/book/src/integrate/desktop.md index 270621fcef..6d7a91776d 100644 --- a/book/src/integrate/desktop.md +++ b/book/src/integrate/desktop.md @@ -23,7 +23,15 @@ Next, add this line to your `CMakeLists.txt` files: # Support files are copied into place next to the executable, so that it can ``` -> **Note** \ -> This method depends on `FetchContent` and co. being available, which -> means that users with CMake versions older than 3.11 will have to install Corrosion -> permanently on their system. See [additional notes here](../template/setup_others.md). +## Linux + +On Linux, you will need to bump the minimum CMake version to 3.11 to make use +of `FetchContent`, which is used by `rust.cmake`. Change this line in `linux/CMakeLists.txt`: + +```diff +-cmake_minimum_required(VERSION 3.10) ++cmake_minimum_required(VERSION 3.11) +``` + +Alternatively, you can install Corrosion permanently on your system. +Read the [supplementary notes here](../template/setup_others.md). diff --git a/frb_example/pure_dart/dart/pubspec.lock b/frb_example/pure_dart/dart/pubspec.lock index 989d2a0b74..698a11a8a5 100644 --- a/frb_example/pure_dart/dart/pubspec.lock +++ b/frb_example/pure_dart/dart/pubspec.lock @@ -5,168 +5,168 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "34.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.2.0" args: dependency: transitive description: name: args - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.3.0" async: dependency: transitive description: name: async - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" build: dependency: transitive description: name: build - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.2.1" build_config: dependency: transitive description: name: build_config - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" build_daemon: dependency: transitive description: name: build_daemon - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" build_resolvers: dependency: transitive description: name: build_resolvers - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.6" build_runner: dependency: "direct dev" description: name: build_runner - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.7" build_runner_core: dependency: transitive description: name: build_runner_core - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "7.2.3" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "8.1.4" charcode: dependency: transitive description: name: charcode - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" checked_yaml: dependency: transitive description: name: checked_yaml - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" cli_util: dependency: transitive description: name: cli_util - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.3.5" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "4.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" convert: dependency: transitive description: name: convert - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.3" crypto: dependency: transitive description: name: crypto - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.2.1" file: dependency: transitive description: name: file - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "6.1.2" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" flutter_rust_bridge: @@ -180,309 +180,309 @@ packages: dependency: "direct dev" description: name: freezed - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.1" freezed_annotation: dependency: "direct main" description: name: freezed_annotation - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.2" glob: dependency: transitive description: name: glob - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" graphs: dependency: transitive description: name: graphs - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.2.0" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "4.0.0" io: dependency: transitive description: name: io - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.3" js: dependency: transitive description: name: js - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: name: json_annotation - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "4.4.0" lints: dependency: "direct main" description: name: lints - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" logging: dependency: transitive description: name: logging - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.2" matcher: dependency: transitive description: name: matcher - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.12.11" meta: dependency: "direct main" description: name: meta - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" mime: dependency: transitive description: name: mime - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.1" package_config: dependency: transitive description: name: package_config - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.2" path: dependency: transitive description: name: path - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" pool: dependency: transitive description: name: pool - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.5.0" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" pubspec_parse: dependency: transitive description: name: pubspec_parse - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" shelf: dependency: transitive description: name: shelf - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" source_gen: dependency: transitive description: name: source_gen - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.1" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.10.10" source_span: dependency: transitive description: name: source_span - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.8.2" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.0.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test: dependency: "direct main" description: name: test - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.20.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.4.9" test_core: dependency: transitive description: name: test_core - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.4.11" timing: dependency: transitive description: name: timing - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vm_service: dependency: "direct main" description: name: vm_service - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "7.5.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.1.0" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.16.0-100.0.dev <3.0.0" diff --git a/frb_example/with_flutter/lib/main.dart b/frb_example/with_flutter/lib/main.dart index 3cd48a458e..53f9beb941 100644 --- a/frb_example/with_flutter/lib/main.dart +++ b/frb_example/with_flutter/lib/main.dart @@ -11,12 +11,12 @@ import 'package:flutter_rust_bridge_example/off_topic_code.dart'; // it is quite trivial and Flutter is just like that. Please refer to Flutter's tutorial to learn Flutter. const base = 'flutter_rust_bridge_example'; -final path = Platform.isWindows - ? '$base.dll' +final path = Platform.isWindows ? '$base.dll' : 'lib$base.so'; +late final dylib = Platform.isIOS + ? DynamicLibrary.process() : Platform.isMacOS - ? 'lib$base.dylib' - : 'lib$base.so'; -late final dylib = Platform.isIOS ? DynamicLibrary.process() : DynamicLibrary.open(path); + ? DynamicLibrary.executable() + : DynamicLibrary.open(path); late final api = FlutterRustBridgeExampleImpl(dylib); void main() => runApp(const MyApp()); diff --git a/frb_example/with_flutter/linux/CMakeLists.txt b/frb_example/with_flutter/linux/CMakeLists.txt index 3eb555ef0d..9bdc1c87d6 100644 --- a/frb_example/with_flutter/linux/CMakeLists.txt +++ b/frb_example/with_flutter/linux/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.11) project(runner LANGUAGES CXX) set(BINARY_NAME "with_flutter") diff --git a/frb_example/with_flutter/macos/Podfile.lock b/frb_example/with_flutter/macos/Podfile.lock index 9c1c634358..dedef297cc 100644 --- a/frb_example/with_flutter/macos/Podfile.lock +++ b/frb_example/with_flutter/macos/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c -COCOAPODS: 1.10.0 +COCOAPODS: 1.11.2 diff --git a/frb_example/with_flutter/macos/Runner.xcodeproj/project.pbxproj b/frb_example/with_flutter/macos/Runner.xcodeproj/project.pbxproj index cd0bfe893a..920e3e3870 100644 --- a/frb_example/with_flutter/macos/Runner.xcodeproj/project.pbxproj +++ b/frb_example/with_flutter/macos/Runner.xcodeproj/project.pbxproj @@ -21,15 +21,14 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ - 0A2CAB13274E8C1600C621DE /* libflutter_rust_bridge_example.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A2CAB12274E8C1600C621DE /* libflutter_rust_bridge_example.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; - 0A2CAB15274E8CC000C621DE /* libflutter_rust_bridge_example.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 0A2CAB14274E8CC000C621DE /* libflutter_rust_bridge_example.dylib */; }; - 0A2CAB16274E8D6B00C621DE /* libflutter_rust_bridge_example.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 0A2CAB14274E8CC000C621DE /* libflutter_rust_bridge_example.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - DEE6A5CFD3AAD0084763B6BA /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E153987575DDB683EF22EB09 /* Pods_Runner.framework */; }; + 5DCFBE4E7C2AD08712D21BEB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AC4CAD777CCE8195EEEED9F /* Pods_Runner.framework */; }; + A379BA9527BFF7AF00A4CD85 /* flutter_rust_bridge_example.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A379BA9227BFF76900A4CD85 /* flutter_rust_bridge_example.dylib */; }; + A379BA9627BFF7D000A4CD85 /* bridge_generated.h in Resources */ = {isa = PBXBuildFile; fileRef = A379BA8C27BFF75900A4CD85 /* bridge_generated.h */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -40,6 +39,20 @@ remoteGlobalIDString = 33CC111A2044C6BA0003C045; remoteInfo = FLX; }; + A379BA9127BFF76900A4CD85 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A379BA8D27BFF76900A4CD85 /* flutter_rust_bridge_example.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = CA60FBAABA3A2B3BABD1B908; + remoteInfo = "flutter_rust_bridge_example-cdylib"; + }; + A379BA9327BFF7AA00A4CD85 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A379BA8D27BFF76900A4CD85 /* flutter_rust_bridge_example.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = CA60FBAABA3AEF9A9B28F6B9; + remoteInfo = "flutter_rust_bridge_example-cdylib"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -49,7 +62,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 0A2CAB16274E8D6B00C621DE /* libflutter_rust_bridge_example.dylib in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -57,8 +69,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0A2CAB12274E8C1600C621DE /* libflutter_rust_bridge_example.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libflutter_rust_bridge_example.dylib; path = "../rust/target/x86_64-apple-darwin/debug/libflutter_rust_bridge_example.dylib"; sourceTree = ""; }; - 0A2CAB14274E8CC000C621DE /* libflutter_rust_bridge_example.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libflutter_rust_bridge_example.dylib; path = "../rust/target/x86_64-apple-darwin/debug/libflutter_rust_bridge_example.dylib"; sourceTree = ""; }; + 2AC4CAD777CCE8195EEEED9F /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 33CC10ED2044A3C60003C045 /* with_flutter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = with_flutter.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -74,11 +85,12 @@ 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 7E90FFC0EB6C29817707A004 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 8F402EE95075FB7B830CAE7E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 842E5678ECBC61DFDDEEE2D5 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - E153987575DDB683EF22EB09 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E9D68D822BBF3BBBDD9527D8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + A379BA8C27BFF75900A4CD85 /* bridge_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bridge_generated.h; sourceTree = ""; }; + A379BA8D27BFF76900A4CD85 /* flutter_rust_bridge_example.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = flutter_rust_bridge_example.xcodeproj; path = ../rust/flutter_rust_bridge_example.xcodeproj; sourceTree = ""; }; + A3B8EE939F14F5AA947E7DDE /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + B95FCA28249E171BD83D6DAF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -86,8 +98,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DEE6A5CFD3AAD0084763B6BA /* Pods_Runner.framework in Frameworks */, - 0A2CAB13274E8C1600C621DE /* libflutter_rust_bridge_example.dylib in Frameworks */, + A379BA9527BFF7AF00A4CD85 /* flutter_rust_bridge_example.dylib in Frameworks */, + 5DCFBE4E7C2AD08712D21BEB /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -108,12 +120,12 @@ 33CC10E42044A3C60003C045 = { isa = PBXGroup; children = ( - 0A2CAB14274E8CC000C621DE /* libflutter_rust_bridge_example.dylib */, + A379BA8D27BFF76900A4CD85 /* flutter_rust_bridge_example.xcodeproj */, 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - 59759B4D5E04F14EE38678EF /* Pods */, + 92317FA51B2B5647B13D518F /* Pods */, ); sourceTree = ""; }; @@ -150,6 +162,7 @@ 33FAB671232836740065AC1E /* Runner */ = { isa = PBXGroup; children = ( + A379BA8C27BFF75900A4CD85 /* bridge_generated.h */, 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 33E51913231747F40026EE4D /* DebugProfile.entitlements */, @@ -160,21 +173,29 @@ path = Runner; sourceTree = ""; }; - 59759B4D5E04F14EE38678EF /* Pods */ = { + 92317FA51B2B5647B13D518F /* Pods */ = { isa = PBXGroup; children = ( - 7E90FFC0EB6C29817707A004 /* Pods-Runner.debug.xcconfig */, - E9D68D822BBF3BBBDD9527D8 /* Pods-Runner.release.xcconfig */, - 8F402EE95075FB7B830CAE7E /* Pods-Runner.profile.xcconfig */, + A3B8EE939F14F5AA947E7DDE /* Pods-Runner.debug.xcconfig */, + B95FCA28249E171BD83D6DAF /* Pods-Runner.release.xcconfig */, + 842E5678ECBC61DFDDEEE2D5 /* Pods-Runner.profile.xcconfig */, ); + name = Pods; path = Pods; sourceTree = ""; }; + A379BA8E27BFF76900A4CD85 /* Products */ = { + isa = PBXGroup; + children = ( + A379BA9227BFF76900A4CD85 /* flutter_rust_bridge_example.dylib */, + ); + name = Products; + sourceTree = ""; + }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - 0A2CAB12274E8C1600C621DE /* libflutter_rust_bridge_example.dylib */, - E153987575DDB683EF22EB09 /* Pods_Runner.framework */, + 2AC4CAD777CCE8195EEEED9F /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -186,7 +207,7 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - C65ECB52C0C1589A48725B06 /* [CP] Check Pods Manifest.lock */, + 57BB210364992634307E818F /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, @@ -196,6 +217,7 @@ buildRules = ( ); dependencies = ( + A379BA9427BFF7AA00A4CD85 /* PBXTargetDependency */, 33CC11202044C79F0003C045 /* PBXTargetDependency */, ); name = Runner; @@ -210,7 +232,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -240,6 +262,12 @@ mainGroup = 33CC10E42044A3C60003C045; productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = A379BA8E27BFF76900A4CD85 /* Products */; + ProjectRef = A379BA8D27BFF76900A4CD85 /* flutter_rust_bridge_example.xcodeproj */; + }, + ); projectRoot = ""; targets = ( 33CC10EC2044A3C60003C045 /* Runner */, @@ -248,14 +276,24 @@ }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + A379BA9227BFF76900A4CD85 /* flutter_rust_bridge_example.dylib */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.dylib"; + path = flutter_rust_bridge_example.dylib; + remoteRef = A379BA9127BFF76900A4CD85 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXResourcesBuildPhase section */ 33CC10EB2044A3C60003C045 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A379BA9627BFF7D000A4CD85 /* bridge_generated.h in Resources */, 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, - 0A2CAB15274E8CC000C621DE /* libflutter_rust_bridge_example.dylib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -299,7 +337,7 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - C65ECB52C0C1589A48725B06 /* [CP] Check Pods Manifest.lock */ = { + 57BB210364992634307E818F /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -342,6 +380,11 @@ target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; }; + A379BA9427BFF7AA00A4CD85 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "flutter_rust_bridge_example-cdylib"; + targetProxy = A379BA9327BFF7AA00A4CD85 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -417,8 +460,8 @@ "$(inherited)", "@executable_path/../Frameworks", ); - LIBRARY_SEARCH_PATHS = "/Users/kevin/development/dart/flutter_rust_bridge/frb_example/with_flutter/rust/target/x86_64-apple-darwin/debug"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = Runner/bridge_generated.h; SWIFT_VERSION = 5.0; }; name = Profile; @@ -544,8 +587,8 @@ "$(inherited)", "@executable_path/../Frameworks", ); - LIBRARY_SEARCH_PATHS = "/Users/kevin/development/dart/flutter_rust_bridge/frb_example/with_flutter/rust/target/x86_64-apple-darwin/debug"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = Runner/bridge_generated.h; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; }; @@ -565,8 +608,8 @@ "$(inherited)", "@executable_path/../Frameworks", ); - LIBRARY_SEARCH_PATHS = "/Users/kevin/development/dart/flutter_rust_bridge/frb_example/with_flutter/rust/target/x86_64-apple-darwin/debug"; PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = Runner/bridge_generated.h; SWIFT_VERSION = 5.0; }; name = Release; diff --git a/frb_example/with_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/frb_example/with_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 5f1323ffc2..da1d416401 100644 --- a/frb_example/with_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/frb_example/with_flutter/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - + + - - Bool { + dummy_method_to_enforce_bundling() return true } } diff --git a/frb_example/with_flutter/macos/Runner/Base.lproj/MainMenu.xib b/frb_example/with_flutter/macos/Runner/Base.lproj/MainMenu.xib index 537341abf9..80e867a4e0 100644 --- a/frb_example/with_flutter/macos/Runner/Base.lproj/MainMenu.xib +++ b/frb_example/with_flutter/macos/Runner/Base.lproj/MainMenu.xib @@ -323,6 +323,10 @@ + + + + diff --git a/frb_example/with_flutter/macos/Runner/Configs/AppInfo.xcconfig b/frb_example/with_flutter/macos/Runner/Configs/AppInfo.xcconfig index a8acfb4a68..c93da6d4ae 100644 --- a/frb_example/with_flutter/macos/Runner/Configs/AppInfo.xcconfig +++ b/frb_example/with_flutter/macos/Runner/Configs/AppInfo.xcconfig @@ -11,4 +11,4 @@ PRODUCT_NAME = with_flutter PRODUCT_BUNDLE_IDENTIFIER = com.example.withFlutter // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. diff --git a/frb_example/with_flutter/macos/Runner/DebugProfile.entitlements b/frb_example/with_flutter/macos/Runner/DebugProfile.entitlements index dddb8a30c8..e585d0e0f8 100644 --- a/frb_example/with_flutter/macos/Runner/DebugProfile.entitlements +++ b/frb_example/with_flutter/macos/Runner/DebugProfile.entitlements @@ -8,5 +8,7 @@ com.apple.security.network.server + com.apple.security.network.client + diff --git a/frb_example/with_flutter/macos/Runner/Release.entitlements b/frb_example/with_flutter/macos/Runner/Release.entitlements index 852fa1a472..779a1789c4 100644 --- a/frb_example/with_flutter/macos/Runner/Release.entitlements +++ b/frb_example/with_flutter/macos/Runner/Release.entitlements @@ -4,5 +4,7 @@ com.apple.security.app-sandbox + com.apple.security.network.client + diff --git a/frb_example/with_flutter/macos/Runner/bridge_generated.h b/frb_example/with_flutter/macos/Runner/bridge_generated.h new file mode 100644 index 0000000000..28d3e3ae0e --- /dev/null +++ b/frb_example/with_flutter/macos/Runner/bridge_generated.h @@ -0,0 +1,109 @@ +#include +#include +#include + +typedef struct wire_Size { + int32_t width; + int32_t height; +} wire_Size; + +typedef struct wire_Point { + double x; + double y; +} wire_Point; + +typedef struct wire_uint_8_list { + uint8_t *ptr; + int32_t len; +} wire_uint_8_list; + +typedef struct wire_list_tree_node { + struct wire_TreeNode *ptr; + int32_t len; +} wire_list_tree_node; + +typedef struct wire_TreeNode { + struct wire_uint_8_list *name; + struct wire_list_tree_node *children; +} wire_TreeNode; + +typedef struct wire_list_size { + struct wire_Size *ptr; + int32_t len; +} wire_list_size; + +typedef struct WireSyncReturnStruct { + uint8_t *ptr; + int32_t len; + bool success; +} WireSyncReturnStruct; + +typedef int64_t DartPort; + +typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message); + +void wire_draw_mandelbrot(int64_t port_, + struct wire_Size *image_size, + struct wire_Point *zoom_point, + double scale, + int32_t num_threads); + +void wire_passing_complex_structs(int64_t port_, struct wire_TreeNode *root); + +void wire_off_topic_memory_test_input_array(int64_t port_, struct wire_uint_8_list *input); + +void wire_off_topic_memory_test_output_zero_copy_buffer(int64_t port_, int32_t len); + +void wire_off_topic_memory_test_output_vec_u8(int64_t port_, int32_t len); + +void wire_off_topic_memory_test_input_vec_of_object(int64_t port_, struct wire_list_size *input); + +void wire_off_topic_memory_test_output_vec_of_object(int64_t port_, int32_t len); + +void wire_off_topic_memory_test_input_complex_struct(int64_t port_, struct wire_TreeNode *input); + +void wire_off_topic_memory_test_output_complex_struct(int64_t port_, int32_t len); + +void wire_off_topic_deliberately_return_error(int64_t port_); + +void wire_off_topic_deliberately_panic(int64_t port_); + +struct wire_Point *new_box_autoadd_point(void); + +struct wire_Size *new_box_autoadd_size(void); + +struct wire_TreeNode *new_box_autoadd_tree_node(void); + +struct wire_list_size *new_list_size(int32_t len); + +struct wire_list_tree_node *new_list_tree_node(int32_t len); + +struct wire_uint_8_list *new_uint_8_list(int32_t len); + +void free_WireSyncReturnStruct(struct WireSyncReturnStruct val); + +void store_dart_post_cobject(DartPostCObjectFnType ptr); + +static int64_t dummy_method_to_enforce_bundling(void) { + int64_t dummy_var = 0; + dummy_var ^= ((int64_t) (void*) wire_draw_mandelbrot); + dummy_var ^= ((int64_t) (void*) wire_passing_complex_structs); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_input_array); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_output_zero_copy_buffer); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_output_vec_u8); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_input_vec_of_object); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_output_vec_of_object); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_input_complex_struct); + dummy_var ^= ((int64_t) (void*) wire_off_topic_memory_test_output_complex_struct); + dummy_var ^= ((int64_t) (void*) wire_off_topic_deliberately_return_error); + dummy_var ^= ((int64_t) (void*) wire_off_topic_deliberately_panic); + dummy_var ^= ((int64_t) (void*) new_box_autoadd_point); + dummy_var ^= ((int64_t) (void*) new_box_autoadd_size); + dummy_var ^= ((int64_t) (void*) new_box_autoadd_tree_node); + dummy_var ^= ((int64_t) (void*) new_list_size); + dummy_var ^= ((int64_t) (void*) new_list_tree_node); + dummy_var ^= ((int64_t) (void*) new_uint_8_list); + dummy_var ^= ((int64_t) (void*) free_WireSyncReturnStruct); + dummy_var ^= ((int64_t) (void*) store_dart_post_cobject); + return dummy_var; +} \ No newline at end of file diff --git a/frb_example/with_flutter/pubspec.lock b/frb_example/with_flutter/pubspec.lock index 2c48ccff8a..3419926412 100644 --- a/frb_example/with_flutter/pubspec.lock +++ b/frb_example/with_flutter/pubspec.lock @@ -5,77 +5,77 @@ packages: dependency: transitive description: name: archive - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.1.6" async: dependency: transitive description: name: async - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.8.2" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" characters: dependency: transitive description: name: characters - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" charcode: dependency: transitive description: name: charcode - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.3.1" clock: dependency: transitive description: name: clock - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" collection: dependency: transitive description: name: collection - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.15.0" crypto: dependency: transitive description: name: crypto - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.0.1" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.4" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" file: dependency: transitive description: name: file - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "6.1.2" flutter: @@ -92,7 +92,7 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.4" flutter_rust_bridge: @@ -121,42 +121,49 @@ packages: dependency: transitive description: name: lints - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: name: meta - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.7.0" path: dependency: transitive description: name: path - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.8.0" platform: dependency: transitive description: name: platform - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" + version: "3.1.0" process: dependency: transitive description: name: process - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "4.2.4" sky_engine: @@ -168,77 +175,77 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.1.0" sync_http: dependency: transitive description: name: sync_http - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "0.3.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.2.0" test_api: dependency: transitive description: name: test_api - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.8" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "2.1.1" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "7.3.0" + version: "7.5.0" webdriver: dependency: transitive description: name: webdriver - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted version: "3.0.0" sdks: diff --git a/frb_example/with_flutter/rust/flutter_rust_bridge_example.xcodeproj/project.pbxproj b/frb_example/with_flutter/rust/flutter_rust_bridge_example.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..992dcab9de --- /dev/null +++ b/frb_example/with_flutter/rust/flutter_rust_bridge_example.xcodeproj/project.pbxproj @@ -0,0 +1,263 @@ +// !$*UTF8*$! +{ + /* generated with cargo-xcode 1.4.1 */ + archiveVersion = 1; + classes = { + }; + objectVersion = 53; + objects = { +/* Begin PBXBuildFile section */ + + CA60BFE73439EF9A9B28F6B9 /* Cargo.toml in Sources */ = { + isa = PBXBuildFile; + fileRef = CA60F3380D5C3EF4668187A5 /* Cargo.toml */; + settings = { + COMPILER_FLAGS = "--lib"; /* == OTHER_INPUT_FILE_FLAGS */ + }; + }; + +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + CA60F3380D5CAC6C1400ACA8 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.proxy.script; + dependencyFile = "$(DERIVED_FILE_DIR)/$(CARGO_XCODE_TARGET_ARCH)-$(EXECUTABLE_NAME).d"; + filePatterns = "*/Cargo.toml"; /* must contain asterisk */ + fileType = pattern.proxy; + inputFiles = (); + isEditable = 0; + name = "Cargo project build"; + outputFiles = ( + "$(OBJECT_FILE_DIR)/$(CARGO_XCODE_TARGET_ARCH)-$(EXECUTABLE_NAME)", + ); + script = "# generated with cargo-xcode 1.4.1\n\nset -eu; export PATH=$PATH:~/.cargo/bin:/usr/local/bin;\nif [ \"${IS_MACCATALYST-NO}\" = YES ]; then\n CARGO_XCODE_TARGET_TRIPLE=\"${CARGO_XCODE_TARGET_ARCH}-apple-ios-macabi\"\nelse\n CARGO_XCODE_TARGET_TRIPLE=\"${CARGO_XCODE_TARGET_ARCH}-apple-${CARGO_XCODE_TARGET_OS}\"\nfi\nif [ \"$CARGO_XCODE_TARGET_OS\" != \"darwin\" ]; then\n PATH=\"${PATH/\\/Contents\\/Developer\\/Toolchains\\/XcodeDefault.xctoolchain\\/usr\\/bin:/xcode-provided-ld-cant-link-lSystem-for-the-host-build-script:}\"\nfi\nPATH=\"$PATH:/opt/homebrew/bin\" # Rust projects often depend on extra tools like nasm, which Xcode lacks\nif [ \"$CARGO_XCODE_BUILD_MODE\" == release ]; then\n OTHER_INPUT_FILE_FLAGS=\"${OTHER_INPUT_FILE_FLAGS} --release\"\nfi\nif command -v rustup &> /dev/null; then\n if ! rustup target list --installed | egrep -q \"${CARGO_XCODE_TARGET_TRIPLE}\"; then\n echo \"warning: this build requires rustup toolchain for $CARGO_XCODE_TARGET_TRIPLE, but it isn\'t installed\"\n rustup target add \"${CARGO_XCODE_TARGET_TRIPLE}\" || echo >&2 \"warning: can\'t install $CARGO_XCODE_TARGET_TRIPLE\"\n fi\nfi\nif [ \"$ACTION\" = clean ]; then\n ( set -x; cargo clean --manifest-path=\"$SCRIPT_INPUT_FILE\" ${OTHER_INPUT_FILE_FLAGS} --target=\"${CARGO_XCODE_TARGET_TRIPLE}\"; );\nelse\n ( set -x; cargo build --manifest-path=\"$SCRIPT_INPUT_FILE\" --features=\"${CARGO_XCODE_FEATURES:-}\" ${OTHER_INPUT_FILE_FLAGS} --target=\"${CARGO_XCODE_TARGET_TRIPLE}\"; );\nfi\n# it\'s too hard to explain Cargo\'s actual exe path to Xcode build graph, so hardlink to a known-good path instead\nBUILT_SRC=\"${CARGO_TARGET_DIR}/${CARGO_XCODE_TARGET_TRIPLE}/${CARGO_XCODE_BUILD_MODE}/${CARGO_XCODE_CARGO_FILE_NAME}\"\nln -f -- \"$BUILT_SRC\" \"$SCRIPT_OUTPUT_FILE_0\"\n\n# xcode generates dep file, but for its own path, so append our rename to it\nDEP_FILE_SRC=\"${CARGO_TARGET_DIR}/${CARGO_XCODE_TARGET_TRIPLE}/${CARGO_XCODE_BUILD_MODE}/${CARGO_XCODE_CARGO_DEP_FILE_NAME}\"\nif [ -f \"$DEP_FILE_SRC\" ]; then\n DEP_FILE_DST=\"${DERIVED_FILE_DIR}/${CARGO_XCODE_TARGET_ARCH}-${EXECUTABLE_NAME}.d\"\n cp -f \"$DEP_FILE_SRC\" \"$DEP_FILE_DST\"\n echo >> \"$DEP_FILE_DST\" \"$SCRIPT_OUTPUT_FILE_0: $BUILT_SRC\"\nfi\n\n# lipo script needs to know all the platform-specific files that have been built\n# archs is in the file name, so that paths don\'t stay around after archs change\n# must match input for LipoScript\nFILE_LIST=\"${DERIVED_FILE_DIR}/${ARCHS}-${EXECUTABLE_NAME}.xcfilelist\"\ntouch \"$FILE_LIST\"\nif ! egrep -q \"$SCRIPT_OUTPUT_FILE_0\" \"$FILE_LIST\" ; then\n echo >> \"$FILE_LIST\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\n"; + }; +/* End PBXBuildRule section */ + +/* Begin PBXFileReference section */ + + CA60FBAABA3A2B3BABD1B908 /* cdylib */ = { + isa = PBXFileReference; + explicitFileType = "compiled.mach-o.dylib"; + includeInIndex = 0; + name = "flutter_rust_bridge_example.dylib"; + sourceTree = TARGET_BUILD_DIR; + }; + CA60F3380D5C3EF4668187A5 /* Cargo.toml */ = { + isa = PBXFileReference; + lastKnownFileType = text; + fileEncoding = 4; + name = "Cargo.toml"; + path = "Cargo.toml"; + sourceTree = ""; + }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + CA60F3380D5C98AF0B5890DB /* Frameworks */ = { + isa = PBXGroup; + children = ( + + ); + name = Frameworks; + sourceTree = ""; + }; + + + + CA60F3380D5C22869D176AE5 /* Products */ = { + isa = PBXGroup; + children = ( + CA60FBAABA3A2B3BABD1B908, + + ); + name = Products; + sourceTree = ""; + }; + + CA60F3380D5CD65BC3C892A8 /* Main */ = { + isa = PBXGroup; + children = ( + CA60F3380D5C3EF4668187A5, +CA60F3380D5C22869D176AE5, +CA60F3380D5C98AF0B5890DB, + + ); + sourceTree = ""; + }; + +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CA60FBAABA3AEF9A9B28F6B9 /* flutter_rust_bridge_example-cdylib */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA60545B73F2EF9A9B28F6B9; + buildPhases = ( + CA607FAE2928EF9A9B28F6B9 /* Sources */, + CA60F3380D5CAF6EBB7F357C /* Universal Binary lipo */, + ); + buildRules = ( + CA60F3380D5CAC6C1400ACA8 /* PBXBuildRule */, + ); + dependencies = ( + ); + name = "flutter_rust_bridge_example-cdylib"; + productName = "flutter_rust_bridge_example.dylib"; + productReference = CA60FBAABA3A2B3BABD1B908; + productType = "com.apple.product-type.library.dynamic"; + }; + +/* End PBXNativeTarget section */ + + CA607FAE2928EF9A9B28F6B9 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA60BFE73439EF9A9B28F6B9 + ); + runOnlyForDeploymentPostprocessing = 0; + }; + + CA60545B73F2EF9A9B28F6B9 /* cdylib */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA605E8450E7EF9A9B28F6B9 /* Release */, + CA60E906EDCDEF9A9B28F6B9 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CA605E8450E7EF9A9B28F6B9 /* cdylib */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "flutter_rust_bridge_example"; + "CARGO_XCODE_CARGO_FILE_NAME" = "libflutter_rust_bridge_example.dylib"; + "CARGO_XCODE_CARGO_DEP_FILE_NAME" = "libflutter_rust_bridge_example.d"; + SUPPORTED_PLATFORMS = "macosx"; + + }; + name = Release; + }; + CA60E906EDCDEF9A9B28F6B9 /* cdylib */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "flutter_rust_bridge_example"; + "CARGO_XCODE_CARGO_FILE_NAME" = "libflutter_rust_bridge_example.dylib"; + "CARGO_XCODE_CARGO_DEP_FILE_NAME" = "libflutter_rust_bridge_example.d"; + SUPPORTED_PLATFORMS = "macosx"; + + }; + name = Debug; + }; + + CA60F3380D5CAF6EBB7F357C /* LipoScript */ = { + name = "Universal Binary lipo"; + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = (); + inputFileListPaths = (); + inputPaths = ( + "$(DERIVED_FILE_DIR)/$(ARCHS)-$(EXECUTABLE_NAME).xcfilelist", + ); + outputFileListPaths = (); + outputPaths = ( + "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)" + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# generated with cargo-xcode 1.4.1\nset -eux; cat \"$DERIVED_FILE_DIR/$ARCHS-$EXECUTABLE_NAME.xcfilelist\" | tr '\\n' '\\0' | xargs -0 lipo -create -output \"$TARGET_BUILD_DIR/$EXECUTABLE_PATH\""; + }; + + CA60F3380D5C80E02D6C7F57 = { + isa = XCConfigurationList; + buildConfigurations = ( + CA60F3DD5F173CC16B37690B /* Release */, + CA60F3DD5F17228BE02872F8 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + + CA60F3DD5F173CC16B37690B = { + isa = XCBuildConfiguration; + buildSettings = { + + ALWAYS_SEARCH_USER_PATHS = NO; + SUPPORTS_MACCATALYST = YES; + CARGO_TARGET_DIR = "$(PROJECT_TEMP_DIR)/cargo_target"; /* for cargo */ + CARGO_XCODE_FEATURES = ""; /* configure yourself */ + "CARGO_XCODE_TARGET_ARCH[arch=arm64*]" = "aarch64"; + "CARGO_XCODE_TARGET_ARCH[arch=x86_64*]" = "x86_64"; /* catalyst adds h suffix */ + "CARGO_XCODE_TARGET_ARCH[arch=i386]" = "i686"; + "CARGO_XCODE_TARGET_OS[sdk=macosx*]" = "darwin"; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*]" = "ios-sim"; + "CARGO_XCODE_TARGET_OS[sdk=iphoneos*]" = "ios"; + "CARGO_XCODE_TARGET_OS[sdk=appletvsimulator*]" = "tvos"; + "CARGO_XCODE_TARGET_OS[sdk=appletvos*]" = "tvos"; + PRODUCT_NAME = "flutter_rust_bridge_example"; + SDKROOT = macosx; + + "CARGO_XCODE_BUILD_MODE" = "release"; /* for xcode scripts */ + }; + name = Release; + }; + + CA60F3DD5F17228BE02872F8 = { + isa = XCBuildConfiguration; + buildSettings = { + + ALWAYS_SEARCH_USER_PATHS = NO; + SUPPORTS_MACCATALYST = YES; + CARGO_TARGET_DIR = "$(PROJECT_TEMP_DIR)/cargo_target"; /* for cargo */ + CARGO_XCODE_FEATURES = ""; /* configure yourself */ + "CARGO_XCODE_TARGET_ARCH[arch=arm64*]" = "aarch64"; + "CARGO_XCODE_TARGET_ARCH[arch=x86_64*]" = "x86_64"; /* catalyst adds h suffix */ + "CARGO_XCODE_TARGET_ARCH[arch=i386]" = "i686"; + "CARGO_XCODE_TARGET_OS[sdk=macosx*]" = "darwin"; + "CARGO_XCODE_TARGET_OS[sdk=iphonesimulator*]" = "ios-sim"; + "CARGO_XCODE_TARGET_OS[sdk=iphoneos*]" = "ios"; + "CARGO_XCODE_TARGET_OS[sdk=appletvsimulator*]" = "tvos"; + "CARGO_XCODE_TARGET_OS[sdk=appletvos*]" = "tvos"; + PRODUCT_NAME = "flutter_rust_bridge_example"; + SDKROOT = macosx; + + "CARGO_XCODE_BUILD_MODE" = "debug"; /* for xcode scripts */ + ONLY_ACTIVE_ARCH = YES; + }; + name = Debug; + }; + + CA60F3380D5CE04653AD465F = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1300; + TargetAttributes = { + CA60FBAABA3AEF9A9B28F6B9 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = CA60F3380D5C80E02D6C7F57; + compatibilityVersion = "Xcode 11.4"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CA60F3380D5CD65BC3C892A8; + productRefGroup = CA60F3380D5C22869D176AE5 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CA60FBAABA3AEF9A9B28F6B9, + + ); + }; + + }; + rootObject = CA60F3380D5CE04653AD465F; +} + \ No newline at end of file diff --git a/frb_example/with_flutter/rust/flutter_rust_bridge_example.xcodeproj/xcuserdata/vdinh.xcuserdatad/xcschemes/xcschememanagement.plist b/frb_example/with_flutter/rust/flutter_rust_bridge_example.xcodeproj/xcuserdata/vdinh.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000..6f4a9a1011 --- /dev/null +++ b/frb_example/with_flutter/rust/flutter_rust_bridge_example.xcodeproj/xcuserdata/vdinh.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + flutter_rust_bridge_example-cdylib.xcscheme_^#shared#^_ + + orderHint + 1 + + + + diff --git a/justfile b/justfile index 40e60638b7..e12197673d 100644 --- a/justfile +++ b/justfile @@ -24,6 +24,8 @@ gen-bridge-rust-only: build -d {{frb_flutter}}/lib/bridge_generated.dart \ -c {{frb_flutter}}/ios/Runner/bridge_generated.h \ --dart-format-line-length {{line_length}} + cp {{frb_flutter}}/ios/Runner/bridge_generated.h \ + {{frb_flutter}}/macos/Runner/bridge_generated.h alias g := gen-bridge gen-bridge: gen-bridge-rust-only