Skip to content

Commit

Permalink
feat: support macOS (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiJingLong committed Oct 20, 2023
1 parent 6266ba4 commit 06ab91e
Show file tree
Hide file tree
Showing 42 changed files with 2,566 additions and 6 deletions.
7 changes: 7 additions & 0 deletions melos.yaml
Expand Up @@ -34,6 +34,13 @@ scripts:
flutter build web
packageFilters:
fileExists: lib/main.dart
try_build_macos:
exec: |
set -e
flutter pub get
flutter build macos
packageFilters:
fileExists: lib/main.dart
cp_files:
exec: |
set -e
Expand Down
12 changes: 6 additions & 6 deletions packages/flutter_image_compress/example/.metadata
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled.

version:
revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
channel: stable

project_type: app
Expand All @@ -13,11 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
- platform: web
create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
- platform: macos
create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8

# User provided section

Expand Down
7 changes: 7 additions & 0 deletions packages/flutter_image_compress/example/macos/.gitignore
@@ -0,0 +1,7 @@
# Flutter-related
**/Flutter/ephemeral/
**/Pods/

# Xcode-related
**/dgph
**/xcuserdata/
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
@@ -0,0 +1,14 @@
//
// Generated file. Do not edit.
//

import FlutterMacOS
import Foundation

import flutter_image_compress_macos
import path_provider_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
43 changes: 43 additions & 0 deletions packages/flutter_image_compress/example/macos/Podfile
@@ -0,0 +1,43 @@
platform :osx, '10.15'

# 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)
end
end

0 comments on commit 06ab91e

Please sign in to comment.