Add support for --track-widget-creation back to ios build rules. (#18046)
This commit is contained in:
@@ -109,6 +109,11 @@ BuildApp() {
|
||||
preview_dart_2_flag="--no-preview-dart-2"
|
||||
fi
|
||||
|
||||
local track_widget_creation_flag=""
|
||||
if [[ -n "$TRACK_WIDGET_CREATION" ]]; then
|
||||
track_widget_creation_flag="--track-widget-creation"
|
||||
fi
|
||||
|
||||
if [[ "${build_mode}" != "debug" ]]; then
|
||||
StreamOutput " ├─Building Dart code..."
|
||||
# Transform ARCHS to comma-separated list of target architectures.
|
||||
@@ -122,7 +127,8 @@ BuildApp() {
|
||||
--${build_mode} \
|
||||
--ios-arch="${archs}" \
|
||||
${local_engine_flag} \
|
||||
${preview_dart_2_flag}
|
||||
${preview_dart_2_flag} \
|
||||
${track_widget_creation_flag}
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
EchoError "Failed to build ${project_path}."
|
||||
@@ -166,7 +172,8 @@ BuildApp() {
|
||||
--asset-dir="${derived_dir}/flutter_assets" \
|
||||
${precompilation_flag} \
|
||||
${local_engine_flag} \
|
||||
${preview_dart_2_flag}
|
||||
${preview_dart_2_flag} \
|
||||
${track_widget_creation_flag}
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
EchoError "Failed to package ${project_path}."
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'globals.dart';
|
||||
class BuildInfo {
|
||||
const BuildInfo(this.mode, this.flavor, {
|
||||
this.previewDart2: false,
|
||||
this.trackWidgetCreation,
|
||||
this.trackWidgetCreation: false,
|
||||
this.extraFrontEndOptions,
|
||||
this.extraGenSnapshotOptions,
|
||||
this.preferSharedLibrary,
|
||||
|
||||
@@ -363,6 +363,7 @@ class IOSSimulator extends Device {
|
||||
|
||||
final BuildInfo debugBuildInfo = new BuildInfo(BuildMode.debug, buildInfo.flavor,
|
||||
previewDart2: buildInfo.previewDart2,
|
||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
|
||||
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
|
||||
preferSharedLibrary: buildInfo.preferSharedLibrary);
|
||||
|
||||
@@ -117,6 +117,10 @@ Future<void> updateGeneratedXcodeProperties({
|
||||
localsBuffer.writeln('PREVIEW_DART_2=true');
|
||||
}
|
||||
|
||||
if (buildInfo.trackWidgetCreation) {
|
||||
localsBuffer.writeln('TRACK_WIDGET_CREATION=true');
|
||||
}
|
||||
|
||||
final File localsFile = fs.file(_generatedXcodePropertiesPath(projectPath));
|
||||
localsFile.createSync(recursive: true);
|
||||
localsFile.writeAsStringSync(localsBuffer.toString());
|
||||
|
||||
@@ -301,6 +301,47 @@ Information about project "Runner":
|
||||
expect(contents.contains('ARCHS=armv7'), isTrue);
|
||||
});
|
||||
|
||||
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
|
||||
previewDart2: true,
|
||||
trackWidgetCreation: true,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
);
|
||||
await updateGeneratedXcodeProperties(
|
||||
projectPath: 'path/to/project',
|
||||
buildInfo: buildInfo,
|
||||
previewDart2: true,
|
||||
);
|
||||
|
||||
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
|
||||
expect(config.existsSync(), isTrue);
|
||||
|
||||
final String contents = config.readAsStringSync();
|
||||
expect(contents.contains('TRACK_WIDGET_CREATION=true'), isTrue);
|
||||
});
|
||||
|
||||
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
|
||||
const BuildInfo buildInfo = const BuildInfo(BuildMode.debug, null,
|
||||
previewDart2: true,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
);
|
||||
await updateGeneratedXcodeProperties(
|
||||
projectPath: 'path/to/project',
|
||||
buildInfo: buildInfo,
|
||||
previewDart2: true,
|
||||
);
|
||||
|
||||
final File config = fs.file('path/to/project/ios/Flutter/Generated.xcconfig');
|
||||
expect(config.existsSync(), isTrue);
|
||||
|
||||
final String contents = config.readAsStringSync();
|
||||
expect(contents.contains('TRACK_WIDGET_CREATION=true'), isFalse);
|
||||
});
|
||||
|
||||
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
|
||||
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
|
||||
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
|
||||
|
||||
Reference in New Issue
Block a user