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'],
|
<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
|
@override
|
||||||
bool isUpToDateInner() {
|
bool isUpToDateInner() {
|
||||||
final Directory pkgDir = cache.getCacheDir('pkg');
|
final Directory pkgDir = cache.getCacheDir('pkg');
|
||||||
@ -416,6 +424,12 @@ class FlutterEngine extends CachedArtifact {
|
|||||||
if (!dir.existsSync())
|
if (!dir.existsSync())
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,6 +461,12 @@ class FlutterEngine extends CachedArtifact {
|
|||||||
os.unzip(frameworkZip, framework);
|
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) {
|
void _makeFilesExecutable(Directory dir) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
||||||
def parse_KV_file(file,seperator='=')
|
def parse_KV_file(file, separator='=')
|
||||||
file_abs_path = File.expand_path(file)
|
file_abs_path = File.expand_path(file)
|
||||||
if !File.exists? file_abs_path
|
if !File.exists? file_abs_path
|
||||||
return [];
|
return [];
|
||||||
@ -13,12 +13,12 @@ def parse_KV_file(file,seperator='=')
|
|||||||
skip_line_start_symbols = ["#", "/"]
|
skip_line_start_symbols = ["#", "/"]
|
||||||
File.foreach(file_abs_path) { |line|
|
File.foreach(file_abs_path) { |line|
|
||||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
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
|
if plugin.length == 2
|
||||||
podname = plugin[0].strip()
|
podname = plugin[0].strip()
|
||||||
path = plugin[1].strip()
|
path = plugin[1].strip()
|
||||||
podpath = File.expand_path("#{path}", file_abs_path)
|
podpath = File.expand_path("#{path}", file_abs_path)
|
||||||
pods_ary.push({:name => podname,:path=>podpath});
|
pods_ary.push({:name => podname, :path => podpath});
|
||||||
else
|
else
|
||||||
puts "Invalid plugin specification: #{line}"
|
puts "Invalid plugin specification: #{line}"
|
||||||
end
|
end
|
||||||
@ -27,21 +27,31 @@ def parse_KV_file(file,seperator='=')
|
|||||||
end
|
end
|
||||||
|
|
||||||
target 'Runner' do
|
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
|
# 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?
|
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
|
end
|
||||||
generated_xcode_build_settings.map{ |p|
|
generated_xcode_build_settings.map { |p|
|
||||||
if p[:name]=='FLUTTER_FRAMEWORK_DIR'
|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||||
pod 'Flutter', :path => p[:path]
|
symlink = File.join('Pods', '.symlinks', 'flutter', File.basename(p[:path]))
|
||||||
|
File.symlink(p[:path], symlink)
|
||||||
|
pod 'Flutter', :path => symlink
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Plugin Pods
|
# Plugin Pods
|
||||||
plugin_pods = parse_KV_file("../.flutter-plugins")
|
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||||
plugin_pods.map{ |p|
|
plugin_pods.map { |p|
|
||||||
pod p[:name], :path => File.expand_path("ios",p[:path])
|
symlink = File.join('Pods', '.symlinks', 'plugins', File.basename(p[:path]))
|
||||||
|
File.symlink(p[:path], symlink)
|
||||||
|
pod p[:name], :path => File.join(symlink, 'ios')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,4 +61,4 @@ post_install do |installer|
|
|||||||
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
||||||
def parse_KV_file(file,seperator='=')
|
def parse_KV_file(file, separator='=')
|
||||||
file_abs_path = File.expand_path(file)
|
file_abs_path = File.expand_path(file)
|
||||||
if !File.exists? file_abs_path
|
if !File.exists? file_abs_path
|
||||||
return [];
|
return [];
|
||||||
@ -13,12 +13,12 @@ def parse_KV_file(file,seperator='=')
|
|||||||
skip_line_start_symbols = ["#", "/"]
|
skip_line_start_symbols = ["#", "/"]
|
||||||
File.foreach(file_abs_path) { |line|
|
File.foreach(file_abs_path) { |line|
|
||||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
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
|
if plugin.length == 2
|
||||||
podname = plugin[0].strip()
|
podname = plugin[0].strip()
|
||||||
path = plugin[1].strip()
|
path = plugin[1].strip()
|
||||||
podpath = File.expand_path("#{path}", file_abs_path)
|
podpath = File.expand_path("#{path}", file_abs_path)
|
||||||
pods_ary.push({:name => podname,:path=>podpath});
|
pods_ary.push({:name => podname, :path => podpath});
|
||||||
else
|
else
|
||||||
puts "Invalid plugin specification: #{line}"
|
puts "Invalid plugin specification: #{line}"
|
||||||
end
|
end
|
||||||
@ -28,21 +28,32 @@ end
|
|||||||
|
|
||||||
target 'Runner' do
|
target 'Runner' do
|
||||||
use_frameworks!
|
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
|
# 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?
|
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
|
end
|
||||||
generated_xcode_build_settings.map{ |p|
|
generated_xcode_build_settings.map { |p|
|
||||||
if p[:name]=='FLUTTER_FRAMEWORK_DIR'
|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
||||||
pod 'Flutter', :path => p[:path]
|
symlink = File.join('Pods', '.symlinks', 'flutter', File.basename(p[:path]))
|
||||||
|
File.symlink(p[:path], symlink)
|
||||||
|
pod 'Flutter', :path => symlink
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
# Plugin Pods
|
# Plugin Pods
|
||||||
plugin_pods = parse_KV_file("../.flutter-plugins")
|
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||||
plugin_pods.map{ |p|
|
plugin_pods.map { |p|
|
||||||
pod p[:name], :path => File.expand_path("ios",p[:path])
|
symlink = File.join('Pods', '.symlinks', 'plugins', File.basename(p[:path]))
|
||||||
|
File.symlink(p[:path], symlink)
|
||||||
|
pod p[:name], :path => File.join(symlink, 'ios')
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -57,4 +68,4 @@ post_install do |installer|
|
|||||||
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user