Skip to content

Commit 23921ec

Browse files
author
Ananthu Kanive
committed
add cocoapods support
1 parent f420bd3 commit 23921ec

File tree

5 files changed

+172
-2
lines changed

5 files changed

+172
-2
lines changed

ios/Podfile

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def parse_KV_file(file, separator='=')
14+
file_abs_path = File.expand_path(file)
15+
if !File.exists? file_abs_path
16+
return [];
17+
end
18+
pods_ary = []
19+
skip_line_start_symbols = ["#", "/"]
20+
File.foreach(file_abs_path) { |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+
pods_ary.push({:name => podname, :path => podpath});
28+
else
29+
puts "Invalid plugin specification: #{line}"
30+
end
31+
}
32+
return pods_ary
33+
end
34+
35+
target 'Runner' do
36+
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
37+
# referring to absolute paths on developers' machines.
38+
system('rm -rf .symlinks')
39+
system('mkdir -p .symlinks/plugins')
40+
41+
# Flutter Pods
42+
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
43+
if generated_xcode_build_settings.empty?
44+
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
45+
end
46+
generated_xcode_build_settings.map { |p|
47+
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
48+
symlink = File.join('.symlinks', 'flutter')
49+
File.symlink(File.dirname(p[:path]), symlink)
50+
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
51+
end
52+
}
53+
54+
# Plugin Pods
55+
plugin_pods = parse_KV_file('../.flutter-plugins')
56+
plugin_pods.map { |p|
57+
symlink = File.join('.symlinks', 'plugins', p[:name])
58+
File.symlink(p[:path], symlink)
59+
pod p[:name], :path => File.join(symlink, 'ios')
60+
}
61+
end
62+
63+
post_install do |installer|
64+
installer.pods_project.targets.each do |target|
65+
target.build_configurations.each do |config|
66+
config.build_settings['ENABLE_BITCODE'] = 'NO'
67+
end
68+
end
69+
end

ios/Podfile.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PODS:
2+
- Flutter (1.0.0)
3+
- shared_preferences (0.0.1):
4+
- Flutter
5+
6+
DEPENDENCIES:
7+
- Flutter (from `.symlinks/flutter/ios`)
8+
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
9+
10+
EXTERNAL SOURCES:
11+
Flutter:
12+
:path: ".symlinks/flutter/ios"
13+
shared_preferences:
14+
:path: ".symlinks/plugins/shared_preferences/ios"
15+
16+
SPEC CHECKSUMS:
17+
Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296
18+
shared_preferences: 5a1d487c427ee18fcd3ea1f2a131569481834b53
19+
20+
PODFILE CHECKSUM: aff02bfeed411c636180d6812254b2daeea14d09
21+
22+
COCOAPODS: 1.5.3

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
2020
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
2121
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
22+
FC591B0B7B6AF333797AC39C /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BD1DC290B126F2A57C7C24AF /* libPods-Runner.a */; };
2223
/* End PBXBuildFile section */
2324

2425
/* Begin PBXCopyFilesBuildPhase section */
@@ -53,6 +54,7 @@
5354
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5455
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5556
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
57+
BD1DC290B126F2A57C7C24AF /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
5658
/* End PBXFileReference section */
5759

5860
/* Begin PBXFrameworksBuildPhase section */
@@ -62,12 +64,20 @@
6264
files = (
6365
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
6466
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67+
FC591B0B7B6AF333797AC39C /* libPods-Runner.a in Frameworks */,
6568
);
6669
runOnlyForDeploymentPostprocessing = 0;
6770
};
6871
/* End PBXFrameworksBuildPhase section */
6972

7073
/* Begin PBXGroup section */
74+
01AE53962CB7FCED0505B703 /* Pods */ = {
75+
isa = PBXGroup;
76+
children = (
77+
);
78+
name = Pods;
79+
sourceTree = "<group>";
80+
};
7181
9740EEB11CF90186004384FC /* Flutter */ = {
7282
isa = PBXGroup;
7383
children = (
@@ -87,7 +97,8 @@
8797
9740EEB11CF90186004384FC /* Flutter */,
8898
97C146F01CF9000F007C117D /* Runner */,
8999
97C146EF1CF9000F007C117D /* Products */,
90-
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
100+
01AE53962CB7FCED0505B703 /* Pods */,
101+
ABECF56C9BA414B6288AD0F0 /* Frameworks */,
91102
);
92103
sourceTree = "<group>";
93104
};
@@ -123,19 +134,29 @@
123134
name = "Supporting Files";
124135
sourceTree = "<group>";
125136
};
137+
ABECF56C9BA414B6288AD0F0 /* Frameworks */ = {
138+
isa = PBXGroup;
139+
children = (
140+
BD1DC290B126F2A57C7C24AF /* libPods-Runner.a */,
141+
);
142+
name = Frameworks;
143+
sourceTree = "<group>";
144+
};
126145
/* End PBXGroup section */
127146

