@@ -32,6 +32,11 @@ import 'utils.dart';
3232/// This defaults to [name] .
3333final standaloneName = InternalConfigVariable .fn <String >(() => name.value);
3434
35+ /// Whether to build native exe.
36+ ///
37+ /// This defaults to `false` .
38+ final useNative = InternalConfigVariable .fn <bool >(() => false );
39+
3540/// For each executable entrypoint in [executables] , builds a script snapshot
3641/// to `build/${executable}.snapshot` .
3742///
@@ -95,6 +100,7 @@ void addStandaloneTasks() {
95100
96101 freezeSharedVariables ();
97102 standaloneName.freeze ();
103+ useNative.freeze ();
98104
99105 addTask (GrinderTask ('pkg-compile-snapshot' ,
100106 taskFunction: () => _compileSnapshot (release: true ),
@@ -121,7 +127,7 @@ void addStandaloneTasks() {
121127 taskFunction: () => _buildPackage (platform),
122128 description:
123129 'Build a standalone package for ${platform .toHumanString ()}.' ,
124- depends: platform.useNative
130+ depends: platform.useNative || useNative.value
125131 ? ['pkg-compile-native' ]
126132 : ['pkg-compile-snapshot' ])
127133 };
@@ -133,7 +139,9 @@ void addStandaloneTasks() {
133139 for (var MapEntry (key: platform, value: task) in tasks.entries)
134140 // Omit Fuchsia tasks because we can't run those unless we're actually
135141 // running on Fuchsia ourselves.
136- if (! platform.os.isFuchsia || platform.isCurrent) task.name
142+ // Omit cross-platform tasks with native exe because we can't run those
143+ // unless we're actually on the target platform.
144+ if (! (platform.os.isFuchsia || useNative.value) || platform.isCurrent) task.name
137145 ]));
138146}
139147
0 commit comments