@@ -23,7 +23,6 @@ const List<String> _kWindowsArtifacts = <String>[
23
23
'flutter_messenger.h' ,
24
24
'flutter_plugin_registrar.h' ,
25
25
'flutter_windows.h' ,
26
- 'icudtl.dat' ,
27
26
];
28
27
29
28
const String _kWindowsDepfile = 'windows_engine_sources.d' ;
@@ -78,6 +77,10 @@ class UnpackWindows extends Target {
78
77
engineSourcePath: engineSourcePath,
79
78
outputDirectory: outputDirectory,
80
79
clientSourcePaths: < String > [clientSourcePath],
80
+ icuDataPath: environment.artifacts.getArtifactPath (
81
+ Artifact .icuData,
82
+ platform: TargetPlatform .windows_x64
83
+ )
81
84
);
82
85
final DepfileService depfileService = DepfileService (
83
86
fileSystem: environment.fileSystem,
@@ -90,12 +93,9 @@ class UnpackWindows extends Target {
90
93
}
91
94
}
92
95
93
- /// Creates a debug bundle for the Windows desktop target.
94
- class DebugBundleWindowsAssets extends Target {
95
- const DebugBundleWindowsAssets ();
96
-
97
- @override
98
- String get name => 'debug_bundle_windows_assets' ;
96
+ /// Creates a bundle for the Windows desktop target.
97
+ abstract class BundleWindowsAssets extends Target {
98
+ const BundleWindowsAssets ();
99
99
100
100
@override
101
101
List <Target > get dependencies => const < Target > [
@@ -105,17 +105,11 @@ class DebugBundleWindowsAssets extends Target {
105
105
106
106
@override
107
107
List <Source > get inputs => const < Source > [
108
- Source .pattern ('{BUILD_DIR}/app.dill' ),
109
108
Source .pattern ('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/windows.dart' ),
110
109
Source .pattern ('{PROJECT_DIR}/pubspec.yaml' ),
111
110
...IconTreeShaker .inputs,
112
111
];
113
112
114
- @override
115
- List <Source > get outputs => const < Source > [
116
- Source .pattern ('{OUTPUT_DIR}/flutter_assets/kernel_blob.bin' ),
117
- ];
118
-
119
113
@override
120
114
List <String > get depfiles => const < String > [
121
115
'flutter_assets.d' ,
@@ -124,7 +118,7 @@ class DebugBundleWindowsAssets extends Target {
124
118
@override
125
119
Future <void > build (Environment environment) async {
126
120
if (environment.defines[kBuildMode] == null ) {
127
- throw MissingDefineException (kBuildMode, 'debug_bundle_windows_assets ' );
121
+ throw MissingDefineException (kBuildMode, 'bundle_windows_assets ' );
128
122
}
129
123
final BuildMode buildMode = getBuildModeForName (environment.defines[kBuildMode]);
130
124
final Directory outputDirectory = environment.outputDir
@@ -149,3 +143,89 @@ class DebugBundleWindowsAssets extends Target {
149
143
);
150
144
}
151
145
}
146
+
147
+ /// A wrapper for AOT compilation that copies app.so into the output directory.
148
+ class WindowsAotBundle extends Target {
149
+ /// Create a [WindowsAotBundle] wrapper for [aotTarget] .
150
+ const WindowsAotBundle (this .aotTarget);
151
+
152
+ /// The [AotElfBase] subclass that produces the app.so.
153
+ final AotElfBase aotTarget;
154
+
155
+ @override
156
+ String get name => 'windows_aot_bundle' ;
157
+
158
+ @override
159
+ List <Source > get inputs => const < Source > [
160
+ Source .pattern ('{BUILD_DIR}/app.so' ),
161
+ ];
162
+
163
+ @override
164
+ List <Source > get outputs => const < Source > [
165
+ Source .pattern ('{OUTPUT_DIR}/windows/app.so' ),
166
+ ];
167
+
168
+ @override
169
+ List <Target > get dependencies => < Target > [
170
+ aotTarget,
171
+ ];
172
+
173
+ @override
174
+ Future <void > build (Environment environment) async {
175
+ final File outputFile = environment.buildDir.childFile ('app.so' );
176
+ final Directory outputDirectory = environment.outputDir.childDirectory ('windows' );
177
+ if (! outputDirectory.existsSync ()) {
178
+ outputDirectory.createSync (recursive: true );
179
+ }
180
+ outputFile.copySync (outputDirectory.childFile ('app.so' ).path);
181
+ }
182
+ }
183
+
184
+ class ReleaseBundleWindowsAssets extends BundleWindowsAssets {
185
+ const ReleaseBundleWindowsAssets ();
186
+
187
+ @override
188
+ String get name => 'release_bundle_windows_assets' ;
189
+
190
+ @override
191
+ List <Source > get outputs => const < Source > [];
192
+
193
+ @override
194
+ List <Target > get dependencies => < Target > [
195
+ ...super .dependencies,
196
+ const WindowsAotBundle (AotElfRelease (TargetPlatform .windows_x64)),
197
+ ];
198
+ }
199
+
200
+ class ProfileBundleWindowsAssets extends BundleWindowsAssets {
201
+ const ProfileBundleWindowsAssets ();
202
+
203
+ @override
204
+ String get name => 'profile_bundle_windows_assets' ;
205
+
206
+ @override
207
+ List <Source > get outputs => const < Source > [];
208
+
209
+ @override
210
+ List <Target > get dependencies => < Target > [
211
+ ...super .dependencies,
212
+ const WindowsAotBundle (AotElfProfile (TargetPlatform .windows_x64)),
213
+ ];
214
+ }
215
+
216
+ class DebugBundleWindowsAssets extends BundleWindowsAssets {
217
+ const DebugBundleWindowsAssets ();
218
+
219
+ @override
220
+ String get name => 'debug_bundle_windows_assets' ;
221
+
222
+ @override
223
+ List <Source > get inputs => < Source > [
224
+ const Source .pattern ('{BUILD_DIR}/app.dill' ),
225
+ ];
226
+
227
+ @override
228
+ List <Source > get outputs => < Source > [
229
+ const Source .pattern ('{OUTPUT_DIR}/flutter_assets/kernel_blob.bin' ),
230
+ ];
231
+ }
0 commit comments