diff --git a/veilid-flutter/example/ios/Podfile.lock b/veilid-flutter/example/ios/Podfile.lock new file mode 100644 index 00000000..354e416b --- /dev/null +++ b/veilid-flutter/example/ios/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - Flutter (1.0.0) + - veilid (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `Flutter`) + - veilid (from `.symlinks/plugins/veilid/ios`) + +EXTERNAL SOURCES: + Flutter: + :path: Flutter + veilid: + :path: ".symlinks/plugins/veilid/ios" + +SPEC CHECKSUMS: + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + veilid: c3ddd66ae3c95c8ad925c02e403d38c8809f762c + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.11.2 diff --git a/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj b/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj index 99666ff6..d41010e1 100644 --- a/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/veilid-flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ @@ -13,6 +13,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + FEE7B6B3B613F78995A4690A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B1EAB6BDBA67DBB8DED93560 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -29,9 +30,12 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0DEA6A7039338BC067F4FB23 /* 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 = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 400B233027A7674E0074EE57 /* libveilid_flutter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libveilid_flutter.a; path = ../../ios/lib/libveilid_flutter.a; sourceTree = ""; }; + 41720C3D885A5FD597C42EA7 /* 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 = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -42,6 +46,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B1EAB6BDBA67DBB8DED93560 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D12CAD1E1213967B2B34ABF5 /* 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +55,23 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FEE7B6B3B613F78995A4690A /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3BAD380B896D08D779A46A64 /* Pods */ = { + isa = PBXGroup; + children = ( + 0DEA6A7039338BC067F4FB23 /* Pods-Runner.debug.xcconfig */, + 41720C3D885A5FD597C42EA7 /* Pods-Runner.release.xcconfig */, + D12CAD1E1213967B2B34ABF5 /* Pods-Runner.profile.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +89,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 3BAD380B896D08D779A46A64 /* Pods */, + C971D38A89F5E1CEE6D692A1 /* Frameworks */, ); sourceTree = ""; }; @@ -98,6 +117,15 @@ path = Runner; sourceTree = ""; }; + C971D38A89F5E1CEE6D692A1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 400B233027A7674E0074EE57 /* libveilid_flutter.a */, + B1EAB6BDBA67DBB8DED93560 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -105,12 +133,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + DCEBE99800A061D4FDC59942 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + A5D76AF0FD12267359F0B3A4 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -181,7 +211,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -197,6 +227,45 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + A5D76AF0FD12267359F0B3A4 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + DCEBE99800A061D4FDC59942 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -235,6 +304,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = arm64; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -306,6 +376,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = arm64; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -361,6 +432,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = arm64; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; diff --git a/veilid-flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/veilid-flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16..21a3cc14 100644 --- a/veilid-flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/veilid-flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/veilid-flutter/example/ios/Runner/Info.plist b/veilid-flutter/example/ios/Runner/Info.plist index a1eefe36..e60c506f 100644 --- a/veilid-flutter/example/ios/Runner/Info.plist +++ b/veilid-flutter/example/ios/Runner/Info.plist @@ -5,7 +5,7 @@ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName - Veilid + Veilid Plugin Example CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier diff --git a/veilid-flutter/example/macos/Podfile.lock b/veilid-flutter/example/macos/Podfile.lock index 8e81c417..811c652c 100644 --- a/veilid-flutter/example/macos/Podfile.lock +++ b/veilid-flutter/example/macos/Podfile.lock @@ -15,7 +15,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 - veilid: fd5957b2b4ff66a1dbeba0433afdce762d21d90c + veilid: f6b04d095ac7058ddf9c00215eb2699de8cc4673 PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c diff --git a/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj b/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj index f719bbe5..28de84a7 100644 --- a/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -26,7 +26,7 @@ 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 */; }; - 40BAB9F027A74B09000EC229 /* libveilid_flutter.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 40BAB9EF27A74B09000EC229 /* libveilid_flutter.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 400B233427A772C20074EE57 /* libveilid_flutter.dylib in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 400B233327A772C20074EE57 /* libveilid_flutter.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 8526E2FC060241577E5281A0 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E89F2D855D7BDA4933E1A2EC /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ @@ -47,7 +47,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 40BAB9F027A74B09000EC229 /* libveilid_flutter.dylib in Bundle Framework */, + 400B233427A772C20074EE57 /* libveilid_flutter.dylib in Bundle Framework */, ); name = "Bundle Framework"; runOnlyForDeploymentPostprocessing = 0; @@ -70,7 +70,7 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 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 = ""; }; - 40BAB9EF27A74B09000EC229 /* libveilid_flutter.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libveilid_flutter.dylib; path = ../../macos/lib/libveilid_flutter.dylib; sourceTree = ""; }; + 400B233327A772C20074EE57 /* libveilid_flutter.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libveilid_flutter.dylib; path = ../../../target/macos_lib/libveilid_flutter.dylib; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; B8606FB3C4AA619FC22C3115 /* 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 = ""; }; @@ -104,7 +104,7 @@ 33CC10E42044A3C60003C045 = { isa = PBXGroup; children = ( - 40BAB9EF27A74B09000EC229 /* libveilid_flutter.dylib */, + 400B233327A772C20074EE57 /* libveilid_flutter.dylib */, 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, diff --git a/veilid-flutter/example/pubspec.yaml b/veilid-flutter/example/pubspec.yaml index 5d13c681..f95ac307 100644 --- a/veilid-flutter/example/pubspec.yaml +++ b/veilid-flutter/example/pubspec.yaml @@ -1,5 +1,6 @@ name: veilid_example description: Demonstrates how to use the veilid plugin. +version: 1.0.0+1 # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. diff --git a/veilid-flutter/ios/Classes/Bridging-Header.h b/veilid-flutter/ios/Classes/Bridging-Header.h index 064f4bd0..55311329 100644 --- a/veilid-flutter/ios/Classes/Bridging-Header.h +++ b/veilid-flutter/ios/Classes/Bridging-Header.h @@ -1,2 +1,2 @@ -#import "GeneratedPluginRegistrant.h" +//#import "GeneratedPluginRegistrant.h" #import "bridge_generated.h" \ No newline at end of file diff --git a/veilid-flutter/ios/veilid.podspec b/veilid-flutter/ios/veilid.podspec index 0c0454da..8c2ab677 100644 --- a/veilid-flutter/ios/veilid.podspec +++ b/veilid-flutter/ios/veilid.podspec @@ -7,11 +7,11 @@ Pod::Spec.new do |s| s.version = '0.0.1' s.summary = 'Veilid Network' s.description = <<-DESC -Veilid Network +Veilid Network Plugin DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } + s.homepage = 'http://veilid.com' + s.license = 'LGPL-2.0-or-later OR MPL-2.0 OR (MIT AND BSD-3-Clause)' + s.author = { 'John Smith' => 'jsmith@example.com' } s.source = { :path => '.' } s.source_files = 'Classes/**/*' s.dependency 'Flutter' @@ -20,4 +20,21 @@ Veilid Network # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' } s.swift_version = '5.0' + + require 'json' + require 'pathname' + cargo_target_dir = File.join(File.dirname(JSON.parse(`cargo locate-project`)['root']), 'target') + + s.xcconfig = { + 'OTHER_LDFLAGS' => '-lveilid_flutter', + "LIBRARY_SEARCH_PATHS" => File.join(cargo_target_dir, 'ios_lib') + } + + s.script_phase = { + :name => 'Cargo Build', + :script => File.join(File.dirname(__dir__), 'rust', 'ios_build.sh'), + :execution_position => :before_compile, + :output_files => [ File.join(cargo_target_dir, 'ios_lib', 'libveilid_flutter.a') ] + } + end diff --git a/veilid-flutter/macos/.gitignore b/veilid-flutter/macos/.gitignore deleted file mode 100644 index a65b4177..00000000 --- a/veilid-flutter/macos/.gitignore +++ /dev/null @@ -1 +0,0 @@ -lib diff --git a/veilid-flutter/macos/veilid.podspec b/veilid-flutter/macos/veilid.podspec index a632b0a7..561e52f3 100644 --- a/veilid-flutter/macos/veilid.podspec +++ b/veilid-flutter/macos/veilid.podspec @@ -20,11 +20,15 @@ Veilid Network Plugin s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.swift_version = '5.0' + require 'json' + require 'pathname' + cargo_target_dir = File.join(File.dirname(JSON.parse(`cargo locate-project`)['root']), 'target') + s.script_phase = { :name => 'Cargo Build', :script => File.join(File.dirname(__dir__), 'rust', 'macos_build.sh'), :execution_position => :before_compile, - :output_files => [ File.join(File.dirname(__dir__), 'lib', 'libveilid_flutter.dylib') ] + :output_files => [ File.join(cargo_target_dir, 'macos_lib', 'libveilid_flutter.dylib') ] } # s.prepare_command = <<-CMD diff --git a/veilid-flutter/rust/ios_build.sh b/veilid-flutter/rust/ios_build.sh index 6e5439a4..dd7607f5 100755 --- a/veilid-flutter/rust/ios_build.sh +++ b/veilid-flutter/rust/ios_build.sh @@ -1,15 +1,30 @@ #!/bin/bash +# Setup varaiables SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +FLUTTER_DIR=$(dirname `which flutter`) +HOMEBREW_DIR=$(dirname `which brew`) +CARGO_DIR=$(dirname `which cargo`) CARGO_MANIFEST_PATH=$(python -c "import os; print(os.path.realpath(\"$SCRIPTDIR/Cargo.toml\"))") -# echo CARGO_MANIFEST_PATH: $CARGO_MANIFEST_PATH +TARGET_DIR=$(dirname `cargo locate-project --message-format plain`)/target +# Configure outputs +OUTPUT_FILENAME=libveilid_flutter.a +OUTPUT_DIR=$TARGET_DIR/ios_lib + +# Get Rust configurations from xcode configurations if [ "$CONFIGURATION" == "Debug" ]; then EXTRA_CARGO_OPTIONS="$@" + RUST_CONFIGURATION="debug" else EXTRA_CARGO_OPTIONS="$@ --release" + RUST_CONFIGURATION="release" fi + +# Build all the matching architectures for the xcode configurations ARCHS=${ARCHS:=arm64} +echo ARCHS: $ARCHS +LIPO_LIST="" for arch in $ARCHS do if [ "$arch" == "arm64" ]; then @@ -24,9 +39,14 @@ do echo Unsupported ARCH: $arch continue fi - FLUTTER_DIR=$(dirname `which flutter`) - HOMEBREW_DIR=$(dirname `which brew`) - CARGO_DIR=$(dirname `which cargo`) + + # Cargo build env -i PATH=/usr/bin:/bin:/usr/local/bin:$HOMEBREW_DIR:$FLUTTER_DIR:$CARGO_DIR HOME="$HOME" USER="$USER" cargo $CARGO_TOOLCHAIN build $EXTRA_CARGO_OPTIONS --target $CARGO_TARGET --manifest-path $CARGO_MANIFEST_PATH + + # Add output to lipo list + LIPO_LIST="$LIPO_LIST $TARGET_DIR/$CARGO_TARGET/$RUST_CONFIGURATION/$OUTPUT_FILENAME" done +# Lipo the architectures together +mkdir -p $OUTPUT_DIR +lipo -output "$OUTPUT_DIR/$OUTPUT_FILENAME" -create $LIPO_LIST diff --git a/veilid-flutter/rust/macos_build.sh b/veilid-flutter/rust/macos_build.sh index 26d96788..55a9baa1 100755 --- a/veilid-flutter/rust/macos_build.sh +++ b/veilid-flutter/rust/macos_build.sh @@ -10,7 +10,7 @@ TARGET_DIR=$(dirname `cargo locate-project --message-format plain`)/target # Configure outputs OUTPUT_FILENAME=libveilid_flutter.dylib -OUTPUT_DIR=$SCRIPTDIR/../macos/lib +OUTPUT_DIR=$TARGET_DIR/macos_lib # Get Rust configurations from xcode configurations if [ "$CONFIGURATION" == "Debug" ]; then diff --git a/veilid-flutter/rust/src/bridge_generated.rs b/veilid-flutter/rust/src/bridge_generated.rs index bbb888f6..11b3bf7f 100644 --- a/veilid-flutter/rust/src/bridge_generated.rs +++ b/veilid-flutter/rust/src/bridge_generated.rs @@ -1,534 +1,502 @@ -#![allow( - non_camel_case_types, - unused, - clippy::redundant_closure, - clippy::useless_conversion, - non_snake_case -)] -// AUTO GENERATED FILE, DO NOT EDIT. +#![allow(non_camel_case_types, unused, clippy::redundant_closure, clippy::useless_conversion, non_snake_case)] + // AUTO GENERATED FILE, DO NOT EDIT. // Generated by `flutter_rust_bridge`. -use crate::api::*; -use flutter_rust_bridge::*; + use crate::api::*; + use flutter_rust_bridge::*; -// Section: wire functions + // Section: wire functions -#[no_mangle] -pub extern "C" fn wire_startup_veilid_core(port_: i64, config: *mut wire_VeilidConfig) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap( - WrapInfo { - debug_name: "startup_veilid_core", - port: Some(port_), - mode: FfiCallMode::Stream, - }, - move || { - let api_config = config.wire2api(); - move |task_callback| startup_veilid_core(task_callback.stream_sink(), api_config) - }, - ) -} + + #[no_mangle] + pub extern "C" fn wire_startup_veilid_core(port_: i64, config: *mut wire_VeilidConfig) { + + FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "startup_veilid_core", port: Some(port_), mode: FfiCallMode::Stream }, move || { + let api_config = config.wire2api(); + move |task_callback| startup_veilid_core(task_callback.stream_sink(), api_config) + + }) + + } + -#[no_mangle] -pub extern "C" fn wire_get_veilid_state(port_: i64) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap( - WrapInfo { - debug_name: "get_veilid_state", - port: Some(port_), - mode: FfiCallMode::Normal, - }, - move || move |task_callback| get_veilid_state(), - ) -} -#[no_mangle] -pub extern "C" fn wire_shutdown_veilid_core(port_: i64) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap( - WrapInfo { - debug_name: "shutdown_veilid_core", - port: Some(port_), - mode: FfiCallMode::Normal, - }, - move || move |task_callback| shutdown_veilid_core(), - ) -} + #[no_mangle] + pub extern "C" fn wire_get_veilid_state(port_: i64) { + + FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "get_veilid_state", port: Some(port_), mode: FfiCallMode::Normal }, move || { + + move |task_callback| get_veilid_state() + + }) + + } + -#[no_mangle] -pub extern "C" fn wire_veilid_version_string(port_: i64) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap( - WrapInfo { - debug_name: "veilid_version_string", - port: Some(port_), - mode: FfiCallMode::Normal, - }, - move || move |task_callback| veilid_version_string(), - ) -} -#[no_mangle] -pub extern "C" fn wire_veilid_version(port_: i64) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap( - WrapInfo { - debug_name: "veilid_version", - port: Some(port_), - mode: FfiCallMode::Normal, - }, - move || move |task_callback| veilid_version(), - ) -} + #[no_mangle] + pub extern "C" fn wire_shutdown_veilid_core(port_: i64) { + + FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "shutdown_veilid_core", port: Some(port_), mode: FfiCallMode::Normal }, move || { + + move |task_callback| shutdown_veilid_core() + + }) + + } + -// Section: wire structs -#[repr(C)] -#[derive(Clone)] -pub struct wire_StringList { - ptr: *mut *mut wire_uint_8_list, - len: i32, -} + #[no_mangle] + pub extern "C" fn wire_veilid_version_string(port_: i64) { + + FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "veilid_version_string", port: Some(port_), mode: FfiCallMode::Normal }, move || { + + move |task_callback| veilid_version_string() + + }) + + } + -#[repr(C)] -#[derive(Clone)] -pub struct wire_uint_8_list { - ptr: *mut u8, - len: i32, -} -#[repr(C)] -#[derive(Clone)] -pub struct wire_VeilidConfig { - program_name: *mut wire_uint_8_list, - veilid_namespace: *mut wire_uint_8_list, - capabilities__protocol_udp: bool, - capabilities__protocol_connect_tcp: bool, - capabilities__protocol_accept_tcp: bool, - capabilities__protocol_connect_ws: bool, - capabilities__protocol_accept_ws: bool, - capabilities__protocol_connect_wss: bool, - capabilities__protocol_accept_wss: bool, - protected_store__allow_insecure_fallback: bool, - protected_store__always_use_insecure_storage: bool, - protected_store__insecure_fallback_directory: *mut wire_uint_8_list, - protected_store__delete: bool, - table_store__directory: *mut wire_uint_8_list, - table_store__delete: bool, - block_store__directory: *mut wire_uint_8_list, - block_store__delete: bool, - network__max_connections: u32, - network__connection_initial_timeout_ms: u32, - network__node_id: *mut wire_uint_8_list, - network__node_id_secret: *mut wire_uint_8_list, - network__bootstrap: *mut wire_StringList, - network__upnp: bool, - network__natpmp: bool, - network__enable_local_peer_scope: bool, - network__restricted_nat_retries: u32, - network__rpc__concurrency: u32, - network__rpc__queue_size: u32, - network__rpc__max_timestamp_behind_ms: *mut u32, - network__rpc__max_timestamp_ahead_ms: *mut u32, - network__rpc__timeout_ms: u32, - network__rpc__max_route_hop_count: u8, - network__dht__resolve_node_timeout_ms: *mut u32, - network__dht__resolve_node_count: u32, - network__dht__resolve_node_fanout: u32, - network__dht__max_find_node_count: u32, - network__dht__get_value_timeout_ms: *mut u32, - network__dht__get_value_count: u32, - network__dht__get_value_fanout: u32, - network__dht__set_value_timeout_ms: *mut u32, - network__dht__set_value_count: u32, - network__dht__set_value_fanout: u32, - network__dht__min_peer_count: u32, - network__dht__min_peer_refresh_time_ms: u32, - network__dht__validate_dial_info_receipt_time_ms: u32, - network__protocol__udp__enabled: bool, - network__protocol__udp__socket_pool_size: u32, - network__protocol__udp__listen_address: *mut wire_uint_8_list, - network__protocol__udp__public_address: *mut wire_uint_8_list, - network__protocol__tcp__connect: bool, - network__protocol__tcp__listen: bool, - network__protocol__tcp__max_connections: u32, - network__protocol__tcp__listen_address: *mut wire_uint_8_list, - network__protocol__tcp__public_address: *mut wire_uint_8_list, - network__protocol__ws__connect: bool, - network__protocol__ws__listen: bool, - network__protocol__ws__max_connections: u32, - network__protocol__ws__listen_address: *mut wire_uint_8_list, - network__protocol__ws__path: *mut wire_uint_8_list, - network__protocol__ws__url: *mut wire_uint_8_list, - network__protocol__wss__connect: bool, - network__protocol__wss__max_connections: u32, - network__leases__max_server_signal_leases: u32, - network__leases__max_server_relay_leases: u32, - network__leases__max_client_signal_leases: u32, - network__leases__max_client_relay_leases: u32, -} + #[no_mangle] + pub extern "C" fn wire_veilid_version(port_: i64) { + + FLUTTER_RUST_BRIDGE_HANDLER.wrap(WrapInfo{ debug_name: "veilid_version", port: Some(port_), mode: FfiCallMode::Normal }, move || { + + move |task_callback| veilid_version() + + }) + + } + -// Section: wire enums + // Section: wire structs -// Section: allocate functions + -#[no_mangle] -pub extern "C" fn new_StringList(len: i32) -> *mut wire_StringList { - let wrap = wire_StringList { - ptr: support::new_leak_vec_ptr(<*mut wire_uint_8_list>::new_with_null_ptr(), len), - len, - }; - support::new_leak_box_ptr(wrap) -} -#[no_mangle] -pub extern "C" fn new_box_autoadd_u32(value: u32) -> *mut u32 { - support::new_leak_box_ptr(value) -} - -#[no_mangle] -pub extern "C" fn new_box_autoadd_veilid_config() -> *mut wire_VeilidConfig { - support::new_leak_box_ptr(wire_VeilidConfig::new_with_null_ptr()) -} - -#[no_mangle] -pub extern "C" fn new_uint_8_list(len: i32) -> *mut wire_uint_8_list { - let ans = wire_uint_8_list { - ptr: support::new_leak_vec_ptr(Default::default(), len), - len, - }; - support::new_leak_box_ptr(ans) -} - -// Section: impl Wire2Api - -pub trait Wire2Api { - fn wire2api(self) -> T; -} - -impl Wire2Api> for *mut S -where - *mut S: Wire2Api, -{ - fn wire2api(self) -> Option { - if self.is_null() { - None - } else { - Some(self.wire2api()) + #[repr(C)] + #[derive(Clone)] + pub struct wire_StringList { + ptr: *mut *mut wire_uint_8_list, +len: i32 } - } -} + -impl Wire2Api for *mut wire_uint_8_list { - fn wire2api(self) -> String { - let vec: Vec = self.wire2api(); - String::from_utf8_lossy(&vec).into_owned() - } -} + + + + + + + + + + + + + + + + #[repr(C)] + #[derive(Clone)] + pub struct wire_uint_8_list { + ptr: *mut u8, +len: i32 + } + + + + #[repr(C)] + #[derive(Clone)] + pub struct wire_VeilidConfig { + program_name: *mut wire_uint_8_list, +veilid_namespace: *mut wire_uint_8_list, +capabilities__protocol_udp: bool, +capabilities__protocol_connect_tcp: bool, +capabilities__protocol_accept_tcp: bool, +capabilities__protocol_connect_ws: bool, +capabilities__protocol_accept_ws: bool, +capabilities__protocol_connect_wss: bool, +capabilities__protocol_accept_wss: bool, +protected_store__allow_insecure_fallback: bool, +protected_store__always_use_insecure_storage: bool, +protected_store__insecure_fallback_directory: *mut wire_uint_8_list, +protected_store__delete: bool, +table_store__directory: *mut wire_uint_8_list, +table_store__delete: bool, +block_store__directory: *mut wire_uint_8_list, +block_store__delete: bool, +network__max_connections: u32, +network__connection_initial_timeout_ms: u32, +network__node_id: *mut wire_uint_8_list, +network__node_id_secret: *mut wire_uint_8_list, +network__bootstrap: *mut wire_StringList, +network__upnp: bool, +network__natpmp: bool, +network__enable_local_peer_scope: bool, +network__restricted_nat_retries: u32, +network__rpc__concurrency: u32, +network__rpc__queue_size: u32, +network__rpc__max_timestamp_behind_ms: *mut u32, +network__rpc__max_timestamp_ahead_ms: *mut u32, +network__rpc__timeout_ms: u32, +network__rpc__max_route_hop_count: u8, +network__dht__resolve_node_timeout_ms: *mut u32, +network__dht__resolve_node_count: u32, +network__dht__resolve_node_fanout: u32, +network__dht__max_find_node_count: u32, +network__dht__get_value_timeout_ms: *mut u32, +network__dht__get_value_count: u32, +network__dht__get_value_fanout: u32, +network__dht__set_value_timeout_ms: *mut u32, +network__dht__set_value_count: u32, +network__dht__set_value_fanout: u32, +network__dht__min_peer_count: u32, +network__dht__min_peer_refresh_time_ms: u32, +network__dht__validate_dial_info_receipt_time_ms: u32, +network__protocol__udp__enabled: bool, +network__protocol__udp__socket_pool_size: u32, +network__protocol__udp__listen_address: *mut wire_uint_8_list, +network__protocol__udp__public_address: *mut wire_uint_8_list, +network__protocol__tcp__connect: bool, +network__protocol__tcp__listen: bool, +network__protocol__tcp__max_connections: u32, +network__protocol__tcp__listen_address: *mut wire_uint_8_list, +network__protocol__tcp__public_address: *mut wire_uint_8_list, +network__protocol__ws__connect: bool, +network__protocol__ws__listen: bool, +network__protocol__ws__max_connections: u32, +network__protocol__ws__listen_address: *mut wire_uint_8_list, +network__protocol__ws__path: *mut wire_uint_8_list, +network__protocol__ws__url: *mut wire_uint_8_list, +network__protocol__wss__connect: bool, +network__protocol__wss__max_connections: u32, +network__leases__max_server_signal_leases: u32, +network__leases__max_server_relay_leases: u32, +network__leases__max_client_signal_leases: u32, +network__leases__max_client_relay_leases: u32 + } + + + // Section: wire enums + + + + // Section: allocate functions + + + + + #[no_mangle] + pub extern "C" fn new_StringList(len: i32) -> *mut wire_StringList { + let wrap = wire_StringList { ptr: support::new_leak_vec_ptr(<*mut wire_uint_8_list>::new_with_null_ptr(), len), len }; + support::new_leak_box_ptr(wrap) + } + + + + + + #[no_mangle] + pub extern "C" fn new_box_autoadd_u32(value: u32) -> *mut u32 { + support::new_leak_box_ptr(value) + } + + + + #[no_mangle] + pub extern "C" fn new_box_autoadd_veilid_config() -> *mut wire_VeilidConfig { + support::new_leak_box_ptr(wire_VeilidConfig::new_with_null_ptr()) + } + + + + + + + + + + + + #[no_mangle] + pub extern "C" fn new_uint_8_list(len: i32) -> *mut wire_uint_8_list { + let ans = wire_uint_8_list { ptr: support::new_leak_vec_ptr(Default::default(), len), len }; + support::new_leak_box_ptr(ans) + } + + + + + // Section: impl Wire2Api + + pub trait Wire2Api { + fn wire2api(self) -> T; + } + + impl Wire2Api> for *mut S + where + *mut S: Wire2Api + { + fn wire2api(self) -> Option { + if self.is_null() { + None + } else { + Some(self.wire2api()) + } + } + } + + impl Wire2Api for *mut wire_uint_8_list { + fn wire2api(self) -> String { + let vec: Vec = self.wire2api(); + String::from_utf8_lossy(&vec).into_owned() + } + } + impl Wire2Api> for *mut wire_StringList { - fn wire2api(self) -> Vec { - let vec = unsafe { - let wrap = support::box_from_leak_ptr(self); - support::vec_from_leak_ptr(wrap.ptr, wrap.len) - }; - vec.into_iter().map(Wire2Api::wire2api).collect() - } -} + fn wire2api(self) -> Vec { + + let vec = unsafe { + let wrap = support::box_from_leak_ptr(self); + support::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(Wire2Api::wire2api).collect() + } + } + impl Wire2Api for bool { - fn wire2api(self) -> bool { - self - } -} + fn wire2api(self) -> bool { + self + } + } + impl Wire2Api for *mut u32 { - fn wire2api(self) -> u32 { - unsafe { *support::box_from_leak_ptr(self) } - } -} + fn wire2api(self) -> u32 { + unsafe { *support::box_from_leak_ptr(self) } + } + } + impl Wire2Api for *mut wire_VeilidConfig { - fn wire2api(self) -> VeilidConfig { - let wrap = unsafe { support::box_from_leak_ptr(self) }; - (*wrap).wire2api().into() - } -} + fn wire2api(self) -> VeilidConfig { + let wrap = unsafe { support::box_from_leak_ptr(self) }; (*wrap).wire2api().into() + } + } + + + + + impl Wire2Api for u32 { - fn wire2api(self) -> u32 { - self - } -} + fn wire2api(self) -> u32 { + self + } + } + impl Wire2Api for u8 { - fn wire2api(self) -> u8 { - self - } -} + fn wire2api(self) -> u8 { + self + } + } + impl Wire2Api> for *mut wire_uint_8_list { - fn wire2api(self) -> Vec { - unsafe { - let wrap = support::box_from_leak_ptr(self); - support::vec_from_leak_ptr(wrap.ptr, wrap.len) + fn wire2api(self) -> Vec { + unsafe { + let wrap = support::box_from_leak_ptr(self); + support::vec_from_leak_ptr(wrap.ptr, wrap.len) + } + } } - } -} + impl Wire2Api for wire_VeilidConfig { - fn wire2api(self) -> VeilidConfig { - VeilidConfig { - program_name: self.program_name.wire2api(), - veilid_namespace: self.veilid_namespace.wire2api(), - capabilities__protocol_udp: self.capabilities__protocol_udp.wire2api(), - capabilities__protocol_connect_tcp: self.capabilities__protocol_connect_tcp.wire2api(), - capabilities__protocol_accept_tcp: self.capabilities__protocol_accept_tcp.wire2api(), - capabilities__protocol_connect_ws: self.capabilities__protocol_connect_ws.wire2api(), - capabilities__protocol_accept_ws: self.capabilities__protocol_accept_ws.wire2api(), - capabilities__protocol_connect_wss: self.capabilities__protocol_connect_wss.wire2api(), - capabilities__protocol_accept_wss: self.capabilities__protocol_accept_wss.wire2api(), - protected_store__allow_insecure_fallback: self - .protected_store__allow_insecure_fallback - .wire2api(), - protected_store__always_use_insecure_storage: self - .protected_store__always_use_insecure_storage - .wire2api(), - protected_store__insecure_fallback_directory: self - .protected_store__insecure_fallback_directory - .wire2api(), - protected_store__delete: self.protected_store__delete.wire2api(), - table_store__directory: self.table_store__directory.wire2api(), - table_store__delete: self.table_store__delete.wire2api(), - block_store__directory: self.block_store__directory.wire2api(), - block_store__delete: self.block_store__delete.wire2api(), - network__max_connections: self.network__max_connections.wire2api(), - network__connection_initial_timeout_ms: self - .network__connection_initial_timeout_ms - .wire2api(), - network__node_id: self.network__node_id.wire2api(), - network__node_id_secret: self.network__node_id_secret.wire2api(), - network__bootstrap: self.network__bootstrap.wire2api(), - network__upnp: self.network__upnp.wire2api(), - network__natpmp: self.network__natpmp.wire2api(), - network__enable_local_peer_scope: self.network__enable_local_peer_scope.wire2api(), - network__restricted_nat_retries: self.network__restricted_nat_retries.wire2api(), - network__rpc__concurrency: self.network__rpc__concurrency.wire2api(), - network__rpc__queue_size: self.network__rpc__queue_size.wire2api(), - network__rpc__max_timestamp_behind_ms: self - .network__rpc__max_timestamp_behind_ms - .wire2api(), - network__rpc__max_timestamp_ahead_ms: self - .network__rpc__max_timestamp_ahead_ms - .wire2api(), - network__rpc__timeout_ms: self.network__rpc__timeout_ms.wire2api(), - network__rpc__max_route_hop_count: self.network__rpc__max_route_hop_count.wire2api(), - network__dht__resolve_node_timeout_ms: self - .network__dht__resolve_node_timeout_ms - .wire2api(), - network__dht__resolve_node_count: self.network__dht__resolve_node_count.wire2api(), - network__dht__resolve_node_fanout: self.network__dht__resolve_node_fanout.wire2api(), - network__dht__max_find_node_count: self.network__dht__max_find_node_count.wire2api(), - network__dht__get_value_timeout_ms: self.network__dht__get_value_timeout_ms.wire2api(), - network__dht__get_value_count: self.network__dht__get_value_count.wire2api(), - network__dht__get_value_fanout: self.network__dht__get_value_fanout.wire2api(), - network__dht__set_value_timeout_ms: self.network__dht__set_value_timeout_ms.wire2api(), - network__dht__set_value_count: self.network__dht__set_value_count.wire2api(), - network__dht__set_value_fanout: self.network__dht__set_value_fanout.wire2api(), - network__dht__min_peer_count: self.network__dht__min_peer_count.wire2api(), - network__dht__min_peer_refresh_time_ms: self - .network__dht__min_peer_refresh_time_ms - .wire2api(), - network__dht__validate_dial_info_receipt_time_ms: self - .network__dht__validate_dial_info_receipt_time_ms - .wire2api(), - network__protocol__udp__enabled: self.network__protocol__udp__enabled.wire2api(), - network__protocol__udp__socket_pool_size: self - .network__protocol__udp__socket_pool_size - .wire2api(), - network__protocol__udp__listen_address: self - .network__protocol__udp__listen_address - .wire2api(), - network__protocol__udp__public_address: self - .network__protocol__udp__public_address - .wire2api(), - network__protocol__tcp__connect: self.network__protocol__tcp__connect.wire2api(), - network__protocol__tcp__listen: self.network__protocol__tcp__listen.wire2api(), - network__protocol__tcp__max_connections: self - .network__protocol__tcp__max_connections - .wire2api(), - network__protocol__tcp__listen_address: self - .network__protocol__tcp__listen_address - .wire2api(), - network__protocol__tcp__public_address: self - .network__protocol__tcp__public_address - .wire2api(), - network__protocol__ws__connect: self.network__protocol__ws__connect.wire2api(), - network__protocol__ws__listen: self.network__protocol__ws__listen.wire2api(), - network__protocol__ws__max_connections: self - .network__protocol__ws__max_connections - .wire2api(), - network__protocol__ws__listen_address: self - .network__protocol__ws__listen_address - .wire2api(), - network__protocol__ws__path: self.network__protocol__ws__path.wire2api(), - network__protocol__ws__url: self.network__protocol__ws__url.wire2api(), - network__protocol__wss__connect: self.network__protocol__wss__connect.wire2api(), - network__protocol__wss__max_connections: self - .network__protocol__wss__max_connections - .wire2api(), - network__leases__max_server_signal_leases: self - .network__leases__max_server_signal_leases - .wire2api(), - network__leases__max_server_relay_leases: self - .network__leases__max_server_relay_leases - .wire2api(), - network__leases__max_client_signal_leases: self - .network__leases__max_client_signal_leases - .wire2api(), - network__leases__max_client_relay_leases: self - .network__leases__max_client_relay_leases - .wire2api(), + fn wire2api(self) -> VeilidConfig { + VeilidConfig{program_name: self.program_name.wire2api(),veilid_namespace: self.veilid_namespace.wire2api(),capabilities__protocol_udp: self.capabilities__protocol_udp.wire2api(),capabilities__protocol_connect_tcp: self.capabilities__protocol_connect_tcp.wire2api(),capabilities__protocol_accept_tcp: self.capabilities__protocol_accept_tcp.wire2api(),capabilities__protocol_connect_ws: self.capabilities__protocol_connect_ws.wire2api(),capabilities__protocol_accept_ws: self.capabilities__protocol_accept_ws.wire2api(),capabilities__protocol_connect_wss: self.capabilities__protocol_connect_wss.wire2api(),capabilities__protocol_accept_wss: self.capabilities__protocol_accept_wss.wire2api(),protected_store__allow_insecure_fallback: self.protected_store__allow_insecure_fallback.wire2api(),protected_store__always_use_insecure_storage: self.protected_store__always_use_insecure_storage.wire2api(),protected_store__insecure_fallback_directory: self.protected_store__insecure_fallback_directory.wire2api(),protected_store__delete: self.protected_store__delete.wire2api(),table_store__directory: self.table_store__directory.wire2api(),table_store__delete: self.table_store__delete.wire2api(),block_store__directory: self.block_store__directory.wire2api(),block_store__delete: self.block_store__delete.wire2api(),network__max_connections: self.network__max_connections.wire2api(),network__connection_initial_timeout_ms: self.network__connection_initial_timeout_ms.wire2api(),network__node_id: self.network__node_id.wire2api(),network__node_id_secret: self.network__node_id_secret.wire2api(),network__bootstrap: self.network__bootstrap.wire2api(),network__upnp: self.network__upnp.wire2api(),network__natpmp: self.network__natpmp.wire2api(),network__enable_local_peer_scope: self.network__enable_local_peer_scope.wire2api(),network__restricted_nat_retries: self.network__restricted_nat_retries.wire2api(),network__rpc__concurrency: self.network__rpc__concurrency.wire2api(),network__rpc__queue_size: self.network__rpc__queue_size.wire2api(),network__rpc__max_timestamp_behind_ms: self.network__rpc__max_timestamp_behind_ms.wire2api(),network__rpc__max_timestamp_ahead_ms: self.network__rpc__max_timestamp_ahead_ms.wire2api(),network__rpc__timeout_ms: self.network__rpc__timeout_ms.wire2api(),network__rpc__max_route_hop_count: self.network__rpc__max_route_hop_count.wire2api(),network__dht__resolve_node_timeout_ms: self.network__dht__resolve_node_timeout_ms.wire2api(),network__dht__resolve_node_count: self.network__dht__resolve_node_count.wire2api(),network__dht__resolve_node_fanout: self.network__dht__resolve_node_fanout.wire2api(),network__dht__max_find_node_count: self.network__dht__max_find_node_count.wire2api(),network__dht__get_value_timeout_ms: self.network__dht__get_value_timeout_ms.wire2api(),network__dht__get_value_count: self.network__dht__get_value_count.wire2api(),network__dht__get_value_fanout: self.network__dht__get_value_fanout.wire2api(),network__dht__set_value_timeout_ms: self.network__dht__set_value_timeout_ms.wire2api(),network__dht__set_value_count: self.network__dht__set_value_count.wire2api(),network__dht__set_value_fanout: self.network__dht__set_value_fanout.wire2api(),network__dht__min_peer_count: self.network__dht__min_peer_count.wire2api(),network__dht__min_peer_refresh_time_ms: self.network__dht__min_peer_refresh_time_ms.wire2api(),network__dht__validate_dial_info_receipt_time_ms: self.network__dht__validate_dial_info_receipt_time_ms.wire2api(),network__protocol__udp__enabled: self.network__protocol__udp__enabled.wire2api(),network__protocol__udp__socket_pool_size: self.network__protocol__udp__socket_pool_size.wire2api(),network__protocol__udp__listen_address: self.network__protocol__udp__listen_address.wire2api(),network__protocol__udp__public_address: self.network__protocol__udp__public_address.wire2api(),network__protocol__tcp__connect: self.network__protocol__tcp__connect.wire2api(),network__protocol__tcp__listen: self.network__protocol__tcp__listen.wire2api(),network__protocol__tcp__max_connections: self.network__protocol__tcp__max_connections.wire2api(),network__protocol__tcp__listen_address: self.network__protocol__tcp__listen_address.wire2api(),network__protocol__tcp__public_address: self.network__protocol__tcp__public_address.wire2api(),network__protocol__ws__connect: self.network__protocol__ws__connect.wire2api(),network__protocol__ws__listen: self.network__protocol__ws__listen.wire2api(),network__protocol__ws__max_connections: self.network__protocol__ws__max_connections.wire2api(),network__protocol__ws__listen_address: self.network__protocol__ws__listen_address.wire2api(),network__protocol__ws__path: self.network__protocol__ws__path.wire2api(),network__protocol__ws__url: self.network__protocol__ws__url.wire2api(),network__protocol__wss__connect: self.network__protocol__wss__connect.wire2api(),network__protocol__wss__max_connections: self.network__protocol__wss__max_connections.wire2api(),network__leases__max_server_signal_leases: self.network__leases__max_server_signal_leases.wire2api(),network__leases__max_server_relay_leases: self.network__leases__max_server_relay_leases.wire2api(),network__leases__max_client_signal_leases: self.network__leases__max_client_signal_leases.wire2api(),network__leases__max_client_relay_leases: self.network__leases__max_client_relay_leases.wire2api()} + } } - } -} + + + // Section: impl NewWithNullPtr + + pub trait NewWithNullPtr { + fn new_with_null_ptr() -> Self; + } + + impl NewWithNullPtr for *mut T { + fn new_with_null_ptr() -> Self { + std::ptr::null_mut() + } + } + + + + + + + + + + + + + + + + + -// Section: impl NewWithNullPtr -pub trait NewWithNullPtr { - fn new_with_null_ptr() -> Self; -} -impl NewWithNullPtr for *mut T { - fn new_with_null_ptr() -> Self { - std::ptr::null_mut() - } -} impl NewWithNullPtr for wire_VeilidConfig { - fn new_with_null_ptr() -> Self { - Self { - program_name: core::ptr::null_mut(), - veilid_namespace: core::ptr::null_mut(), - capabilities__protocol_udp: Default::default(), - capabilities__protocol_connect_tcp: Default::default(), - capabilities__protocol_accept_tcp: Default::default(), - capabilities__protocol_connect_ws: Default::default(), - capabilities__protocol_accept_ws: Default::default(), - capabilities__protocol_connect_wss: Default::default(), - capabilities__protocol_accept_wss: Default::default(), - protected_store__allow_insecure_fallback: Default::default(), - protected_store__always_use_insecure_storage: Default::default(), - protected_store__insecure_fallback_directory: core::ptr::null_mut(), - protected_store__delete: Default::default(), - table_store__directory: core::ptr::null_mut(), - table_store__delete: Default::default(), - block_store__directory: core::ptr::null_mut(), - block_store__delete: Default::default(), - network__max_connections: Default::default(), - network__connection_initial_timeout_ms: Default::default(), - network__node_id: core::ptr::null_mut(), - network__node_id_secret: core::ptr::null_mut(), - network__bootstrap: core::ptr::null_mut(), - network__upnp: Default::default(), - network__natpmp: Default::default(), - network__enable_local_peer_scope: Default::default(), - network__restricted_nat_retries: Default::default(), - network__rpc__concurrency: Default::default(), - network__rpc__queue_size: Default::default(), - network__rpc__max_timestamp_behind_ms: core::ptr::null_mut(), - network__rpc__max_timestamp_ahead_ms: core::ptr::null_mut(), - network__rpc__timeout_ms: Default::default(), - network__rpc__max_route_hop_count: Default::default(), - network__dht__resolve_node_timeout_ms: core::ptr::null_mut(), - network__dht__resolve_node_count: Default::default(), - network__dht__resolve_node_fanout: Default::default(), - network__dht__max_find_node_count: Default::default(), - network__dht__get_value_timeout_ms: core::ptr::null_mut(), - network__dht__get_value_count: Default::default(), - network__dht__get_value_fanout: Default::default(), - network__dht__set_value_timeout_ms: core::ptr::null_mut(), - network__dht__set_value_count: Default::default(), - network__dht__set_value_fanout: Default::default(), - network__dht__min_peer_count: Default::default(), - network__dht__min_peer_refresh_time_ms: Default::default(), - network__dht__validate_dial_info_receipt_time_ms: Default::default(), - network__protocol__udp__enabled: Default::default(), - network__protocol__udp__socket_pool_size: Default::default(), - network__protocol__udp__listen_address: core::ptr::null_mut(), - network__protocol__udp__public_address: core::ptr::null_mut(), - network__protocol__tcp__connect: Default::default(), - network__protocol__tcp__listen: Default::default(), - network__protocol__tcp__max_connections: Default::default(), - network__protocol__tcp__listen_address: core::ptr::null_mut(), - network__protocol__tcp__public_address: core::ptr::null_mut(), - network__protocol__ws__connect: Default::default(), - network__protocol__ws__listen: Default::default(), - network__protocol__ws__max_connections: Default::default(), - network__protocol__ws__listen_address: core::ptr::null_mut(), - network__protocol__ws__path: core::ptr::null_mut(), - network__protocol__ws__url: core::ptr::null_mut(), - network__protocol__wss__connect: Default::default(), - network__protocol__wss__max_connections: Default::default(), - network__leases__max_server_signal_leases: Default::default(), - network__leases__max_server_relay_leases: Default::default(), - network__leases__max_client_signal_leases: Default::default(), - network__leases__max_client_relay_leases: Default::default(), - } - } -} + fn new_with_null_ptr() -> Self { + Self { program_name: core::ptr::null_mut(), +veilid_namespace: core::ptr::null_mut(), +capabilities__protocol_udp: Default::default(), +capabilities__protocol_connect_tcp: Default::default(), +capabilities__protocol_accept_tcp: Default::default(), +capabilities__protocol_connect_ws: Default::default(), +capabilities__protocol_accept_ws: Default::default(), +capabilities__protocol_connect_wss: Default::default(), +capabilities__protocol_accept_wss: Default::default(), +protected_store__allow_insecure_fallback: Default::default(), +protected_store__always_use_insecure_storage: Default::default(), +protected_store__insecure_fallback_directory: core::ptr::null_mut(), +protected_store__delete: Default::default(), +table_store__directory: core::ptr::null_mut(), +table_store__delete: Default::default(), +block_store__directory: core::ptr::null_mut(), +block_store__delete: Default::default(), +network__max_connections: Default::default(), +network__connection_initial_timeout_ms: Default::default(), +network__node_id: core::ptr::null_mut(), +network__node_id_secret: core::ptr::null_mut(), +network__bootstrap: core::ptr::null_mut(), +network__upnp: Default::default(), +network__natpmp: Default::default(), +network__enable_local_peer_scope: Default::default(), +network__restricted_nat_retries: Default::default(), +network__rpc__concurrency: Default::default(), +network__rpc__queue_size: Default::default(), +network__rpc__max_timestamp_behind_ms: core::ptr::null_mut(), +network__rpc__max_timestamp_ahead_ms: core::ptr::null_mut(), +network__rpc__timeout_ms: Default::default(), +network__rpc__max_route_hop_count: Default::default(), +network__dht__resolve_node_timeout_ms: core::ptr::null_mut(), +network__dht__resolve_node_count: Default::default(), +network__dht__resolve_node_fanout: Default::default(), +network__dht__max_find_node_count: Default::default(), +network__dht__get_value_timeout_ms: core::ptr::null_mut(), +network__dht__get_value_count: Default::default(), +network__dht__get_value_fanout: Default::default(), +network__dht__set_value_timeout_ms: core::ptr::null_mut(), +network__dht__set_value_count: Default::default(), +network__dht__set_value_fanout: Default::default(), +network__dht__min_peer_count: Default::default(), +network__dht__min_peer_refresh_time_ms: Default::default(), +network__dht__validate_dial_info_receipt_time_ms: Default::default(), +network__protocol__udp__enabled: Default::default(), +network__protocol__udp__socket_pool_size: Default::default(), +network__protocol__udp__listen_address: core::ptr::null_mut(), +network__protocol__udp__public_address: core::ptr::null_mut(), +network__protocol__tcp__connect: Default::default(), +network__protocol__tcp__listen: Default::default(), +network__protocol__tcp__max_connections: Default::default(), +network__protocol__tcp__listen_address: core::ptr::null_mut(), +network__protocol__tcp__public_address: core::ptr::null_mut(), +network__protocol__ws__connect: Default::default(), +network__protocol__ws__listen: Default::default(), +network__protocol__ws__max_connections: Default::default(), +network__protocol__ws__listen_address: core::ptr::null_mut(), +network__protocol__ws__path: core::ptr::null_mut(), +network__protocol__ws__url: core::ptr::null_mut(), +network__protocol__wss__connect: Default::default(), +network__protocol__wss__max_connections: Default::default(), +network__leases__max_server_signal_leases: Default::default(), +network__leases__max_server_relay_leases: Default::default(), +network__leases__max_client_signal_leases: Default::default(), +network__leases__max_client_relay_leases: Default::default(), } + } + } -// Section: impl IntoDart + // Section: impl IntoDart + impl support::IntoDart for AttachmentState { - fn into_dart(self) -> support::DartCObject { - match self { - Self::Detached => 0, - Self::Attaching => 1, - Self::AttachedWeak => 2, - Self::AttachedGood => 3, - Self::AttachedStrong => 4, - Self::FullyAttached => 5, - Self::OverAttached => 6, - Self::Detaching => 7, - } - .into_dart() - } -} + fn into_dart(self) -> support::DartCObject { + match self { + Self::Detached => 0, +Self::Attaching => 1, +Self::AttachedWeak => 2, +Self::AttachedGood => 3, +Self::AttachedStrong => 4, +Self::FullyAttached => 5, +Self::OverAttached => 6, +Self::Detaching => 7, + }.into_dart() + } + } + + + + + + + + impl support::IntoDart for VeilidState { - fn into_dart(self) -> support::DartCObject { - vec![self.attachment.into_dart()].into_dart() - } -} -impl support::IntoDartExceptPrimitive for VeilidState {} + fn into_dart(self) -> support::DartCObject { + vec![ + self.attachment.into_dart() + ].into_dart() + } + } + impl support::IntoDartExceptPrimitive for VeilidState {} + impl support::IntoDart for VeilidUpdate { - fn into_dart(self) -> support::DartCObject { - match self { - Self::Attachment(field0) => vec![0.into_dart(), field0.into_dart()], - } - .into_dart() - } -} + fn into_dart(self) -> support::DartCObject { + match self { + Self::Attachment(field0) => vec![0.into_dart(),field0.into_dart()], + }.into_dart() + } + } impl support::IntoDart for VeilidVersion { - fn into_dart(self) -> support::DartCObject { - vec![ - self.major.into_dart(), - self.minor.into_dart(), - self.patch.into_dart(), - ] - .into_dart() - } -} -impl support::IntoDartExceptPrimitive for VeilidVersion {} + fn into_dart(self) -> support::DartCObject { + vec![ + self.major.into_dart(), +self.minor.into_dart(), +self.patch.into_dart() + ].into_dart() + } + } + impl support::IntoDartExceptPrimitive for VeilidVersion {} + -// Section: executor -support::lazy_static! { - pub static ref FLUTTER_RUST_BRIDGE_HANDLER: support::DefaultHandler = Default::default(); -} + // Section: executor + support::lazy_static! { + pub static ref FLUTTER_RUST_BRIDGE_HANDLER: support::DefaultHandler = Default::default(); + } + -// Section: sync execution mode utility + // Section: sync execution mode utility + + #[no_mangle] + pub extern "C" fn free_WireSyncReturnStruct(val: support::WireSyncReturnStruct) { + unsafe { let _ = support::vec_from_leak_ptr(val.ptr, val.len); } + } + -#[no_mangle] -pub extern "C" fn free_WireSyncReturnStruct(val: support::WireSyncReturnStruct) { - unsafe { - let _ = support::vec_from_leak_ptr(val.ptr, val.len); - } -} + \ No newline at end of file