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
8663aea5
Unverified
Commit
8663aea5
authored
Apr 22, 2021
by
Jonah Williams
Committed by
GitHub
Apr 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] run UWP builds ahead of cmake (#80879)
parent
9c0270d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
25 deletions
+101
-25
build_windows.dart
packages/flutter_tools/lib/src/windows/build_windows.dart
+61
-1
install_manifest.dart
packages/flutter_tools/lib/src/windows/install_manifest.dart
+1
-1
build_windows_test.dart
...ools/test/commands.shard/hermetic/build_windows_test.dart
+20
-4
install_manifest_test.dart
...ols/test/general.shard/windows/install_manifest_test.dart
+19
-19
No files found.
packages/flutter_tools/lib/src/windows/build_windows.dart
View file @
8663aea5
...
...
@@ -164,12 +164,72 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
'Building Windows application...'
,
);
try
{
// The Cmake re-entrant build does not work for UWP, so the flutter build is
// run in advance.
await
_runFlutterBuild
(
buildDirectory
,
buildInfo
,
target
);
await
_runCmakeGeneration
(
cmakePath
,
buildDirectory
,
windowsProject
.
cmakeFile
.
parent
);
await
_runBuild
(
cmakePath
,
buildDirectory
,
buildModeName
,
install:
false
);
}
finally
{
status
.
cancel
();
}
throwToolExit
(
'Windows UWP builds are not implemented.'
);
}
const
Map
<
BuildMode
,
String
>
_targets
=
<
BuildMode
,
String
>{
BuildMode
.
debug
:
'debug_bundle_windows_assets_uwp'
,
BuildMode
.
profile
:
'profile_bundle_windows_assets_uwp'
,
BuildMode
.
release
:
'release_bundle_windows_assets_uwp'
,
};
Future
<
void
>
_runFlutterBuild
(
Directory
buildDirectory
,
BuildInfo
buildInfo
,
String
targetFile
)
async
{
await
buildDirectory
.
create
(
recursive:
true
);
int
result
;
String
flutterEngine
;
String
localEngine
;
if
(
globals
.
artifacts
is
LocalEngineArtifacts
)
{
final
LocalEngineArtifacts
localEngineArtifacts
=
globals
.
artifacts
as
LocalEngineArtifacts
;
final
String
engineOutPath
=
localEngineArtifacts
.
engineOutPath
;
flutterEngine
=
globals
.
fs
.
path
.
dirname
(
globals
.
fs
.
path
.
dirname
(
engineOutPath
));
localEngine
=
globals
.
fs
.
path
.
basename
(
engineOutPath
);
}
try
{
result
=
await
globals
.
processUtils
.
stream
(
<
String
>[
globals
.
fs
.
path
.
join
(
Cache
.
flutterRoot
,
'bin'
,
'flutter'
),
if
(
globals
.
logger
.
isVerbose
)
'--verbose'
,
if
(
flutterEngine
!=
null
)
'--local-engine-src-path=
$flutterEngine
'
,
if
(
localEngine
!=
null
)
'--local-engine=
$localEngine
'
,
'assemble'
,
'--no-version-check'
,
'--output=build'
,
'-dTargetPlatform=windows-uwp-x64'
,
'-dTrackWidgetCreation=
${buildInfo.trackWidgetCreation}
'
,
'-dBuildMode=
${getNameForBuildMode(buildInfo.mode)}
'
,
'-dTargetFile=
$targetFile
'
,
'-dTreeShakeIcons="
${buildInfo.treeShakeIcons}
"'
,
'-dDartObfuscation=
${buildInfo.dartObfuscation}
'
,
if
(
buildInfo
.
bundleSkSLPath
!=
null
)
'-iBundleSkSLPath=
${buildInfo.bundleSkSLPath}
'
,
if
(
buildInfo
.
codeSizeDirectory
!=
null
)
'-dCodeSizeDirectory=
${buildInfo.codeSizeDirectory}
'
,
if
(
buildInfo
.
splitDebugInfoPath
!=
null
)
'-dSplitDebugInfo=
${buildInfo.splitDebugInfoPath}
'
,
if
(
buildInfo
.
dartDefines
!=
null
&&
buildInfo
.
dartDefines
.
isNotEmpty
)
'--DartDefines=
${encodeDartDefines(buildInfo.dartDefines)}
'
,
if
(
buildInfo
.
extraGenSnapshotOptions
!=
null
&&
buildInfo
.
extraGenSnapshotOptions
.
isNotEmpty
)
'--ExtraGenSnapshotOptions=
${buildInfo.extraGenSnapshotOptions}
'
,
if
(
buildInfo
.
extraFrontEndOptions
!=
null
&&
buildInfo
.
extraFrontEndOptions
.
isNotEmpty
)
'--ExtraFrontEndOptions=
${buildInfo.extraFrontEndOptions}
'
,
_targets
[
buildInfo
.
mode
],
],
trace:
true
,
);
}
on
ArgumentError
{
throwToolExit
(
"cmake not found. Run 'flutter doctor' for more information."
);
}
if
(
result
!=
0
)
{
throwToolExit
(
'Unable to generate build files'
);
}
}
Future
<
void
>
_runCmakeGeneration
(
String
cmakePath
,
Directory
buildDir
,
Directory
sourceDir
)
async
{
...
...
packages/flutter_tools/lib/src/windows/install_manifest.dart
View file @
8663aea5
...
...
@@ -51,5 +51,5 @@ Future<void> createManifest({
outputs
.
add
(
project
.
ephemeralDirectory
.
childFile
(
'icudtl.dat'
));
project
.
ephemeralDirectory
.
childFile
(
'install_manifest'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
outputs
.
map
((
File
file
)
=>
file
.
absolute
.
path
).
join
(
'
\n
'
));
..
writeAsStringSync
(
outputs
.
map
((
File
file
)
=>
file
.
absolute
.
uri
.
path
.
substring
(
1
)
).
join
(
'
\n
'
));
}
packages/flutter_tools/test/commands.shard/hermetic/build_windows_test.dart
View file @
8663aea5
...
...
@@ -53,6 +53,7 @@ void main() {
setUpAll
(()
{
Cache
.
disableLocking
();
Cache
.
flutterRoot
=
''
;
});
setUp
(()
{
...
...
@@ -530,7 +531,7 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
setUpMockProjectFilesForBuild
();
// This message should include 'To enable, run "flutter config --enable-windows-uwp-desktop"."
// once the `windowsUwpEmbedding` feature is available on all
platform
s.
// once the `windowsUwpEmbedding` feature is available on all
channel
s.
expect
(
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'winuwp'
,
'--no-pub'
]
),
throwsToolExit
(
message:
RegExp
(
r'"build winuwp" is not currently supported\.$'
)));
...
...
@@ -541,19 +542,34 @@ C:\foo\windows\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identifier
FeatureFlags:
()
=>
TestFeatureFlags
(
isWindowsUwpEnabled:
false
),
});
testUsingContext
(
'Windows UWP build
fails after writing Cmake file
'
,
()
async
{
testUsingContext
(
'Windows UWP build
completes successfully
'
,
()
async
{
final
FakeVisualStudio
fakeVisualStudio
=
FakeVisualStudio
(
cmakePath
);
final
BuildWindowsUwpCommand
command
=
BuildWindowsUwpCommand
()
..
visualStudioOverride
=
fakeVisualStudio
;
setUpMockUwpFilesForBuild
(
0
);
expect
(
createTestCommandRunner
(
command
).
run
(
await
createTestCommandRunner
(
command
).
run
(
const
<
String
>[
'winuwp'
,
'--no-pub'
]
)
,
throwsToolExit
(
message:
'Windows UWP builds are not implemented'
))
;
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
list
(<
FakeCommand
>[
const
FakeCommand
(
command:
<
String
>[
r'C:\flutter\bin\flutter'
,
'assemble'
,
'--no-version-check'
,
'--output=build'
,
'-dTargetPlatform=windows-uwp-x64'
,
'-dTrackWidgetCreation=true'
,
'-dBuildMode=release'
,
r'-dTargetFile=lib\main.dart'
,
'-dTreeShakeIcons="true"'
,
'-dDartObfuscation=false'
,
'release_bundle_windows_assets_uwp'
],
),
cmakeGenerationCommand
(
winuwp:
true
),
buildCommand
(
'Release'
,
stdout:
'STDOUT STUFF'
,
winuwp:
true
),
]),
...
...
packages/flutter_tools/test/general.shard/windows/install_manifest_test.dart
View file @
8663aea5
...
...
@@ -22,7 +22,7 @@ void main() {
FileSystem
fileSystem
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
fileSystem
=
MemoryFileSystem
.
test
(
style:
FileSystemStyle
.
windows
);
});
testUsingContext
(
'Generates install manifest for a debug build'
,
()
async
{
...
...
@@ -44,11 +44,11 @@ void main() {
final
File
manifest
=
flutterProject
.
windowsUwp
.
ephemeralDirectory
.
childFile
(
'install_manifest'
);
expect
(
manifest
,
exists
);
expect
(
manifest
.
readAsLinesSync
(),
unorderedEquals
(<
String
>[
'/build/winuwp/flutter_assets/kernel_blob.bin'
,
'/build/winuwp/flutter_assets/AssetManifest.json'
,
'/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll'
,
'/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb'
,
'/winuwp/flutter/ephemeral/icudtl.dat'
,
'
C:
/build/winuwp/flutter_assets/kernel_blob.bin'
,
'
C:
/build/winuwp/flutter_assets/AssetManifest.json'
,
'
C:
/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll'
,
'
C:
/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb'
,
'
C:
/winuwp/flutter/ephemeral/icudtl.dat'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
...
...
@@ -74,11 +74,11 @@ void main() {
final
File
manifest
=
flutterProject
.
windowsUwp
.
ephemeralDirectory
.
childFile
(
'install_manifest'
);
expect
(
manifest
,
exists
);
expect
(
manifest
.
readAsLinesSync
(),
unorderedEquals
(<
String
>[
'/build/winuwp/app.so'
,
'/build/winuwp/flutter_assets/AssetManifest.json'
,
'/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll'
,
'/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb'
,
'/winuwp/flutter/ephemeral/icudtl.dat'
'
C:
/build/winuwp/app.so'
,
'
C:
/build/winuwp/flutter_assets/AssetManifest.json'
,
'
C:
/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll'
,
'
C:
/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb'
,
'
C:
/winuwp/flutter/ephemeral/icudtl.dat'
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
...
...
@@ -128,14 +128,14 @@ flutter:
final
File
manifest
=
flutterProject
.
windowsUwp
.
ephemeralDirectory
.
childFile
(
'install_manifest'
);
expect
(
manifest
,
exists
);
expect
(
manifest
.
readAsLinesSync
(),
unorderedEquals
(<
String
>[
'/build/winuwp/app.so'
,
'/build/winuwp/flutter_assets/assets/foo.png'
,
'/build/winuwp/flutter_assets/AssetManifest.json'
,
'/build/winuwp/flutter_assets/FontManifest.json'
,
'/build/winuwp/flutter_assets/NOTICES'
,
'/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll'
,
'/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb'
,
'/winuwp/flutter/ephemeral/icudtl.dat'
'
C:
/build/winuwp/app.so'
,
'
C:
/build/winuwp/flutter_assets/assets/foo.png'
,
'
C:
/build/winuwp/flutter_assets/AssetManifest.json'
,
'
C:
/build/winuwp/flutter_assets/FontManifest.json'
,
'
C:
/build/winuwp/flutter_assets/NOTICES'
,
'
C:
/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll'
,
'
C:
/winuwp/flutter/ephemeral/flutter_windows_winuwp.dll.pdb'
,
'
C:
/winuwp/flutter/ephemeral/icudtl.dat'
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
...
...
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