Skip to content

feat(darwin): migrate to Swift Package Manager#323

Merged
AlexV525 merged 10 commits into
mainfrom
support-swift-package-manager
Jul 14, 2026
Merged

feat(darwin): migrate to Swift Package Manager#323
AlexV525 merged 10 commits into
mainfrom
support-swift-package-manager

Conversation

@CaiJingLong

@CaiJingLong CaiJingLong commented Nov 25, 2024

Copy link
Copy Markdown
Member

Signed-off-by: Caijinglong <cjl_spy@163.com>
- Added FVM version cache to .gitignore files.
- Updated melos.yaml to include commands for building iOS with and without Swift Package Manager.
- Modified GitHub Actions workflow for iOS builds to utilize new build commands.
- Updated .gitignore in flutter_image_compress to exclude build artifacts.
- Added new Swift package files for Flutter integration in flutter_image_compress example.
- Updated pubspec.lock to reflect dependency version changes.

Signed-off-by: Caijinglong <cjl_spy@163.com>
Signed-off-by: Caijinglong <cjl_spy@163.com>
@alejandro-all-win-software

Copy link
Copy Markdown

Hey @CaiJingLong, do you have any updates on this?

AlexV525 and others added 4 commits July 12, 2026 21:54
- Reorganize flutter_image_compress_common Obj-C sources into
  Sources/flutter_image_compress_common/ layout with public headers under
  include/flutter_image_compress_common/. Add Package.swift declaring
  SwiftPM dependencies on SDWebImage 5.19+, SDWebImageWebPCoder 0.14+,
  and Mantle 2.2+. Keep iOS 9.0 deployment floor to match dependencies
  and existing podspec.
- Switch native dependency imports to @import (Mantle's SPM headers are
  flat and not namespaced under <Mantle/...>). Add explicit
  <UIKit/UIKit.h> to CompressHandler.h that CocoaPods provided
  implicitly.
- Add Package.swift for flutter_image_compress_macos and move the Swift
  source into Sources/flutter_image_compress_macos/ (macOS 10.15,
  FlutterMacOS only).
- Update podspecs to point at new source paths. CocoaPods integration
  continues to work.
- Add example/integration_test/compress_test.dart — behavior baseline
  covering all four APIs, JPEG/PNG/WebP/HEIC container assertions, EXIF
  preservation & orientation, rotation invariants, and transparency.
  Registers a flutter_image_compress/test MethodChannel in the example
  app (iOS + macOS) that exposes native EXIF key inspection.
- Add integration_test_{iOS,macOS} matrix jobs (SPM + CocoaPods) to CI.
- Add melos scripts verify_{ios,macos}_behavior.

Verified locally: iOS simulator 14/14 on both SPM and CocoaPods paths;
macOS 9/9 + 5 platform-gated skips on both paths.

Closes #322, #356, #360, #365.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
path_provider.getTemporaryDirectory() returns a path inside the
container's Library/Caches on sandboxed macOS builds, but the directory
is not created on first launch. On a fresh CI runner this causes
File.writeAsBytesSync to fail with PathNotFoundException — a locally
launched app happens to have created the directory on prior runs, which
is why this only surfaces in CI.

Route all test scratch writes through ensureScratchDirectory() which
creates the directory if missing. iOS/Android are unaffected (path
already existed) but the fix is safe there too.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AlexV525 AlexV525 marked this pull request as ready for review July 12, 2026 16:48
@AlexV525 AlexV525 changed the title feat(iOS): migrate to swift package manager feat(darwin): migrate to Swift Package Manager Jul 12, 2026
AlexV525 and others added 2 commits July 13, 2026 01:03
Xcode's DerivedData is a per-machine build cache and should never be
tracked. It leaked into the macOS example directory (19 files, ~555
lines of xcactivitylog / plist noise). Add `**/DerivedData/` to the root
.gitignore and remove the tracked copy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The root .gitignore already excludes pubspec.lock; example/pubspec.lock
was tracked before that rule landed. Remove it from the index so future
`flutter pub get` doesn't dirty the tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@adam-langley-minrisk

Copy link
Copy Markdown

Not sure this fix is working across the board.
When building a MacOS application, I still get the warning

The following plugins do not support Swift Package Manager for macos:
  - flutter_image_compress_macos

I have linked this branch directly in my pubspec

  flutter_image_compress:
    git:
      url: https://github.com/fluttercandies/flutter_image_compress.git
      ref: support-swift-package-manager
      path: packages/flutter_image_compress

I have confirmed pub get has downloaded the correct branch

* flutter_image_compress 2.4.0 from git https://github.com/fluttercandies/flutter_image_compress.git at dc2d12 in packages/flutter_image_compress (was 2.4.0)

@NearTox

NearTox commented Jul 13, 2026

Copy link
Copy Markdown

@adam-langley-minrisk I think you forget that we must override all sub projects meanwhile.

dependency_overrides:
  flutter_image_compress_common:
    git:
      url: https://github.com/fluttercandies/flutter_image_compress.git
      path: packages/flutter_image_compress_common
      ref: support-swift-package-manager
  flutter_image_compress_macos:
    git:
      url: https://github.com/fluttercandies/flutter_image_compress.git
      path: packages/flutter_image_compress_macos
      ref: support-swift-package-manager

@AlexV525 AlexV525 merged commit a77d6c4 into main Jul 14, 2026
17 of 18 checks passed
@AlexV525 AlexV525 deleted the support-swift-package-manager branch July 14, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants