Skip to content

Commit

Permalink
Restore and fix flavors_test_macos (#139841)
Browse files Browse the repository at this point in the history
Partially resolves[^1] flutter/flutter#139774.

Effectively reverts flutter/flutter#125581.

The main change here is that I deleted and recreated the macos Xcode project for this integration test (hence the large diff). I tried fixing the existing project first, but it was set up quite differently, and�for whatever reason�the integration test would get stuck trying to load `dev/integration_tests/flavors/integration_test/integration_test.dart`.

I verified that this works locally, but I don't know if it's possible to run this on the devicelab try pool to verify that it works on devicelab hardware.

[^1]: I would not close the issue until 1) this PR lands, 2) the integration test consistently passes on CI, and 3) macOS support for flavors is publicly documented.
  • Loading branch information
andrewkolos authored Dec 18, 2023
1 parent 79bc6de commit f8b9748
Show file tree
Hide file tree
Showing 16 changed files with 492 additions and 341 deletions.
15 changes: 15 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,21 @@ targets:
- bin/**
- .ci.yaml

- name: Mac flavors_test_macos
bringup: true
presubmit: false
recipe: devicelab/devicelab_drone
timeout: 60
properties:
dependencies: >-
[
{"dependency": "xcode", "version": "14c18"},
{"dependency": "gems", "version": "v3.3.14"}
]
tags: >
["devicelab", "hostonly", "mac"]
task_name: flavors_test_macos

- name: Mac_benchmark flutter_gallery_macos__compile
presubmit: false
recipe: devicelab/devicelab_drone
Expand Down
21 changes: 13 additions & 8 deletions dev/devicelab/bin/tasks/flavors_test_macos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@ Future<void> main() async {
final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors',
() async {
await flutter(
'install',
options: <String>['--flavor', 'paid', '-d', 'macos'],
);
await flutter(
'install',
options: <String>['--flavor', 'paid', '--uninstall-only', '-d', 'macos'],
);
final StringBuffer stderr = StringBuffer();

await evalFlutter(
'install',
'build',
canFail: true,
stderr: stderr,
options: <String>[
'--d', 'macos',
'--flavor', 'free'
],
options: <String>['macos', '--flavor', 'bogus'],
);

final String stderrString = stderr.toString();
if (!stderrString.contains('Host and target are the same. Nothing to install.')) {
print(stderrString);
if (!stderrString.contains('The Xcode project defines schemes:')) {
print(stderrString);
return TaskResult.failure('Installing a macOS app on macOS should no-op');
return TaskResult.failure('Should not succeed with bogus flavor');
}

return TaskResult.success(null);
Expand Down
43 changes: 43 additions & 0 deletions dev/integration_tests/flavors/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# 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
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
30 changes: 30 additions & 0 deletions dev/integration_tests/flavors/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "e0caf9ca0b7c592bd7b00d5413fae534738bb385"
channel: "[user-branch]"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: e0caf9ca0b7c592bd7b00d5413fae534738bb385
base_revision: e0caf9ca0b7c592bd7b00d5413fae534738bb385
- platform: macos
create_revision: e0caf9ca0b7c592bd7b00d5413fae534738bb385
base_revision: e0caf9ca0b7c592bd7b00d5413fae534738bb385

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
17 changes: 9 additions & 8 deletions dev/integration_tests/flavors/macos/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug Free' => :debug,
'Debug Paid' => :debug,
'Release Free' => :release,
'Release Paid' => :release,
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
Expand All @@ -27,12 +26,14 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe

flutter_macos_podfile_setup

target 'Free App' do
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
end
target 'Runner' do
use_frameworks!
use_modular_headers!

target 'Paid App' do
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
Expand Down
Loading

0 comments on commit f8b9748

Please sign in to comment.