|
|
|
@ -9,26 +9,31 @@ const buildutils = require("./buildutils");
|
|
|
|
|
const execSync = require("child_process").execSync;
|
|
|
|
|
|
|
|
|
|
function gulptasksStandalone($, gulp) {
|
|
|
|
|
const electronBaseDir = path.join(__dirname, "..", "electron");
|
|
|
|
|
const targets = [
|
|
|
|
|
{
|
|
|
|
|
tempDestDir: path.join(__dirname, "..", "tmp_standalone_files"),
|
|
|
|
|
suffix: "",
|
|
|
|
|
taskPrefix: "",
|
|
|
|
|
electronBaseDir: path.join(__dirname, "..", "electron"),
|
|
|
|
|
steam: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
tempDestDir: path.join(__dirname, "..", "tmp_standalone_files_china"),
|
|
|
|
|
suffix: "china",
|
|
|
|
|
taskPrefix: "china.",
|
|
|
|
|
electronBaseDir: path.join(__dirname, "..", "electron"),
|
|
|
|
|
steam: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
tempDestDir: path.join(__dirname, "..", "tmp_standalone_files_wegame"),
|
|
|
|
|
suffix: "wegame",
|
|
|
|
|
taskPrefix: "wegame.",
|
|
|
|
|
electronBaseDir: path.join(__dirname, "..", "electron_wegame"),
|
|
|
|
|
steam: false,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
for (const { tempDestDir, suffix, taskPrefix } of targets) {
|
|
|
|
|
for (const { tempDestDir, suffix, taskPrefix, electronBaseDir, steam } of targets) {
|
|
|
|
|
const tempDestBuildDir = path.join(tempDestDir, "built");
|
|
|
|
|
|
|
|
|
|
gulp.task(taskPrefix + "standalone.prepare.cleanup", () => {
|
|
|
|
@ -39,13 +44,15 @@ function gulptasksStandalone($, gulp) {
|
|
|
|
|
const requiredFiles = [
|
|
|
|
|
path.join(electronBaseDir, "node_modules", "**", "*.*"),
|
|
|
|
|
path.join(electronBaseDir, "node_modules", "**", ".*"),
|
|
|
|
|
path.join(electronBaseDir, "steam_appid.txt"),
|
|
|
|
|
path.join(electronBaseDir, "favicon*"),
|
|
|
|
|
|
|
|
|
|
// fails on platforms which support symlinks
|
|
|
|
|
// https://github.com/gulpjs/gulp/issues/1427
|
|
|
|
|
// path.join(electronBaseDir, "node_modules", "**", "*"),
|
|
|
|
|
];
|
|
|
|
|
if (steam) {
|
|
|
|
|
requiredFiles.push(path.join(electronBaseDir, "steam_appid.txt"));
|
|
|
|
|
}
|
|
|
|
|
return gulp.src(requiredFiles, { base: electronBaseDir }).pipe(gulp.dest(tempDestBuildDir));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -69,6 +76,11 @@ function gulptasksStandalone($, gulp) {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
gulp.task(taskPrefix + "standalone.prepareVDF", cb => {
|
|
|
|
|
if (!steam) {
|
|
|
|
|
cb();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const hash = buildutils.getRevision();
|
|
|
|
|
|
|
|
|
|
const steampipeDir = path.join(__dirname, "steampipe", "scripts");
|
|
|
|
@ -122,7 +134,7 @@ function gulptasksStandalone($, gulp) {
|
|
|
|
|
const privateArtifactsPath = "node_modules/shapez.io-private-artifacts";
|
|
|
|
|
|
|
|
|
|
let asar;
|
|
|
|
|
if (fs.existsSync(path.join(tempDestBuildDir, privateArtifactsPath))) {
|
|
|
|
|
if (steam && fs.existsSync(path.join(tempDestBuildDir, privateArtifactsPath))) {
|
|
|
|
|
asar = { unpackDir: privateArtifactsPath };
|
|
|
|
|
} else {
|
|
|
|
|
asar = true;
|
|
|
|
@ -152,24 +164,26 @@ function gulptasksStandalone($, gulp) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync(
|
|
|
|
|
path.join(appPath, "LICENSE"),
|
|
|
|
|
fs.readFileSync(path.join(__dirname, "..", "LICENSE"))
|
|
|
|
|
);
|
|
|
|
|
if (steam) {
|
|
|
|
|
fs.writeFileSync(
|
|
|
|
|
path.join(appPath, "LICENSE"),
|
|
|
|
|
fs.readFileSync(path.join(__dirname, "..", "LICENSE"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
fse.copySync(
|
|
|
|
|
path.join(tempDestBuildDir, "steam_appid.txt"),
|
|
|
|
|
path.join(appPath, "steam_appid.txt")
|
|
|
|
|
);
|
|
|
|
|
fse.copySync(
|
|
|
|
|
path.join(tempDestBuildDir, "steam_appid.txt"),
|
|
|
|
|
path.join(appPath, "steam_appid.txt")
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync(path.join(appPath, ".itch.toml"), tomlFile);
|
|
|
|
|
fs.writeFileSync(path.join(appPath, ".itch.toml"), tomlFile);
|
|
|
|
|
|
|
|
|
|
if (platform === "linux") {
|
|
|
|
|
fs.writeFileSync(
|
|
|
|
|
path.join(appPath, "play.sh"),
|
|
|
|
|
'#!/usr/bin/env bash\n./shapezio --no-sandbox "$@"\n'
|
|
|
|
|
);
|
|
|
|
|
fs.chmodSync(path.join(appPath, "play.sh"), 0o775);
|
|
|
|
|
if (platform === "linux") {
|
|
|
|
|
fs.writeFileSync(
|
|
|
|
|
path.join(appPath, "play.sh"),
|
|
|
|
|
'#!/usr/bin/env bash\n./shapezio --no-sandbox "$@"\n'
|
|
|
|
|
);
|
|
|
|
|
fs.chmodSync(path.join(appPath, "play.sh"), 0o775);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|