diff --git a/setup_macos.sh b/setup_macos.sh index 5530c238..7b9eeee8 100755 --- a/setup_macos.sh +++ b/setup_macos.sh @@ -109,4 +109,4 @@ if [ "$BREW_USER" == "" ]; then fi fi sudo -H -u $BREW_USER brew install capnp cmake wabt llvm protobuf openjdk@11 - +sudo gem install cocoapods diff --git a/veilid-flutter/example/lib/config.dart b/veilid-flutter/example/lib/config.dart index 6f155825..92020d68 100644 --- a/veilid-flutter/example/lib/config.dart +++ b/veilid-flutter/example/lib/config.dart @@ -46,8 +46,8 @@ Future getDefaultVeilidConfig() async { clientWhitelistTimeoutMs: 300000, reverseConnectionReceiptTimeMs: 5000, holePunchReceiptTimeMs: 5000, - nodeId: "", - nodeIdSecret: "", + nodeId: null, + nodeIdSecret: null, bootstrap: kIsWeb ? ["ws://bootstrap.dev.veilid.net:5150/ws"] : ["bootstrap.dev.veilid.net"], diff --git a/veilid-flutter/example/macos/Podfile b/veilid-flutter/example/macos/Podfile index dade8dfa..e8d38fb2 100644 --- a/veilid-flutter/example/macos/Podfile +++ b/veilid-flutter/example/macos/Podfile @@ -33,8 +33,27 @@ target 'Runner' do flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) end +require 'json' +require 'pathname' +require 'fileutils' +workspace_dir = File.dirname(JSON.parse(`cargo locate-project --workspace`)['root']) +cargo_target_dir = File.join(workspace_dir, 'target') +lipo_dir= File.join(cargo_target_dir, 'lipo-darwin') +veilid_flutter = File.join(lipo_dir, 'libveilid_flutter.dylib') +FileUtils.mkdir_p(lipo_dir) +FileUtils.touch(veilid_flutter) + post_install do |installer| - installer.pods_project.targets.each do |target| + project = installer.pods_project + reference = project.add_file_reference(veilid_flutter, project.main_group["Frameworks"]) + + project.targets.each do |target| flutter_additional_macos_build_settings(target) + + if (target.is_a? Xcodeproj::Project::Object::PBXNativeTarget) && target.name == "veilid" + target.resources_build_phase.add_file_reference(reference) + end + end + end diff --git a/veilid-flutter/example/macos/Podfile.lock b/veilid-flutter/example/macos/Podfile.lock index e7ce6ebc..89fa7fcc 100644 --- a/veilid-flutter/example/macos/Podfile.lock +++ b/veilid-flutter/example/macos/Podfile.lock @@ -23,6 +23,6 @@ SPEC CHECKSUMS: path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 veilid: f2b3b5b3ac8cd93fc5443ab830d5153575dacf36 -PODFILE CHECKSUM: 554ea19fe44240be72b76305f41eaaeb731ea434 +PODFILE CHECKSUM: 4ccbce18f83e3892ae919944d8803eb392455cb9 COCOAPODS: 1.11.3 diff --git a/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj b/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj index a5003451..7a30c68c 100644 --- a/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj +++ b/veilid-flutter/example/macos/Runner.xcodeproj/project.pbxproj @@ -159,7 +159,6 @@ BC8854C07DAB1433F44BB126 /* Pods-Runner.release.xcconfig */, 269F3F1A4251F82E97C46D1F /* Pods-Runner.profile.xcconfig */, ); - name = Pods; path = Pods; sourceTree = ""; }; @@ -289,7 +288,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire\n"; }; 6C9005308B324F4C4A5637A3 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/veilid-flutter/lib/veilid.dart b/veilid-flutter/lib/veilid.dart index 219dad64..c9d83087 100644 --- a/veilid-flutter/lib/veilid.dart +++ b/veilid-flutter/lib/veilid.dart @@ -1556,6 +1556,10 @@ abstract class VeilidAPIException implements Exception { return VeilidAPIExceptionMissingArgument( json["context"], json["argument"]); } + case "Generic": + { + return VeilidAPIExceptionGeneric(json["message"]); + } default: { throw VeilidAPIExceptionInternal( @@ -1681,6 +1685,18 @@ class VeilidAPIExceptionMissingArgument implements VeilidAPIException { VeilidAPIExceptionMissingArgument(this.context, this.argument); } +class VeilidAPIExceptionGeneric implements VeilidAPIException { + final String message; + + @override + String toString() { + return "VeilidAPIException: Generic (message: $message)"; + } + + // + VeilidAPIExceptionGeneric(this.message); +} + ////////////////////////////////////// /// VeilidVersion diff --git a/veilid-flutter/lib/veilid_ffi.dart b/veilid-flutter/lib/veilid_ffi.dart index c3ef7a4f..994e61e0 100644 --- a/veilid-flutter/lib/veilid_ffi.dart +++ b/veilid-flutter/lib/veilid_ffi.dart @@ -16,7 +16,7 @@ const _base = 'veilid_flutter'; final _path = Platform.isWindows ? '$_base.dll' : Platform.isMacOS - ? 'lib$_base.dylib' + ? 'veilid.framework/Resources/lib$_base.dylib' : 'lib$_base.so'; final _dylib = Platform.isIOS ? DynamicLibrary.process() : DynamicLibrary.open(_path);