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
5526dcc2
Unverified
Commit
5526dcc2
authored
Apr 21, 2021
by
Jonah Williams
Committed by
GitHub
Apr 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] generate install manifest for UWP builds (#80803)
parent
f2417e6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
209 additions
and
1 deletion
+209
-1
build_windows.dart
packages/flutter_tools/lib/src/windows/build_windows.dart
+10
-1
install_manifest.dart
packages/flutter_tools/lib/src/windows/install_manifest.dart
+55
-0
install_manifest_test.dart
...ols/test/general.shard/windows/install_manifest_test.dart
+144
-0
No files found.
packages/flutter_tools/lib/src/windows/build_windows.dart
View file @
5526dcc2
...
@@ -19,6 +19,7 @@ import '../flutter_plugins.dart';
...
@@ -19,6 +19,7 @@ import '../flutter_plugins.dart';
import
'../globals.dart'
as
globals
;
import
'../globals.dart'
as
globals
;
import
'../migrations/cmake_custom_command_migration.dart'
;
import
'../migrations/cmake_custom_command_migration.dart'
;
import
'../project.dart'
;
import
'../project.dart'
;
import
'install_manifest.dart'
;
import
'visual_studio.dart'
;
import
'visual_studio.dart'
;
// From https://cmake.org/cmake/help/v3.15/manual/cmake-generators.7.html#visual-studio-generators
// From https://cmake.org/cmake/help/v3.15/manual/cmake-generators.7.html#visual-studio-generators
...
@@ -120,6 +121,7 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
...
@@ -120,6 +121,7 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
String
target
,
String
target
,
VisualStudio
visualStudioOverride
,
VisualStudio
visualStudioOverride
,
})
async
{
})
async
{
final
Directory
buildDirectory
=
globals
.
fs
.
directory
(
getWindowsBuildUwpDirectory
());
if
(!
windowsProject
.
existsSync
())
{
if
(!
windowsProject
.
existsSync
())
{
throwToolExit
(
throwToolExit
(
'No Windows UWP desktop project configured. See '
'No Windows UWP desktop project configured. See '
...
@@ -136,6 +138,14 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
...
@@ -136,6 +138,14 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
// Ensure that necessary ephemeral files are generated and up to date.
// Ensure that necessary ephemeral files are generated and up to date.
_writeGeneratedFlutterConfig
(
windowsProject
,
buildInfo
,
target
);
_writeGeneratedFlutterConfig
(
windowsProject
,
buildInfo
,
target
);
createPluginSymlinks
(
windowsProject
.
parent
);
createPluginSymlinks
(
windowsProject
.
parent
);
await
createManifest
(
buildDirectory:
buildDirectory
,
logger:
globals
.
logger
,
platform:
globals
.
platform
,
project:
windowsProject
,
buildInfo:
buildInfo
,
fileSystem:
globals
.
fs
,
);
final
VisualStudio
visualStudio
=
visualStudioOverride
??
VisualStudio
(
final
VisualStudio
visualStudio
=
visualStudioOverride
??
VisualStudio
(
fileSystem:
globals
.
fs
,
fileSystem:
globals
.
fs
,
...
@@ -149,7 +159,6 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
...
@@ -149,7 +159,6 @@ Future<void> buildWindowsUwp(WindowsUwpProject windowsProject, BuildInfo buildIn
'Please run `flutter doctor` for more details.'
);
'Please run `flutter doctor` for more details.'
);
}
}
final
Directory
buildDirectory
=
globals
.
fs
.
directory
(
getWindowsBuildUwpDirectory
());
final
String
buildModeName
=
getNameForBuildMode
(
buildInfo
.
mode
??
BuildMode
.
release
);
final
String
buildModeName
=
getNameForBuildMode
(
buildInfo
.
mode
??
BuildMode
.
release
);
final
Status
status
=
globals
.
logger
.
startProgress
(
final
Status
status
=
globals
.
logger
.
startProgress
(
'Building Windows application...'
,
'Building Windows application...'
,
...
...
packages/flutter_tools/lib/src/windows/install_manifest.dart
0 → 100644
View file @
5526dcc2
// 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.
// @dart = 2.8
import
'package:meta/meta.dart'
;
import
'../asset.dart'
;
import
'../base/common.dart'
;
import
'../base/file_system.dart'
;
import
'../base/logger.dart'
;
import
'../base/platform.dart'
;
import
'../build_info.dart'
;
import
'../project.dart'
;
/// Generate an install manifest that is required for CMAKE on UWP projects.
Future
<
void
>
createManifest
({
@required
Logger
logger
,
@required
FileSystem
fileSystem
,
@required
Platform
platform
,
@required
WindowsUwpProject
project
,
@required
BuildInfo
buildInfo
,
@required
Directory
buildDirectory
,
})
async
{
final
List
<
File
>
outputs
=
<
File
>[];
final
AssetBundle
assetBundle
=
AssetBundleFactory
.
defaultInstance
(
logger:
logger
,
fileSystem:
fileSystem
,
platform:
platform
,
splitDeferredAssets:
false
,
).
createBundle
();
final
int
resultCode
=
await
assetBundle
.
build
(
packagesPath:
buildInfo
.
packagesPath
,
assetDirPath:
buildDirectory
.
childDirectory
(
'flutter_assets'
).
path
,
);
if
(
resultCode
!=
0
)
{
throwToolExit
(
'Failed to build assets.'
);
}
if
(
buildInfo
.
mode
.
isPrecompiled
)
{
outputs
.
add
(
buildDirectory
.
childFile
(
'app.so'
));
}
else
{
outputs
.
add
(
buildDirectory
.
childDirectory
(
'flutter_assets'
).
childFile
(
'kernel_blob.bin'
));
}
for
(
final
String
key
in
assetBundle
.
entries
.
keys
)
{
outputs
.
add
(
buildDirectory
.
childDirectory
(
'flutter_assets'
).
childFile
(
key
));
}
outputs
.
add
(
project
.
ephemeralDirectory
.
childFile
(
'flutter_windows_winuwp.dll'
));
outputs
.
add
(
project
.
ephemeralDirectory
.
childFile
(
'flutter_windows_winuwp.dll.pdb'
));
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
'
));
}
packages/flutter_tools/test/general.shard/windows/install_manifest_test.dart
0 → 100644
View file @
5526dcc2
// 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.
// @dart = 2.8
import
'package:file/memory.dart'
;
import
'package:file_testing/file_testing.dart'
;
import
'package:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/platform.dart'
;
import
'package:flutter_tools/src/build_info.dart'
;
import
'package:flutter_tools/src/project.dart'
;
import
'package:flutter_tools/src/windows/install_manifest.dart'
;
import
'../../src/common.dart'
;
import
'../../src/context.dart'
;
final
Platform
platform
=
FakePlatform
(
operatingSystem:
'windows'
);
void
main
(
)
{
FileSystem
fileSystem
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
});
testUsingContext
(
'Generates install manifest for a debug build'
,
()
async
{
final
Logger
logger
=
BufferLogger
.
test
();
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
Directory
buildDirectory
=
fileSystem
.
currentDirectory
.
childDirectory
(
'build'
)
.
childDirectory
(
'winuwp'
);
await
createManifest
(
logger:
logger
,
fileSystem:
fileSystem
,
platform:
platform
,
project:
flutterProject
.
windowsUwp
,
buildDirectory:
buildDirectory
,
buildInfo:
BuildInfo
.
debug
,
);
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'
,
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Generates install manifest for a release build'
,
()
async
{
final
Logger
logger
=
BufferLogger
.
test
();
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
Directory
buildDirectory
=
fileSystem
.
currentDirectory
.
childDirectory
(
'build'
)
.
childDirectory
(
'winuwp'
);
await
createManifest
(
logger:
logger
,
fileSystem:
fileSystem
,
platform:
platform
,
project:
flutterProject
.
windowsUwp
,
buildDirectory:
buildDirectory
,
buildInfo:
BuildInfo
.
release
,
);
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'
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Generates install manifest for a release build with assets'
,
()
async
{
final
BufferLogger
logger
=
BufferLogger
.
test
();
final
FlutterProject
flutterProject
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
Directory
buildDirectory
=
fileSystem
.
currentDirectory
.
childDirectory
(
'build'
)
.
childDirectory
(
'winuwp'
);
fileSystem
.
currentDirectory
.
childDirectory
(
'.dart_tool'
).
childFile
(
'package_config.json'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
'''
{
"configVersion": 2,
"packages": []
}
'''
);
fileSystem
.
currentDirectory
.
childFile
(
'pubspec.yaml'
)
..
createSync
()
..
writeAsStringSync
(
'''
name: foo
flutter:
assets:
- assets/foo.png
'''
);
fileSystem
.
currentDirectory
.
childDirectory
(
'assets'
)
.
childFile
(
'foo.png'
)
.
createSync
(
recursive:
true
);
await
createManifest
(
logger:
logger
,
fileSystem:
fileSystem
,
platform:
platform
,
project:
flutterProject
.
windowsUwp
,
buildDirectory:
buildDirectory
,
buildInfo:
BuildInfo
.
release
,
);
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'
]));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
}
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