Skip to content

Commit 6356f43

Browse files
committed
vscode-extension: Linux build tasks
1 parent 01b2778 commit 6356f43

File tree

1 file changed

+136
-4
lines changed

1 file changed

+136
-4
lines changed

vscode-extension/src/main/ts/utils/ActionScriptTaskProvider.ts

Lines changed: 136 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const PLATFORM_ANDROID = "android";
2828
const PLATFORM_AIR = "air";
2929
const PLATFORM_WINDOWS = "windows";
3030
const PLATFORM_MAC = "mac";
31+
const PLATFORM_LINUX = "linux";
3132
const PLATFORM_BUNDLE = "bundle";
3233
const TARGET_AIR = "air";
3334
const TARGET_BUNDLE = "bundle";
@@ -60,12 +61,20 @@ const TASK_NAME_PACKAGE_MAC_SHARED_DEBUG =
6061
"package macOS debug (shared runtime)";
6162
const TASK_NAME_PACKAGE_MAC_SHARED_RELEASE =
6263
"package macOS release (shared runtime)";
64+
const TASK_NAME_PACKAGE_LINUX_SHARED_DEBUG =
65+
"package Linux debug (shared runtime)";
66+
const TASK_NAME_PACKAGE_LINUX_SHARED_RELEASE =
67+
"package Linux release (shared runtime)";
6368
const TASK_NAME_PACKAGE_WINDOWS_CAPTIVE =
6469
"package Windows release (captive runtime)";
6570
const TASK_NAME_PACKAGE_MAC_CAPTIVE = "package macOS release (captive runtime)";
71+
const TASK_NAME_PACKAGE_LINUX_CAPTIVE =
72+
"package Linux release (captive runtime)";
6673
const TASK_NAME_PACKAGE_WINDOWS_NATIVE =
6774
"package Windows release (native installer)";
6875
const TASK_NAME_PACKAGE_MAC_NATIVE = "package macOS release (native installer)";
76+
const TASK_NAME_PACKAGE_LINUX_NATIVE =
77+
"package Linux release (native installer)";
6978

7079
interface ActionScriptTaskDefinition extends vscode.TaskDefinition {
7180
type: typeof TASK_TYPE_ACTIONSCRIPT;
@@ -233,10 +242,13 @@ export default class ActionScriptTaskProvider
233242
let isRootTargetNativeInstaller = false;
234243
let isWindowsOverrideBundle = false;
235244
let isMacOverrideBundle = false;
245+
let isLinuxOverrideBundle = false;
236246
let isWindowsOverrideNativeInstaller = false;
237247
let isMacOverrideNativeInstaller = false;
248+
let isLinuxOverrideNativeInstaller = false;
238249
let isWindowsOverrideShared = false;
239250
let isMacOverrideShared = false;
251+
let isLinuxOverrideShared = false;
240252
const asconfigJson = this.readASConfigJSON(jsonURI);
241253
if (asconfigJson !== null) {
242254
isLibrary = this.isLibrary(asconfigJson);
@@ -254,12 +266,16 @@ export default class ActionScriptTaskProvider
254266
this.isRootTargetNativeInstaller(asconfigJson);
255267
isWindowsOverrideShared = this.isWindowsOverrideShared(asconfigJson);
256268
isMacOverrideShared = this.isMacOverrideShared(asconfigJson);
269+
isLinuxOverrideShared = this.isLinuxOverrideShared(asconfigJson);
257270
isWindowsOverrideBundle = this.isWindowsOverrideBundle(asconfigJson);
258271
isMacOverrideBundle = this.isMacOverrideBundle(asconfigJson);
272+
isLinuxOverrideBundle = this.isLinuxOverrideBundle(asconfigJson);
259273
isWindowsOverrideNativeInstaller =
260274
this.isWindowsOverrideNativeInstaller(asconfigJson);
261275
isMacOverrideNativeInstaller =
262276
this.isMacOverrideNativeInstaller(asconfigJson);
277+
isLinuxOverrideNativeInstaller =
278+
this.isLinuxOverrideNativeInstaller(asconfigJson);
263279
}
264280
}
265281

@@ -398,7 +414,11 @@ export default class ActionScriptTaskProvider
398414
//to determine what to display in the list of tasks.
399415

400416
//captive runtime
401-
if (isWindowsOverrideBundle || isMacOverrideBundle) {
417+
if (
418+
isWindowsOverrideBundle ||
419+
isMacOverrideBundle ||
420+
isLinuxOverrideBundle
421+
) {
402422
result.push(
403423
this.getTask(
404424
`${TASK_NAME_PACKAGE_DESKTOP_CAPTIVE} - ${taskNameSuffix}`,
@@ -435,6 +455,18 @@ export default class ActionScriptTaskProvider
435455
isAIRDesktop || isAIRMobile
436456
)
437457
);
458+
} else if (isLinuxOverrideBundle) {
459+
result.push(
460+
this.getTask(
461+
`${TASK_NAME_PACKAGE_LINUX_CAPTIVE} - ${taskNameSuffix}`,
462+
jsonURI,
463+
workspaceFolder,
464+
frameworkSDK,
465+
false,
466+
PLATFORM_LINUX,
467+
isAIRDesktop || isAIRMobile
468+
)
469+
);
438470
}
439471
//shared runtime with platform overrides
440472
else if (isWindowsOverrideShared) {
@@ -483,6 +515,29 @@ export default class ActionScriptTaskProvider
483515
isAIRDesktop || isAIRMobile
484516
)
485517
);
518+
} else if (isLinuxOverrideShared) {
519+
result.push(
520+
this.getTask(
521+
`${TASK_NAME_PACKAGE_LINUX_SHARED_DEBUG} - ${taskNameSuffix}`,
522+
jsonURI,
523+
workspaceFolder,
524+
frameworkSDK,
525+
true,
526+
PLATFORM_LINUX,
527+
isAIRDesktop || isAIRMobile
528+
)
529+
);
530+
result.push(
531+
this.getTask(
532+
`${TASK_NAME_PACKAGE_LINUX_SHARED_RELEASE} - ${taskNameSuffix}`,
533+
jsonURI,
534+
workspaceFolder,
535+
frameworkSDK,
536+
false,
537+
PLATFORM_LINUX,
538+
isAIRDesktop || isAIRMobile
539+
)
540+
);
486541
}
487542
//native installers
488543
else if (isWindowsOverrideNativeInstaller) {
@@ -509,6 +564,18 @@ export default class ActionScriptTaskProvider
509564
isAIRDesktop || isAIRMobile
510565
)
511566
);
567+
} else if (isLinuxOverrideNativeInstaller) {
568+
result.push(
569+
this.getTask(
570+
`${TASK_NAME_PACKAGE_LINUX_NATIVE} - ${taskNameSuffix}`,
571+
jsonURI,
572+
workspaceFolder,
573+
frameworkSDK,
574+
false,
575+
PLATFORM_LINUX,
576+
isAIRDesktop || isAIRMobile
577+
)
578+
);
512579
}
513580

514581
//--- root target in airOptions
@@ -517,11 +584,14 @@ export default class ActionScriptTaskProvider
517584
//desktop platform. if it is overridden, it should be skipped to avoid
518585
//duplicate items in the list.
519586
const isWindows = process.platform === "win32";
587+
const isMac = process.platform === "darwin";
588+
const isLinux = process.platform === "linux";
520589

521590
if (
522591
isRootTargetNativeInstaller &&
523592
((isWindows && !isWindowsOverrideNativeInstaller) ||
524-
(!isWindows && !isMacOverrideNativeInstaller))
593+
(isMac && !isMacOverrideNativeInstaller) ||
594+
(isLinux && !isLinuxOverrideNativeInstaller))
525595
) {
526596
let taskName = isWindows
527597
? TASK_NAME_PACKAGE_WINDOWS_NATIVE
@@ -541,7 +611,8 @@ export default class ActionScriptTaskProvider
541611
if (
542612
(isRootTargetBundle || isRootTargetEmpty) &&
543613
((isWindows && !isWindowsOverrideBundle) ||
544-
(!isWindows && !isMacOverrideBundle))
614+
(isMac && !isMacOverrideBundle) ||
615+
(isLinux && !isLinuxOverrideBundle))
545616
) {
546617
result.push(
547618
this.getTask(
@@ -574,7 +645,8 @@ export default class ActionScriptTaskProvider
574645
if (
575646
(isRootTargetShared || isRootTargetEmpty) &&
576647
((isWindows && !isWindowsOverrideShared) ||
577-
(!isWindows && !isMacOverrideShared))
648+
(isMac && !isMacOverrideShared) ||
649+
(isLinux && !isLinuxOverrideShared))
578650
) {
579651
result.push(
580652
this.getTask(
@@ -834,6 +906,26 @@ export default class ActionScriptTaskProvider
834906
return target === TARGET_AIR;
835907
}
836908

909+
private isLinuxOverrideShared(asconfigJson: any): boolean {
910+
if (process.platform !== "linux") {
911+
return false;
912+
}
913+
if (!(FIELD_AIR_OPTIONS in asconfigJson)) {
914+
return false;
915+
}
916+
let airOptions = asconfigJson[FIELD_AIR_OPTIONS];
917+
if (!(PLATFORM_LINUX in airOptions)) {
918+
return false;
919+
}
920+
let linux = airOptions[PLATFORM_LINUX];
921+
if (!(FIELD_TARGET in linux)) {
922+
//if target is omitted, defaults to bundle
923+
return false;
924+
}
925+
let target = linux[FIELD_TARGET];
926+
return target === TARGET_AIR;
927+
}
928+
837929
private isWindowsOverrideNativeInstaller(asconfigJson: any): boolean {
838930
if (process.platform !== "win32") {
839931
return false;
@@ -874,6 +966,26 @@ export default class ActionScriptTaskProvider
874966
return target === TARGET_NATIVE;
875967
}
876968

969+
private isLinuxOverrideNativeInstaller(asconfigJson: any): boolean {
970+
if (process.platform !== "linux") {
971+
return false;
972+
}
973+
if (!(FIELD_AIR_OPTIONS in asconfigJson)) {
974+
return false;
975+
}
976+
let airOptions = asconfigJson[FIELD_AIR_OPTIONS];
977+
if (!(PLATFORM_LINUX in airOptions)) {
978+
return false;
979+
}
980+
let linux = airOptions[PLATFORM_LINUX];
981+
if (!(FIELD_TARGET in linux)) {
982+
//if target is omitted, defaults to bundle
983+
return false;
984+
}
985+
let target = linux[FIELD_TARGET];
986+
return target === TARGET_NATIVE;
987+
}
988+
877989
private isSharedOverride(asconfigJson: any): boolean {
878990
if (!(FIELD_AIR_OPTIONS in asconfigJson)) {
879991
return false;
@@ -922,6 +1034,26 @@ export default class ActionScriptTaskProvider
9221034
return target === TARGET_BUNDLE;
9231035
}
9241036

1037+
private isLinuxOverrideBundle(asconfigJson: any): boolean {
1038+
if (process.platform !== "linux") {
1039+
return false;
1040+
}
1041+
if (!(FIELD_AIR_OPTIONS in asconfigJson)) {
1042+
return false;
1043+
}
1044+
let airOptions = asconfigJson[FIELD_AIR_OPTIONS];
1045+
if (!(PLATFORM_LINUX in airOptions)) {
1046+
return false;
1047+
}
1048+
let linux = airOptions[PLATFORM_LINUX];
1049+
if (!(FIELD_TARGET in linux)) {
1050+
//if target is omitted, default to bundle
1051+
return true;
1052+
}
1053+
let target = linux[FIELD_TARGET];
1054+
return target === TARGET_BUNDLE;
1055+
}
1056+
9251057
private isRootTargetShared(asconfigJson: any): boolean {
9261058
if (!(FIELD_AIR_OPTIONS in asconfigJson)) {
9271059
//if no airOptions are specified at all, consider it shared runtime

0 commit comments

Comments
 (0)