mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 07:08:10 +08:00
[pigeon] Null safe requires Dart 2.12 (#252)
This commit is contained in:
10
.cirrus.yml
10
.cirrus.yml
@ -73,11 +73,19 @@ task:
|
|||||||
image: catalina-flutter
|
image: catalina-flutter
|
||||||
env:
|
env:
|
||||||
PATH: $PATH:/usr/local/bin
|
PATH: $PATH:/usr/local/bin
|
||||||
|
matrix:
|
||||||
|
CHANNEL: "master"
|
||||||
|
CHANNEL: "stable"
|
||||||
setup_script:
|
setup_script:
|
||||||
- pod repo update
|
- pod repo update
|
||||||
|
- git clone https://github.com/flutter/flutter.git
|
||||||
- git fetch origin master
|
- git fetch origin master
|
||||||
- flutter doctor
|
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
|
||||||
- pub global activate flutter_plugin_tools
|
- pub global activate flutter_plugin_tools
|
||||||
- brew install clang-format
|
- brew install clang-format
|
||||||
|
upgrade_script:
|
||||||
|
- flutter channel $CHANNEL
|
||||||
|
- flutter upgrade
|
||||||
|
- flutter doctor
|
||||||
build_script:
|
build_script:
|
||||||
- ./script/local_tests.sh
|
- ./script/local_tests.sh
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
## 0.1.18
|
||||||
|
|
||||||
|
* Null safe requires Dart 2.12.
|
||||||
|
|
||||||
## 0.1.17
|
## 0.1.17
|
||||||
|
|
||||||
* Split out test code generation for Dart into a separate file via the
|
* Split out test code generation for Dart into a separate file via the
|
||||||
|
@ -10,79 +10,33 @@ project 'Runner', {
|
|||||||
'Release' => :release,
|
'Release' => :release,
|
||||||
}
|
}
|
||||||
|
|
||||||
def parse_KV_file(file, separator='=')
|
def flutter_root
|
||||||
file_abs_path = File.expand_path(file)
|
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
||||||
if !File.exists? file_abs_path
|
unless File.exist?(generated_xcode_build_settings_path)
|
||||||
return [];
|
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||||
end
|
end
|
||||||
generated_key_values = {}
|
|
||||||
skip_line_start_symbols = ["#", "/"]
|
File.foreach(generated_xcode_build_settings_path) do |line|
|
||||||
File.foreach(file_abs_path) do |line|
|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
||||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
return matches[1].strip if matches
|
||||||
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)
|
|
||||||
generated_key_values[podname] = podpath
|
|
||||||
else
|
|
||||||
puts "Invalid plugin specification: #{line}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
generated_key_values
|
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
||||||
|
|
||||||
|
flutter_ios_podfile_setup
|
||||||
|
|
||||||
target 'Runner' do
|
target 'Runner' do
|
||||||
# Flutter Pod
|
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
use_modular_headers!
|
||||||
|
|
||||||
copied_flutter_dir = File.join(__dir__, 'Flutter')
|
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||||
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
|
|
||||||
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
|
|
||||||
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
|
|
||||||
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
|
|
||||||
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
|
|
||||||
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
|
|
||||||
|
|
||||||
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
|
|
||||||
unless File.exist?(generated_xcode_build_settings_path)
|
|
||||||
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
|
||||||
end
|
|
||||||
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
|
|
||||||
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
|
|
||||||
|
|
||||||
unless File.exist?(copied_framework_path)
|
|
||||||
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
|
|
||||||
end
|
|
||||||
unless File.exist?(copied_podspec_path)
|
|
||||||
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Keep pod path relative so it can be checked into Podfile.lock.
|
|
||||||
pod 'Flutter', :path => 'Flutter'
|
|
||||||
|
|
||||||
# Plugin Pods
|
|
||||||
|
|
||||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
|
||||||
# referring to absolute paths on developers' machines.
|
|
||||||
system('rm -rf .symlinks')
|
|
||||||
system('mkdir -p .symlinks/plugins')
|
|
||||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
|
||||||
plugin_pods.each do |name, path|
|
|
||||||
symlink = File.join('.symlinks', 'plugins', name)
|
|
||||||
File.symlink(path, symlink)
|
|
||||||
pod name, :path => File.join(symlink, 'ios')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
|
|
||||||
install! 'cocoapods', :disable_input_output_paths => true
|
|
||||||
|
|
||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
installer.pods_project.targets.each do |target|
|
installer.pods_project.targets.each do |target|
|
||||||
target.build_configurations.each do |config|
|
flutter_additional_ios_build_settings(target)
|
||||||
config.build_settings['ENABLE_BITCODE'] = 'NO'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import 'generator_tools.dart';
|
|||||||
|
|
||||||
/// Options that control how Dart code will be generated.
|
/// Options that control how Dart code will be generated.
|
||||||
class DartOptions {
|
class DartOptions {
|
||||||
/// Determines if the generated code has null safety annotations (Dart >2.10 required).
|
/// Determines if the generated code has null safety annotations (Dart >=2.12 required).
|
||||||
bool isNullSafe = false;
|
bool isNullSafe = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ void generateDart(DartOptions opt, Root root, StringSink sink) {
|
|||||||
indent.writeln(
|
indent.writeln(
|
||||||
'// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import',
|
'// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import',
|
||||||
);
|
);
|
||||||
indent.writeln('// @dart = ${opt.isNullSafe ? '2.10' : '2.8'}');
|
indent.writeln('// @dart = ${opt.isNullSafe ? '2.12' : '2.8'}');
|
||||||
indent.writeln('import \'dart:async\';');
|
indent.writeln('import \'dart:async\';');
|
||||||
indent.writeln(
|
indent.writeln(
|
||||||
'import \'dart:typed_data\' show Uint8List, Int32List, Int64List, Float64List;',
|
'import \'dart:typed_data\' show Uint8List, Int32List, Int64List, Float64List;',
|
||||||
@ -284,7 +284,7 @@ void generateTestDart(
|
|||||||
indent.writeln(
|
indent.writeln(
|
||||||
'// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import',
|
'// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import',
|
||||||
);
|
);
|
||||||
indent.writeln('// @dart = ${opt.isNullSafe ? '2.10' : '2.8'}');
|
indent.writeln('// @dart = ${opt.isNullSafe ? '2.12' : '2.8'}');
|
||||||
indent.writeln('import \'dart:async\';');
|
indent.writeln('import \'dart:async\';');
|
||||||
indent.writeln(
|
indent.writeln(
|
||||||
'import \'dart:typed_data\' show Uint8List, Int32List, Int64List, Float64List;',
|
'import \'dart:typed_data\' show Uint8List, Int32List, Int64List, Float64List;',
|
||||||
|
@ -8,7 +8,7 @@ import 'dart:mirrors';
|
|||||||
import 'ast.dart';
|
import 'ast.dart';
|
||||||
|
|
||||||
/// The current version of pigeon.
|
/// The current version of pigeon.
|
||||||
const String pigeonVersion = '0.1.17';
|
const String pigeonVersion = '0.1.18';
|
||||||
|
|
||||||
/// Read all the content from [stdin] to a String.
|
/// Read all the content from [stdin] to a String.
|
||||||
String readStdin() {
|
String readStdin() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: pigeon
|
name: pigeon
|
||||||
version: 0.1.17
|
version: 0.1.18
|
||||||
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
|
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
|
||||||
homepage: https://github.com/flutter/packages/tree/master/packages/pigeon
|
homepage: https://github.com/flutter/packages/tree/master/packages/pigeon
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# run_tests.sh
|
# run_tests.sh
|
||||||
#
|
#
|
||||||
# This runs all the different types of tests for pigeon. It should be run from
|
# This runs all the different types of tests for pigeon. It should be run from
|
||||||
# the directory that contains the script.
|
# the directory that contains the script.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# exit when any command fails
|
# exit when any command fails
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
# TODO(blasten): Enable on stable when possible.
|
||||||
|
# https://github.com/flutter/flutter/issues/75187
|
||||||
|
if [[ "$CHANNEL" == "stable" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Variables
|
# Variables
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -43,6 +49,7 @@ test_pigeon_ios() {
|
|||||||
-arch arm64 \
|
-arch arm64 \
|
||||||
-isysroot $(xcrun --sdk iphoneos --show-sdk-path) \
|
-isysroot $(xcrun --sdk iphoneos --show-sdk-path) \
|
||||||
-F $framework_path \
|
-F $framework_path \
|
||||||
|
-F $framework_path/Flutter.xcframework/ios-armv7_arm64 \
|
||||||
-Werror \
|
-Werror \
|
||||||
-fobjc-arc \
|
-fobjc-arc \
|
||||||
-c $temp_dir/pigeon.m \
|
-c $temp_dir/pigeon.m \
|
||||||
@ -194,7 +201,7 @@ xcodebuild \
|
|||||||
-scheme RunnerTests \
|
-scheme RunnerTests \
|
||||||
-sdk iphonesimulator \
|
-sdk iphonesimulator \
|
||||||
-destination 'platform=iOS Simulator,name=iPhone 8' \
|
-destination 'platform=iOS Simulator,name=iPhone 8' \
|
||||||
test | xcpretty
|
test
|
||||||
popd
|
popd
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
Reference in New Issue
Block a user