mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Make Podfiles use symlinks to local pods (#14748)
This commit is contained in:
parent
54bf773d37
commit
130dfc87ad
@ -1 +1 @@
|
||||
e5b72e5f87cae358b457b6c1cb55c4560ce3c46c
|
||||
13cf22c284c24f81357aec6a89074a536efbf4d1
|
||||
|
@ -402,6 +402,14 @@ class FlutterEngine extends CachedArtifact {
|
||||
<String>['windows-x64', 'dart-sdk-windows-x64.zip'],
|
||||
];
|
||||
|
||||
// A list of cache directory paths to which the LICENSE file should be copied.
|
||||
List<String> _getLicenseDirs() {
|
||||
if (cache.includeAllPlatforms || platform.isMacOS) {
|
||||
return const <String>['ios', 'ios-profile', 'ios-release'];
|
||||
}
|
||||
return const <String>[];
|
||||
}
|
||||
|
||||
@override
|
||||
bool isUpToDateInner() {
|
||||
final Directory pkgDir = cache.getCacheDir('pkg');
|
||||
@ -416,6 +424,12 @@ class FlutterEngine extends CachedArtifact {
|
||||
if (!dir.existsSync())
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String licenseDir in _getLicenseDirs()) {
|
||||
final File file = fs.file(fs.path.join(location.path, licenseDir, 'LICENSE'));
|
||||
if (!file.existsSync())
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -447,6 +461,12 @@ class FlutterEngine extends CachedArtifact {
|
||||
os.unzip(frameworkZip, framework);
|
||||
}
|
||||
}
|
||||
|
||||
final File licenseSource = fs.file(fs.path.join(Cache.flutterRoot, 'LICENSE'));
|
||||
for (String licenseDir in _getLicenseDirs()) {
|
||||
final String licenseDestinationPath = fs.path.join(location.path, licenseDir, 'LICENSE');
|
||||
await licenseSource.copy(licenseDestinationPath);
|
||||
}
|
||||
}
|
||||
|
||||
void _makeFilesExecutable(Directory dir) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
def parse_KV_file(file,seperator='=')
|
||||
def parse_KV_file(file, separator='=')
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return [];
|
||||
@ -13,12 +13,12 @@ def parse_KV_file(file,seperator='=')
|
||||
skip_line_start_symbols = ["#", "/"]
|
||||
File.foreach(file_abs_path) { |line|
|
||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
||||
plugin = line.split(pattern=seperator)
|
||||
plugin = line.split(pattern=separator)
|
||||
if plugin.length == 2
|
||||
podname = plugin[0].strip()
|
||||
path = plugin[1].strip()
|
||||
podpath = File.expand_path("#{path}", file_abs_path)
|
||||
pods_ary.push({:name => podname,:path=>podpath});
|
||||
pods_ary.push({:name => podname, :path => podpath});
|
||||
else
|
||||
puts "Invalid plugin specification: #{line}"
|
||||
end
|
||||
@ -27,21 +27,31 @@ def parse_KV_file(file,seperator='=')
|
||||
end
|
||||
|
||||
target 'Runner' do
|
||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||
# referring to absolute paths on developers' machines.
|
||||
system('rm -rf Pods/.symlinks')
|
||||
system('mkdir -p Pods/.symlinks/flutter')
|
||||
system('mkdir -p Pods/.symlinks/plugins')
|
||||
|
||||
# Flutter Pods
|
||||
generated_xcode_build_settings = parse_KV_file("./Flutter/Generated.xcconfig")
|
||||
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
|
||||
if generated_xcode_build_settings.empty?
|
||||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first."
|
||||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
|
||||
end
|
||||
generated_xcode_build_settings.map{ |p|
|
||||
if p[:name]=='FLUTTER_FRAMEWORK_DIR'
|
||||
pod 'Flutter', :path => p[:path]
|
||||
generated_xcode_build_settings.map { |p|
|
||||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||
symlink = File.join('Pods', '.symlinks', 'flutter', File.basename(p[:path]))
|
||||
File.symlink(p[:path], symlink)
|
||||
pod 'Flutter', :path => symlink
|
||||
end
|
||||
}
|
||||
|
||||
# Plugin Pods
|
||||
plugin_pods = parse_KV_file("../.flutter-plugins")
|
||||
plugin_pods.map{ |p|
|
||||
pod p[:name], :path => File.expand_path("ios",p[:path])
|
||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||
plugin_pods.map { |p|
|
||||
symlink = File.join('Pods', '.symlinks', 'plugins', File.basename(p[:path]))
|
||||
File.symlink(p[:path], symlink)
|
||||
pod p[:name], :path => File.join(symlink, 'ios')
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||
|
||||
def parse_KV_file(file,seperator='=')
|
||||
def parse_KV_file(file, separator='=')
|
||||
file_abs_path = File.expand_path(file)
|
||||
if !File.exists? file_abs_path
|
||||
return [];
|
||||
@ -13,12 +13,12 @@ def parse_KV_file(file,seperator='=')
|
||||
skip_line_start_symbols = ["#", "/"]
|
||||
File.foreach(file_abs_path) { |line|
|
||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
||||
plugin = line.split(pattern=seperator)
|
||||
plugin = line.split(pattern=separator)
|
||||
if plugin.length == 2
|
||||
podname = plugin[0].strip()
|
||||
path = plugin[1].strip()
|
||||
podpath = File.expand_path("#{path}", file_abs_path)
|
||||
pods_ary.push({:name => podname,:path=>podpath});
|
||||
pods_ary.push({:name => podname, :path => podpath});
|
||||
else
|
||||
puts "Invalid plugin specification: #{line}"
|
||||
end
|
||||
@ -28,21 +28,32 @@ end
|
||||
|
||||
target 'Runner' do
|
||||
use_frameworks!
|
||||
|
||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||
# referring to absolute paths on developers' machines.
|
||||
system('rm -rf Pods/.symlinks')
|
||||
system('mkdir -p Pods/.symlinks/flutter')
|
||||
system('mkdir -p Pods/.symlinks/plugins')
|
||||
|
||||
# Flutter Pods
|
||||
generated_xcode_build_settings = parse_KV_file("./Flutter/Generated.xcconfig")
|
||||
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
|
||||
if generated_xcode_build_settings.empty?
|
||||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter build or flutter run is executed once first."
|
||||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
|
||||
end
|
||||
generated_xcode_build_settings.map{ |p|
|
||||
if p[:name]=='FLUTTER_FRAMEWORK_DIR'
|
||||
pod 'Flutter', :path => p[:path]
|
||||
generated_xcode_build_settings.map { |p|
|
||||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||
symlink = File.join('Pods', '.symlinks', 'flutter', File.basename(p[:path]))
|
||||
File.symlink(p[:path], symlink)
|
||||
pod 'Flutter', :path => symlink
|
||||
end
|
||||
}
|
||||
|
||||
# Plugin Pods
|
||||
plugin_pods = parse_KV_file("../.flutter-plugins")
|
||||
plugin_pods.map{ |p|
|
||||
pod p[:name], :path => File.expand_path("ios",p[:path])
|
||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||
plugin_pods.map { |p|
|
||||
symlink = File.join('Pods', '.symlinks', 'plugins', File.basename(p[:path]))
|
||||
File.symlink(p[:path], symlink)
|
||||
pod p[:name], :path => File.join(symlink, 'ios')
|
||||
}
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user