diff --git a/bin/internal/engine.version b/bin/internal/engine.version index 9e6c8e7771137..0ad7f0cdeef96 100644 --- a/bin/internal/engine.version +++ b/bin/internal/engine.version @@ -1 +1 @@ -e5b72e5f87cae358b457b6c1cb55c4560ce3c46c +13cf22c284c24f81357aec6a89074a536efbf4d1 diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart index e8be2da565913..97b570481b1a8 100644 --- a/packages/flutter_tools/lib/src/cache.dart +++ b/packages/flutter_tools/lib/src/cache.dart @@ -402,6 +402,14 @@ class FlutterEngine extends CachedArtifact { ['windows-x64', 'dart-sdk-windows-x64.zip'], ]; + // A list of cache directory paths to which the LICENSE file should be copied. + List _getLicenseDirs() { + if (cache.includeAllPlatforms || platform.isMacOS) { + return const ['ios', 'ios-profile', 'ios-release']; + } + return const []; + } + @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) { diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-objc b/packages/flutter_tools/templates/cocoapods/Podfile-objc index cfee435775f2a..cdaa7b5efa496 100644 --- a/packages/flutter_tools/templates/cocoapods/Podfile-objc +++ b/packages/flutter_tools/templates/cocoapods/Podfile-objc @@ -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 @@ -51,4 +61,4 @@ post_install do |installer| config.build_settings['ENABLE_BITCODE'] = 'NO' end end -end \ No newline at end of file +end diff --git a/packages/flutter_tools/templates/cocoapods/Podfile-swift b/packages/flutter_tools/templates/cocoapods/Podfile-swift index 40fa1d2fae549..6b17e82d33844 100644 --- a/packages/flutter_tools/templates/cocoapods/Podfile-swift +++ b/packages/flutter_tools/templates/cocoapods/Podfile-swift @@ -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 @@ -57,4 +68,4 @@ post_install do |installer| config.build_settings['ENABLE_BITCODE'] = 'NO' end end -end \ No newline at end of file +end