128147
/* Begin PBXNativeTarget section */
129148
97C146ED1CF9000F007C117D /* Runner */ = {
130149
isa = PBXNativeTarget;
131150
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
132151
buildPhases = (
152+
74DF3C7EFBE324577AC388F5 /* [CP] Check Pods Manifest.lock */,
133153
9740EEB61CF901F6004384FC /* Run Script */,
134154
97C146EA1CF9000F007C117D /* Sources */,
135155
97C146EB1CF9000F007C117D /* Frameworks */,
136156
97C146EC1CF9000F007C117D /* Resources */,
137157
9705A1C41CF9048500538489 /* Embed Frameworks */,
138158
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
159+
E031359F41A63973EDBB7368 /* [CP] Embed Pods Frameworks */,
139160
);
140161
buildRules = (
141162
);
@@ -157,6 +178,7 @@
157178
TargetAttributes = {
158179
97C146ED1CF9000F007C117D = {
159180
CreatedOnToolsVersion = 7.3.1;
181+
DevelopmentTeam = 5ZT6D5885Q;
160182
};
161183
};
162184
};
@@ -208,6 +230,28 @@
208230
shellPath = /bin/sh;
209231
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
210232
};
233+
74DF3C7EFBE324577AC388F5 /* [CP] Check Pods Manifest.lock */ = {
234+
isa = PBXShellScriptBuildPhase;
235+
buildActionMask = 2147483647;
236+
files = (
237+
);
238+
inputFileListPaths = (
239+
);
240+
inputPaths = (
241+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
242+
"${PODS_ROOT}/Manifest.lock",
243+
);
244+
name = "[CP] Check Pods Manifest.lock";
245+
outputFileListPaths = (
246+
);
247+
outputPaths = (
248+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
249+
);
250+
runOnlyForDeploymentPostprocessing = 0;
251+
shellPath = /bin/sh;
252+
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";
253+
showEnvVarsInLog = 0;
254+
};
211255
9740EEB61CF901F6004384FC /* Run Script */ = {
212256
isa = PBXShellScriptBuildPhase;
213257
buildActionMask = 2147483647;
@@ -222,6 +266,28 @@
222266
shellPath = /bin/sh;
223267
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
224268
};
269+
E031359F41A63973EDBB7368 /* [CP] Embed Pods Frameworks */ = {
270+
isa = PBXShellScriptBuildPhase;
271+
buildActionMask = 2147483647;
272+
files = (
273+
);
274+
inputFileListPaths = (
275+
);
276+
inputPaths = (
277+
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
278+
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
279+
);
280+
name = "[CP] Embed Pods Frameworks";
281+
outputFileListPaths = (
282+
);
283+
outputPaths = (
284+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
285+
);
286+
runOnlyForDeploymentPostprocessing = 0;
287+
shellPath = /bin/sh;
288+
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
289+
showEnvVarsInLog = 0;
290+
};
225291
/* End PBXShellScriptBuildPhase section */
226292

227293
/* Begin PBXSourcesBuildPhase section */
@@ -311,7 +377,7 @@
311377
buildSettings = {
312378
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
313379
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
314-
DEVELOPMENT_TEAM = S8QB4VV633;
380+
DEVELOPMENT_TEAM = 5ZT6D5885Q;
315381
ENABLE_BITCODE = NO;
316382
FRAMEWORK_SEARCH_PATHS = (
317383
"$(inherited)",
@@ -437,6 +503,7 @@
437503
buildSettings = {
438504
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
439505
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
506+
DEVELOPMENT_TEAM = 5ZT6D5885Q;
440507
ENABLE_BITCODE = NO;
441508
FRAMEWORK_SEARCH_PATHS = (
442509
"$(inherited)",
@@ -460,6 +527,7 @@
460527
buildSettings = {
461528
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
462529
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
530+
DEVELOPMENT_TEAM = 5ZT6D5885Q;
463531
ENABLE_BITCODE = NO;
464532
FRAMEWORK_SEARCH_PATHS = (
465533
"$(inherited)",

ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)