Skip to content

Commit 8861ca7

Browse files
committed
feat: CI for dart analyze and build
1 parent 7da1b8f commit 8861ca7

File tree

13 files changed

+129
-148
lines changed

13 files changed

+129
-148
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-java@v1
15+
with:
16+
java-version: '12.x'
17+
- name: Install Flutter
18+
uses: subosito/flutter-action@v1
19+
with:
20+
flutter-version: '2.0.3'
21+
- name: Install dependencies
22+
run: flutter pub get
23+
- name: Run dart analyze
24+
run: dart analyze
25+
- name: build iOS example project
26+
working-directory: ./example
27+
run: flutter build ios --release --no-codesign
28+
- name: build android example project
29+
working-directory: ./example
30+
run: flutter build apk
31+
- name: publish --dry-run
32+
run: flutter pub publish --dry-run

example/ios/Podfile

Lines changed: 16 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Uncomment this line to define a global platform for your project
2-
# platform :ios, '9.0'
2+
platform :ios, '9.0'
33

44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
@@ -10,81 +10,32 @@ project 'Runner', {
1010
'Release' => :release,
1111
}
1212

13-
def parse_KV_file(file, separator='=')
14-
file_abs_path = File.expand_path(file)
15-
if !File.exists? file_abs_path
16-
return [];
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
1717
end
18-
generated_key_values = {}
19-
skip_line_start_symbols = ["#", "/"]
20-
File.foreach(file_abs_path) do |line|
21-
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22-
plugin = line.split(pattern=separator)
23-
if plugin.length == 2
24-
podname = plugin[0].strip()
25-
path = plugin[1].strip()
26-
podpath = File.expand_path("#{path}", file_abs_path)
27-
generated_key_values[podname] = podpath
28-
else
29-
puts "Invalid plugin specification: #{line}"
30-
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
3122
end
32-
generated_key_values
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
3324
end
3425

26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
3530
target 'Runner' do
3631
use_frameworks!
3732
use_modular_headers!
38-
39-
# Flutter Pod
4033

41-
copied_flutter_dir = File.join(__dir__, 'Flutter')
42-
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43-
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44-
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45-
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46-
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47-
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48-
49-
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50-
unless File.exist?(generated_xcode_build_settings_path)
51-
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52-
end
53-
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54-
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55-
56-
unless File.exist?(copied_framework_path)
57-
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58-
end
59-
unless File.exist?(copied_podspec_path)
60-
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61-
end
62-
end
63-
64-
# Keep pod path relative so it can be checked into Podfile.lock.
65-
pod 'Flutter', :path => 'Flutter'
66-
67-
# Plugin Pods
68-
69-
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70-
# referring to absolute paths on developers' machines.
71-
system('rm -rf .symlinks')
72-
system('mkdir -p .symlinks/plugins')
73-
plugin_pods = parse_KV_file('../.flutter-plugins')
74-
plugin_pods.each do |name, path|
75-
symlink = File.join('.symlinks', 'plugins', name)
76-
File.symlink(path, symlink)
77-
pod name, :path => File.join(symlink, 'ios')
78-
end
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
7935
end
8036

81-
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
82-
install! 'cocoapods', :disable_input_output_paths => true
83-
8437
post_install do |installer|
8538
installer.pods_project.targets.each do |target|
86-
target.build_configurations.each do |config|
87-
config.build_settings['ENABLE_BITCODE'] = 'NO'
88-
end
39+
flutter_additional_ios_build_settings(target)
8940
end
9041
end

