Unverified Commit 0b3f5cfc authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] initial support for enable experiment, run, apk, ios, macos (#54617)

parent e9868501
...@@ -605,6 +605,7 @@ Future<void> verifyNoTrailingSpaces(String workingDirectory, { int minimumMatche ...@@ -605,6 +605,7 @@ Future<void> verifyNoTrailingSpaces(String workingDirectory, { int minimumMatche
.where((File file) => path.extension(file.path) != '.jpg') .where((File file) => path.extension(file.path) != '.jpg')
.where((File file) => path.extension(file.path) != '.ico') .where((File file) => path.extension(file.path) != '.ico')
.where((File file) => path.extension(file.path) != '.jar') .where((File file) => path.extension(file.path) != '.jar')
.where((File file) => path.extension(file.path) != '.swp')
.toList(); .toList();
final List<String> problems = <String>[]; final List<String> problems = <String>[];
for (final File file in files) { for (final File file in files) {
...@@ -1299,5 +1300,6 @@ bool _isGeneratedPluginRegistrant(File file) { ...@@ -1299,5 +1300,6 @@ bool _isGeneratedPluginRegistrant(File file) {
return !file.path.contains('.pub-cache') return !file.path.contains('.pub-cache')
&& (filename == 'GeneratedPluginRegistrant.java' || && (filename == 'GeneratedPluginRegistrant.java' ||
filename == 'GeneratedPluginRegistrant.h' || filename == 'GeneratedPluginRegistrant.h' ||
filename == 'GeneratedPluginRegistrant.m'); filename == 'GeneratedPluginRegistrant.m' ||
filename == 'generated_plugin_registrant.dart');
} }
...@@ -9,6 +9,7 @@ import 'dart:math' as math; ...@@ -9,6 +9,7 @@ import 'dart:math' as math;
import 'package:googleapis/bigquery/v2.dart' as bq; import 'package:googleapis/bigquery/v2.dart' as bq;
import 'package:googleapis_auth/auth_io.dart' as auth; import 'package:googleapis_auth/auth_io.dart' as auth;
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'browser.dart'; import 'browser.dart';
...@@ -287,21 +288,27 @@ Future<void> _runToolTests() async { ...@@ -287,21 +288,27 @@ Future<void> _runToolTests() async {
/// we can build when there are spaces in the path name for the Flutter SDK and /// we can build when there are spaces in the path name for the Flutter SDK and
/// target app. /// target app.
Future<void> _runBuildTests() async { Future<void> _runBuildTests() async {
final Stream<FileSystemEntity> exampleDirectories = Directory(path.join(flutterRoot, 'examples')).list(); final List<FileSystemEntity> exampleDirectories = Directory(path.join(flutterRoot, 'examples')).listSync()
await for (final FileSystemEntity fileEntity in exampleDirectories) { ..add(Directory(path.join(flutterRoot, 'dev', 'integration_tests', 'non_nullable')));
for (final FileSystemEntity fileEntity in exampleDirectories) {
if (fileEntity is! Directory) { if (fileEntity is! Directory) {
continue; continue;
} }
final String examplePath = fileEntity.path; final String examplePath = fileEntity.path;
final bool hasNullSafety = File(path.join(examplePath, 'null_safety')).existsSync();
final List<String> additionalArgs = hasNullSafety
? <String>['--enable-experiment', 'non-nullable']
: <String>[];
if (Directory(path.join(examplePath, 'android')).existsSync()) { if (Directory(path.join(examplePath, 'android')).existsSync()) {
await _flutterBuildAot(examplePath); await _flutterBuildApk(examplePath, release: false, additionalArgs: additionalArgs);
await _flutterBuildApk(examplePath); await _flutterBuildApk(examplePath, release: true, additionalArgs: additionalArgs);
} else { } else {
print('Example project ${path.basename(examplePath)} has no android directory, skipping aot and apk'); print('Example project ${path.basename(examplePath)} has no android directory, skipping apk');
} }
if (Platform.isMacOS) { if (Platform.isMacOS) {
if (Directory(path.join(examplePath, 'ios')).existsSync()) { if (Directory(path.join(examplePath, 'ios')).existsSync()) {
await _flutterBuildIpa(examplePath); await _flutterBuildIpa(examplePath, release: false, additionalArgs: additionalArgs);
await _flutterBuildIpa(examplePath, release: true, additionalArgs: additionalArgs);
} else { } else {
print('Example project ${path.basename(examplePath)} has no ios directory, skipping ipa'); print('Example project ${path.basename(examplePath)} has no ios directory, skipping ipa');
} }
...@@ -323,23 +330,30 @@ Future<void> _runBuildTests() async { ...@@ -323,23 +330,30 @@ Future<void> _runBuildTests() async {
} }
} }
Future<void> _flutterBuildAot(String relativePathToApplication) async { Future<void> _flutterBuildApk(String relativePathToApplication, {
print('${green}Testing AOT build$reset for $cyan$relativePathToApplication$reset...'); @required bool release,
await runCommand(flutter, List<String> additionalArgs = const <String>[],
<String>['build', 'aot', '-v'], }) async {
workingDirectory: path.join(flutterRoot, relativePathToApplication),
);
}
Future<void> _flutterBuildApk(String relativePathToApplication) async {
print('${green}Testing APK --debug build$reset for $cyan$relativePathToApplication$reset...'); print('${green}Testing APK --debug build$reset for $cyan$relativePathToApplication$reset...');
await runCommand(flutter, await runCommand(flutter,
<String>['build', 'apk', '--debug', '-v'], <String>[
'build',
'apk',
...additionalArgs,
if (release)
'--release'
else
'--debug',
'-v',
],
workingDirectory: path.join(flutterRoot, relativePathToApplication), workingDirectory: path.join(flutterRoot, relativePathToApplication),
); );
} }
Future<void> _flutterBuildIpa(String relativePathToApplication) async { Future<void> _flutterBuildIpa(String relativePathToApplication, {
@required bool release,
List<String> additionalArgs = const <String>[],
}) async {
assert(Platform.isMacOS); assert(Platform.isMacOS);
print('${green}Testing IPA build$reset for $cyan$relativePathToApplication$reset...'); print('${green}Testing IPA build$reset for $cyan$relativePathToApplication$reset...');
// Install Cocoapods. We don't have these checked in for the examples, // Install Cocoapods. We don't have these checked in for the examples,
...@@ -355,7 +369,17 @@ Future<void> _flutterBuildIpa(String relativePathToApplication) async { ...@@ -355,7 +369,17 @@ Future<void> _flutterBuildIpa(String relativePathToApplication) async {
); );
} }
await runCommand(flutter, await runCommand(flutter,
<String>['build', 'ios', '--no-codesign', '--debug', '-v'], <String>[
'build',
'ios',
...additionalArgs,
'--no-codesign',
if (release)
'--release'
else
'--debug',
'-v',
],
workingDirectory: path.join(flutterRoot, relativePathToApplication), workingDirectory: path.join(flutterRoot, relativePathToApplication),
); );
} }
...@@ -590,6 +614,7 @@ Future<void> _runWebIntegrationTests() async { ...@@ -590,6 +614,7 @@ Future<void> _runWebIntegrationTests() async {
await _runWebDebugTest('lib/stack_trace.dart'); await _runWebDebugTest('lib/stack_trace.dart');
await _runWebDebugTest('lib/web_directory_loading.dart'); await _runWebDebugTest('lib/web_directory_loading.dart');
await _runWebDebugTest('test/test.dart'); await _runWebDebugTest('test/test.dart');
await _runWebDebugTest('lib/null_safe_main.dart', enableNullSafety: true);
await _runWebDebugTest('lib/web_define_loading.dart', await _runWebDebugTest('lib/web_define_loading.dart',
additionalArguments: <String>[ additionalArguments: <String>[
'--dart-define=test.valueA=Example', '--dart-define=test.valueA=Example',
...@@ -692,6 +717,7 @@ Future<void> _runWebReleaseTest(String target, { ...@@ -692,6 +717,7 @@ Future<void> _runWebReleaseTest(String target, {
/// ///
/// Instead, we use `flutter run --debug` and sniff out the standard output. /// Instead, we use `flutter run --debug` and sniff out the standard output.
Future<void> _runWebDebugTest(String target, { Future<void> _runWebDebugTest(String target, {
bool enableNullSafety = false,
List<String> additionalArguments = const<String>[], List<String> additionalArguments = const<String>[],
}) async { }) async {
final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web'); final String testAppDirectory = path.join(flutterRoot, 'dev', 'integration_tests', 'web');
...@@ -702,6 +728,11 @@ Future<void> _runWebDebugTest(String target, { ...@@ -702,6 +728,11 @@ Future<void> _runWebDebugTest(String target, {
<String>[ <String>[
'run', 'run',
'--debug', '--debug',
if (enableNullSafety)
...<String>[
'--enable-experiment',
'non-nullable',
],
'-d', '-d',
'chrome', 'chrome',
'--web-run-headless', '--web-run-headless',
......
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
# Exclude lib/main.dart to avoid warnings about the non_nullable
# experiment before it is enabled.
analyzer:
exclude:
- lib/main.dart
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.non_nullable"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.non_nullable">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.non_nullable">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="non_nullable"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/NormalTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
package com.example.non_nullable
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<resources>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
</style>
</resources>
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.non_nullable">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>non_nullable</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "GeneratedPluginRegistrant.h"
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart=2.9
import 'package:flutter/material.dart';
String? unused;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const Center(child: Text('hello, world'))
);
}
}
name: non_nullable
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: 0.1.3
collection: 1.14.12 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.1.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
typed_data: 1.1.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.0.8 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
sdk: flutter
async: 2.4.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
charcode: 1.1.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
clock: 1.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
fake_async: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.6 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
path: 1.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.9.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.0.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.0.5 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.1.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.2.15 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
flutter:
uses-material-design: true
# PUBSPEC CHECKSUM: 7c67
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
<!DOCTYPE HTML>
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="non_nullable">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<title>non_nullable</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
{
"name": "non_nullable",
"short_name": "non_nullable",
"start_url": ".",
"display": "minimal-ui",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
# Exclude lib/main.dart to avoid warnings about the non_nullable
# experiment before it is enabled.
analyzer:
exclude:
- lib/null_safe_main.dart
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart=2.9
String? x;
void main() {
print('--- TEST SUCCEEDED ---');
}
...@@ -3,7 +3,7 @@ description: Integration test for web compilation. ...@@ -3,7 +3,7 @@ description: Integration test for web compilation.
environment: environment:
# The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite. # The pub client defaults to an <2.0.0 sdk constraint which we need to explicitly overwrite.
sdk: ">=2.0.0-dev.68.0 <3.0.0" sdk: ">=2.6.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
...@@ -84,6 +84,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" \ ...@@ -84,6 +84,7 @@ RunCommand "${FLUTTER_ROOT}/bin/flutter" \
-dDartObfuscation="${dart_obfuscation_flag}" \ -dDartObfuscation="${dart_obfuscation_flag}" \
-dSplitDebugInfo="${SPLIT_DEBUG_INFO}" \ -dSplitDebugInfo="${SPLIT_DEBUG_INFO}" \
--DartDefines="${DART_DEFINES}" \ --DartDefines="${DART_DEFINES}" \
--ExtraGenSnapshotOptions="${EXTRA_GEN_SNAPSHOT_OPTIONS}" \
-dExtraFrontEndOptions="${EXTRA_FRONT_END_OPTIONS}" \ -dExtraFrontEndOptions="${EXTRA_FRONT_END_OPTIONS}" \
--build-inputs="${build_inputs_path}" \ --build-inputs="${build_inputs_path}" \
--build-outputs="${build_outputs_path}" \ --build-outputs="${build_outputs_path}" \
......
...@@ -186,6 +186,7 @@ BuildApp() { ...@@ -186,6 +186,7 @@ BuildApp() {
-dTrackWidgetCreation="${track_widget_creation_flag}" \ -dTrackWidgetCreation="${track_widget_creation_flag}" \
-dDartObfuscation="${dart_obfuscation_flag}" \ -dDartObfuscation="${dart_obfuscation_flag}" \
-dEnableBitcode="${bitcode_flag}" \ -dEnableBitcode="${bitcode_flag}" \
--ExtraGenSnapshotOptions="${EXTRA_GEN_SNAPSHOT_OPTIONS}" \
--DartDefines="${DART_DEFINES}" \ --DartDefines="${DART_DEFINES}" \
-dExtraFrontEndOptions="${EXTRA_FRONT_END_OPTIONS}" \ -dExtraFrontEndOptions="${EXTRA_FRONT_END_OPTIONS}" \
"${build_mode}_ios_bundle_flutter_assets" "${build_mode}_ios_bundle_flutter_assets"
......
...@@ -315,7 +315,7 @@ Future<void> buildGradleApp({ ...@@ -315,7 +315,7 @@ Future<void> buildGradleApp({
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions.join(',')}'); command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions.join(',')}');
} }
if (buildInfo.extraGenSnapshotOptions != null) { if (buildInfo.extraGenSnapshotOptions != null) {
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}'); command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions.join(',')}');
} }
if (buildInfo.fileSystemRoots != null && buildInfo.fileSystemRoots.isNotEmpty) { if (buildInfo.fileSystemRoots != null && buildInfo.fileSystemRoots.isNotEmpty) {
command.add('-Pfilesystem-roots=${buildInfo.fileSystemRoots.join('|')}'); command.add('-Pfilesystem-roots=${buildInfo.fileSystemRoots.join('|')}');
......
...@@ -24,6 +24,7 @@ class BuildInfo { ...@@ -24,6 +24,7 @@ class BuildInfo {
this.splitDebugInfoPath, this.splitDebugInfoPath,
this.dartObfuscation = false, this.dartObfuscation = false,
this.dartDefines = const <String>[], this.dartDefines = const <String>[],
this.dartExperiments = const <String>[],
@required this.treeShakeIcons, @required this.treeShakeIcons,
}); });
...@@ -79,6 +80,9 @@ class BuildInfo { ...@@ -79,6 +80,9 @@ class BuildInfo {
/// [bool], [String], [int], and [double]. /// [bool], [String], [int], and [double].
final List<String> dartDefines; final List<String> dartDefines;
/// A list of Dart experiments.
final List<String> dartExperiments;
static const BuildInfo debug = BuildInfo(BuildMode.debug, null, treeShakeIcons: false); static const BuildInfo debug = BuildInfo(BuildMode.debug, null, treeShakeIcons: false);
static const BuildInfo profile = BuildInfo(BuildMode.profile, null, treeShakeIcons: kIconTreeShakerEnabledDefault); static const BuildInfo profile = BuildInfo(BuildMode.profile, null, treeShakeIcons: kIconTreeShakerEnabledDefault);
static const BuildInfo jitRelease = BuildInfo(BuildMode.jitRelease, null, treeShakeIcons: kIconTreeShakerEnabledDefault); static const BuildInfo jitRelease = BuildInfo(BuildMode.jitRelease, null, treeShakeIcons: kIconTreeShakerEnabledDefault);
......
...@@ -435,6 +435,7 @@ class _ResidentWebRunner extends ResidentWebRunner { ...@@ -435,6 +435,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
debuggingOptions.buildInfo, debuggingOptions.buildInfo,
debuggingOptions.initializePlatform, debuggingOptions.initializePlatform,
false, false,
debuggingOptions.buildInfo.dartExperiments,
); );
} }
await device.device.startApp( await device.device.startApp(
...@@ -496,6 +497,7 @@ class _ResidentWebRunner extends ResidentWebRunner { ...@@ -496,6 +497,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
debuggingOptions.buildInfo, debuggingOptions.buildInfo,
debuggingOptions.initializePlatform, debuggingOptions.initializePlatform,
false, false,
debuggingOptions.buildInfo.dartExperiments,
); );
} on ToolExit { } on ToolExit {
return OperationResult(1, 'Failed to recompile application.'); return OperationResult(1, 'Failed to recompile application.');
......
...@@ -46,8 +46,7 @@ abstract class AotAssemblyBase extends Target { ...@@ -46,8 +46,7 @@ abstract class AotAssemblyBase extends Target {
if (environment.defines[kTargetPlatform] == null) { if (environment.defines[kTargetPlatform] == null) {
throw MissingDefineException(kTargetPlatform, 'aot_assembly'); throw MissingDefineException(kTargetPlatform, 'aot_assembly');
} }
final List<String> extraGenSnapshotOptions = environment final List<String> extraGenSnapshotOptions = parseExtraGenSnapshotOptions(environment);
.defines[kExtraGenSnapshotOptions]?.split(',') ?? const <String>[];
final bool bitcode = environment.defines[kBitcodeFlag] == 'true'; final bool bitcode = environment.defines[kBitcodeFlag] == 'true';
final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]); final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]);
final TargetPlatform targetPlatform = getTargetPlatformForName(environment.defines[kTargetPlatform]); final TargetPlatform targetPlatform = getTargetPlatformForName(environment.defines[kTargetPlatform]);
...@@ -438,3 +437,13 @@ Future<RunResult> createStubAppFramework(File outputFile, SdkType sdk, { bool in ...@@ -438,3 +437,13 @@ Future<RunResult> createStubAppFramework(File outputFile, SdkType sdk, { bool in
} }
} }
} }
/// iOS and macOS build scripts may pass extraGenSnapshotOptions as an empty
/// string.
List<String> parseExtraGenSnapshotOptions(Environment environment) {
final String value = environment.defines[kExtraGenSnapshotOptions];
if (value == null || value.trim().isEmpty) {
return <String>[];
}
return value.split(',');
}
...@@ -15,6 +15,7 @@ import '../exceptions.dart'; ...@@ -15,6 +15,7 @@ import '../exceptions.dart';
import 'assets.dart'; import 'assets.dart';
import 'dart.dart'; import 'dart.dart';
import 'icon_tree_shaker.dart'; import 'icon_tree_shaker.dart';
import 'ios.dart';
/// Copy the macOS framework to the correct copy dir by invoking 'cp -R'. /// Copy the macOS framework to the correct copy dir by invoking 'cp -R'.
/// ///
...@@ -198,6 +199,7 @@ class CompileMacOSFramework extends Target { ...@@ -198,6 +199,7 @@ class CompileMacOSFramework extends Target {
} }
final String splitDebugInfo = environment.defines[kSplitDebugInfo]; final String splitDebugInfo = environment.defines[kSplitDebugInfo];
final bool dartObfuscation = environment.defines[kDartObfuscation] == 'true'; final bool dartObfuscation = environment.defines[kDartObfuscation] == 'true';
final List<String> extraGenSnapshotOptions = parseExtraGenSnapshotOptions(environment);
final AOTSnapshotter snapshotter = AOTSnapshotter( final AOTSnapshotter snapshotter = AOTSnapshotter(
reportTimings: false, reportTimings: false,
fileSystem: globals.fs, fileSystem: globals.fs,
...@@ -216,6 +218,7 @@ class CompileMacOSFramework extends Target { ...@@ -216,6 +218,7 @@ class CompileMacOSFramework extends Target {
packagesPath: environment.projectDir.childFile('.packages').path, packagesPath: environment.projectDir.childFile('.packages').path,
splitDebugInfo: splitDebugInfo, splitDebugInfo: splitDebugInfo,
dartObfuscation: dartObfuscation, dartObfuscation: dartObfuscation,
extraGenSnapshotOptions: extraGenSnapshotOptions,
); );
if (result != 0) { if (result != 0) {
throw Exception('gen shapshot failed.'); throw Exception('gen shapshot failed.');
......
...@@ -27,6 +27,11 @@ const String kHasWebPlugins = 'HasWebPlugins'; ...@@ -27,6 +27,11 @@ const String kHasWebPlugins = 'HasWebPlugins';
/// Valid values are O1 (lowest, profile default) to O4 (highest, release default). /// Valid values are O1 (lowest, profile default) to O4 (highest, release default).
const String kDart2jsOptimization = 'Dart2jsOptimization'; const String kDart2jsOptimization = 'Dart2jsOptimization';
/// Allow specifying experiments for dart2js.
///
/// Multiple values should be encoded as a comma-separated list.
const String kEnableExperiment = 'EnableExperiment';
/// Whether to disable dynamic generation code to satisfy csp policies. /// Whether to disable dynamic generation code to satisfy csp policies.
const String kCspMode = 'cspMode'; const String kCspMode = 'cspMode';
...@@ -152,11 +157,13 @@ class Dart2JSTarget extends Target { ...@@ -152,11 +157,13 @@ class Dart2JSTarget extends Target {
final String dart2jsOptimization = environment.defines[kDart2jsOptimization]; final String dart2jsOptimization = environment.defines[kDart2jsOptimization];
final bool csp = environment.defines[kCspMode] == 'true'; final bool csp = environment.defines[kCspMode] == 'true';
final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]); final BuildMode buildMode = getBuildModeForName(environment.defines[kBuildMode]);
final String specPath = globals.fs.path.join(globals.artifacts.getArtifactPath(Artifact.flutterWebSdk), 'libraries.json'); final String specPath = globals.fs.path.join(
globals.artifacts.getArtifactPath(Artifact.flutterWebSdk), 'libraries.json');
final String packageFile = globalPackagesPath; final String packageFile = globalPackagesPath;
final File outputKernel = environment.buildDir.childFile('app.dill'); final File outputKernel = environment.buildDir.childFile('app.dill');
final File outputFile = environment.buildDir.childFile('main.dart.js'); final File outputFile = environment.buildDir.childFile('main.dart.js');
final List<String> dartDefines = parseDartDefines(environment); final List<String> dartDefines = parseDartDefines(environment);
final String enabledExperiments = environment.defines[kEnableExperiment];
// Run the dart2js compilation in two stages, so that icon tree shaking can // Run the dart2js compilation in two stages, so that icon tree shaking can
// parse the kernel file for web builds. // parse the kernel file for web builds.
...@@ -164,11 +171,17 @@ class Dart2JSTarget extends Target { ...@@ -164,11 +171,17 @@ class Dart2JSTarget extends Target {
globals.artifacts.getArtifactPath(Artifact.engineDartBinary), globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
globals.artifacts.getArtifactPath(Artifact.dart2jsSnapshot), globals.artifacts.getArtifactPath(Artifact.dart2jsSnapshot),
'--libraries-spec=$specPath', '--libraries-spec=$specPath',
if (enabledExperiments != null)
'--enable-experiment=$enabledExperiments',
'-o', '-o',
outputKernel.path, outputKernel.path,
'--packages=$packageFile',
if (buildMode == BuildMode.profile)
'-Ddart.vm.profile=true'
else
'-Ddart.vm.product=true',
for (final String dartDefine in dartDefines) for (final String dartDefine in dartDefines)
'-D$dartDefine', '-D$dartDefine',
'--packages=$packageFile',
'--cfe-only', '--cfe-only',
environment.buildDir.childFile('main.dart').path, environment.buildDir.childFile('main.dart').path,
]); ]);
...@@ -179,6 +192,8 @@ class Dart2JSTarget extends Target { ...@@ -179,6 +192,8 @@ class Dart2JSTarget extends Target {
globals.artifacts.getArtifactPath(Artifact.engineDartBinary), globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
globals.artifacts.getArtifactPath(Artifact.dart2jsSnapshot), globals.artifacts.getArtifactPath(Artifact.dart2jsSnapshot),
'--libraries-spec=$specPath', '--libraries-spec=$specPath',
if (enabledExperiments != null)
'--enable-experiment=$enabledExperiments',
if (dart2jsOptimization != null) if (dart2jsOptimization != null)
'-$dart2jsOptimization' '-$dart2jsOptimization'
else else
......
...@@ -30,7 +30,7 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -30,7 +30,7 @@ class AnalyzeCommand extends FlutterCommand {
_logger = logger, _logger = logger,
_terminal = terminal, _terminal = terminal,
_platform = platform { _platform = platform {
addEnableExperimentation(verbose: verboseHelp); addEnableExperimentation(hide: !verboseHelp);
argParser.addFlag('flutter-repo', argParser.addFlag('flutter-repo',
negatable: false, negatable: false,
help: 'Include all the examples and tests from the Flutter repository.', help: 'Include all the examples and tests from the Flutter repository.',
......
...@@ -21,19 +21,19 @@ import 'build_ios_framework.dart'; ...@@ -21,19 +21,19 @@ import 'build_ios_framework.dart';
import 'build_web.dart'; import 'build_web.dart';
class BuildCommand extends FlutterCommand { class BuildCommand extends FlutterCommand {
BuildCommand({bool verboseHelp = false}) { BuildCommand({ bool verboseHelp = false }) {
addSubcommand(BuildAarCommand()); addSubcommand(BuildAarCommand());
addSubcommand(BuildApkCommand(verboseHelp: verboseHelp)); addSubcommand(BuildApkCommand(verboseHelp: verboseHelp));
addSubcommand(BuildAppBundleCommand(verboseHelp: verboseHelp)); addSubcommand(BuildAppBundleCommand(verboseHelp: verboseHelp));
addSubcommand(BuildAotCommand()); addSubcommand(BuildAotCommand());
addSubcommand(BuildIOSCommand()); addSubcommand(BuildIOSCommand(verboseHelp: verboseHelp));
addSubcommand(BuildIOSFrameworkCommand( addSubcommand(BuildIOSFrameworkCommand(
buildSystem: globals.buildSystem, buildSystem: globals.buildSystem,
bundleBuilder: BundleBuilder(), bundleBuilder: BundleBuilder(),
)); ));
addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp)); addSubcommand(BuildBundleCommand(verboseHelp: verboseHelp));
addSubcommand(BuildWebCommand()); addSubcommand(BuildWebCommand(verboseHelp: verboseHelp));
addSubcommand(BuildMacosCommand()); addSubcommand(BuildMacosCommand(verboseHelp: verboseHelp));
addSubcommand(BuildLinuxCommand()); addSubcommand(BuildLinuxCommand());
addSubcommand(BuildWindowsCommand()); addSubcommand(BuildWindowsCommand());
addSubcommand(BuildFuchsiaCommand(verboseHelp: verboseHelp)); addSubcommand(BuildFuchsiaCommand(verboseHelp: verboseHelp));
......
...@@ -30,6 +30,7 @@ class BuildApkCommand extends BuildSubCommand { ...@@ -30,6 +30,7 @@ class BuildApkCommand extends BuildSubCommand {
addDartObfuscationOption(); addDartObfuscationOption();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraFrontendOptions();
addEnableExperimentation(hide: !verboseHelp);
argParser argParser
..addFlag('split-per-abi', ..addFlag('split-per-abi',
negatable: false, negatable: false,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'dart:async'; import 'dart:async';
import 'package:meta/meta.dart';
import '../application_package.dart'; import '../application_package.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../base/utils.dart'; import '../base/utils.dart';
...@@ -17,7 +19,7 @@ import 'build.dart'; ...@@ -17,7 +19,7 @@ import 'build.dart';
/// or simulator. Can only be run on a macOS host. For producing deployment /// or simulator. Can only be run on a macOS host. For producing deployment
/// .ipas, see https://flutter.dev/docs/deployment/ios. /// .ipas, see https://flutter.dev/docs/deployment/ios.
class BuildIOSCommand extends BuildSubCommand { class BuildIOSCommand extends BuildSubCommand {
BuildIOSCommand() { BuildIOSCommand({ @required bool verboseHelp }) {
addTreeShakeIconsFlag(); addTreeShakeIconsFlag();
addSplitDebugInfoOption(); addSplitDebugInfoOption();
addBuildModeFlags(defaultToRelease: false); addBuildModeFlags(defaultToRelease: false);
...@@ -29,6 +31,7 @@ class BuildIOSCommand extends BuildSubCommand { ...@@ -29,6 +31,7 @@ class BuildIOSCommand extends BuildSubCommand {
addDartObfuscationOption(); addDartObfuscationOption();
usesDartDefineOption(); usesDartDefineOption();
usesExtraFrontendOptions(); usesExtraFrontendOptions();
addEnableExperimentation(hide: !verboseHelp);
argParser argParser
..addFlag('simulator', ..addFlag('simulator',
help: 'Build for the iOS simulator instead of the device.', help: 'Build for the iOS simulator instead of the device.',
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
import 'dart:async'; import 'dart:async';
import 'package:meta/meta.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../cache.dart'; import '../cache.dart';
...@@ -16,7 +18,7 @@ import 'build.dart'; ...@@ -16,7 +18,7 @@ import 'build.dart';
/// A command to build a macOS desktop target through a build shell script. /// A command to build a macOS desktop target through a build shell script.
class BuildMacosCommand extends BuildSubCommand { class BuildMacosCommand extends BuildSubCommand {
BuildMacosCommand() { BuildMacosCommand({ @required bool verboseHelp }) {
addTreeShakeIconsFlag(); addTreeShakeIconsFlag();
addSplitDebugInfoOption(); addSplitDebugInfoOption();
usesTargetOption(); usesTargetOption();
...@@ -25,6 +27,7 @@ class BuildMacosCommand extends BuildSubCommand { ...@@ -25,6 +27,7 @@ class BuildMacosCommand extends BuildSubCommand {
usesExtraFrontendOptions(); usesExtraFrontendOptions();
usesBuildNumberOption(); usesBuildNumberOption();
usesBuildNameOption(); usesBuildNameOption();
addEnableExperimentation(hide: !verboseHelp);
} }
@override @override
......
...@@ -4,22 +4,27 @@ ...@@ -4,22 +4,27 @@
import 'dart:async'; import 'dart:async';
import 'package:meta/meta.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../features.dart'; import '../features.dart';
import '../project.dart'; import '../project.dart';
import '../runner/flutter_command.dart' import '../runner/flutter_command.dart'
show DevelopmentArtifact, FlutterCommandResult; show DevelopmentArtifact, FlutterCommandResult, FlutterOptions;
import '../web/compile.dart'; import '../web/compile.dart';
import 'build.dart'; import 'build.dart';
class BuildWebCommand extends BuildSubCommand { class BuildWebCommand extends BuildSubCommand {
BuildWebCommand() { BuildWebCommand({
@required bool verboseHelp,
}) {
addTreeShakeIconsFlag(); addTreeShakeIconsFlag();
usesTargetOption(); usesTargetOption();
usesPubOption(); usesPubOption();
addBuildModeFlags(excludeDebug: true); addBuildModeFlags(excludeDebug: true);
usesDartDefineOption(); usesDartDefineOption();
addEnableExperimentation(hide: !verboseHelp);
argParser.addFlag('web-initialize-platform', argParser.addFlag('web-initialize-platform',
defaultsTo: true, defaultsTo: true,
negatable: true, negatable: true,
...@@ -66,6 +71,7 @@ class BuildWebCommand extends BuildSubCommand { ...@@ -66,6 +71,7 @@ class BuildWebCommand extends BuildSubCommand {
buildInfo, buildInfo,
boolArg('web-initialize-platform'), boolArg('web-initialize-platform'),
boolArg('csp'), boolArg('csp'),
stringsArg(FlutterOptions.kEnableExperiment),
); );
return FlutterCommandResult.success(); return FlutterCommandResult.success();
} }
......
...@@ -80,6 +80,8 @@ class RunCommand extends RunCommandBase { ...@@ -80,6 +80,8 @@ class RunCommand extends RunCommandBase {
RunCommand({ bool verboseHelp = false }) : super(verboseHelp: verboseHelp) { RunCommand({ bool verboseHelp = false }) : super(verboseHelp: verboseHelp) {
requiresPubspecYaml(); requiresPubspecYaml();
usesFilesystemOptions(hide: !verboseHelp); usesFilesystemOptions(hide: !verboseHelp);
usesExtraFrontendOptions();
addEnableExperimentation(hide: !verboseHelp);
argParser argParser
..addFlag('start-paused', ..addFlag('start-paused',
negatable: false, negatable: false,
...@@ -208,11 +210,6 @@ class RunCommand extends RunCommandBase { ...@@ -208,11 +210,6 @@ class RunCommand extends RunCommandBase {
help: 'Whether to quickly bootstrap applications with a minimal app. ' help: 'Whether to quickly bootstrap applications with a minimal app. '
'Currently this is only supported on Android devices. This option ' 'Currently this is only supported on Android devices. This option '
'cannot be paired with --use-application-binary.' 'cannot be paired with --use-application-binary.'
)
..addOption(FlutterOptions.kExtraFrontEndOptions, hide: true)
..addMultiOption(FlutterOptions.kEnableExperiment,
splitCommas: true,
hide: true,
); );
} }
......
...@@ -239,7 +239,16 @@ List<String> _xcodeBuildSettingsLines({ ...@@ -239,7 +239,16 @@ List<String> _xcodeBuildSettingsLines({
} }
if (buildInfo.extraFrontEndOptions?.isNotEmpty ?? false) { if (buildInfo.extraFrontEndOptions?.isNotEmpty ?? false) {
xcodeBuildSettings.add('EXTRA_FRONT_END_OPTIONS=${buildInfo.extraFrontEndOptions.join(',')}'); xcodeBuildSettings.add(
'EXTRA_FRONT_END_OPTIONS='
'${buildInfo.extraFrontEndOptions.join(',')}',
);
}
if (buildInfo.extraGenSnapshotOptions?.isNotEmpty ?? false) {
xcodeBuildSettings.add(
'EXTRA_GEN_SNAPSHOT_OPTIONS='
'${buildInfo.extraGenSnapshotOptions.join(',')}',
);
} }
return xcodeBuildSettings; return xcodeBuildSettings;
......
...@@ -470,14 +470,14 @@ abstract class FlutterCommand extends Command<void> { ...@@ -470,14 +470,14 @@ abstract class FlutterCommand extends Command<void> {
); );
} }
void addEnableExperimentation({ bool verbose }) { void addEnableExperimentation({ bool hide = false }) {
argParser.addMultiOption( argParser.addMultiOption(
FlutterOptions.kEnableExperiment, FlutterOptions.kEnableExperiment,
help: help:
'The name of an experimental Dart feature to enable. For more info ' 'The name of an experimental Dart feature to enable. For more info '
'see: https://github.com/dart-lang/sdk/blob/master/docs/process/' 'see: https://github.com/dart-lang/sdk/blob/master/docs/process/'
'experimental-flags.md', 'experimental-flags.md',
hide: !verbose, hide: hide,
); );
} }
...@@ -542,18 +542,27 @@ abstract class FlutterCommand extends Command<void> { ...@@ -542,18 +542,27 @@ abstract class FlutterCommand extends Command<void> {
boolArg('track-widget-creation'); boolArg('track-widget-creation');
final String buildNumber = argParser.options.containsKey('build-number') final String buildNumber = argParser.options.containsKey('build-number')
? stringArg('build-number') ? stringArg('build-number')
: null; : null;
final List<String> experiments =
argParser.options.containsKey(FlutterOptions.kEnableExperiment)
? stringsArg(FlutterOptions.kEnableExperiment)
: <String>[];
final List<String> extraGenSnapshotOptions =
argParser.options.containsKey(FlutterOptions.kExtraGenSnapshotOptions)
? stringsArg(FlutterOptions.kExtraGenSnapshotOptions)
: <String>[];
final List<String> extraFrontEndOptions = final List<String> extraFrontEndOptions =
argParser.options.containsKey(FlutterOptions.kExtraFrontEndOptions) argParser.options.containsKey(FlutterOptions.kExtraFrontEndOptions)
? stringsArg(FlutterOptions.kExtraFrontEndOptions) ? stringsArg(FlutterOptions.kExtraFrontEndOptions)
: <String>[]; : <String>[];
if (argParser.options.containsKey(FlutterOptions.kEnableExperiment) &&
argResults[FlutterOptions.kEnableExperiment] != null) { if (experiments.isNotEmpty) {
for (final String expFlag in stringsArg(FlutterOptions.kEnableExperiment)) { for (final String expFlag in experiments) {
final String flag = '--enable-experiment=' + expFlag; final String flag = '--enable-experiment=' + expFlag;
extraFrontEndOptions.add(flag); extraFrontEndOptions.add(flag);
extraGenSnapshotOptions.add(flag);
} }
} }
...@@ -579,8 +588,8 @@ abstract class FlutterCommand extends Command<void> { ...@@ -579,8 +588,8 @@ abstract class FlutterCommand extends Command<void> {
extraFrontEndOptions: extraFrontEndOptions?.isNotEmpty ?? false extraFrontEndOptions: extraFrontEndOptions?.isNotEmpty ?? false
? extraFrontEndOptions ? extraFrontEndOptions
: null, : null,
extraGenSnapshotOptions: argParser.options.containsKey(FlutterOptions.kExtraGenSnapshotOptions) extraGenSnapshotOptions: extraGenSnapshotOptions?.isNotEmpty ?? false
? stringsArg(FlutterOptions.kExtraGenSnapshotOptions) ? extraGenSnapshotOptions
: null, : null,
fileSystemRoots: argParser.options.containsKey(FlutterOptions.kFileSystemRoot) fileSystemRoots: argParser.options.containsKey(FlutterOptions.kFileSystemRoot)
? stringsArg(FlutterOptions.kFileSystemRoot) ? stringsArg(FlutterOptions.kFileSystemRoot)
...@@ -600,6 +609,7 @@ abstract class FlutterCommand extends Command<void> { ...@@ -600,6 +609,7 @@ abstract class FlutterCommand extends Command<void> {
dartDefines: argParser.options.containsKey(FlutterOptions.kDartDefinesOption) dartDefines: argParser.options.containsKey(FlutterOptions.kDartDefinesOption)
? stringsArg(FlutterOptions.kDartDefinesOption) ? stringsArg(FlutterOptions.kDartDefinesOption)
: const <String>[], : const <String>[],
dartExperiments: experiments,
); );
} }
......
...@@ -28,6 +28,7 @@ Future<void> buildWeb( ...@@ -28,6 +28,7 @@ Future<void> buildWeb(
BuildInfo buildInfo, BuildInfo buildInfo,
bool initializePlatform, bool initializePlatform,
bool csp, bool csp,
List<String> experiments,
) async { ) async {
if (!flutterProject.web.existsSync()) { if (!flutterProject.web.existsSync()) {
throwToolExit('Missing index.html.'); throwToolExit('Missing index.html.');
...@@ -52,6 +53,8 @@ Future<void> buildWeb( ...@@ -52,6 +53,8 @@ Future<void> buildWeb(
kDartDefines: buildInfo.dartDefines.join(','), kDartDefines: buildInfo.dartDefines.join(','),
kCspMode: csp.toString(), kCspMode: csp.toString(),
kIconTreeShakerFlag: buildInfo.treeShakeIcons.toString(), kIconTreeShakerFlag: buildInfo.treeShakeIcons.toString(),
if (experiments.isNotEmpty)
kEnableExperiment: experiments?.join(','),
}, },
artifacts: globals.artifacts, artifacts: globals.artifacts,
fileSystem: globals.fs, fileSystem: globals.fs,
......
...@@ -249,14 +249,14 @@ void main() { ...@@ -249,14 +249,14 @@ void main() {
}); });
testUsingContext('hidden when not enabled on macOS host', () { testUsingContext('hidden when not enabled on macOS host', () {
expect(BuildMacosCommand().hidden, true); expect(BuildMacosCommand(verboseHelp: false).hidden, true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: false),
Platform: () => macosPlatform, Platform: () => macosPlatform,
}); });
testUsingContext('Not hidden when enabled and on macOS host', () { testUsingContext('Not hidden when enabled and on macOS host', () {
expect(BuildMacosCommand().hidden, false); expect(BuildMacosCommand(verboseHelp: false).hidden, false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true), FeatureFlags: () => TestFeatureFlags(isMacOSEnabled: true),
Platform: () => macosPlatform, Platform: () => macosPlatform,
......
...@@ -59,6 +59,7 @@ void main() { ...@@ -59,6 +59,7 @@ void main() {
BuildInfo.debug, BuildInfo.debug,
false, false,
false, false,
<String>[],
), throwsToolExit()); ), throwsToolExit());
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => fakePlatform, Platform: () => fakePlatform,
...@@ -186,7 +187,7 @@ class UrlLauncherPlugin {} ...@@ -186,7 +187,7 @@ class UrlLauncherPlugin {}
}); });
testUsingContext('hidden if feature flag is not enabled', () async { testUsingContext('hidden if feature flag is not enabled', () async {
expect(BuildWebCommand().hidden, true); expect(BuildWebCommand(verboseHelp: false).hidden, true);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
...@@ -196,7 +197,7 @@ class UrlLauncherPlugin {} ...@@ -196,7 +197,7 @@ class UrlLauncherPlugin {}
}); });
testUsingContext('not hidden if feature flag is enabled', () async { testUsingContext('not hidden if feature flag is enabled', () async {
expect(BuildWebCommand().hidden, false); expect(BuildWebCommand(verboseHelp: false).hidden, false);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
Platform: () => fakePlatform, Platform: () => fakePlatform,
FileSystem: () => fileSystem, FileSystem: () => fileSystem,
......
...@@ -229,7 +229,8 @@ void main() { ...@@ -229,7 +229,8 @@ void main() {
...kDart2jsLinuxArgs, ...kDart2jsLinuxArgs,
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}', '--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.profile=true',
'--cfe-only', '--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart').absolute.path,
] ]
...@@ -253,6 +254,39 @@ void main() { ...@@ -253,6 +254,39 @@ void main() {
})); }));
test('Dart2JSTarget calls dart2js with expected args with enabled experiment', () => testbed.run(() async {
environment.defines[kBuildMode] = 'profile';
environment.defines[kEnableExperiment] = 'non-nullable';
processManager.addCommand(FakeCommand(
command: <String>[
...kDart2jsLinuxArgs,
'--enable-experiment=non-nullable',
'-o',
environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.profile=true',
'--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path,
]
));
processManager.addCommand(FakeCommand(
command: <String>[
...kDart2jsLinuxArgs,
'--enable-experiment=non-nullable',
'-O4',
'-Ddart.vm.profile=true',
'--no-minify',
'-o',
environment.buildDir.childFile('main.dart.js').absolute.path,
environment.buildDir.childFile('app.dill').absolute.path,
]
));
await const Dart2JSTarget().build(environment);
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
}));
test('Dart2JSTarget calls dart2js with expected args in profile mode', () => testbed.run(() async { test('Dart2JSTarget calls dart2js with expected args in profile mode', () => testbed.run(() async {
environment.defines[kBuildMode] = 'profile'; environment.defines[kBuildMode] = 'profile';
processManager.addCommand(FakeCommand( processManager.addCommand(FakeCommand(
...@@ -260,7 +294,8 @@ void main() { ...@@ -260,7 +294,8 @@ void main() {
...kDart2jsLinuxArgs, ...kDart2jsLinuxArgs,
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}', '--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.profile=true',
'--cfe-only', '--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart').absolute.path,
] ]
...@@ -289,7 +324,8 @@ void main() { ...@@ -289,7 +324,8 @@ void main() {
...kDart2jsLinuxArgs, ...kDart2jsLinuxArgs,
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}', '--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.product=true',
'--cfe-only', '--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart').absolute.path,
] ]
...@@ -318,7 +354,8 @@ void main() { ...@@ -318,7 +354,8 @@ void main() {
...kDart2jsLinuxArgs, ...kDart2jsLinuxArgs,
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}', '--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.product=true',
'--cfe-only', '--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart').absolute.path,
] ]
...@@ -366,10 +403,11 @@ void main() { ...@@ -366,10 +403,11 @@ void main() {
...kDart2jsLinuxArgs, ...kDart2jsLinuxArgs,
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.product=true',
'-DFOO=bar', '-DFOO=bar',
'-DBAZ=qux', '-DBAZ=qux',
'--packages=${globals.fs.path.join('foo', '.packages')}', '--cfe-only',
'--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart').absolute.path,
] ]
)); ));
...@@ -399,9 +437,10 @@ void main() { ...@@ -399,9 +437,10 @@ void main() {
...kDart2jsLinuxArgs, ...kDart2jsLinuxArgs,
'-o', '-o',
environment.buildDir.childFile('app.dill').absolute.path, environment.buildDir.childFile('app.dill').absolute.path,
'--packages=${globals.fs.path.join('foo', '.packages')}',
'-Ddart.vm.profile=true',
'-DFOO=bar', '-DFOO=bar',
'-DBAZ=qux', '-DBAZ=qux',
'--packages=${globals.fs.path.join('foo', '.packages')}',
'--cfe-only', '--cfe-only',
environment.buildDir.childFile('main.dart').absolute.path, environment.buildDir.childFile('main.dart').absolute.path,
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment