Unverified Commit f8b97486 authored by Andrew Kolos's avatar Andrew Kolos Committed by GitHub

Restore and fix flavors_test_macos (#139841)

Partially resolves[^1] https://github.com/flutter/flutter/issues/139774.

Effectively reverts https://github.com/flutter/flutter/pull/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.
parent 79bc6ded
...@@ -3156,6 +3156,21 @@ targets: ...@@ -3156,6 +3156,21 @@ targets:
- bin/** - bin/**
- .ci.yaml - .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 - name: Mac_benchmark flutter_gallery_macos__compile
presubmit: false presubmit: false
recipe: devicelab/devicelab_drone recipe: devicelab/devicelab_drone
......
...@@ -17,22 +17,27 @@ Future<void> main() async { ...@@ -17,22 +17,27 @@ Future<void> main() async {
final TaskResult installTestsResult = await inDirectory( final TaskResult installTestsResult = await inDirectory(
'${flutterDirectory.path}/dev/integration_tests/flavors', '${flutterDirectory.path}/dev/integration_tests/flavors',
() async { () 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(); final StringBuffer stderr = StringBuffer();
await evalFlutter( await evalFlutter(
'install', 'build',
canFail: true, canFail: true,
stderr: stderr, stderr: stderr,
options: <String>[ options: <String>['macos', '--flavor', 'bogus'],
'--d', 'macos',
'--flavor', 'free'
],
); );
final String stderrString = stderr.toString(); 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); 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); return TaskResult.success(null);
......
# 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
# 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'
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', { project 'Runner', {
'Debug Free' => :debug, 'Debug' => :debug,
'Debug Paid' => :debug, 'Profile' => :release,
'Release Free' => :release, 'Release' => :release,
'Release Paid' => :release,
} }
def flutter_root def flutter_root
...@@ -27,12 +26,14 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe ...@@ -27,12 +26,14 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
flutter_macos_podfile_setup flutter_macos_podfile_setup
target 'Free App' do target 'Runner' do
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) use_frameworks!
end use_modular_headers!
target 'Paid App' do
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end end
post_install do |installer| post_install do |installer|
......
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Debug Free.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">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Debug Free.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C80D4294CF70F00263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</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 = "33CC10EC2044A3C60003C045"
BuildableName = "Debug Free.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Debug Free.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"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1430" LastUpgradeVersion = "1500"
version = "1.3"> version = "1.7">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
...@@ -15,32 +15,22 @@ ...@@ -15,32 +15,22 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Free App.app" BuildableName = "Debug Free.app"
BlueprintName = "Free App" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug Free" buildConfiguration = "Debug-free"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES"
<MacroExpansion> shouldAutocreateTestPlan = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Free App.app"
BlueprintName = "Free App"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug Free" buildConfiguration = "Release-free"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
...@@ -54,14 +44,14 @@ ...@@ -54,14 +44,14 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Free App.app" BuildableName = "Debug Free.app"
BlueprintName = "Free App" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Debug Free" buildConfiguration = "Release-free"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
...@@ -71,17 +61,17 @@ ...@@ -71,17 +61,17 @@
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Free App.app" BuildableName = "Debug Free.app"
BlueprintName = "Free App" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug Free"> buildConfiguration = "Debug-free">
</AnalyzeAction> </AnalyzeAction>
<ArchiveAction <ArchiveAction
buildConfiguration = "Release Free" buildConfiguration = "Release-free"
revealArchiveInOrganizer = "YES"> revealArchiveInOrganizer = "YES">
</ArchiveAction> </ArchiveAction>
</Scheme> </Scheme>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1400" LastUpgradeVersion = "1500"
version = "1.3"> version = "1.7">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
...@@ -14,24 +14,23 @@ ...@@ -14,24 +14,23 @@
buildForAnalyzing = "YES"> buildForAnalyzing = "YES">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F383D4A52938029D00598432" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Paid App.app" BuildableName = "Debug Free.app"
BlueprintName = "Paid App" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug Paid" buildConfiguration = "Debug-free"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES"
<Testables> shouldAutocreateTestPlan = "YES">
</Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug Paid" buildConfiguration = "Release-paid"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
...@@ -44,15 +43,15 @@ ...@@ -44,15 +43,15 @@
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F383D4A52938029D00598432" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Paid App.app" BuildableName = "Debug Free.app"
BlueprintName = "Paid App" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release Paid" buildConfiguration = "Release-free"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
...@@ -61,18 +60,18 @@ ...@@ -61,18 +60,18 @@
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
BlueprintIdentifier = "F383D4A52938029D00598432" BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "Paid App.app" BuildableName = "Debug Free.app"
BlueprintName = "Paid App" BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj"> ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
</ProfileAction> </ProfileAction>
<AnalyzeAction <AnalyzeAction
buildConfiguration = "Debug Paid"> buildConfiguration = "Debug-free">
</AnalyzeAction> </AnalyzeAction>
<ArchiveAction <ArchiveAction
buildConfiguration = "Release Paid" buildConfiguration = "Release-free"
revealArchiveInOrganizer = "YES"> revealArchiveInOrganizer = "YES">
</ArchiveAction> </ArchiveAction>
</Scheme> </Scheme>
// This xcconfig used for both the paid and free flavor, but the plugins are not different between #include "../../Flutter/Flutter-Debug.xcconfig"
// them. Pick one. #include "Warnings.xcconfig"
#include? "Pods/Target Support Files/Pods-Free App/Pods-Free App.debug free.xcconfig"
// This xcconfig used for both the paid and free flavor, but the plugins are not different between #include "../../Flutter/Flutter-Release.xcconfig"
// them. Pick one. #include "Warnings.xcconfig"
#include? "Pods/Target Support Files/Pods-Paid App/Pods-Paid App.release free.xcconfig"
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
...@@ -20,8 +22,6 @@ ...@@ -20,8 +22,6 @@
<string>$(FLUTTER_BUILD_NAME)</string> <string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string> <string>$(FLUTTER_BUILD_NUMBER)</string>
<key>Flavor</key>
<string>${PRODUCT_FLAVOR}</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
......
...@@ -24,7 +24,8 @@ class MainFlutterWindow: NSWindow { ...@@ -24,7 +24,8 @@ class MainFlutterWindow: NSWindow {
let channel = FlutterMethodChannel(name: "flavor", let channel = FlutterMethodChannel(name: "flavor",
binaryMessenger: registrar.messenger) binaryMessenger: registrar.messenger)
channel.setMethodCallHandler({ (call, result) in channel.setMethodCallHandler({ (call, result) in
let flavor = Bundle.main.infoDictionary?["Flavor"] as? String let bundleIdentifier = Bundle.main.infoDictionary?["CFBundleName"] as? String
let flavor = bundleIdentifier?.split(separator: " ").last?.lowercased();
result(flavor) result(flavor)
}) })
} }
......
// 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 FlutterMacOS
import Cocoa
import XCTest
class RunnerTests: XCTestCase {
func testExample() {
// If you add code to the Runner application, consider adding tests here.
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
}
}
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