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
01feddbe
Unverified
Commit
01feddbe
authored
Aug 15, 2019
by
Jonah Williams
Committed by
GitHub
Aug 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for macOS release mode (1 of 3) (#37425)
parent
57f1508b
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
282 additions
and
244 deletions
+282
-244
macos_build_flutter_assets.sh
packages/flutter_tools/bin/macos_build_flutter_assets.sh
+18
-23
build_system.dart
...ages/flutter_tools/lib/src/build_system/build_system.dart
+9
-6
dart.dart
...ages/flutter_tools/lib/src/build_system/targets/dart.dart
+1
-0
macos.dart
...ges/flutter_tools/lib/src/build_system/targets/macos.dart
+170
-85
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+2
-3
desktop.dart
packages/flutter_tools/lib/src/desktop.dart
+3
-0
application_package.dart
...ages/flutter_tools/lib/src/macos/application_package.dart
+1
-1
build_macos.dart
packages/flutter_tools/lib/src/macos/build_macos.dart
+7
-0
macos_test.dart
...s/test/general.shard/build_system/targets/macos_test.dart
+70
-125
assemble_test.dart
...tter_tools/test/general.shard/commands/assemble_test.dart
+1
-1
No files found.
packages/flutter_tools/bin/macos_build_flutter_assets.sh
View file @
01feddbe
...
@@ -33,18 +33,6 @@ if [[ -n "$FLUTTER_TARGET" ]]; then
...
@@ -33,18 +33,6 @@ if [[ -n "$FLUTTER_TARGET" ]]; then
target_path
=
"
${
FLUTTER_TARGET
}
"
target_path
=
"
${
FLUTTER_TARGET
}
"
fi
fi
# Set the track widget creation flag.
track_widget_creation_flag
=
""
if
[[
-n
"
$TRACK_WIDGET_CREATION
"
]]
;
then
track_widget_creation_flag
=
"--track-widget-creation"
fi
# Copy the framework and handle local engine builds.
framework_name
=
"FlutterMacOS.framework"
ephemeral_dir
=
"
${
SOURCE_ROOT
}
/Flutter/ephemeral"
framework_path
=
"
${
FLUTTER_ROOT
}
/bin/cache/artifacts/engine/darwin-x64"
flutter_framework
=
"
${
framework_path
}
/
${
framework_name
}
"
if
[[
-n
"
$FLUTTER_ENGINE
"
]]
;
then
if
[[
-n
"
$FLUTTER_ENGINE
"
]]
;
then
flutter_engine_flag
=
"--local-engine-src-path=
${
FLUTTER_ENGINE
}
"
flutter_engine_flag
=
"--local-engine-src-path=
${
FLUTTER_ENGINE
}
"
fi
fi
...
@@ -63,22 +51,29 @@ if [[ -n "$LOCAL_ENGINE" ]]; then
...
@@ -63,22 +51,29 @@ if [[ -n "$LOCAL_ENGINE" ]]; then
exit
-1
exit
-1
fi
fi
local_engine_flag
=
"--local-engine=
${
LOCAL_ENGINE
}
"
local_engine_flag
=
"--local-engine=
${
LOCAL_ENGINE
}
"
flutter_framework
=
"
${
FLUTTER_ENGINE
}
/out/
${
LOCAL_ENGINE
}
/
${
framework_name
}
"
fi
fi
RunCommand
mkdir
-p
--
"
$ephemeral_dir
"
RunCommand
rm
-rf
--
"
${
ephemeral_dir
}
/
${
framework_name
}
"
RunCommand
cp
-Rp
--
"
${
flutter_framework
}
"
"
${
ephemeral_dir
}
"
# Set the build mode
# Set the build mode
build_mode
=
"
$(
echo
"
${
FLUTTER_BUILD_MODE
:-${
CONFIGURATION
}}
"
|
tr
"[:upper:]"
"[:lower:]"
)
"
build_mode
=
"
$(
echo
"
${
FLUTTER_BUILD_MODE
:-${
CONFIGURATION
}}
"
|
tr
"[:upper:]"
"[:lower:]"
)
"
# The path where the input/output xcfilelists are stored. These are used by xcode
# to conditionally skip this script phase if neither have changed.
ephemeral_dir
=
"
${
SOURCE_ROOT
}
/Flutter/ephemeral"
build_inputs_path
=
"
${
ephemeral_dir
}
/FlutterInputs.xcfilelist"
build_outputs_path
=
"
${
ephemeral_dir
}
/FlutterOutputs.xcfilelist"
# TODO(jonahwilliams): connect AOT rules once engine artifacts are published.
# The build mode is currently hard-coded to debug only. Since this does not yet
# support AOT, we need to ensure that we compile the kernel file in debug so that
# the VM can load it.
RunCommand
"
${
FLUTTER_ROOT
}
/bin/flutter"
--suppress-analytics
\
RunCommand
"
${
FLUTTER_ROOT
}
/bin/flutter"
--suppress-analytics
\
${
verbose_flag
}
\
${
verbose_flag
}
\
build bundle
\
--target-platform
=
darwin-x64
\
--target
=
"
${
target_path
}
"
\
--
${
build_mode
}
\
${
track_widget_creation_flag
}
\
${
flutter_engine_flag
}
\
${
flutter_engine_flag
}
\
${
local_engine_flag
}
${
local_engine_flag
}
\
assemble
\
-dTargetPlatform
=
darwin-x64
\
-dTargetFile
=
"
${
target_path
}
"
\
-dBuildMode
=
debug
\
--build-inputs
=
"
${
build_inputs_path
}
"
\
--build-outputs
=
"
${
build_outputs_path
}
"
\
debug_bundle_flutter_assets
packages/flutter_tools/lib/src/build_system/build_system.dart
View file @
01feddbe
...
@@ -485,16 +485,18 @@ class BuildSystem {
...
@@ -485,16 +485,18 @@ class BuildSystem {
// timestamps to track files, this leads to unecessary rebuilds if they
// timestamps to track files, this leads to unecessary rebuilds if they
// are included. Once all the places that write these files have been
// are included. Once all the places that write these files have been
// tracked down and moved into assemble, these checks should be removable.
// tracked down and moved into assemble, these checks should be removable.
// We also remove files under .dart_tool, since these are intermediaries
// and don't need to be tracked by external systems.
{
{
buildInstance
.
inputFiles
.
removeWhere
((
String
path
,
File
file
)
{
buildInstance
.
inputFiles
.
removeWhere
((
String
path
,
File
file
)
{
return
path
.
contains
(
'
pubspec.yaml
'
)
||
return
path
.
contains
(
'
.flutter-plugins
'
)
||
path
.
contains
(
'.flutter-plugins
'
)
||
path
.
contains
(
'xcconfig
'
)
||
path
.
contains
(
'xcconfig
'
);
path
.
contains
(
'.dart_tool
'
);
});
});
buildInstance
.
outputFiles
.
removeWhere
((
String
path
,
File
file
)
{
buildInstance
.
outputFiles
.
removeWhere
((
String
path
,
File
file
)
{
return
path
.
contains
(
'
pubspec.yaml
'
)
||
return
path
.
contains
(
'
.flutter-plugins
'
)
||
path
.
contains
(
'.flutter-plugins
'
)
||
path
.
contains
(
'xcconfig
'
)
||
path
.
contains
(
'xcconfig
'
);
path
.
contains
(
'.dart_tool
'
);
});
});
}
}
return
BuildResult
(
return
BuildResult
(
...
@@ -509,6 +511,7 @@ class BuildSystem {
...
@@ -509,6 +511,7 @@ class BuildSystem {
}
}
}
}
/// An active instance of a build.
/// An active instance of a build.
class
_BuildInstance
{
class
_BuildInstance
{
_BuildInstance
(
this
.
environment
,
this
.
fileCache
,
this
.
buildSystemConfig
)
_BuildInstance
(
this
.
environment
,
this
.
fileCache
,
this
.
buildSystemConfig
)
...
...
packages/flutter_tools/lib/src/build_system/targets/dart.dart
View file @
01feddbe
...
@@ -64,6 +64,7 @@ class KernelSnapshot extends Target {
...
@@ -64,6 +64,7 @@ class KernelSnapshot extends Target {
@override
@override
List
<
Source
>
get
inputs
=>
const
<
Source
>[
List
<
Source
>
get
inputs
=>
const
<
Source
>[
Source
.
pattern
(
'{PROJECT_DIR}/.packages'
),
Source
.
pattern
(
'{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/dart.dart'
),
Source
.
pattern
(
'{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/dart.dart'
),
Source
.
function
(
listDartSources
),
// <- every dart file under {PROJECT_DIR}/lib and in .packages
Source
.
function
(
listDartSources
),
// <- every dart file under {PROJECT_DIR}/lib and in .packages
Source
.
artifact
(
Artifact
.
platformKernelDill
),
Source
.
artifact
(
Artifact
.
platformKernelDill
),
...
...
packages/flutter_tools/lib/src/build_system/targets/macos.dart
View file @
01feddbe
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
01feddbe
...
@@ -32,9 +32,8 @@ const List<Target> _kDefaultTargets = <Target>[
...
@@ -32,9 +32,8 @@ const List<Target> _kDefaultTargets = <Target>[
AotElfRelease
(),
AotElfRelease
(),
AotAssemblyProfile
(),
AotAssemblyProfile
(),
AotAssemblyRelease
(),
AotAssemblyRelease
(),
DebugMacOSApplication
(),
DebugMacOSFramework
(),
ProfileMacOSApplication
(),
DebugBundleFlutterAssets
(),
ReleaseMacOSApplication
(),
];
];
/// Assemble provides a low level API to interact with the flutter tool build
/// Assemble provides a low level API to interact with the flutter tool build
...
...
packages/flutter_tools/lib/src/desktop.dart
View file @
01feddbe
...
@@ -11,6 +11,9 @@ import 'device.dart';
...
@@ -11,6 +11,9 @@ import 'device.dart';
/// Kills a process on linux or macOS.
/// Kills a process on linux or macOS.
Future
<
bool
>
killProcess
(
String
executable
)
async
{
Future
<
bool
>
killProcess
(
String
executable
)
async
{
if
(
executable
==
null
)
{
return
false
;
}
final
RegExp
whitespace
=
RegExp
(
r'\s+'
);
final
RegExp
whitespace
=
RegExp
(
r'\s+'
);
bool
succeeded
=
true
;
bool
succeeded
=
true
;
try
{
try
{
...
...
packages/flutter_tools/lib/src/macos/application_package.dart
View file @
01feddbe
...
@@ -141,7 +141,7 @@ class BuildableMacOSApp extends MacOSApp {
...
@@ -141,7 +141,7 @@ class BuildableMacOSApp extends MacOSApp {
return
null
;
return
null
;
}
}
final
_ExecutableAndId
executableAndId
=
MacOSApp
.
_executableFromBundle
(
fs
.
directory
(
directory
));
final
_ExecutableAndId
executableAndId
=
MacOSApp
.
_executableFromBundle
(
fs
.
directory
(
directory
));
return
executableAndId
.
executable
;
return
executableAndId
?
.
executable
;
}
}
}
}
...
...
packages/flutter_tools/lib/src/macos/build_macos.dart
View file @
01feddbe
...
@@ -36,6 +36,13 @@ Future<void> buildMacOS({
...
@@ -36,6 +36,13 @@ Future<void> buildMacOS({
setSymroot:
false
,
setSymroot:
false
,
);
);
await
processPodsIfNeeded
(
flutterProject
.
macos
,
getMacOSBuildDirectory
(),
buildInfo
.
mode
);
await
processPodsIfNeeded
(
flutterProject
.
macos
,
getMacOSBuildDirectory
(),
buildInfo
.
mode
);
// If the xcfilelists do not exist, create empty version.
if
(!
flutterProject
.
macos
.
inputFileList
.
existsSync
())
{
flutterProject
.
macos
.
inputFileList
.
createSync
(
recursive:
true
);
}
if
(!
flutterProject
.
macos
.
outputFileList
.
existsSync
())
{
flutterProject
.
macos
.
outputFileList
.
createSync
(
recursive:
true
);
}
// Set debug or release mode.
// Set debug or release mode.
String
config
=
'Debug'
;
String
config
=
'Debug'
;
...
...
packages/flutter_tools/test/general.shard/build_system/targets/macos_test.dart
View file @
01feddbe
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/commands/assemble_test.dart
View file @
01feddbe
...
@@ -73,7 +73,7 @@ void main() {
...
@@ -73,7 +73,7 @@ void main() {
return
BuildResult
(
return
BuildResult
(
success:
true
,
success:
true
,
inputFiles:
<
File
>[
fs
.
file
(
'foo'
),
fs
.
file
(
'fizz'
)..
createSync
()],
inputFiles:
<
File
>[
fs
.
file
(
'foo'
),
fs
.
file
(
'fizz'
)..
createSync
()],
outputFiles:
<
File
>[
fs
.
file
(
'bar'
)]);
outputFiles:
<
File
>[
fs
.
file
(
'bar'
)
,
fs
.
file
(
fs
.
path
.
join
(
'.dart_tool'
,
'fizz2'
))..
createSync
(
recursive:
true
)
]);
});
});
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'unpack_macos'
]);
await
commandRunner
.
run
(<
String
>[
'assemble'
,
'--build-outputs=outputs'
,
'--build-inputs=inputs'
,
'unpack_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