Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1dd7f45b
Unverified
Commit
1dd7f45b
authored
Jan 19, 2023
by
Alex Wallen
Committed by
GitHub
Jan 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `build macos --config-only` option. (#118649)
Co-authored-by:
a-wallen
<
stephenwallen@google.com
>
parent
2258590a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
96 additions
and
1 deletion
+96
-1
build_macos.dart
packages/flutter_tools/lib/src/commands/build_macos.dart
+10
-0
build_macos.dart
packages/flutter_tools/lib/src/macos/build_macos.dart
+4
-1
build_macos_config_only_test.dart
.../test/integration.shard/build_macos_config_only_test.dart
+82
-0
No files found.
packages/flutter_tools/lib/src/commands/build_macos.dart
View file @
1dd7f45b
...
...
@@ -20,6 +20,13 @@ class BuildMacosCommand extends BuildSubCommand {
required
bool
verboseHelp
,
})
:
super
(
verboseHelp:
verboseHelp
)
{
addCommonDesktopBuildOptions
(
verboseHelp:
verboseHelp
);
usesFlavorOption
();
argParser
.
addFlag
(
'config-only'
,
help:
'Update the project configuration without performing a build. '
'This can be used in CI/CD process that create an archive to avoid '
'performing duplicate work.'
);
}
@override
...
...
@@ -39,6 +46,8 @@ class BuildMacosCommand extends BuildSubCommand {
@override
bool
get
supported
=>
globals
.
platform
.
isMacOS
;
bool
get
configOnly
=>
boolArgDeprecated
(
'config-only'
);
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
...
...
@@ -55,6 +64,7 @@ class BuildMacosCommand extends BuildSubCommand {
buildInfo:
buildInfo
,
targetOverride:
targetFile
,
verboseLogging:
globals
.
logger
.
isVerbose
,
configOnly:
configOnly
,
sizeAnalyzer:
SizeAnalyzer
(
fileSystem:
globals
.
fs
,
logger:
globals
.
logger
,
...
...
packages/flutter_tools/lib/src/macos/build_macos.dart
View file @
1dd7f45b
...
...
@@ -35,6 +35,7 @@ Future<void> buildMacOS({
required
BuildInfo
buildInfo
,
String
?
targetOverride
,
required
bool
verboseLogging
,
bool
configOnly
=
false
,
SizeAnalyzer
?
sizeAnalyzer
,
})
async
{
final
Directory
?
xcodeWorkspace
=
flutterProject
.
macos
.
xcodeWorkspace
;
...
...
@@ -78,6 +79,9 @@ Future<void> buildMacOS({
if
(!
flutterProject
.
macos
.
outputFileList
.
existsSync
())
{
flutterProject
.
macos
.
outputFileList
.
createSync
(
recursive:
true
);
}
if
(
configOnly
)
{
return
;
}
final
Directory
xcodeProject
=
flutterProject
.
macos
.
xcodeProject
;
...
...
@@ -97,7 +101,6 @@ Future<void> buildMacOS({
if
(
configuration
==
null
)
{
throwToolExit
(
'Unable to find expected configuration in Xcode project.'
);
}
// Run the Xcode build.
final
Stopwatch
sw
=
Stopwatch
()..
start
();
final
Status
status
=
globals
.
logger
.
startProgress
(
...
...
packages/flutter_tools/test/integration.shard/build_macos_config_only_test.dart
0 → 100644
View file @
1dd7f45b
// 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
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'../src/common.dart'
;
import
'test_utils.dart'
;
void
main
(
)
{
test
(
'flutter build macOS --config only updates generated xcconfig file without performing build'
,
()
async
{
final
String
workingDirectory
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'dev'
,
'integration_tests'
,
'flutter_gallery'
,
);
final
String
flutterBin
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
'flutter'
);
await
processManager
.
run
(<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'clean'
,
],
workingDirectory:
workingDirectory
);
final
List
<
String
>
buildCommand
=
<
String
>[
flutterBin
,
...
getLocalEngineArguments
(),
'build'
,
'macos'
,
'--config-only'
,
'--release'
,
'--obfuscate'
,
'--split-debug-info=info'
,
];
final
ProcessResult
firstRunResult
=
await
processManager
.
run
(
buildCommand
,
workingDirectory:
workingDirectory
);
printOnFailure
(
'Output of flutter build macOS:'
);
final
String
firstRunStdout
=
firstRunResult
.
stdout
.
toString
();
printOnFailure
(
'First run stdout:
$firstRunStdout
'
);
printOnFailure
(
'First run stderr:
${firstRunResult.stderr}
'
);
expect
(
firstRunResult
.
exitCode
,
0
);
expect
(
firstRunStdout
,
contains
(
'Running pod install'
));
final
File
generatedConfig
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
workingDirectory
,
'macos'
,
'Flutter'
,
'ephemeral'
,
'Flutter-Generated.xcconfig'
,
));
// Config is updated if command succeeded.
expect
(
generatedConfig
,
exists
);
expect
(
generatedConfig
.
readAsStringSync
(),
contains
(
'DART_OBFUSCATION=true'
));
// file that only exists if app was fully built.
final
File
frameworkPlist
=
fileSystem
.
file
(
fileSystem
.
path
.
join
(
workingDirectory
,
'build'
,
'macos'
,
'Build'
,
'Products'
,
'Release'
,
'App.framework'
,
'Resources'
,
'Info.plist'
));
expect
(
frameworkPlist
,
isNot
(
exists
));
// Run again with no changes.
final
ProcessResult
secondRunResult
=
await
processManager
.
run
(
buildCommand
,
workingDirectory:
workingDirectory
);
final
String
secondRunStdout
=
secondRunResult
.
stdout
.
toString
();
printOnFailure
(
'Second run stdout:
$secondRunStdout
'
);
printOnFailure
(
'Second run stderr:
${secondRunResult.stderr}
'
);
expect
(
secondRunResult
.
exitCode
,
0
);
},
skip:
!
platform
.
isMacOS
);
// [intended] macOS builds only work on macos.
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment