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
6ca4db4b
Unverified
Commit
6ca4db4b
authored
Jul 30, 2022
by
Jenn Magder
Committed by
GitHub
Jul 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add usage event when macOS app is archived (#108651)
parent
40940de6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
1 deletion
+61
-1
macos_assemble.sh
packages/flutter_tools/bin/macos_assemble.sh
+1
-0
macos.dart
...ges/flutter_tools/lib/src/build_system/targets/macos.dart
+24
-0
macos_test.dart
...s/test/general.shard/build_system/targets/macos_test.dart
+36
-1
No files found.
packages/flutter_tools/bin/macos_assemble.sh
View file @
6ca4db4b
...
...
@@ -77,6 +77,7 @@ BuildApp() {
"-dDartObfuscation=
${
DART_OBFUSCATION
}
"
"-dSplitDebugInfo=
${
SPLIT_DEBUG_INFO
}
"
"-dTrackWidgetCreation=
${
TRACK_WIDGET_CREATION
}
"
"-dAction=
${
ACTION
}
"
"--DartDefines=
${
DART_DEFINES
}
"
"--ExtraGenSnapshotOptions=
${
EXTRA_GEN_SNAPSHOT_OPTIONS
}
"
"--ExtraFrontEndOptions=
${
EXTRA_FRONT_END_OPTIONS
}
"
...
...
packages/flutter_tools/lib/src/build_system/targets/macos.dart
View file @
6ca4db4b
...
...
@@ -9,6 +9,7 @@ import '../../base/io.dart';
import
'../../base/process.dart'
;
import
'../../build_info.dart'
;
import
'../../globals.dart'
as
globals
show
xcode
;
import
'../../reporting/reporting.dart'
;
import
'../build_system.dart'
;
import
'../depfile.dart'
;
import
'../exceptions.dart'
;
...
...
@@ -544,4 +545,27 @@ class ReleaseMacOSBundleFlutterAssets extends MacOSBundleFlutterAssets {
CompileMacOSFramework
(),
ReleaseUnpackMacOS
(),
];
@override
Future
<
void
>
build
(
Environment
environment
)
async
{
bool
buildSuccess
=
true
;
try
{
await
super
.
build
(
environment
);
}
catch
(
_
)
{
// ignore: avoid_catches_without_on_clauses
buildSuccess
=
false
;
rethrow
;
}
finally
{
// Send a usage event when the app is being archived from Xcode.
if
(
environment
.
defines
[
kXcodeAction
]?.
toLowerCase
()
==
'install'
)
{
environment
.
logger
.
printTrace
(
'Sending archive event if usage enabled.'
);
UsageEvent
(
'assemble'
,
'macos-archive'
,
label:
buildSuccess
?
'success'
:
'fail'
,
flutterUsage:
environment
.
usage
,
).
send
();
}
}
}
}
packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
View file @
6ca4db4b
...
...
@@ -11,6 +11,7 @@ import 'package:flutter_tools/src/build_info.dart';
import
'package:flutter_tools/src/build_system/build_system.dart'
;
import
'package:flutter_tools/src/build_system/targets/macos.dart'
;
import
'package:flutter_tools/src/convert.dart'
;
import
'package:flutter_tools/src/reporting/reporting.dart'
;
import
'../../../src/common.dart'
;
import
'../../../src/context.dart'
;
...
...
@@ -27,12 +28,14 @@ void main() {
late
FakeCommand
lipoInfoNonFatCommand
;
late
FakeCommand
lipoInfoFatCommand
;
late
FakeCommand
lipoVerifyX86_64Command
;
late
TestUsage
usage
;
setUp
(()
{
processManager
=
FakeProcessManager
.
empty
();
artifacts
=
Artifacts
.
test
();
fileSystem
=
MemoryFileSystem
.
test
();
logger
=
BufferLogger
.
test
();
usage
=
TestUsage
();
environment
=
Environment
.
test
(
fileSystem
.
currentDirectory
,
defines:
<
String
,
String
>{
...
...
@@ -45,7 +48,8 @@ void main() {
processManager:
processManager
,
logger:
logger
,
fileSystem:
fileSystem
,
engineVersion:
'2'
engineVersion:
'2'
,
usage:
usage
,
);
binary
=
environment
.
outputDir
...
...
@@ -314,6 +318,37 @@ void main() {
ProcessManager:
()
=>
processManager
,
});
testUsingContext
(
'ReleaseMacOSBundleFlutterAssets sends archive success event'
,
()
async
{
environment
.
defines
[
kBuildMode
]
=
'release'
;
environment
.
defines
[
kXcodeAction
]
=
'install'
;
fileSystem
.
file
(
'bin/cache/artifacts/engine/darwin-x64/vm_isolate_snapshot.bin'
)
.
createSync
(
recursive:
true
);
fileSystem
.
file
(
'bin/cache/artifacts/engine/darwin-x64/isolate_snapshot.bin'
)
.
createSync
(
recursive:
true
);
fileSystem
.
file
(
fileSystem
.
path
.
join
(
environment
.
buildDir
.
path
,
'App.framework'
,
'App'
))
.
createSync
(
recursive:
true
);
await
const
ReleaseMacOSBundleFlutterAssets
().
build
(
environment
);
expect
(
usage
.
events
,
contains
(
const
TestUsageEvent
(
'assemble'
,
'macos-archive'
,
label:
'success'
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
testUsingContext
(
'ReleaseMacOSBundleFlutterAssets sends archive fail event'
,
()
async
{
environment
.
defines
[
kBuildMode
]
=
'release'
;
environment
.
defines
[
kXcodeAction
]
=
'install'
;
// Throws because the project files are not set up.
await
expectLater
(()
=>
const
ReleaseMacOSBundleFlutterAssets
().
build
(
environment
),
throwsA
(
const
TypeMatcher
<
FileSystemException
>()));
expect
(
usage
.
events
,
contains
(
const
TestUsageEvent
(
'assemble'
,
'macos-archive'
,
label:
'fail'
)));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
processManager
,
});
testUsingContext
(
'DebugMacOSFramework creates expected binary with arm64 only arch'
,
()
async
{
environment
.
defines
[
kDarwinArchs
]
=
'arm64'
;
processManager
.
addCommand
(
...
...
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