example/ios/Podfile.lock

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@ PODS:
22
- apple_maps_flutter (0.0.1):
33
- Flutter
44
- Flutter (1.0.0)
5-
- flutter_plugin_android_lifecycle (0.0.1):
6-
- Flutter
75
- google_maps_flutter (0.0.1):
86
- Flutter
9-
- GoogleMaps
10-
- GoogleMaps (2.7.0):
11-
- GoogleMaps/Maps (= 2.7.0)
12-
- GoogleMaps/Base (2.7.0)
13-
- GoogleMaps/Maps (2.7.0):
7+
- GoogleMaps (< 3.10)
8+
- GoogleMaps (3.8.0):
9+
- GoogleMaps/Maps (= 3.8.0)
10+
- GoogleMaps/Base (3.8.0)
11+
- GoogleMaps/Maps (3.8.0):
1412
- GoogleMaps/Base
1513

1614
DEPENDENCIES:
1715
- apple_maps_flutter (from `.symlinks/plugins/apple_maps_flutter/ios`)
1816
- Flutter (from `Flutter`)
19-
- flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`)
2017
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`)
2118

2219
SPEC REPOS:
@@ -28,18 +25,15 @@ EXTERNAL SOURCES:
2825
:path: ".symlinks/plugins/apple_maps_flutter/ios"
2926
Flutter:
3027
:path: Flutter
31-
flutter_plugin_android_lifecycle:
32-
:path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios"
3328
google_maps_flutter:
3429
:path: ".symlinks/plugins/google_maps_flutter/ios"
3530

3631
SPEC CHECKSUMS:
37-
apple_maps_flutter: 45925bdf704b86f713fcf6979ee1999d17b2a6e0
38-
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
39-
flutter_plugin_android_lifecycle: 47de533a02850f070f5696a623995e93eddcdb9b
40-
google_maps_flutter: d0dd62f5a7d39bae61057eb9f52dd778d99c7c6c
41-
GoogleMaps: f79af95cb24d869457b1f961c93d3ce8b2f3b848
32+
apple_maps_flutter: c59725efea39e13e703cde52a1d2b14866ad68a8
33+
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
34+
google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619
35+
GoogleMaps: 7c8d66d70e4e8c300f43a7219d8fdaad7b325a9a
4236

43-
PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83
37+
PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
4438

45-
COCOAPODS: 1.8.3
39+
COCOAPODS: 1.10.0

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,12 @@
243243
files = (
244244
);
245245
inputPaths = (
246+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
247+
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks/GoogleMaps.framework/Resources/GoogleMaps.bundle",
246248
);
247249
name = "[CP] Copy Pods Resources";
248250
outputPaths = (
251+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleMaps.bundle",
249252
);
250253
runOnlyForDeploymentPostprocessing = 0;
251254
shellPath = /bin/sh;
@@ -258,9 +261,12 @@
258261
files = (
259262
);
260263
inputPaths = (
264+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
265+
"${BUILT_PRODUCTS_DIR}/apple_maps_flutter/apple_maps_flutter.framework",
261266
);
262267
name = "[CP] Embed Pods Frameworks";
263268
outputPaths = (
269+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/apple_maps_flutter.framework",
264270
);
265271
runOnlyForDeploymentPostprocessing = 0;
266272
shellPath = /bin/sh;
@@ -325,7 +331,6 @@
325331
/* Begin XCBuildConfiguration section */
326332
249021D3217E4FDB00AE95B9 /* Profile */ = {
327333
isa = XCBuildConfiguration;
328-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
329334
buildSettings = {
330335
ALWAYS_SEARCH_USER_PATHS = NO;
331336
CLANG_ANALYZER_NONNULL = YES;
@@ -402,7 +407,6 @@
402407
};
403408
97C147031CF9000F007C117D /* Debug */ = {
404409
isa = XCBuildConfiguration;
405-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
406410
buildSettings = {
407411
ALWAYS_SEARCH_USER_PATHS = NO;
408412
CLANG_ANALYZER_NONNULL = YES;
@@ -458,7 +462,6 @@
458462
};
459463
97C147041CF9000F007C117D /* Release */ = {
460464
isa = XCBuildConfiguration;
461-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
462465
buildSettings = {
463466
ALWAYS_SEARCH_USER_PATHS = NO;
464467
CLANG_ANALYZER_NONNULL = YES;

example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)