diff --git a/.ci.yaml b/.ci.yaml index 096f7ac915b..9eab2429bb0 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -3164,8 +3164,7 @@ targets: properties: dependencies: >- [ - {"dependency": "xcode", "version": "14c18"}, - {"dependency": "gems", "version": "v3.3.14"} + {"dependency": "ruby", "version": "ruby_3.1-pod_1.13"} ] tags: > ["devicelab", "hostonly", "mac"] diff --git a/dev/devicelab/bin/tasks/flavors_test.dart b/dev/devicelab/bin/tasks/flavors_test.dart index e9ebe408248..f5981f1adb8 100644 --- a/dev/devicelab/bin/tasks/flavors_test.dart +++ b/dev/devicelab/bin/tasks/flavors_test.dart @@ -59,8 +59,15 @@ Future _testInstallDebugPaidFlavor(String projectDir) async { .decodeMessage(ByteData.sublistView(assetManifestFileData)) as Map; if (assetManifest.containsKey('assets/free/free.txt')) { - return TaskResult.failure('Assets declared with a flavor not equal to the ' - 'argued --flavor value should not be bundled.'); + return TaskResult.failure('Expected the asset "assets/free/free.txt", which ' + ' was declared with a flavor of "free" to not be included in the asset bundle ' + ' because the --flavor was set to "paid".'); + } + + if (!assetManifest.containsKey('assets/paid/paid.txt')) { + return TaskResult.failure('Expected the asset "assets/paid/paid.txt", which ' + ' was declared with a flavor of "paid" to be included in the asset bundle ' + ' because the --flavor was set to "paid".'); } await flutter( diff --git a/dev/devicelab/bin/tasks/flavors_test_ios.dart b/dev/devicelab/bin/tasks/flavors_test_ios.dart index 9dab73d8687..25767b9ee77 100644 --- a/dev/devicelab/bin/tasks/flavors_test_ios.dart +++ b/dev/devicelab/bin/tasks/flavors_test_ios.dart @@ -67,8 +67,15 @@ Future _testInstallDebugPaidFlavor(String projectDir) async { .decodeMessage(ByteData.sublistView(assetManifestFileData)) as Map; if (assetManifest.containsKey('assets/free/free.txt')) { - return TaskResult.failure('Assets declared with a flavor not equal to the ' - 'argued --flavor value should not be bundled.'); + return TaskResult.failure('Expected the asset "assets/free/free.txt", which ' + ' was declared with a flavor of "free" to not be included in the asset bundle ' + ' because the --flavor was set to "paid".'); + } + + if (!assetManifest.containsKey('assets/paid/paid.txt')) { + return TaskResult.failure('Expected the asset "assets/paid/paid.txt", which ' + ' was declared with a flavor of "paid" to be included in the asset bundle ' + ' because the --flavor was set to "paid".'); } await flutter( diff --git a/dev/devicelab/bin/tasks/flavors_test_macos.dart b/dev/devicelab/bin/tasks/flavors_test_macos.dart index 5fc51b933f2..0884ad0e50f 100644 --- a/dev/devicelab/bin/tasks/flavors_test_macos.dart +++ b/dev/devicelab/bin/tasks/flavors_test_macos.dart @@ -2,11 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:io'; +import 'dart:typed_data'; + import 'package:flutter_devicelab/framework/devices.dart'; import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/framework/task_result.dart'; import 'package:flutter_devicelab/framework/utils.dart'; import 'package:flutter_devicelab/tasks/integration_tests.dart'; +import 'package:path/path.dart' as path; +import 'package:standard_message_codec/standard_message_codec.dart'; Future main() async { deviceOperatingSystem = DeviceOperatingSystem.macos; @@ -14,8 +19,9 @@ Future main() async { await createFlavorsTest().call(); await createIntegrationTestFlavorsTest().call(); + final String projectDir = '${flutterDirectory.path}/dev/integration_tests/flavors'; final TaskResult installTestsResult = await inDirectory( - '${flutterDirectory.path}/dev/integration_tests/flavors', + projectDir, () async { await flutter( 'install', @@ -33,6 +39,39 @@ Future main() async { options: ['macos', '--flavor', 'bogus'], ); + final Uint8List assetManifestFileData = File( + path.join( + projectDir, + 'build', + 'macos', + 'Build', + 'Products', + 'Debug-paid', + 'Debug Paid.app', + 'Contents', + 'Frameworks', + 'App.framework', + 'Resources', + 'flutter_assets', + 'AssetManifest.bin' + ), + ).readAsBytesSync(); + + final Map assetManifest = const StandardMessageCodec() + .decodeMessage(ByteData.sublistView(assetManifestFileData)) as Map; + + if (assetManifest.containsKey('assets/free/free.txt')) { + return TaskResult.failure('Expected the asset "assets/free/free.txt", which ' + ' was declared with a flavor of "free" to not be included in the asset bundle ' + ' because the --flavor was set to "paid".'); + } + + if (!assetManifest.containsKey('assets/paid/paid.txt')) { + return TaskResult.failure('Expected the asset "assets/paid/paid.txt", which ' + ' was declared with a flavor of "paid" to be included in the asset bundle ' + ' because the --flavor was set to "paid".'); + } + final String stderrString = stderr.toString(); print(stderrString); if (!stderrString.contains('The Xcode project defines schemes:')) { diff --git a/packages/flutter_tools/bin/macos_assemble.sh b/packages/flutter_tools/bin/macos_assemble.sh index 3963a808395..71f69ef22e1 100755 --- a/packages/flutter_tools/bin/macos_assemble.sh +++ b/packages/flutter_tools/bin/macos_assemble.sh @@ -131,6 +131,10 @@ BuildApp() { "--build-outputs=${build_outputs_path}" "--output=${BUILT_PRODUCTS_DIR}" ) + + if [[ -n "$FLAVOR" ]]; then + flutter_args+=("-dFlavor=${FLAVOR}") + fi if [[ -n "$PERFORMANCE_MEASUREMENT_FILE" ]]; then flutter_args+=("--performance-measurement-file=${PERFORMANCE_MEASUREMENT_FILE}") fi