diff --git a/demo/ios/Flutter/AppFrameworkInfo.plist b/demo/ios/Flutter/AppFrameworkInfo.plist index 7c5696400..391a902b2 100644 --- a/demo/ios/Flutter/AppFrameworkInfo.plist +++ b/demo/ios/Flutter/AppFrameworkInfo.plist @@ -20,7 +20,5 @@ ???? CFBundleVersion 1.0 - MinimumOSVersion - 12.0 diff --git a/demo/ios/Flutter/Debug.xcconfig b/demo/ios/Flutter/Debug.xcconfig index ec97fc6f3..592ceee85 100644 --- a/demo/ios/Flutter/Debug.xcconfig +++ b/demo/ios/Flutter/Debug.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/demo/ios/Flutter/Release.xcconfig b/demo/ios/Flutter/Release.xcconfig index c4855bfe2..592ceee85 100644 --- a/demo/ios/Flutter/Release.xcconfig +++ b/demo/ios/Flutter/Release.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/demo/ios/Podfile b/demo/ios/Podfile deleted file mode 100644 index d97f17e22..000000000 --- a/demo/ios/Podfile +++ /dev/null @@ -1,44 +0,0 @@ -# Uncomment this line to define a global platform for your project -# platform :ios, '12.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) - end -end diff --git a/demo/ios/Podfile.lock b/demo/ios/Podfile.lock deleted file mode 100644 index 2a4d8ae1e..000000000 --- a/demo/ios/Podfile.lock +++ /dev/null @@ -1,89 +0,0 @@ -PODS: - - DKImagePickerController/Core (4.3.9): - - DKImagePickerController/ImageDataManager - - DKImagePickerController/Resource - - DKImagePickerController/ImageDataManager (4.3.9) - - DKImagePickerController/PhotoGallery (4.3.9): - - DKImagePickerController/Core - - DKPhotoGallery - - DKImagePickerController/Resource (4.3.9) - - DKPhotoGallery (0.0.19): - - DKPhotoGallery/Core (= 0.0.19) - - DKPhotoGallery/Model (= 0.0.19) - - DKPhotoGallery/Preview (= 0.0.19) - - DKPhotoGallery/Resource (= 0.0.19) - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Core (0.0.19): - - DKPhotoGallery/Model - - DKPhotoGallery/Preview - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Model (0.0.19): - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Preview (0.0.19): - - DKPhotoGallery/Model - - DKPhotoGallery/Resource - - SDWebImage - - SwiftyGif - - DKPhotoGallery/Resource (0.0.19): - - SDWebImage - - SwiftyGif - - file_picker (0.0.1): - - DKImagePickerController/PhotoGallery - - Flutter - - Flutter (1.0.0) - - path_provider_foundation (0.0.1): - - Flutter - - FlutterMacOS - - SDWebImage (5.19.0): - - SDWebImage/Core (= 5.19.0) - - SDWebImage/Core (5.19.0) - - sqflite (0.0.3): - - Flutter - - FlutterMacOS - - SwiftyGif (5.4.5) - - url_launcher_ios (0.0.1): - - Flutter - -DEPENDENCIES: - - file_picker (from `.symlinks/plugins/file_picker/ios`) - - Flutter (from `Flutter`) - - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - - sqflite (from `.symlinks/plugins/sqflite/darwin`) - - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - -SPEC REPOS: - trunk: - - DKImagePickerController - - DKPhotoGallery - - SDWebImage - - SwiftyGif - -EXTERNAL SOURCES: - file_picker: - :path: ".symlinks/plugins/file_picker/ios" - Flutter: - :path: Flutter - path_provider_foundation: - :path: ".symlinks/plugins/path_provider_foundation/darwin" - sqflite: - :path: ".symlinks/plugins/sqflite/darwin" - url_launcher_ios: - :path: ".symlinks/plugins/url_launcher_ios/ios" - -SPEC CHECKSUMS: - DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c - DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 - file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 - Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 - SDWebImage: 981fd7e860af070920f249fd092420006014c3eb - sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec - SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 - url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe - -PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 - -COCOAPODS: 1.15.2 diff --git a/demo/ios/Runner.xcodeproj/project.pbxproj b/demo/ios/Runner.xcodeproj/project.pbxproj index bc8f48773..922252fd2 100644 --- a/demo/ios/Runner.xcodeproj/project.pbxproj +++ b/demo/ios/Runner.xcodeproj/project.pbxproj @@ -10,12 +10,11 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 670C29666A950342EB28E12D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 16308D384DED0ADBA35F6B73 /* Pods_Runner.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 78D5B995AF42B8CA0FB6C453 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A1B4336BF3609AC3A0E65B2 /* Pods_RunnerTests.framework */; }; 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 */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -44,16 +43,11 @@ /* Begin PBXFileReference section */ 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 = ""; }; - 16308D384DED0ADBA35F6B73 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 22528DAC27A9B2F331ECBD8D /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 386C428226C5D7E3E0E095C9 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 4A1B4336BF3609AC3A0E65B2 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = ""; }; - 79AFD802B83878E2675FBFCF /* 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 = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -62,9 +56,7 @@ 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 = ""; }; - A0B45CE0EFE389E99FC51BF1 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - B08EDFBD01FC3FDB59280474 /* 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 = ""; }; - CA026C14BC6F4F3C81DD48A0 /* 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 = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -72,7 +64,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 78D5B995AF42B8CA0FB6C453 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -80,7 +71,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 670C29666A950342EB28E12D /* Pods_Runner.framework in Frameworks */, + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -98,6 +89,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, @@ -113,8 +105,6 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, - D64547297FA8EA027BF2B50F /* Pods */, - D7B51951A935828BF40EB5E8 /* Frameworks */, ); sourceTree = ""; }; @@ -142,29 +132,6 @@ path = Runner; sourceTree = ""; }; - D64547297FA8EA027BF2B50F /* Pods */ = { - isa = PBXGroup; - children = ( - CA026C14BC6F4F3C81DD48A0 /* Pods-Runner.debug.xcconfig */, - B08EDFBD01FC3FDB59280474 /* Pods-Runner.release.xcconfig */, - 79AFD802B83878E2675FBFCF /* Pods-Runner.profile.xcconfig */, - A0B45CE0EFE389E99FC51BF1 /* Pods-RunnerTests.debug.xcconfig */, - 386C428226C5D7E3E0E095C9 /* Pods-RunnerTests.release.xcconfig */, - 22528DAC27A9B2F331ECBD8D /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - D7B51951A935828BF40EB5E8 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 16308D384DED0ADBA35F6B73 /* Pods_Runner.framework */, - 4A1B4336BF3609AC3A0E65B2 /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -172,7 +139,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - 955165415BDE0B6FC2A9C44B /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, 334F36450A62B78C93AE3299 /* Frameworks */, @@ -188,17 +154,18 @@ productType = "com.apple.product-type.bundle.unit-test"; }; 97C146ED1CF9000F007C117D /* Runner */ = { + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 4C750108331A8394CD426D96 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - F6F22B48ABA57741F0FE11D5 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -213,6 +180,9 @@ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; @@ -286,50 +256,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 4C750108331A8394CD426D96 /* [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; - }; - 955165415BDE0B6FC2A9C44B /* [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-RunnerTests-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; - }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -345,23 +271,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - F6F22B48ABA57741F0FE11D5 /* [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; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -455,7 +364,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -488,7 +397,6 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A0B45CE0EFE389E99FC51BF1 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -506,7 +414,6 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 386C428226C5D7E3E0E095C9 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -522,7 +429,6 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 22528DAC27A9B2F331ECBD8D /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -585,7 +491,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -636,7 +542,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -726,6 +632,18 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8e3ca5dfe..c3fedb29c 100644 --- a/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + diff --git a/demo/ios/Runner.xcworkspace/contents.xcworkspacedata b/demo/ios/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc14c..1d526a16e 100644 --- a/demo/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/demo/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/demo/ios/Runner/AppDelegate.swift b/demo/ios/Runner/AppDelegate.swift index 626664468..c30b367ec 100644 --- a/demo/ios/Runner/AppDelegate.swift +++ b/demo/ios/Runner/AppDelegate.swift @@ -2,12 +2,15 @@ import Flutter import UIKit @main -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } } diff --git a/demo/ios/Runner/Info.plist b/demo/ios/Runner/Info.plist index 5458fc418..3ef4d0d39 100644 --- a/demo/ios/Runner/Info.plist +++ b/demo/ios/Runner/Info.plist @@ -2,6 +2,8 @@ + CADisableMinimumFrameDurationOnPhone + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName @@ -24,6 +26,29 @@ $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneConfigurationName + flutter + UISceneDelegateClassName + FlutterSceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -41,9 +66,5 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - CADisableMinimumFrameDurationOnPhone - - UIApplicationSupportsIndirectInputEvents - diff --git a/demo/linux/flutter/generated_plugin_registrant.cc b/demo/linux/flutter/generated_plugin_registrant.cc index 139f958d8..29f711380 100644 --- a/demo/linux/flutter/generated_plugin_registrant.cc +++ b/demo/linux/flutter/generated_plugin_registrant.cc @@ -7,24 +7,16 @@ #include "generated_plugin_registrant.h" #include -#include #include -#include #include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) file_saver_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FileSaverPlugin"); file_saver_plugin_register_with_registrar(file_saver_registrar); - g_autoptr(FlPluginRegistrar) irondash_engine_context_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "IrondashEngineContextPlugin"); - irondash_engine_context_plugin_register_with_registrar(irondash_engine_context_registrar); g_autoptr(FlPluginRegistrar) screen_retriever_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin"); screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar); - g_autoptr(FlPluginRegistrar) super_native_extensions_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "SuperNativeExtensionsPlugin"); - super_native_extensions_plugin_register_with_registrar(super_native_extensions_registrar); g_autoptr(FlPluginRegistrar) window_manager_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin"); window_manager_plugin_register_with_registrar(window_manager_registrar); diff --git a/demo/linux/flutter/generated_plugins.cmake b/demo/linux/flutter/generated_plugins.cmake index 70278be3c..e161ef69f 100644 --- a/demo/linux/flutter/generated_plugins.cmake +++ b/demo/linux/flutter/generated_plugins.cmake @@ -4,9 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST file_saver - irondash_engine_context screen_retriever_linux - super_native_extensions window_manager ) diff --git a/demo/macos/Flutter/Flutter-Debug.xcconfig b/demo/macos/Flutter/Flutter-Debug.xcconfig index 4b81f9b2d..c2efd0b60 100644 --- a/demo/macos/Flutter/Flutter-Debug.xcconfig +++ b/demo/macos/Flutter/Flutter-Debug.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/demo/macos/Flutter/Flutter-Release.xcconfig b/demo/macos/Flutter/Flutter-Release.xcconfig index 5caa9d157..c2efd0b60 100644 --- a/demo/macos/Flutter/Flutter-Release.xcconfig +++ b/demo/macos/Flutter/Flutter-Release.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/demo/macos/Flutter/GeneratedPluginRegistrant.swift b/demo/macos/Flutter/GeneratedPluginRegistrant.swift index dccf57ee9..7106eb680 100644 --- a/demo/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/demo/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,22 +5,16 @@ import FlutterMacOS import Foundation -import device_info_plus import file_saver -import irondash_engine_context import screen_retriever_macos import sqflite_darwin -import super_native_extensions import webview_flutter_wkwebview import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin")) - IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin")) ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) - SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin")) WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin")) WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin")) } diff --git a/demo/macos/Podfile b/demo/macos/Podfile deleted file mode 100644 index 8f6114fb9..000000000 --- a/demo/macos/Podfile +++ /dev/null @@ -1,49 +0,0 @@ -platform :osx, '12.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_macos_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_macos_build_settings(target) - # Pods such as FlutterMacOS declare 10.15, which current Xcode rejects. - target.build_configurations.each do |config| - if config.build_settings['MACOSX_DEPLOYMENT_TARGET'].to_f < 12.0 - config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.0' - end - end - end -end diff --git a/demo/macos/Podfile.lock b/demo/macos/Podfile.lock deleted file mode 100644 index 6350c7870..000000000 --- a/demo/macos/Podfile.lock +++ /dev/null @@ -1,28 +0,0 @@ -PODS: - - FlutterMacOS (1.0.0) - - irondash_engine_context (0.0.1): - - FlutterMacOS - - super_native_extensions (0.0.1): - - FlutterMacOS - -DEPENDENCIES: - - FlutterMacOS (from `Flutter/ephemeral`) - - irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`) - - super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`) - -EXTERNAL SOURCES: - FlutterMacOS: - :path: Flutter/ephemeral - irondash_engine_context: - :path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos - super_native_extensions: - :path: Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos - -SPEC CHECKSUMS: - FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 - irondash_engine_context: 893c7d96d20ce361d7e996f39d360c4c2f9869ba - super_native_extensions: c2795d6d9aedf4a79fae25cb6160b71b50549189 - -PODFILE CHECKSUM: 65eaf14d02135103e2a5f4163e68d9585407bfc5 - -COCOAPODS: 1.17.0 diff --git a/demo/macos/Runner.xcodeproj/project.pbxproj b/demo/macos/Runner.xcodeproj/project.pbxproj index bc95e40ee..685c6ce19 100644 --- a/demo/macos/Runner.xcodeproj/project.pbxproj +++ b/demo/macos/Runner.xcodeproj/project.pbxproj @@ -27,9 +27,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 */; }; - 3C7F02F531EE8B8E96FDCD85 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67704BDC61896D7D1ED432F9 /* Pods_Runner.framework */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; - FA047FDAACF132C8FDCAE309 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E600C98B2532AC2785701EE /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -63,8 +61,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 1E600C98B2532AC2785701EE /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 21511E81602A801A8E21C7CD /* 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 = ""; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; @@ -81,15 +77,9 @@ 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 = ""; }; - 52F74288AF9AF86ABCFE970F /* 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 = ""; }; - 581C05F03DD9D309B121AAEE /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - 67704BDC61896D7D1ED432F9 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 70C3E6D656304B99FD0B1289 /* 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 = ""; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 82524DD4DD10587301372C85 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - D8DAC3BC7E807CD0F32FD395 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -97,7 +87,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - FA047FDAACF132C8FDCAE309 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -106,7 +95,6 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - 3C7F02F531EE8B8E96FDCD85 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -139,8 +127,6 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - EE39A6A2A55017D82C9C3078 /* Pods */, ); sourceTree = ""; }; @@ -189,29 +175,6 @@ path = Runner; sourceTree = ""; }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 67704BDC61896D7D1ED432F9 /* Pods_Runner.framework */, - 1E600C98B2532AC2785701EE /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - EE39A6A2A55017D82C9C3078 /* Pods */ = { - isa = PBXGroup; - children = ( - 21511E81602A801A8E21C7CD /* Pods-Runner.debug.xcconfig */, - 52F74288AF9AF86ABCFE970F /* Pods-Runner.release.xcconfig */, - 70C3E6D656304B99FD0B1289 /* Pods-Runner.profile.xcconfig */, - D8DAC3BC7E807CD0F32FD395 /* Pods-RunnerTests.debug.xcconfig */, - 82524DD4DD10587301372C85 /* Pods-RunnerTests.release.xcconfig */, - 581C05F03DD9D309B121AAEE /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -219,7 +182,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - E1EAB9F2FA8DCA9689F733BC /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -238,13 +200,11 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 1EDCDE1967A52C0C5A85096D /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 8A14AB4F804B7CAA2E64DF2E /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -333,28 +293,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1EDCDE1967A52C0C5A85096D /* [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; - }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -393,45 +331,6 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 8A14AB4F804B7CAA2E64DF2E /* [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; - }; - E1EAB9F2FA8DCA9689F733BC /* [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-RunnerTests-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 */ @@ -483,7 +382,6 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D8DAC3BC7E807CD0F32FD395 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -498,7 +396,6 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 82524DD4DD10587301372C85 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -513,7 +410,6 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 581C05F03DD9D309B121AAEE /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; diff --git a/demo/macos/Runner.xcworkspace/contents.xcworkspacedata b/demo/macos/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc14c..1d526a16e 100644 --- a/demo/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/demo/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/demo/windows/flutter/generated_plugin_registrant.cc b/demo/windows/flutter/generated_plugin_registrant.cc index 4ab6de584..79a0dd3e5 100644 --- a/demo/windows/flutter/generated_plugin_registrant.cc +++ b/demo/windows/flutter/generated_plugin_registrant.cc @@ -7,20 +7,14 @@ #include "generated_plugin_registrant.h" #include -#include #include -#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { FileSaverPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FileSaverPlugin")); - IrondashEngineContextPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi")); ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi")); - SuperNativeExtensionsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi")); WindowManagerPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("WindowManagerPlugin")); } diff --git a/demo/windows/flutter/generated_plugins.cmake b/demo/windows/flutter/generated_plugins.cmake index e2df9db0e..be4e098e4 100644 --- a/demo/windows/flutter/generated_plugins.cmake +++ b/demo/windows/flutter/generated_plugins.cmake @@ -4,9 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST file_saver - irondash_engine_context screen_retriever_windows - super_native_extensions window_manager ) diff --git a/packages/playground/macos/Flutter/Flutter-Debug.xcconfig b/packages/playground/macos/Flutter/Flutter-Debug.xcconfig index 4b81f9b2d..c2efd0b60 100644 --- a/packages/playground/macos/Flutter/Flutter-Debug.xcconfig +++ b/packages/playground/macos/Flutter/Flutter-Debug.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/playground/macos/Flutter/Flutter-Release.xcconfig b/packages/playground/macos/Flutter/Flutter-Release.xcconfig index 5caa9d157..c2efd0b60 100644 --- a/packages/playground/macos/Flutter/Flutter-Release.xcconfig +++ b/packages/playground/macos/Flutter/Flutter-Release.xcconfig @@ -1,2 +1 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/playground/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/playground/macos/Flutter/GeneratedPluginRegistrant.swift index e302d4800..00f174d18 100644 --- a/packages/playground/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/packages/playground/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,12 +6,9 @@ import FlutterMacOS import Foundation import audioplayers_darwin -import device_info_plus import file_saver -import irondash_engine_context import screen_retriever_macos import sqflite_darwin -import super_native_extensions import url_launcher_macos import video_player_avfoundation import webview_flutter_wkwebview @@ -19,12 +16,9 @@ import window_manager func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin")) - DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin")) - IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin")) ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) - SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) VideoPlayerPlugin.register(with: registry.registrar(forPlugin: "VideoPlayerPlugin")) WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin")) diff --git a/packages/playground/macos/Podfile b/packages/playground/macos/Podfile deleted file mode 100644 index 505f21c7a..000000000 --- a/packages/playground/macos/Podfile +++ /dev/null @@ -1,48 +0,0 @@ -platform :osx, '12.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_macos_podfile_setup - -target 'Runner' do - use_frameworks! - - flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) - target 'RunnerTests' do - inherit! :search_paths - end -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_macos_build_settings(target) - # Pods such as FlutterMacOS declare 10.15, which current Xcode rejects. - target.build_configurations.each do |config| - if config.build_settings['MACOSX_DEPLOYMENT_TARGET'].to_f < 12.0 - config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.0' - end - end - end -end diff --git a/packages/playground/macos/Podfile.lock b/packages/playground/macos/Podfile.lock deleted file mode 100644 index 44d2e9a37..000000000 --- a/packages/playground/macos/Podfile.lock +++ /dev/null @@ -1,28 +0,0 @@ -PODS: - - FlutterMacOS (1.0.0) - - irondash_engine_context (0.0.1): - - FlutterMacOS - - super_native_extensions (0.0.1): - - FlutterMacOS - -DEPENDENCIES: - - FlutterMacOS (from `Flutter/ephemeral`) - - irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`) - - super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`) - -EXTERNAL SOURCES: - FlutterMacOS: - :path: Flutter/ephemeral - irondash_engine_context: - :path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos - super_native_extensions: - :path: Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos - -SPEC CHECKSUMS: - FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 - irondash_engine_context: 893c7d96d20ce361d7e996f39d360c4c2f9869ba - super_native_extensions: c2795d6d9aedf4a79fae25cb6160b71b50549189 - -PODFILE CHECKSUM: e7bfde0a53182c565495ad24a8a3d2ca8a57b768 - -COCOAPODS: 1.17.0 diff --git a/packages/playground/macos/Runner.xcodeproj/project.pbxproj b/packages/playground/macos/Runner.xcodeproj/project.pbxproj index db662882e..709b30219 100644 --- a/packages/playground/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/playground/macos/Runner.xcodeproj/project.pbxproj @@ -27,9 +27,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 */; }; - 607761A9960048984A5A4E6F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B2CD240576EF27BE303B514 /* Pods_Runner.framework */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; - B495E5BD97984C6EF0C5B96A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA381DA986524D8EF0AA2DEF /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -63,8 +61,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 1B2CD240576EF27BE303B514 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 2B336C8BC1FE0C09D4DD0753 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; @@ -81,15 +77,9 @@ 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 = ""; }; - 48B89F3DB390ACC609FA2E21 /* 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 = ""; }; - 59FFBDFBB38319137F6C084B /* 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 = ""; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; - 79792DA5E87C85B8068E045D /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; - 7E9A6C0725AE267ECBE50B9D /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - DA381DA986524D8EF0AA2DEF /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DBDEAEBB3B165959B92AA66F /* 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -97,7 +87,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B495E5BD97984C6EF0C5B96A /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -106,7 +95,6 @@ buildActionMask = 2147483647; files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, - 607761A9960048984A5A4E6F /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -139,8 +127,6 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, - D73912EC22F37F3D000D13A0 /* Frameworks */, - 97D196F8A91B306EF7A8B9E1 /* Pods */, ); sourceTree = ""; }; @@ -189,29 +175,6 @@ path = Runner; sourceTree = ""; }; - 97D196F8A91B306EF7A8B9E1 /* Pods */ = { - isa = PBXGroup; - children = ( - DBDEAEBB3B165959B92AA66F /* Pods-Runner.debug.xcconfig */, - 59FFBDFBB38319137F6C084B /* Pods-Runner.release.xcconfig */, - 48B89F3DB390ACC609FA2E21 /* Pods-Runner.profile.xcconfig */, - 7E9A6C0725AE267ECBE50B9D /* Pods-RunnerTests.debug.xcconfig */, - 2B336C8BC1FE0C09D4DD0753 /* Pods-RunnerTests.release.xcconfig */, - 79792DA5E87C85B8068E045D /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - D73912EC22F37F3D000D13A0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1B2CD240576EF27BE303B514 /* Pods_Runner.framework */, - DA381DA986524D8EF0AA2DEF /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -219,7 +182,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - 578E78DF22ACC6449EDD2890 /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -238,13 +200,11 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - A817824FB62B3558AA381ABF /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 45ECCD83F1130CE08987BEC1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -371,67 +331,6 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 45ECCD83F1130CE08987BEC1 /* [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; - }; - 578E78DF22ACC6449EDD2890 /* [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-RunnerTests-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; - }; - A817824FB62B3558AA381ABF /* [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 */ @@ -483,7 +382,6 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7E9A6C0725AE267ECBE50B9D /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -498,7 +396,6 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2B336C8BC1FE0C09D4DD0753 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; @@ -513,7 +410,6 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 79792DA5E87C85B8068E045D /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; diff --git a/packages/playground/macos/Runner.xcworkspace/contents.xcworkspacedata b/packages/playground/macos/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc14c..1d526a16e 100644 --- a/packages/playground/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/packages/playground/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,7 +4,4 @@ - - diff --git a/packages/superdeck/CHANGELOG.md b/packages/superdeck/CHANGELOG.md index 4f10b64df..b52846b0e 100644 --- a/packages/superdeck/CHANGELOG.md +++ b/packages/superdeck/CHANGELOG.md @@ -1,5 +1,10 @@ ## 1.0.0 +- Drop the `syntax_highlight` dependency and vendor its highlighter. Apps no + longer pull in `super_clipboard`, `super_native_extensions`, or + `irondash_engine_context`, so macOS and iOS builds need no CocoaPods and + Android builds avoid that plugin's 16 KB page-size crash. Highlighted output + is unchanged. - **Breaking:** remove `superDeckAspectRatio`; it had no production use. Use `superDeckSlideSize` for slide geometry. diff --git a/packages/superdeck/assets/grammars/dart.json b/packages/superdeck/assets/grammars/dart.json new file mode 100644 index 000000000..20167be63 --- /dev/null +++ b/packages/superdeck/assets/grammars/dart.json @@ -0,0 +1,534 @@ +{ + "name": "Dart", + "version": "1.2.3", + "fileTypes": [ + "dart" + ], + "scopeName": "source.dart", + + "foldingStartMarker": "\\{\\s*$", + "foldingStopMarker": "^\\s*\\}", + + "patterns": [ + { + "name": "meta.preprocessor.script.dart", + "match": "^(#!.*)$" + }, + { + "name": "meta.declaration.dart", + "begin": "^\\w*\\b(library|import|part of|part|export)\\b", + "beginCaptures": { + "0": { + "name": "keyword.other.import.dart" + } + }, + "end": ";", + "endCaptures": { + "0": { + "name": "punctuation.terminator.dart" + } + }, + "patterns": [ + { + "include": "#strings" + }, + { + "include": "#comments" + }, + { + "name": "keyword.other.import.dart", + "match": "\\b(as|show|hide)\\b" + }, + { + "name": "keyword.control.dart", + "match": "\\b(if)\\b" + } + ] + }, + { + "include": "#comments" + }, + { + "include": "#punctuation" + }, + { + "include": "#annotations" + }, + { + "include": "#keywords" + }, + { + "include": "#constants-and-special-vars" + }, + { + "include": "#operators" + }, + { + "include": "#strings" + } + ], + + "repository": { + "dartdoc": { + "patterns": [ + { + "match": "(\\[.*?\\])", + "captures": { + "0": { + "name": "variable.name.source.dart" + } + } + }, + { + "match": "^ {4,}(?![ \\*]).*", + "captures": { + "0": { + "name": "variable.name.source.dart" + } + } + }, + { + "contentName": "variable.other.source.dart", + "begin": "```.*?$", + "end": "```" + }, + { + "match": "(`.*?`)", + "captures": { + "0": { + "name": "variable.other.source.dart" + } + } + }, + { + "match": "(`.*?`)", + "captures": { + "0": { + "name": "variable.other.source.dart" + } + } + }, + { + "match": "(\\* (( ).*))$", + "captures": { + "2": { + "name": "variable.other.source.dart" + } + } + } + ] + }, + "comments": { + "patterns": [ + { + "name": "comment.block.empty.dart", + "match": "/\\*\\*/", + "captures": { + "0": { + "name": "punctuation.definition.comment.dart" + } + } + }, + { + "include": "#comments-doc-oldschool" + }, + { + "include": "#comments-doc" + }, + { + "include": "#comments-inline" + } + ] + }, + "comments-doc-oldschool": { + "patterns": [ + { + "name": "comment.block.documentation.dart", + "begin": "/\\*\\*", + "end": "\\*/", + "patterns": [ + { + "include": "#comments-doc-oldschool" + }, + { + "include": "#comments-block" + }, + { + "include": "#dartdoc" + } + ] + } + ] + }, + "comments-doc": { + "patterns": [ + { + "name": "comment.block.documentation.dart", + "begin": "///", + "while": "^\\s*///", + "patterns": [ + { + "include": "#dartdoc" + } + ] + } + ] + }, + "comments-inline": { + "patterns": [ + { + "include": "#comments-block" + }, + { + "match": "((//).*)$", + "captures": { + "1": { + "name": "comment.line.double-slash.dart" + } + } + } + ] + }, + "comments-block": { + "patterns": [ + { + "name": "comment.block.dart", + "begin": "/\\*", + "end": "\\*/", + "patterns": [ + { + "include": "#comments-block" + } + ] + } + ] + }, + "annotations": { + "patterns": [ + { + "name": "storage.type.annotation.dart", + "match": "@[a-zA-Z]+" + } + ] + }, + "constants-and-special-vars": { + "patterns": [ + { + "name": "constant.language.dart", + "match": "(??]|,\\s*|\\s+extends\\s+)+>)?[!?]?\\(", + "captures": { + "1": { + "name": "entity.name.function.dart" + }, + "2": { + "patterns": [ + { + "include": "#type-args" + } + ] + } + } + } + ] + }, + "type-args": { + "begin": "(<)", + "end": "(>)", + "beginCaptures": { + "1": { + "name": "other.source.dart" + } + }, + "endCaptures": { + "1": { + "name": "other.source.dart" + } + }, + "patterns": [ + { + "include": "#class-identifier" + }, + { + "match": "," + }, + { + "name": "keyword.declaration.dart", + "match": "extends" + }, + { + "include": "#comments" + } + ] + }, + "keywords": { + "patterns": [ + { + "name": "keyword.cast.dart", + "match": "(?>>?|~|\\^|\\||&)" + }, + { + "name": "keyword.operator.assignment.bitwise.dart", + "match": "((&|\\^|\\||<<|>>>?)=)" + }, + { + "name": "keyword.operator.closure.dart", + "match": "(=>)" + }, + { + "name": "keyword.operator.comparison.dart", + "match": "(==|!=|<=?|>=?)" + }, + { + "name": "keyword.operator.assignment.arithmetic.dart", + "match": "(([+*/%-]|\\~)=)" + }, + { + "name": "keyword.operator.assignment.dart", + "match": "(=)" + }, + { + "name": "keyword.operator.increment-decrement.dart", + "match": "(\\-\\-|\\+\\+)" + }, + { + "name": "keyword.operator.arithmetic.dart", + "match": "(\\-|\\+|\\*|\\/|\\~\\/|%)" + }, + { + "name": "keyword.operator.logical.dart", + "match": "(!|&&|\\|\\|)" + } + ] + }, + "string-interp": { + "patterns": [ + { + "match": "\\$([a-zA-Z0-9_]+)", + "captures": { + "1": { + "name": "variable.parameter.dart" + } + } + }, + { + "name": "string.interpolated.expression.dart", + "begin": "\\$\\{", + "end": "\\}", + "patterns": [ + { + "include": "#constants-and-special-vars", + "name": "variable.parameter.dart" + }, + { + "include": "#strings" + }, + { + "name": "variable.parameter.dart", + "match": "[a-zA-Z0-9_]+" + } + ] + }, + { + "name": "constant.character.escape.dart", + "match": "\\\\." + } + ] + }, + "strings": { + "patterns": [ + { + "name": "string.interpolated.triple.double.dart", + "begin": "(?[ + TextStyle(color: Color(0xFF5caeef)), + TextStyle(color: Color(0xFFdfb976)), + TextStyle(color: Color(0xFFc172d9)), + TextStyle(color: Color(0xFF4fb1bc)), + TextStyle(color: Color(0xFF97c26c)), + TextStyle(color: Color(0xFFabb2c0)), +]; + +const _failedBracketStyle = TextStyle(color: Color(0xFFff0000)); + +// SUPERDECK PATCH: themes load from SuperDeck's assets. +const _defaultLightThemeFiles = [ + 'packages/superdeck/assets/highlight_themes/light_vs.json', + 'packages/superdeck/assets/highlight_themes/light_plus.json', +]; + +// SUPERDECK PATCH: themes load from SuperDeck's assets. +const _defaultDarkThemeFiles = [ + 'packages/superdeck/assets/highlight_themes/dark_vs.json', + 'packages/superdeck/assets/highlight_themes/dark_plus.json', +]; + +/// The [Highlighter] class can format a String of code and add syntax +/// highlighting in the form of a [TextSpan]. Currrently supports Dart and +/// YAML. Formatting style is similar to VS Code. +class Highlighter { + static final _cache = {}; + + /// Creates a [Highlighter] for the given [language] and [theme]. The + /// [language] must be one of the languages supported by this package, + /// unless it has been manually added. Before creating a [Highlighter], + /// you must call [initialize] with a list of languages to load. + Highlighter({ + required this.language, + required this.theme, + }) { + _grammar = _cache[language]!; + } + + /// Initializes the [Highlighter] with the given list of [languages]. This + /// must be called before creating any [Highlighter]s. Supported languages + /// are 'dart' and 'yaml'. + static Future initialize(List languages) async { + for (var language in languages) { + // SUPERDECK PATCH: grammars load from SuperDeck's assets. + var json = await rootBundle.loadString( + 'packages/superdeck/assets/grammars/$language.json', + ); + _cache[language] = Grammar.fromJson(jsonDecode(json)); + } + } + + /// Adds a custom language to the list of languages. + /// Associates a language [name] with a TextMate formatted [json] definition. + /// This must be called before creating any [Highlighter]s. + static void addLanguage(String name, String json) { + _cache.putIfAbsent(name, () => Grammar.fromJson(jsonDecode(json))); + } + + /// The language of this [Highlighter]. + final String language; + + late final Grammar _grammar; + + /// The [HighlighterTheme] used to style the code. + final HighlighterTheme theme; + + /// Formats the given [code] and returns a [TextSpan] with syntax + /// highlighting. + TextSpan highlight(String code) { + var spans = SpanParser.parse(_grammar, code); + var textSpans = []; + var bracketCounter = 0; + + int charPos = 0; + for (var span in spans) { + // Add any text before the span. + if (span.start > charPos) { + var text = code.substring(charPos, span.start); + TextSpan? textSpan; + (textSpan, bracketCounter) = _formatBrackets(text, bracketCounter); + textSpans.add( + textSpan, + ); + + charPos = span.start; + } + + // Add the span. + var segment = code.substring(span.start, span.end); + var style = theme._getStyle(span.scopes); + textSpans.add( + TextSpan( + text: segment, + style: style, + ), + ); + + charPos = span.end; + } + + // Add any text after the last span. + if (charPos < code.length) { + var text = code.substring(charPos, code.length); + TextSpan? textSpan; + (textSpan, bracketCounter) = _formatBrackets(text, bracketCounter); + textSpans.add( + textSpan, + ); + } + + return TextSpan(children: textSpans, style: theme._wrapper); + } + + (TextSpan, int) _formatBrackets(String text, int bracketCounter) { + var spans = []; + var plainText = ''; + for (var char in text.characters) { + if (_isStartingBracket(char)) { + if (plainText.isNotEmpty) { + spans.add(TextSpan(text: plainText)); + plainText = ''; + } + + spans.add(TextSpan( + text: char, + style: _getBracketStyle(bracketCounter), + )); + bracketCounter += 1; + plainText = ''; + } else if (_isEndingBracket(char)) { + if (plainText.isNotEmpty) { + spans.add(TextSpan(text: plainText)); + plainText = ''; + } + + bracketCounter -= 1; + spans.add(TextSpan( + text: char, + style: _getBracketStyle(bracketCounter), + )); + plainText = ''; + } else { + plainText += char; + } + } + if (plainText.isNotEmpty) { + spans.add(TextSpan(text: plainText)); + } + + if (spans.length == 1) { + return (spans[0], bracketCounter); + } else { + return (TextSpan(children: spans), bracketCounter); + } + } + + TextStyle _getBracketStyle(int bracketCounter) { + if (bracketCounter < 0) { + return _failedBracketStyle; + } + return _bracketStyles[bracketCounter % _bracketStyles.length]; + } + + bool _isStartingBracket(String bracket) { + return bracket == '{' || bracket == '[' || bracket == '('; + } + + bool _isEndingBracket(String bracket) { + return bracket == '}' || bracket == ']' || bracket == ')'; + } +} + +/// A [HighlighterTheme] which is used to style the code. +class HighlighterTheme { + final TextStyle _wrapper; + TextStyle? _fallback; + final _scopes = {}; + + HighlighterTheme._({required TextStyle wrapper}) : _wrapper = wrapper; + + /// Load a [HighlighterTheme] from a JSON string. + factory HighlighterTheme.fromConfiguration( + String json, + TextStyle defaultStyle, + ) { + final theme = HighlighterTheme._(wrapper: defaultStyle); + theme._parseTheme(json); + return theme; + } + + /// Loads the default theme for the given [brightness]. + static Future loadForBrightness( + Brightness brightness, + ) async { + if (brightness == Brightness.dark) { + return loadDarkTheme(); + } else { + return loadLightTheme(); + } + } + + /// Loads the default theme for the given [BuildContext]. + static Future loadForContext( + BuildContext context, + ) async { + return loadForBrightness( + Theme.of(context).brightness, + ); + } + + /// Loads the default dark theme. + static Future loadDarkTheme() async { + return loadFromAssets( + _defaultDarkThemeFiles, + const TextStyle(color: Color(0xFFB9EEFF)), + ); + } + + /// Loads the default light theme. + static Future loadLightTheme() async { + return loadFromAssets( + _defaultLightThemeFiles, + const TextStyle(color: Color(0xFF000088)), + ); + } + + /// Loads a custom theme from a (list of) [jsonFiles] and a [defaultStyle]. + /// Pass in multiple [jsonFiles] to merge multiple themes. + static Future loadFromAssets( + List jsonFiles, + TextStyle defaultStyle, + ) async { + var theme = HighlighterTheme._(wrapper: defaultStyle); + await theme._load(jsonFiles); + return theme; + } + + Future _load(List definitions) async { + for (var definition in definitions) { + var json = await rootBundle.loadString( + definition, + ); + _parseTheme(json); + } + } + + void _parseTheme(String json) { + var theme = jsonDecode(json); + List settings = theme['settings']; + for (Map setting in settings) { + var style = _parseTextStyle(setting['settings']); + + var scopes = setting['scope']; + if (scopes is String) { + _addScope(scopes, style); + } else if (scopes is List) { + for (String scope in scopes) { + _addScope(scope, style); + } + } else if (scopes == null) { + _fallback = style; + } + } + } + + TextStyle _parseTextStyle(Map setting) { + Color? color; + var foregroundSetting = setting['foreground']; + if (foregroundSetting is String && foregroundSetting.startsWith('#')) { + color = Color( + int.parse( + foregroundSetting.substring(1), + radix: 16, + ) | + 0xFF000000, + ); + } + + FontStyle? fontStyle; + FontWeight? fontWeight; + TextDecoration? textDecoration; + + var fontStyleSetting = setting['fontStyle']; + if (fontStyleSetting is String) { + if (fontStyleSetting == 'italic') { + fontStyle = FontStyle.italic; + } else if (fontStyleSetting == 'bold') { + fontWeight = FontWeight.bold; + } else if (fontStyleSetting == 'underline') { + textDecoration = TextDecoration.underline; + } else { + throw Exception('WARNING unknown style: $fontStyleSetting'); + } + } + + return TextStyle( + color: color, + fontStyle: fontStyle, + fontWeight: fontWeight, + decoration: textDecoration, + ); + } + + void _addScope(String scope, TextStyle style) { + _scopes[scope] = style; + } + + TextStyle? _getStyle(List scope) { + for (var s in scope) { + var fallbacks = _fallbacks(s); + for (var f in fallbacks) { + var style = _scopes[f]; + if (style != null) { + return style; + } + } + } + return _fallback; + } + + List _fallbacks(String scope) { + var fallbacks = []; + var parts = scope.split('.'); + for (var i = 0; i < parts.length; i++) { + var s = parts.sublist(0, i + 1).join('.'); + fallbacks.add(s); + } + return fallbacks.reversed.toList(); + } +} diff --git a/packages/superdeck/lib/src/markdown/syntax_highlight/vendor/span_parser.dart b/packages/superdeck/lib/src/markdown/syntax_highlight/vendor/span_parser.dart new file mode 100644 index 000000000..aab10e550 --- /dev/null +++ b/packages/superdeck/lib/src/markdown/syntax_highlight/vendor/span_parser.dart @@ -0,0 +1,809 @@ +// Vendored unchanged from syntax_highlight 0.5.0 (pub.dev), file +// `lib/src/span_parser.dart`, at https://github.com/serverpod/syntax_highlight +// commit 7ac296c6 (2025-08-19), which took it from Flutter DevTools. See the +// licence text reproduced in `LICENSE` beside this file, and the notes in +// `highlighter.dart`. + +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// This file is taken from DevTools and should be kept in-sync with any changes +// that affect the resulting tokens. +// +// https://github.com/flutter/devtools/blob/master/packages/devtools_app/lib/src/screens/debugger/span_parser.dart + +// ignore_for_file: public_member_api_docs, use_super_parameters + +import 'dart:collection'; +import 'dart:convert'; + +import 'package:collection/collection.dart'; +import 'package:string_scanner/string_scanner.dart'; + +const _neverMatchingRegexStr = r'^(?!x)x'; + +//TODO(jacobr): cleanup. +// ignore: avoid_classes_with_only_static_members +abstract class SpanParser { + /// Takes a TextMate [Grammar] and a [String] and outputs a list of + /// [ScopeSpan]s corresponding to the parsed input. + static List parse(Grammar grammar, String src) { + final scopeStack = ScopeStack(); + final scanner = LineScanner(src); + while (!scanner.isDone) { + final foundMatch = + grammar.topLevelMatcher.scan(grammar, scanner, scopeStack); + if (!foundMatch && !scanner.isDone) { + // Found no match, move forward by a character and try again. + scanner.readChar(); + } + } + scopeStack.popAll(scanner.location); + return scopeStack.spans; + } +} + +/// A representation of a TextMate grammar used to create [ScopeSpan]s +/// representing scopes within a body of text. +/// +/// References used: +/// - Grammar specification: +/// https://macromates.com/manual/en/language_grammars#language_grammars +/// - Helpful blog post which clears up ambiguities in the spec: +/// https://www.apeth.com/nonblog/stories/textmatebundle.html +/// +class Grammar { + factory Grammar.fromJson(Map json) { + return Grammar._( + name: json['name'] as String, + scopeName: json['scopeName'] as String, + topLevelMatcher: GrammarMatcher.parse(json), + repository: Repository.build(json), + ); + } + + Grammar._({ + this.name, + this.scopeName, + required this.topLevelMatcher, + required this.repository, + }); + + final String? name; + + final String? scopeName; + + final GrammarMatcher topLevelMatcher; + + final Repository repository; + + @override + String toString() { + return const JsonEncoder.withIndent(' ').convert({ + 'name': name, + 'scopeName': scopeName, + 'topLevelMatcher': topLevelMatcher.toJson(), + 'repository': repository.toJson(), + }); + } +} + +/// A representation of a span of text which has `scope` applied to it. +class ScopeSpan { + ScopeSpan({ + required this.scopes, + required ScopeStackLocation startLocation, + required ScopeStackLocation endLocation, + }) : _startLocation = startLocation, + _endLocation = endLocation; + + ScopeStackLocation get startLocation => _startLocation; + ScopeStackLocation get endLocation => _endLocation; + int get start => _startLocation.position; + int get end => _endLocation.position; + int get length => end - start; + + final ScopeStackLocation _startLocation; + ScopeStackLocation _endLocation; + + /// The one-based line number. + int get line => startLocation.line + 1; + + /// The one-based column number. + int get column => startLocation.column + 1; + + final List scopes; + + bool contains(int token) => (start <= token) && (token < end); + + /// Splits the current [ScopeSpan] into multiple spans separated by [cond]. + /// This is useful for post-processing the results from a rule with a while + /// condition as formatting should not be applied to the characters that + /// match the while condition. + List split(LineScanner scanner, RegExp cond) { + final splitSpans = []; + + // Create a temporary scanner, copying [0, end] to ensure that line/column + // information is consistent with the original scanner. + final splitScanner = LineScanner( + scanner.substring(0, end), + position: start, + ); + + // Start with a copy of the original span + ScopeSpan current = ScopeSpan( + scopes: scopes.toList(), + startLocation: startLocation, + endLocation: endLocation, + ); + + while (!splitScanner.isDone) { + if (splitScanner.matches(cond)) { + // Update the end position for this span as it's been fully processed. + current._endLocation = splitScanner.location; + splitSpans.add(current); + + // Move the scanner position past the matched condition. + splitScanner.scan(cond); + + // Create a new span based on the current position. + current = ScopeSpan( + scopes: scopes.toList(), + startLocation: splitScanner.location, + // Will be updated later. + endLocation: ScopeStackLocation.zero, + ); + } else { + // Move scanner position forward. + splitScanner.readChar(); + } + } + // Finish processing the last span, which will always have the same end + // position as the span we're splitting. + current._endLocation = endLocation; + splitSpans.add(current); + + return splitSpans; + } + + @override + String toString() { + return '[$start, $end, $line:$column (len: $length)] = $scopes'; + } +} + +/// A top-level repository of rules that can be referenced within other rules +/// using the 'includes' keyword. +class Repository { + Repository.build(Map grammarJson) { + final repositoryJson = (grammarJson['repository'] as Map?) + ?.cast>(); + if (repositoryJson == null) { + return; + } + for (final subRepo in repositoryJson.keys) { + matchers[subRepo] = GrammarMatcher.parse(repositoryJson[subRepo]!); + } + } + + final matchers = {}; + + Map toJson() { + return { + for (final entry in matchers.entries) + if (entry.key != null) entry.key!: entry.value.toJson(), + }; + } +} + +abstract class GrammarMatcher { + factory GrammarMatcher.parse(Map json) { + if (_IncludeMatcher.isType(json)) { + return _IncludeMatcher(json['include'] as String); + } else if (_SimpleMatcher.isType(json)) { + try { + return _SimpleMatcher(json); + } catch (e) { + return _SimpleMatcher({ + 'match': _neverMatchingRegexStr, + }); + } + } else if (_MultilineMatcher.isType(json)) { + try { + return _MultilineMatcher(json); + } catch (e) { + return _MultilineMatcher({ + 'begin': _neverMatchingRegexStr, + }); + } + } else if (_PatternMatcher.isType(json)) { + return _PatternMatcher(json); + } + throw StateError('Unknown matcher type: $json'); + } + + GrammarMatcher._(Map json) : name = json['name'] as String?; + + final String? name; + + bool scan(Grammar grammar, LineScanner scanner, ScopeStack scopeStack); + + void _applyCapture( + Grammar grammar, + LineScanner scanner, + ScopeStack scopeStack, + Map? captures, + ScopeStackLocation location, + ) { + final lastMatch = scanner.lastMatch!; + final start = lastMatch.start; + final end = lastMatch.end; + final matchStartLocation = location; + if (captures != null) { + final match = scanner.substring(start, end); + for (int i = 0; i <= lastMatch.groupCount; ++i) { + // Skip if we don't have a scope or nested patterns for this capture. + if (!captures.containsKey(i.toString())) continue; + + final captureText = lastMatch.group(i); + if (captureText == null || captureText.isEmpty) continue; + + final startOffset = match.indexOf(captureText); + final capture = captures[i.toString()] as Map; + final captureStartLocation = matchStartLocation.offset(startOffset); + final captureEndLocation = + captureStartLocation.offset(captureText.length); + final captureName = capture['name'] as String?; + + scopeStack.push(captureName, captureStartLocation); + + // Handle nested pattern matchers. + if (capture.containsKey('patterns')) { + final captureScanner = LineScanner( + scanner.substring(0, captureEndLocation.position), + position: captureStartLocation.position, + ); + GrammarMatcher.parse(capture) + .scan(grammar, captureScanner, scopeStack); + } + + scopeStack.pop(captureName, captureEndLocation); + } + } + } + + Map toJson(); +} + +/// A simple matcher which matches a single line. +class _SimpleMatcher extends GrammarMatcher { + _SimpleMatcher(Map json) + : match = RegExp(json['match'] as String, multiLine: true), + captures = (json['captures'] as Map?) + ?.cast>(), + super._(json); + + static bool isType(Map json) { + return json.containsKey('match'); + } + + final RegExp match; + + final Map? captures; + + @override + bool scan(Grammar grammar, LineScanner scanner, ScopeStack scopeStack) { + final location = scanner.location; + if (scanner.scan(match)) { + scopeStack.push(name, location); + _applyCapture(grammar, scanner, scopeStack, captures, location); + scopeStack.pop(name, scanner.location); + return true; + } + return false; + } + + @override + Map toJson() { + return { + if (name != null) 'name': name, + 'match': match.pattern, + if (captures != null) 'captures': captures, + }; + } +} + +class _MultilineMatcher extends GrammarMatcher { + _MultilineMatcher(Map json) + : begin = RegExp(json['begin'] as String, multiLine: true), + beginCaptures = json['beginCaptures'] as Map?, + contentName = json['contentName'] as String?, + end = json['end'] == null + ? null + : RegExp(json['end'] as String, multiLine: true), + endCaptures = json['endCaptures'] as Map?, + captures = json['captures'] as Map?, + whileCond = json['while'] == null + ? null + : RegExp(json['while'] as String, multiLine: true), + patterns = (json['patterns'] as List?) + ?.cast>() + .map((e) => GrammarMatcher.parse(e)) + .toList() + .cast(), + super._(json); + + static bool isType(Map json) { + return json.containsKey('begin') && + (json.containsKey('end') || json.containsKey('while')); + } + + /// A regular expression which defines the beginning match of this rule. This + /// property is required and must be defined along with either `end` or + /// `while`. + final RegExp begin; + + /// A set of scopes to apply to groups captured by `begin`. `captures` should + /// be null if this property is provided. + final Map? beginCaptures; + + /// The scope that applies to the content between the matches found by + /// `begin` and `end`. + final String? contentName; + + /// A regular expression which defines the match signaling the end of the + /// rule application. This property is mutually exclusive with the `while` + /// property. + final RegExp? end; + + /// A set of scopes to apply to groups captured by `begin`. `captures` should + /// be null if this property is provided. + final Map? endCaptures; + + /// A regular expression corresponding with the `while` property used to + /// determine if the next line should have the current rule applied. If + /// `patterns` is provided, the contents of a line that satisfy this regular + /// expression will be processed against the provided patterns. + /// + /// This expression is applied to every line **after** the first line matched + /// by `begin`. If this expression fails after the line matched by `begin`, + /// the overall rule does not fail and the resulting [ScopeSpan]s will consist + /// of matches found in the first line. + /// + /// This property is mutually exclusive with the `end` property. + final RegExp? whileCond; + + /// A set of scopes to apply to groups captured by `begin` and `end`. + /// Providing this property is the equivalent of setting `beginCaptures` and + /// `endCaptures` to the same value. `beginCaptures` and `endCaptures` should + /// be null if this property is provided. + final Map? captures; + + final List? patterns; + + void _scanBegin(Grammar grammar, LineScanner scanner, ScopeStack scopeStack) { + final location = scanner.location; + if (!scanner.scan(begin)) { + // This shouldn't happen since we've already checked that `begin` matches + // the beginning of the string. + throw StateError('Expected ${begin.pattern} to match.'); + } + _processCaptureHelper( + grammar, + scanner, + scopeStack, + beginCaptures, + location, + ); + } + + void _scanToEndOfLine( + Grammar grammar, + LineScanner scanner, + ScopeStack scopeStack, + ) { + while (!scanner.isDone) { + if (String.fromCharCode(scanner.peekChar()!) == '\n') { + scanner.readChar(); + break; + } + bool foundMatch = false; + for (final pattern in patterns ?? []) { + if (pattern.scan(grammar, scanner, scopeStack)) { + foundMatch = true; + break; + } + } + if (!foundMatch) { + scanner.readChar(); + } + } + } + + void _scanUpToEndMatch( + Grammar grammar, + LineScanner scanner, + ScopeStack scopeStack, + ) { + while (!scanner.isDone && end != null && !scanner.matches(end!)) { + bool foundMatch = false; + for (final pattern in patterns ?? []) { + if (pattern.scan(grammar, scanner, scopeStack)) { + foundMatch = true; + break; + } + } + if (!foundMatch) { + // Move forward by a character, try again. + scanner.readChar(); + } + } + } + + void _scanEnd(Grammar grammar, LineScanner scanner, ScopeStack scopeStack) { + final location = scanner.location; + if (end != null && !scanner.scan(end!)) { + return; + } + _processCaptureHelper(grammar, scanner, scopeStack, endCaptures, location); + } + + void _processCaptureHelper( + Grammar grammar, + LineScanner scanner, + ScopeStack scopeStack, + Map? customCaptures, + ScopeStackLocation location, + ) { + if (contentName == null || (customCaptures ?? captures) != null) { + _applyCapture( + grammar, + scanner, + scopeStack, + customCaptures ?? captures, + location, + ); + } + } + + @override + bool scan(Grammar grammar, LineScanner scanner, ScopeStack scopeStack) { + if (!scanner.matches(begin)) { + return false; + } + + scopeStack.push(name, scanner.location); + _scanBegin(grammar, scanner, scopeStack); + if (end != null) { + scopeStack.push(contentName, scanner.location); + _scanUpToEndMatch(grammar, scanner, scopeStack); + scopeStack.pop(contentName, scanner.location); + _scanEnd(grammar, scanner, scopeStack); + } else if (whileCond != null) { + // Find the range of the string that is matched by the while condition. + final start = scanner.position; + _skipLine(scanner); + while (!scanner.isDone && whileCond != null && scanner.scan(whileCond!)) { + _skipLine(scanner); + } + final end = scanner.position; + + // Create a temporary scanner to ensure that rules that don't find an + // end match don't try and match all the way to the end of the file. + final contentScanner = LineScanner( + scanner.substring(0, end), + position: start, + ); + + // Capture a marker for where the contents start, used later to split + // spans. + final whileContentBeginMarker = scopeStack.marker(); + + _scanToEndOfLine(grammar, contentScanner, scopeStack); + + // Process each line until the `while` condition fails. + while (!contentScanner.isDone && + whileCond != null && + contentScanner.scan(whileCond!)) { + _scanToEndOfLine(grammar, contentScanner, scopeStack); + } + + // Now, split any spans produced whileContentBeginMarker by `whileCond`. + scopeStack.splitFromMarker( + scanner, + whileContentBeginMarker, + whileCond!, + ); + } else { + throw StateError( + "One of 'end' or 'while' must be provided for rule: $name", + ); + } + scopeStack.pop(name, scanner.location); + return true; + } + + void _skipLine(LineScanner scanner) { + scanner.scan(RegExp('.*\n')); + } + + @override + Map toJson() { + return { + if (name != null) 'name': name, + 'begin': begin.pattern, + if (beginCaptures != null) 'beginCaptures': beginCaptures, + if (end != null) 'end': end!.pattern, + if (endCaptures != null) 'endCaptures': endCaptures, + if (whileCond != null) 'while': whileCond!.pattern, + if (patterns != null) + 'patterns': patterns!.map((e) => e.toJson()).toList(), + }; + } +} + +class _PatternMatcher extends GrammarMatcher { + _PatternMatcher(Map json) + : patterns = (json['patterns'] as List?) + ?.cast>() + .map((e) => GrammarMatcher.parse(e)) + .toList() + .cast(), + super._(json); + + static bool isType(Map json) { + return json.containsKey('patterns'); + } + + final List? patterns; + + @override + bool scan(Grammar grammar, LineScanner scanner, ScopeStack scopeStack) { + // Try each rule in the include and return after the first successful match. + for (final pattern in patterns!) { + if (pattern.scan(grammar, scanner, scopeStack)) { + return true; + } + } + return false; + } + + @override + Map toJson() { + return { + if (name != null) 'name': name, + if (patterns != null) + 'patterns': patterns!.map((e) => e.toJson()).toList(), + }; + } +} + +/// A [GrammarMatcher] that corresponds to an `include` rule referenced in a +/// `patterns` array. Allows for executing rules defined within a +/// [Repository]. +class _IncludeMatcher extends GrammarMatcher { + _IncludeMatcher(String include) + : include = include.substring(1), + super._({}); + + final String include; + + static bool isType(Map json) { + return json.containsKey('include'); + } + + @override + bool scan(Grammar grammar, LineScanner scanner, ScopeStack scopeStack) { + final matcher = grammar.repository.matchers[include]; + if (matcher == null) { + throw StateError('Could not find $include in the repository.'); + } + return matcher.scan(grammar, scanner, scopeStack); + } + + @override + Map toJson() { + return { + 'include': include, + }; + } +} + +/// Tracks the current scope stack, producing [ScopeSpan]s as the contents +/// change. +class ScopeStack { + ScopeStack(); + + final stack = Queue(); + final spans = []; + + /// Location where the next produced span should begin. + ScopeStackLocation _nextLocation = ScopeStackLocation.zero; + + /// Adds a scope for a given region. + /// + /// This method is the same as calling [push] and then [pop] with the same + /// args. + void add( + String? scope, { + required ScopeStackLocation start, + required ScopeStackLocation end, + }) { + push(scope, start); + pop(scope, end); + } + + /// Pushes a new scope onto the stack starting at [start]. + void push(String? scope, ScopeStackLocation location) { + if (scope == null) return; + + // If the stack is empty, seed the position which is used for the start + // of the next produced token. + if (stack.isEmpty) { + _nextLocation = location; + } + + // Whenever we push a new item, produce a span for the region between the + // last started scope and the new current position. + if (location.position > _nextLocation.position) { + final scopes = stack.map((item) => item.scope).toSet(); + _produceSpan(scopes, end: location); + } + + // Add this new scope to the stack, but don't produce its token yet. We will + // do that when the next item is pushed (in which case we'll fill the gap), + // or when this item is popped (in which case we'll produce a span for that + // full region). + stack.add(ScopeStackItem(scope, location)); + } + + /// Pops the last scope off the stack, producing a token if necessary up until + /// [end]. + void pop(String? scope, ScopeStackLocation end) { + if (scope == null) return; + assert(stack.isNotEmpty); + + final scopes = stack.map((item) => item.scope).toSet(); + final last = stack.removeLast(); + assert(last.scope == scope); + assert(last.location.position <= end.position); + + _produceSpan(scopes, end: end); + } + + void popAll(ScopeStackLocation location) { + while (stack.isNotEmpty) { + pop(stack.last.scope, location); + } + } + + /// Captures a marker to identify spans produced before/after this call. + ScopeStackMarker marker() { + return ScopeStackMarker(spanIndex: spans.length, location: _nextLocation); + } + + /// Splits all spans created since [begin] by [condition]. + /// + /// This is used to handle multiline spans that use begin/end such as + /// capturing triple-backtick code blocks that would have captured the leading + /// '/// ', which should not be included. + void splitFromMarker( + LineScanner scanner, + ScopeStackMarker begin, + RegExp condition, + ) { + // Remove the spans to be split. We will push new spans after splitting. + final spansToSplit = spans.sublist(begin.spanIndex); + if (spansToSplit.isEmpty) return; + spans.removeRange(begin.spanIndex, spans.length); + + // Also rewind the last positions to the start place. + _nextLocation = begin.location; + + // Add the split spans individually. + for (final span in spansToSplit + .expand((spanToSplit) => spanToSplit.split(scanner, condition))) { + // To handler spans with multiple scopes, we need to push each scope, and + // then pop each scope. We cannot use `add`. + for (final scope in span.scopes) { + push(scope, span.startLocation); + } + for (final scope in span.scopes.reversed) { + pop(scope, span.endLocation); + } + } + } + + void _produceSpan( + Set scopes, { + required ScopeStackLocation end, + }) { + // Don't produce zero-width spans. + if (end.position == _nextLocation.position) return; + + // If the new span starts at the same place that the previous one ends and + // has the same scopes, we can replace the previous one with a single new + // larger span. + final newScopes = scopes.toList(); + final lastSpan = spans.lastOrNull; + if (lastSpan != null && + lastSpan.endLocation.position == _nextLocation.position && + lastSpan.scopes.equals(newScopes)) { + final span = ScopeSpan( + scopes: newScopes, + startLocation: lastSpan.startLocation, + endLocation: end, + ); + // Replace the last span with this one. + spans.last = span; + } else { + final span = ScopeSpan( + scopes: newScopes, + startLocation: _nextLocation, + endLocation: end, + ); + spans.add(span); + } + _nextLocation = end; + } +} + +/// An item pushed onto the scope stack, consisting of a [String] scope and a +/// location. +class ScopeStackItem { + ScopeStackItem(this.scope, this.location); + + final String scope; + final ScopeStackLocation location; +} + +/// A marker tracking a position in the list of produced tokens. +/// +/// Used for back-tracking when handling nested multiline tokens. +class ScopeStackMarker { + ScopeStackMarker({ + required this.spanIndex, + required this.location, + }); + + final int spanIndex; + final ScopeStackLocation location; +} + +/// A location (including offset, line, column) in the code parsed for scopes. +class ScopeStackLocation { + const ScopeStackLocation({ + required this.position, + required this.line, + required this.column, + }); + + static const zero = ScopeStackLocation(position: 0, line: 0, column: 0); + + /// 0-based offset in content. + final int position; + + /// 0-based line number of [position]. + final int line; + + /// 0-based column number of [position]. + final int column; + + /// Returns a location offset by [offset] characters. + /// + /// This method does not handle line wrapping so should only be used where it + /// is known that the offset does not wrap across a line boundary. + ScopeStackLocation offset(int offset) { + return ScopeStackLocation( + position: position + offset, + line: line, + column: column + offset, + ); + } +} + +extension LineScannerExtension on LineScanner { + ScopeStackLocation get location => + ScopeStackLocation(position: position, line: line, column: column); +} diff --git a/packages/superdeck/lib/src/utils/syntax_highlighter.dart b/packages/superdeck/lib/src/utils/syntax_highlighter.dart index a2e211cfb..3615e3675 100644 --- a/packages/superdeck/lib/src/utils/syntax_highlighter.dart +++ b/packages/superdeck/lib/src/utils/syntax_highlighter.dart @@ -2,7 +2,8 @@ import 'dart:async'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; -import 'package:syntax_highlight/syntax_highlight.dart'; + +import '../markdown/syntax_highlight/vendor/highlighter.dart'; class SyntaxHighlight { SyntaxHighlight._(); diff --git a/packages/superdeck/pubspec.yaml b/packages/superdeck/pubspec.yaml index dd2e5d3bc..fbc7f07ce 100644 --- a/packages/superdeck/pubspec.yaml +++ b/packages/superdeck/pubspec.yaml @@ -16,8 +16,8 @@ dependencies: cached_network_image: ^3.4.1 window_manager: ^0.5.2 collection: ^1.18.0 + string_scanner: ^1.4.0 path: ^1.9.0 - syntax_highlight: ^0.5.0 scrollable_positioned_list: ^0.3.8 go_router: ^17.3.0 path_provider: ^2.1.4 @@ -52,3 +52,4 @@ flutter: uses-material-design: true assets: - assets/grammars/ + - assets/highlight_themes/ diff --git a/packages/superdeck/test/fixtures/syntax_highlight/rendered_spans.json b/packages/superdeck/test/fixtures/syntax_highlight/rendered_spans.json new file mode 100644 index 000000000..9d29aa9f4 --- /dev/null +++ b/packages/superdeck/test/fixtures/syntax_highlight/rendered_spans.json @@ -0,0 +1,1505 @@ +{ + "dart/light": [ + { + "children": [ + { + "color": "ff000088", + "children": [] + }, + { + "text": "import", + "color": "ff0000ff" + }, + { + "text": " " + }, + { + "text": "'dart:async'", + "color": "ffa31515" + }, + { + "text": ";" + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": "/// A counter.", + "color": "ff008000" + } + ] + }, + { + "children": [ + { + "text": "class", + "color": "ff0000ff" + }, + { + "text": " " + }, + { + "text": "Counter", + "color": "ff267f99" + }, + { + "children": [] + }, + { + "text": " " + }, + { + "text": "{", + "color": "ff407aa7" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "int", + "color": "ff267f99" + }, + { + "text": " _value " + }, + { + "text": "=", + "color": "ff000000" + }, + { + "text": " " + }, + { + "text": "0", + "color": "ff098156" + }, + { + "text": ";" + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "Future", + "color": "ff267f99" + }, + { + "text": "<" + }, + { + "text": "void", + "color": "ff0000ff" + }, + { + "text": ">" + }, + { + "text": " " + }, + { + "text": "increment", + "color": "ff795e26" + }, + { + "children": [] + }, + { + "text": "(", + "color": "ff866f47" + }, + { + "text": "{", + "color": "ff9a5bae" + }, + { + "text": "int", + "color": "ff267f99" + }, + { + "text": " by " + }, + { + "text": "=", + "color": "ff000000" + }, + { + "text": " " + }, + { + "text": "1", + "color": "ff098156" + }, + { + "children": [] + }, + { + "text": "}", + "color": "ff9a5bae" + }, + { + "text": ")", + "color": "ff866f47" + }, + { + "text": " " + }, + { + "text": "async", + "color": "ffaf00db" + }, + { + "children": [] + }, + { + "text": " " + }, + { + "text": "{", + "color": "ff866f47" + } + ] + }, + { + "children": [ + { + "text": " _value " + }, + { + "text": "+=", + "color": "ff000000" + }, + { + "text": " by" + }, + { + "text": ";" + }, + { + "text": " " + }, + { + "text": "// bump", + "color": "ff008000" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "print", + "color": "ff795e26" + }, + { + "text": "(", + "color": "ff9a5bae" + }, + { + "text": "'value: $", + "color": "ffa31515" + }, + { + "text": "_value", + "color": "ffa31515" + }, + { + "text": "'", + "color": "ffa31515" + }, + { + "text": ")", + "color": "ff9a5bae" + }, + { + "text": ";" + }, + { + "children": [] + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "}", + "color": "ff866f47" + } + ] + }, + { + "children": [ + { + "text": "}", + "color": "ff407aa7" + } + ] + }, + { + "children": [] + } + ], + "dart/dark": [ + { + "children": [ + { + "color": "ffb9eeff", + "children": [] + }, + { + "text": "import", + "color": "ff569cd6" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "'dart:async'", + "color": "ffce9178" + }, + { + "text": ";", + "color": "ffd4d4d4" + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": "/// A counter.", + "color": "ff608b4e" + } + ] + }, + { + "children": [ + { + "text": "class", + "color": "ff569cd6" + }, + { + "text": " " + }, + { + "text": "Counter", + "color": "ff4ec9b0" + }, + { + "children": [] + }, + { + "text": " " + }, + { + "text": "{", + "color": "ff5caeef" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "int", + "color": "ff4ec9b0" + }, + { + "text": " _value " + }, + { + "text": "=", + "color": "ffd4d4d4" + }, + { + "text": " " + }, + { + "text": "0", + "color": "ffb5cea8" + }, + { + "text": ";", + "color": "ffd4d4d4" + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "Future", + "color": "ff4ec9b0" + }, + { + "text": "<", + "color": "ffd4d4d4" + }, + { + "text": "void", + "color": "ff569cd6" + }, + { + "text": ">", + "color": "ffd4d4d4" + }, + { + "text": " " + }, + { + "text": "increment", + "color": "ffdcdcaa" + }, + { + "children": [] + }, + { + "text": "(", + "color": "ffdfb976" + }, + { + "text": "{", + "color": "ffc172d9" + }, + { + "text": "int", + "color": "ff4ec9b0" + }, + { + "text": " by " + }, + { + "text": "=", + "color": "ffd4d4d4" + }, + { + "text": " " + }, + { + "text": "1", + "color": "ffb5cea8" + }, + { + "children": [] + }, + { + "text": "}", + "color": "ffc172d9" + }, + { + "text": ")", + "color": "ffdfb976" + }, + { + "text": " " + }, + { + "text": "async", + "color": "ffc586c0" + }, + { + "children": [] + }, + { + "text": " " + }, + { + "text": "{", + "color": "ffdfb976" + } + ] + }, + { + "children": [ + { + "text": " _value " + }, + { + "text": "+=", + "color": "ffd4d4d4" + }, + { + "text": " by" + }, + { + "text": ";", + "color": "ffd4d4d4" + }, + { + "text": " " + }, + { + "text": "// bump", + "color": "ff608b4e" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "print", + "color": "ffdcdcaa" + }, + { + "text": "(", + "color": "ffc172d9" + }, + { + "text": "'value: $", + "color": "ffce9178" + }, + { + "text": "_value", + "color": "ffce9178" + }, + { + "text": "'", + "color": "ffce9178" + }, + { + "text": ")", + "color": "ffc172d9" + }, + { + "text": ";", + "color": "ffd4d4d4" + }, + { + "children": [] + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "}", + "color": "ffdfb976" + } + ] + }, + { + "children": [ + { + "text": "}", + "color": "ff5caeef" + } + ] + }, + { + "children": [] + } + ], + "json/light": [ + { + "children": [ + { + "color": "ff000088", + "children": [] + }, + { + "text": "{" + }, + { + "text": "\"", + "color": "ff0451a5" + }, + { + "text": "name", + "color": "ff0451a5" + }, + { + "text": "\"", + "color": "ff0451a5" + }, + { + "text": ":" + }, + { + "text": " " + }, + { + "text": "\"", + "color": "ffa31515" + }, + { + "text": "superdeck", + "color": "ffa31515" + }, + { + "text": "\"", + "color": "ffa31515" + }, + { + "text": "," + }, + { + "text": " " + }, + { + "text": "\"", + "color": "ff0451a5" + }, + { + "text": "version", + "color": "ff0451a5" + }, + { + "text": "\"", + "color": "ff0451a5" + }, + { + "text": ":" + }, + { + "text": " " + }, + { + "text": "1", + "color": "ffcd3131" + }, + { + "text": "," + }, + { + "text": " " + }, + { + "text": "\"", + "color": "ff0451a5" + }, + { + "text": "tags", + "color": "ff0451a5" + }, + { + "text": "\"", + "color": "ff0451a5" + }, + { + "text": ":" + }, + { + "text": " " + }, + { + "text": "[" + }, + { + "text": "\"", + "color": "ffa31515" + }, + { + "text": "slides", + "color": "ffa31515" + }, + { + "text": "\"", + "color": "ffa31515" + }, + { + "text": "," + }, + { + "text": " " + }, + { + "text": "true", + "color": "ff0000ff" + }, + { + "text": "," + }, + { + "text": " " + }, + { + "text": "null", + "color": "ff0000ff" + }, + { + "text": "]" + }, + { + "text": "}" + } + ] + }, + { + "children": [] + } + ], + "json/dark": [ + { + "children": [ + { + "color": "ffb9eeff", + "children": [] + }, + { + "text": "{", + "color": "ffd4d4d4" + }, + { + "text": "\"", + "color": "ff9cdcfe" + }, + { + "text": "name", + "color": "ff9cdcfe" + }, + { + "text": "\"", + "color": "ff9cdcfe" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "\"", + "color": "ffce9178" + }, + { + "text": "superdeck", + "color": "ffce9178" + }, + { + "text": "\"", + "color": "ffce9178" + }, + { + "text": ",", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "\"", + "color": "ff9cdcfe" + }, + { + "text": "version", + "color": "ff9cdcfe" + }, + { + "text": "\"", + "color": "ff9cdcfe" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "1", + "color": "fff44747" + }, + { + "text": ",", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "\"", + "color": "ff9cdcfe" + }, + { + "text": "tags", + "color": "ff9cdcfe" + }, + { + "text": "\"", + "color": "ff9cdcfe" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "[", + "color": "ffd4d4d4" + }, + { + "text": "\"", + "color": "ffce9178" + }, + { + "text": "slides", + "color": "ffce9178" + }, + { + "text": "\"", + "color": "ffce9178" + }, + { + "text": ",", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "true", + "color": "ff569cd6" + }, + { + "text": ",", + "color": "ffd4d4d4" + }, + { + "text": " ", + "color": "ffd4d4d4" + }, + { + "text": "null", + "color": "ff569cd6" + }, + { + "text": "]", + "color": "ffd4d4d4" + }, + { + "text": "}", + "color": "ffd4d4d4" + } + ] + }, + { + "children": [] + } + ], + "yaml/light": [ + { + "children": [ + { + "color": "ff000088", + "children": [] + }, + { + "text": "# Deck options", + "color": "ff008000" + } + ] + }, + { + "children": [ + { + "text": "title", + "color": "ff800000" + }, + { + "text": ":" + }, + { + "text": " Launch" + } + ] + }, + { + "children": [ + { + "text": "style", + "color": "ff800000" + }, + { + "text": ":" + }, + { + "text": " dark" + } + ] + }, + { + "children": [ + { + "text": "sections", + "color": "ff800000" + }, + { + "text": ":" + } + ] + }, + { + "children": [ + { + "text": " - name" + }, + { + "text": ":" + }, + { + "text": " intro" + } + ] + }, + { + "children": [ + { + "text": " flex", + "color": "ff800000" + }, + { + "text": ":" + }, + { + "text": " 2" + } + ] + }, + { + "children": [] + } + ], + "yaml/dark": [ + { + "children": [ + { + "color": "ffb9eeff", + "children": [] + }, + { + "text": "# Deck options", + "color": "ff608b4e" + } + ] + }, + { + "children": [ + { + "text": "title", + "color": "ff569cd6" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " Launch" + } + ] + }, + { + "children": [ + { + "text": "style", + "color": "ff569cd6" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " dark" + } + ] + }, + { + "children": [ + { + "text": "sections", + "color": "ff569cd6" + }, + { + "text": ":", + "color": "ffd4d4d4" + } + ] + }, + { + "children": [ + { + "text": " - name" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " intro" + } + ] + }, + { + "children": [ + { + "text": " flex", + "color": "ff569cd6" + }, + { + "text": ":", + "color": "ffd4d4d4" + }, + { + "text": " 2" + } + ] + }, + { + "children": [] + } + ], + "markdown/light": [ + { + "children": [ + { + "color": "ff000088", + "children": [] + }, + { + "text": "#" + }, + { + "text": " " + }, + { + "text": "Heading", + "color": "ff800000", + "weight": 700 + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": "Some " + }, + { + "text": "*emphasis*", + "style": "italic" + }, + { + "text": ", " + }, + { + "text": "**strong**", + "color": "ff000080", + "weight": 700 + }, + { + "text": ", and " + }, + { + "text": "`code`" + }, + { + "text": "." + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": "- " + }, + { + "text": "item one" + } + ] + }, + { + "children": [ + { + "text": "- " + }, + { + "text": "[", + "color": "ff407aa7" + }, + { + "text": "link", + "color": "ffa31515" + }, + { + "children": [] + }, + { + "text": "]", + "color": "ff407aa7" + }, + { + "text": "(", + "color": "ff407aa7" + }, + { + "text": "https://superdeck.dev" + }, + { + "children": [] + }, + { + "text": ")", + "color": "ff407aa7" + } + ] + }, + { + "children": [] + } + ], + "markdown/dark": [ + { + "children": [ + { + "color": "ffb9eeff", + "children": [] + }, + { + "text": "#", + "color": "ffd4d4d4" + }, + { + "text": " " + }, + { + "text": "Heading", + "color": "ff569cd6", + "weight": 700 + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": "Some " + }, + { + "text": "*emphasis*", + "style": "italic" + }, + { + "text": ", " + }, + { + "text": "**strong**", + "color": "ff569cd6", + "weight": 700 + }, + { + "text": ", and " + }, + { + "text": "`code`", + "color": "ffd4d4d4" + }, + { + "text": "." + } + ] + }, + { + "children": [] + }, + { + "children": [ + { + "text": "- ", + "color": "ffd4d4d4" + }, + { + "text": "item one" + } + ] + }, + { + "children": [ + { + "text": "- ", + "color": "ffd4d4d4" + }, + { + "text": "[", + "color": "ff5caeef" + }, + { + "text": "link", + "color": "ffce9178" + }, + { + "children": [] + }, + { + "text": "]", + "color": "ff5caeef" + }, + { + "text": "(", + "color": "ff5caeef" + }, + { + "text": "https://superdeck.dev" + }, + { + "children": [] + }, + { + "text": ")", + "color": "ff5caeef" + } + ] + }, + { + "children": [] + } + ], + "python/light": [ + { + "children": [ + { + "color": "ff000088", + "children": [] + }, + { + "text": "def", + "color": "ff0000ff" + }, + { + "children": [] + }, + { + "text": " greet" + }, + { + "text": "(", + "color": "ff407aa7" + }, + { + "text": "name: str" + }, + { + "text": ")", + "color": "ff407aa7" + }, + { + "text": " -> str:" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "\"\"\"Say hello.\"\"\"", + "color": "ff008000" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "return", + "color": "ffaf00db" + }, + { + "text": " f" + }, + { + "text": "\"Hello, {name}!\"", + "color": "ffa31515" + }, + { + "text": " " + }, + { + "text": "# done", + "color": "ff008000" + } + ] + }, + { + "children": [] + } + ], + "python/dark": [ + { + "children": [ + { + "color": "ffb9eeff", + "children": [] + }, + { + "text": "def", + "color": "ff569cd6" + }, + { + "children": [] + }, + { + "text": " greet" + }, + { + "text": "(", + "color": "ff5caeef" + }, + { + "text": "name: str" + }, + { + "text": ")", + "color": "ff5caeef" + }, + { + "text": " -> str:" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "\"\"\"Say hello.\"\"\"", + "color": "ff608b4e" + } + ] + }, + { + "children": [ + { + "text": " " + }, + { + "text": "return", + "color": "ffc586c0" + }, + { + "text": " f" + }, + { + "text": "\"Hello, {name}!\"", + "color": "ffce9178" + }, + { + "text": " " + }, + { + "text": "# done", + "color": "ff608b4e" + } + ] + }, + { + "children": [] + } + ], + "rust/light": [ + { + "children": [ + { + "color": "ff000088", + "children": [] + }, + { + "text": "fn " + }, + { + "text": "main", + "color": "ff795e26" + }, + { + "children": [] + }, + { + "text": "(", + "color": "ff407aa7" + }, + { + "text": ")", + "color": "ff407aa7" + }, + { + "text": " " + }, + { + "text": "{", + "color": "ff407aa7" + }, + { + "text": " " + }, + { + "text": "println", + "color": "ff795e26" + }, + { + "children": [] + }, + { + "text": "!" + }, + { + "text": "(", + "color": "ff866f47" + }, + { + "text": "\"hi\"", + "color": "ffa31515" + }, + { + "text": ")", + "color": "ff866f47" + }, + { + "text": ";" + }, + { + "children": [] + }, + { + "text": " " + }, + { + "text": "}", + "color": "ff407aa7" + } + ] + }, + { + "children": [] + } + ], + "rust/dark": [ + { + "children": [ + { + "color": "ffb9eeff", + "children": [] + }, + { + "text": "fn " + }, + { + "text": "main", + "color": "ffdcdcaa" + }, + { + "children": [] + }, + { + "text": "(", + "color": "ff5caeef" + }, + { + "text": ")", + "color": "ff5caeef" + }, + { + "text": " " + }, + { + "text": "{", + "color": "ff5caeef" + }, + { + "text": " " + }, + { + "text": "println", + "color": "ffdcdcaa" + }, + { + "children": [] + }, + { + "text": "!" + }, + { + "text": "(", + "color": "ffdfb976" + }, + { + "text": "\"hi\"", + "color": "ffce9178" + }, + { + "text": ")", + "color": "ffdfb976" + }, + { + "text": ";", + "color": "ffd4d4d4" + }, + { + "children": [] + }, + { + "text": " " + }, + { + "text": "}", + "color": "ff5caeef" + } + ] + }, + { + "children": [] + } + ] +} diff --git a/packages/superdeck/test/src/utils/syntax_highlighter_output_test.dart b/packages/superdeck/test/src/utils/syntax_highlighter_output_test.dart new file mode 100644 index 000000000..acb0d1eb3 --- /dev/null +++ b/packages/superdeck/test/src/utils/syntax_highlighter_output_test.dart @@ -0,0 +1,104 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:flutter/widgets.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:superdeck/src/utils/syntax_highlighter.dart'; + +/// Regenerates the fixture from the current highlighter instead of comparing. +const _update = bool.fromEnvironment('UPDATE_HIGHLIGHT_FIXTURE'); + +const _fixturePath = 'test/fixtures/syntax_highlight/rendered_spans.json'; + +const _samples = { + 'dart': ''' +import 'dart:async'; + +/// A counter. +class Counter { + int _value = 0; + + Future increment({int by = 1}) async { + _value += by; // bump + print('value: \$_value'); + } +} +''', + 'json': ''' +{"name": "superdeck", "version": 1, "tags": ["slides", true, null]} +''', + 'yaml': ''' +# Deck options +title: Launch +style: dark +sections: + - name: intro + flex: 2 +''', + 'markdown': ''' +# Heading + +Some *emphasis*, **strong**, and `code`. + +- item one +- [link](https://superdeck.dev) +''', + 'python': ''' +def greet(name: str) -> str: + """Say hello.""" + return f"Hello, {name}!" # done +''', + // Unsupported languages fall back to the Dart grammar. + 'rust': ''' +fn main() { println!("hi"); } +''', +}; + +const _backgrounds = { + 'light': Color(0xFFFFFFFF), + 'dark': Color(0xFF101010), +}; + +Object? _spanToJson(InlineSpan span) { + if (span is! TextSpan) return span.runtimeType.toString(); + final style = span.style; + + return { + if (span.text != null) 'text': span.text, + if (style?.color != null) + 'color': style!.color!.toARGB32().toRadixString(16), + if (style?.fontWeight != null) 'weight': style!.fontWeight!.value, + if (style?.fontStyle != null) 'style': style!.fontStyle!.name, + if (span.children != null) + 'children': span.children!.map(_spanToJson).toList(), + }; +} + +Map _render() => { + for (final MapEntry(key: language, value: source) in _samples.entries) + for (final MapEntry(key: mode, value: background) in _backgrounds.entries) + '$language/$mode': SyntaxHighlight.render( + source, + language, + backgroundColor: background, + ).map(_spanToJson).toList(), +}; + +void main() { + testWidgets('highlighted output matches the recorded spans', (tester) async { + await SyntaxHighlight.initialize(); + + final rendered = _render(); + final file = File(_fixturePath); + // Synchronous I/O: real async file work never completes in the test zone. + if (_update) { + file.parent.createSync(recursive: true); + file.writeAsStringSync( + '${const JsonEncoder.withIndent(' ').convert(rendered)}\n', + ); + } + + final recorded = jsonDecode(file.readAsStringSync()); + expect(jsonDecode(jsonEncode(rendered)), recorded); + }); +} diff --git a/pubspec.lock b/pubspec.lock index 22f36559f..2ffc3cf7d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -433,22 +433,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.4" - device_info_plus: - dependency: transitive - description: - name: device_info_plus - sha256: "98f28b42168cc509abc92f88518882fd58061ea372d7999aecc424345c7bff6a" - url: "https://pub.dev" - source: hosted - version: "11.5.0" - device_info_plus_platform_interface: - dependency: transitive - description: - name: device_info_plus_platform_interface - sha256: e1ea89119e34903dca74b883d0dd78eb762814f97fb6c76f35e9ff74d261a18f - url: "https://pub.dev" - source: hosted - version: "7.0.3" dio: dependency: transitive description: @@ -800,22 +784,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.5" - irondash_engine_context: - dependency: transitive - description: - name: irondash_engine_context - sha256: "2bb0bc13dfda9f5aaef8dde06ecc5feb1379f5bb387d59716d799554f3f305d7" - url: "https://pub.dev" - source: hosted - version: "0.5.5" - irondash_message_channel: - dependency: transitive - description: - name: irondash_message_channel - sha256: b4101669776509c76133b8917ab8cfc704d3ad92a8c450b92934dd8884a2f060 - url: "https://pub.dev" - source: hosted - version: "0.7.0" jni: dependency: transitive description: @@ -1200,14 +1168,6 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.2" - pixel_snap: - dependency: transitive - description: - name: pixel_snap - sha256: "677410ea37b07cd37ecb6d5e6c0d8d7615a7cf3bd92ba406fd1ac57e937d1fb0" - url: "https://pub.dev" - source: hosted - version: "0.1.5" platform: dependency: transitive description: @@ -1605,22 +1565,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.1" - super_clipboard: - dependency: transitive - description: - name: super_clipboard - sha256: e73f3bb7e66cc9260efa1dc507f979138e7e106c3521e2dda2d0311f6d728a16 - url: "https://pub.dev" - source: hosted - version: "0.9.1" - super_native_extensions: - dependency: transitive - description: - name: super_native_extensions - sha256: b9611dcb68f1047d6f3ef11af25e4e68a21b1a705bbcc3eb8cb4e9f5c3148569 - url: "https://pub.dev" - source: hosted - version: "0.9.1" sync_http: dependency: transitive description: @@ -1637,14 +1581,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.4.1" - syntax_highlight: - dependency: transitive - description: - name: syntax_highlight - sha256: "4d3ba40658cadba6ba55d697f29f00b43538ebb6eb4a0ca0e895c568eaced138" - url: "https://pub.dev" - source: hosted - version: "0.5.0" term_glyph: dependency: transitive description: @@ -1925,14 +1861,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.15.0" - win32_registry: - dependency: transitive - description: - name: win32_registry - sha256: "6f1b564492d0147b330dd794fee8f512cec4977957f310f9951b5f9d83618dae" - url: "https://pub.dev" - source: hosted - version: "2.1.0" window_manager: dependency: transitive description: