jdeploy-installer-linux-x64 6.1.5 → 6.1.6-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
Binary file
|
|
@@ -8,6 +8,12 @@ var mainClass = "{{MAIN_CLASS}}";
|
|
|
8
8
|
var classPath = "{{CLASSPATH}}";
|
|
9
9
|
var port = "0";
|
|
10
10
|
var warPath = "";
|
|
11
|
+
// JVM/program arguments declared in the "jdeploy.args" array of package.json.
|
|
12
|
+
// Injected at publish time as a JSON array literal (defaults to []). These are
|
|
13
|
+
// processed at runtime (see processPackageArg/appendPackageArgs) so that
|
|
14
|
+
// platform-conditional args such as "-[mac]--add-opens ..." resolve on the
|
|
15
|
+
// machine the app actually runs on, mirroring the client4j launcher.
|
|
16
|
+
var packageArgs = [];
|
|
11
17
|
var javaVersionString = "8";
|
|
12
18
|
var tryJavaHomeFirst = false;
|
|
13
19
|
var javafx = false;
|
|
@@ -160,10 +166,25 @@ function njreWrap() {
|
|
|
160
166
|
zipFile.openReadStream(entry, (err, readStream) => {
|
|
161
167
|
if (err) reject(err)
|
|
162
168
|
|
|
169
|
+
// Zip entries carry the original Unix mode in the high 16 bits
|
|
170
|
+
// of externalFileAttributes. Preserve it so executables (java,
|
|
171
|
+
// jspawnhelper, keytool, ...) keep their execute bit. Without
|
|
172
|
+
// this, child-process spawning fails on macOS/Windows with
|
|
173
|
+
// "posix_spawn failed, error: 0" because lib/jspawnhelper is
|
|
174
|
+
// left non-executable.
|
|
175
|
+
const mode = (entry.externalFileAttributes >>> 16) & 0o777
|
|
176
|
+
|
|
163
177
|
readStream.on('end', () => {
|
|
178
|
+
// createWriteStream's mode is still subject to umask, so
|
|
179
|
+
// chmod explicitly to guarantee the stored mode is applied.
|
|
180
|
+
if (mode) {
|
|
181
|
+
try {
|
|
182
|
+
fs.chmodSync(entryPath, mode)
|
|
183
|
+
} catch (e) {}
|
|
184
|
+
}
|
|
164
185
|
zipFile.readEntry()
|
|
165
186
|
})
|
|
166
|
-
readStream.pipe(fs.createWriteStream(entryPath))
|
|
187
|
+
readStream.pipe(fs.createWriteStream(entryPath, mode ? { mode } : undefined))
|
|
167
188
|
})
|
|
168
189
|
}
|
|
169
190
|
})
|
|
@@ -569,6 +590,112 @@ if (!done) {
|
|
|
569
590
|
|
|
570
591
|
|
|
571
592
|
|
|
593
|
+
// Resolves the platform-conditional prefix syntax used in package.json
|
|
594
|
+
// "jdeploy.args" entries, mirroring processArg() in the client4j launcher.
|
|
595
|
+
//
|
|
596
|
+
// Supported prefixes (the bracket lists a comma-separated set of conditions
|
|
597
|
+
// that must ALL be satisfied; a condition may itself be a pipe-separated OR
|
|
598
|
+
// group such as "mac|linux"):
|
|
599
|
+
// -[conditions]<arg> generic, e.g. "-[mac]--add-opens java.desktop/...=..."
|
|
600
|
+
// -D[conditions]<rest> becomes "-D<rest>" when the conditions pass
|
|
601
|
+
// -X[conditions]<rest> becomes "-X<rest>" when the conditions pass
|
|
602
|
+
//
|
|
603
|
+
// Returns the resolved argument string, or '' if the conditions exclude the
|
|
604
|
+
// current platform (in which case the caller drops the argument).
|
|
605
|
+
function processPackageArg(arg) {
|
|
606
|
+
var isMac = (process.platform === 'darwin');
|
|
607
|
+
var isWin = (process.platform === 'win32');
|
|
608
|
+
var isLinux = (process.platform === 'linux');
|
|
609
|
+
|
|
610
|
+
if ((arg.indexOf('-D[') === 0 || arg.indexOf('-X[') === 0 || arg.indexOf('-[') === 0) && arg.indexOf(']') >= 0) {
|
|
611
|
+
var conditionsStr = arg.substring(arg.indexOf('[') + 1, arg.indexOf(']'));
|
|
612
|
+
var conditions = conditionsStr.split(',');
|
|
613
|
+
var fulfilled = true;
|
|
614
|
+
for (var i = 0; i < conditions.length; i++) {
|
|
615
|
+
var condition = conditions[i].trim();
|
|
616
|
+
var lcCondition = condition.toLowerCase();
|
|
617
|
+
if (lcCondition === 'mac' && !isMac) {
|
|
618
|
+
fulfilled = false;
|
|
619
|
+
continue;
|
|
620
|
+
} else if (lcCondition === 'win' && !isWin) {
|
|
621
|
+
fulfilled = false;
|
|
622
|
+
continue;
|
|
623
|
+
} else if (lcCondition === 'linux' && !isLinux) {
|
|
624
|
+
fulfilled = false;
|
|
625
|
+
continue;
|
|
626
|
+
} else if (lcCondition === 'windows' && !isWin) {
|
|
627
|
+
fulfilled = false;
|
|
628
|
+
continue;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (condition.indexOf('|') >= 0) {
|
|
632
|
+
lcCondition = '|' + lcCondition + '|';
|
|
633
|
+
fulfilled = false;
|
|
634
|
+
if (isMac && lcCondition.indexOf('|mac|') >= 0) {
|
|
635
|
+
fulfilled = true;
|
|
636
|
+
} else if (isLinux && lcCondition.indexOf('|linux|') >= 0) {
|
|
637
|
+
fulfilled = true;
|
|
638
|
+
} else if (isWin && lcCondition.indexOf('|win|') >= 0) {
|
|
639
|
+
fulfilled = true;
|
|
640
|
+
} else if (isWin && lcCondition.indexOf('|windows|') >= 0) {
|
|
641
|
+
fulfilled = true;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
if (!fulfilled) {
|
|
647
|
+
return '';
|
|
648
|
+
}
|
|
649
|
+
if (arg.indexOf('-[') === 0) {
|
|
650
|
+
arg = arg.substring(arg.indexOf(']') + 1);
|
|
651
|
+
} else if (arg.indexOf('-D[') === 0) {
|
|
652
|
+
arg = '-D' + arg.substring(arg.indexOf(']') + 1);
|
|
653
|
+
} else if (arg.indexOf('-X[') === 0) {
|
|
654
|
+
arg = '-X' + arg.substring(arg.indexOf(']') + 1);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
return arg;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// Categorizes each package.json "jdeploy.args" entry into JVM args (placed
|
|
662
|
+
// before -jar) or program args (placed after the jar), mirroring the relevant
|
|
663
|
+
// part of processRunArgs() in the client4j launcher. A "--flag value" JVM
|
|
664
|
+
// option (e.g. "--add-opens java.desktop/com.apple.eawt=ALL-UNNAMED") is split
|
|
665
|
+
// into two tokens because the JVM expects the flag and value as separate
|
|
666
|
+
// arguments. Package args are appended before the user-supplied CLI args.
|
|
667
|
+
function appendPackageArgs(rawArgs, javaArgs, programArgs) {
|
|
668
|
+
if (!Array.isArray(rawArgs)) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
rawArgs.forEach(function(rawArg) {
|
|
672
|
+
var arg = processPackageArg(rawArg);
|
|
673
|
+
if (arg === '' || arg === null || typeof arg === 'undefined') {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
if (arg.indexOf('-D') === 0 || arg.indexOf('-X') === 0) {
|
|
677
|
+
javaArgs.push(arg);
|
|
678
|
+
} else if (arg.indexOf('--') === 0) {
|
|
679
|
+
// JVM module/access options (--add-opens, --add-exports,
|
|
680
|
+
// --add-modules, --module-path, --enable-preview, ...). Split off a
|
|
681
|
+
// value if one is present in the same token.
|
|
682
|
+
var spaceIdx = arg.indexOf(' ');
|
|
683
|
+
if (spaceIdx >= 0) {
|
|
684
|
+
javaArgs.push(arg.substring(0, spaceIdx));
|
|
685
|
+
javaArgs.push(arg.substring(spaceIdx + 1));
|
|
686
|
+
} else {
|
|
687
|
+
javaArgs.push(arg);
|
|
688
|
+
}
|
|
689
|
+
} else if (arg.indexOf('-p ') === 0) {
|
|
690
|
+
// Short form of --module-path.
|
|
691
|
+
javaArgs.push('-p');
|
|
692
|
+
javaArgs.push(arg.substring(3));
|
|
693
|
+
} else {
|
|
694
|
+
programArgs.push(arg);
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
|
|
572
699
|
function run(_javaHome) {
|
|
573
700
|
var fail = reason => {
|
|
574
701
|
console.error(reason);
|
|
@@ -593,6 +720,8 @@ function run(_javaHome) {
|
|
|
593
720
|
javaArgs.push('-Djdeploy.port='+port);
|
|
594
721
|
javaArgs.push('-Djdeploy.war.path='+warPath);
|
|
595
722
|
var programArgs = [];
|
|
723
|
+
// Args declared in package.json (jdeploy.args) come before the user's CLI args.
|
|
724
|
+
appendPackageArgs(packageArgs, javaArgs, programArgs);
|
|
596
725
|
userArgs.forEach(function(arg) {
|
|
597
726
|
if (arg.startsWith('-D') || arg.startsWith('-X')) {
|
|
598
727
|
javaArgs.push(arg);
|