refactor steam pipe generation

pull/1434/head
tobspr 2 years ago
parent 691911104e
commit b821c7259c

4
.gitignore vendored

@ -58,4 +58,6 @@ config.local.js
*.*.swo
app.vdf
steamtmp
steamtmp
build_output
built_vdfs

@ -200,8 +200,6 @@ function serveHTML({ version = "web-dev" }) {
gulp.series("js." + version + ".dev.watch")(() => true);
}
///////////////////// RUNNABLE TASKS /////////////////////
// Pre and postbuild
gulp.task("step.baseResources", gulp.series("imgres.allOptimized"));
gulp.task("step.deleteEmpty", cb => {
@ -211,7 +209,9 @@ gulp.task("step.deleteEmpty", cb => {
gulp.task("step.postbuild", gulp.series("imgres.cleanupUnusedCssInlineImages", "step.deleteEmpty"));
// // Builds everything (dev)
///////////////////// RUNNABLE TASKS /////////////////////
// Builds everything (dev)
gulp.task(
"build.prepare.dev",
gulp.series(
@ -229,29 +229,12 @@ gulp.task(
)
);
// // Builds everything (staging)
// gulp.task("step.staging.code", gulp.series("sounds.fullbuild", "translations.fullBuild", "js.staging"));
// gulp.task(
// "step.staging.mainbuild",
// gulp.parallel("utils.copyAdditionalBuildFiles", "step.baseResources", "step.staging.code")
// );
// gulp.task("step.staging.all", gulp.series("step.staging.mainbuild", "css.prod", "html.staging"));
// gulp.task("build.staging", gulp.series("utils.cleanup", "step.staging.all", "step.postbuild"));
// // Builds everything (prod)
// gulp.task("step.prod.code", gulp.series("sounds.fullbuild", "translations.fullBuild", "js.prod"));
// gulp.task(
// "step.prod.mainbuild",
// gulp.parallel("utils.copyAdditionalBuildFiles", "step.baseResources", "step.prod.code")
// );
// gulp.task("step.prod.all", gulp.series("step.prod.mainbuild", "css.prod", "html.prod"));
// gulp.task("build.prod", gulp.series("utils.cleanup", "step.prod.all", "step.postbuild"));
// Builds everything for every variant
for (const variant in BUILD_VARIANTS) {
const data = BUILD_VARIANTS[variant];
const buildName = "build." + variant;
// build
gulp.task(
buildName + ".code",
gulp.series(
@ -270,6 +253,18 @@ for (const variant in BUILD_VARIANTS) {
gulp.task(buildName, gulp.series("utils.cleanup", buildName + ".all", "step.postbuild"));
// bundle
if (data.standalone) {
gulp.task(
"bundle." + variant + ".from-windows",
gulp.series(buildName, "standalone." + variant + ".build-from-windows")
);
gulp.task(
"bundle." + variant + ".from-darwin",
gulp.series(buildName, "standalone." + variant + ".build-from-darwin")
);
}
// serve
gulp.task(
"serve." + variant,
@ -277,16 +272,6 @@ for (const variant in BUILD_VARIANTS) {
);
}
// OS X build and release upload
// gulp.task(
// "build.darwin64-prod",
// gulp.series(
// "build.standalone-prod",
// "standalone.prepare",
// "standalone.package.prod.darwin64.signManually"
// )
// );
// Deploying!
gulp.task(
"deploy.staging",
@ -297,23 +282,26 @@ gulp.task(
gulp.series("utils.requireCleanWorkingTree", "build.web-shapezio", "ftp.upload.prod")
);
// // china
// gulp.task(
// "china.main.standalone",
// gulp.series("china.build.standalone-prod", "china.standalone.package.prod")
// );
// // wegame
// gulp.task(
// "wegame.main.standalone",
// gulp.series("wegame.build.standalone-prod", "wegame.standalone.package.prod")
// );
// // all (except wegame)
// gulp.task("standalone.steam", gulp.series("regular.main.standalone", "china.main.standalone"));
// gulp.task(
// "standalone.all",
// gulp.series("regular.main.standalone", "china.main.standalone", "wegame.main.standalone")
// );
// Bundling (pre upload)
gulp.task(
"bundle.steam.from-darwin",
gulp.series("bundle.standalone-steam.from-darwin", "bundle.standalone-steam-china.from-darwin")
);
gulp.task(
"bundle.steam.from-windows",
gulp.series("bundle.standalone-steam.from-windows", "bundle.standalone-steam-china.from-windows")
);
gulp.task(
"bundle.steam-demo.from-darwin",
gulp.series("bundle.standalone-steam-demo.from-darwin", "bundle.standalone-steam-china-demo.from-darwin")
);
gulp.task(
"bundle.steam-demo.from-windows",
gulp.series(
"bundle.standalone-steam-demo.from-windows",
"bundle.standalone-steam-china-demo.from-windows"
)
);
// Default task (dev, localhost)
gulp.task("default", gulp.series("serve.web-localhost"));

@ -119,7 +119,7 @@ function gulptasksStandalone($, gulp) {
asar: asar,
executableName: "shapezio",
icon: path.join(electronBaseDir, "favicon"),
name: "shapez-" + variant,
name: "shapez",
out: tempDestDir,
overwrite: true,
appBundleId: "tobspr.shapezio." + variant,
@ -175,7 +175,7 @@ function gulptasksStandalone($, gulp) {
fs.writeFileSync(
path.join(
appPath,
"shapez.io-standalone.app",
"shapez.app",
"Contents",
"MacOS",
"steam_appid.txt"
@ -202,14 +202,14 @@ function gulptasksStandalone($, gulp) {
"darwin",
"x64",
() => {
const appFile = path.join(tempDestDir, "shapez.io-standalone-darwin-x64");
const appFileInner = path.join(appFile, "shapez.io-standalone.app");
const appFile = path.join(tempDestDir, "shapez-darwin-x64");
const appFileInner = path.join(appFile, "shapez.app");
const appIdDest = path.join(
path.join(appFileInner, "Contents", "MacOS"),
"steam_appid.txt"
);
console.warn("++ Preparing ++");
fse.copySync(path.join(tempDestBuildDir, "steam_appid.txt"), appIdDest);
// console.warn("++ Preparing ++");
// fse.copySync(path.join(tempDestBuildDir, "steam_appid.txt"), appIdDest);
console.warn("++ Signing ++");
console.warn("Signing steam_appid.txt");
@ -241,17 +241,14 @@ function gulptasksStandalone($, gulp) {
};
},
}).then(() => {
execSync(
`codesign --verify --verbose ${path.join(appFile, "shapez.io-standalone.app")}`,
{
cwd: appFile,
}
);
execSync(`codesign --verify --verbose ${path.join(appFile, "shapez.app")}`, {
cwd: appFile,
});
console.warn("++ Notarizing ++");
electronNotarize
.notarize({
appPath: path.join(appFile, "shapez.io-standalone.app"),
appPath: path.join(appFile, "shapez.app"),
tool: "legacy",
appBundleId: "tobspr.shapezio.standalone",
@ -289,22 +286,53 @@ function gulptasksStandalone($, gulp) {
const hash = buildutils.getRevision();
const version = buildutils.getVersion();
for (const platform of ["steampipe", "steampipe-darwin"]) {
const steampipeDir = path.join(__dirname, platform, "scripts");
for (const buildVariant of ["app", "app-demo"]) {
const templateContents = fs
.readFileSync(path.join(steampipeDir, buildVariant + ".vdf.template"), {
encoding: "utf-8",
})
.toString();
const convertedContents = templateContents.replace(
"$DESC$",
platform + " " + buildVariant + " version " + version + ", commit " + hash
);
fs.writeFileSync(path.join(steampipeDir, buildVariant + ".vdf"), convertedContents);
// for (const platform of ["steampipe", "steampipe-darwin"]) {
const templatesSource = path.join(__dirname, "steampipe", "templates");
const templatesDest = path.join(__dirname, "steampipe", "built_vdfs");
const variables = {
PROJECT_DIR: path.resolve(path.join(__dirname, "..")).replace(/\\/g, "/"),
BUNDLE_DIR: path.resolve(path.join(__dirname, "..", "build_output")).replace(/\\/g, "/"),
TMP_DIR: path.resolve(path.join(__dirname, "steampipe", "tmp")).replace(/\\/g, "/"),
// BUILD_DESC: "v" + version + " @ " + hash,
VDF_DIR: path.resolve(path.join(__dirname, "steampipe", "built_vdfs")).replace(/\\/g, "/"),
};
const files = fs.readdirSync(templatesSource);
for (const file of files) {
if (!file.endsWith(".vdf")) {
continue;
}
variables.BUILD_DESC = file.replace(".vdf", "") + " - v" + version + " @ " + hash;
let content = fs.readFileSync(path.join(templatesSource, file)).toString("utf-8");
content = content.replace(/\$([^$]+)\$/gi, (_, variable) => {
if (!variables[variable]) {
throw new Error("Unknown variable " + variable + " in " + file);
}
return variables[variable];
});
fs.writeFileSync(path.join(templatesDest, file), content, { encoding: "utf8" });
}
// for (const buildVariant of ["app", "app-demo"]) {
// const templateContents = fs
// .readFileSync(path.join(steampipeDir, buildVariant + ".vdf.template"), {
// encoding: "utf-8",
// })
// .toString();
// const convertedContents = templateContents.replace(
// "$DESC$",
// platform + " " + buildVariant + " version " + version + ", commit " + hash
// );
// fs.writeFileSync(path.join(steampipeDir, buildVariant + ".vdf"), convertedContents);
// }
// }
cb();
});
}

@ -1,14 +0,0 @@
"appbuild"
{
"appid" "1930750"
"desc" "$DESC$"
"buildoutput" "$STEAMPIPE_DIR$/steamtmp"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1930756" "$STEAMPIPE_DIR$/scripts/demo-darwin.vdf"
}
}

@ -1,14 +0,0 @@
"appbuild"
{
"appid" "1318690"
"desc" "$DESC$"
"buildoutput" "$PROJECT_DIR$/gulp/steampipe-darwin/steamtmp"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1318693" "$PROJECT_DIR$/gulp/steampipe-darwin/scripts/darwin.vdf"
}
}

@ -1,17 +0,0 @@
"appbuild"
{
"appid" "1930750"
"desc" "$DESC$"
"buildoutput" "$STEAMPIPE_DIR$\steamtemp"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1930753" "$STEAMPIPE_DIR$\scripts\demo-windows.vdf"
"1930754" "$STEAMPIPE_DIR$\scripts\demo-china-windows.vdf"
"1930752" "$STEAMPIPE_DIR$\scripts\demo-linux.vdf"
"1930755" "$STEAMPIPE_DIR$\scripts\demo-china-linux.vdf"
}
}

@ -1,17 +0,0 @@
"appbuild"
{
"appid" "1318690"
"desc" "$DESC$"
"buildoutput" "$STEAMPIPE_DIR$\steamtemp"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1318691" "$STEAMPIPE_DIR$\scripts\windows.vdf"
"1318694" "$STEAMPIPE_DIR$\scripts\china-windows.vdf"
"1318692" "$STEAMPIPE_DIR$\scripts\linux.vdf"
"1318695" "$STEAMPIPE_DIR$\scripts\china-linux.vdf"
}
}

@ -0,0 +1,14 @@
"appbuild"
{
"appid" "1930750"
"desc" "$BUILD_DESC$"
"buildoutput" "$TMP_DIR$"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1930756" "$VDF_DIR$/demo-darwin.vdf"
}
}

@ -0,0 +1,14 @@
"appbuild"
{
"appid" "1318690"
"desc" "$BUILD_DESC$"
"buildoutput" "$TMP_DIR$"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1318693" "$VDF_DIR$/standalone-darwin.vdf"
}
}

@ -0,0 +1,17 @@
"appbuild"
{
"appid" "1930750"
"desc" "$BUILD_DESC$"
"buildoutput" "$TMP_DIR$"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1930753" "$VDF_DIR$/demo-windows.vdf"
"1930754" "$VDF_DIR$/demo-china-windows.vdf"
"1930752" "$VDF_DIR$/demo-linux.vdf"
"1930755" "$VDF_DIR$/demo-china-linux.vdf"
}
}

@ -0,0 +1,17 @@
"appbuild"
{
"appid" "1318690"
"desc" "$BUILD_DESC$"
"buildoutput" "$TMP_DIR$"
"contentroot" ""
"setlive" ""
"preview" "0"
"local" ""
"depots"
{
"1318691" "$VDF_DIR$\standalone-windows.vdf"
"1318694" "$VDF_DIR$\standalone-china-windows.vdf"
"1318692" "$VDF_DIR$\standalone-linux.vdf"
"1318695" "$VDF_DIR$\standalone-china-linux.vdf"
}
}

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1930755"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files_china\shapez.io-demochina-linux-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-china-demo\shapez-linux-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1930754"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files_china\shapez.io-demochina-win32-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-china-demo\shapez-win32-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1930756"
"contentroot" "$PROJECT_DIR$/tmp_standalone_files/shapez.io-demo-darwin-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-demo\shapez-darwin-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1930752"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files\shapez.io-demo-linux-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-demo\shapez-linux-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1930753"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files\shapez.io-demo-win32-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-demo\shapez-win32-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1318695"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files_china\shapez.io-standalonechina-linux-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-china\shapez-linux-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1318694"
"contentroot" "$PROJECT_DIR$\shapez.io-standalonechina-win32-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam-china\shapez-win32-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1318693"
"contentroot" "$PROJECT_DIR$/tmp_standalone_files/shapez.io-standalone-darwin-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam\shapez-darwin-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1318692"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files\shapez.io-standalone-linux-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam\shapez-linux-x64"
"FileMapping"
{
"LocalPath" "*"

@ -1,7 +1,7 @@
"DepotBuildConfig"
{
"DepotID" "1318691"
"contentroot" "$PROJECT_DIR$\tmp_standalone_files\shapez.io-standalone-win32-x64"
"contentroot" "$BUNDLE_DIR$\standalone-steam\shapez-win32-x64"
"FileMapping"
{
"LocalPath" "*"

@ -0,0 +1,9 @@
"depotbuild"
{
"appid" "1930750"
"depotid" "1930756"
"flags" "0"
"steamid" "76561198992617597"
"manifest" "5433433891569989718"
"baselinemanifest" "213072635964295767"
}

@ -0,0 +1,3 @@
#!/bin/sh
yarn gulp standalone.prepareVDF
steamcmd.sh +login $STEAM_UPLOAD_SHAPEZ_ID $STEAM_UPLOAD_SHAPEZ_USER +run_app_build $PWD/built_vdfs/app-darwin-demo.vdf +quit

@ -1,3 +1,3 @@
#!/bin/sh
yarn gulp standalone.prepareVDF
steamcmd.sh +login $STEAM_UPLOAD_SHAPEZ_ID $STEAM_UPLOAD_SHAPEZ_USER +run_app_build $PWD/scripts/app.vdf +quit
steamcmd.sh +login $STEAM_UPLOAD_SHAPEZ_ID $STEAM_UPLOAD_SHAPEZ_USER +run_app_build $PWD/built_vdfs/app-darwin.vdf +quit

@ -1,3 +1,3 @@
@echo off
cmd /c yarn gulp standalone.prepareVDF
steamcmd +login %STEAM_UPLOAD_SHAPEZ_ID% %STEAM_UPLOAD_SHAPEZ_USER% +run_app_build %cd%/scripts/app.vdf +quit
@echo off
cmd /c yarn gulp standalone.prepareVDF
steamcmd +login %STEAM_UPLOAD_SHAPEZ_ID% %STEAM_UPLOAD_SHAPEZ_USER% +run_app_build %cd%/built_vdfs/app-winlinux-demo.vdf +quit

@ -1,3 +1,3 @@
@echo off
cmd /c yarn gulp standalone.prepareVDF
steamcmd +login %STEAM_UPLOAD_SHAPEZ_ID% %STEAM_UPLOAD_SHAPEZ_USER% +run_app_build %cd%/scripts/app-demo.vdf +quit
@echo off
cmd /c yarn gulp standalone.prepareVDF
steamcmd +login %STEAM_UPLOAD_SHAPEZ_ID% %STEAM_UPLOAD_SHAPEZ_USER% +run_app_build %cd%/built_vdfs/app-winlinux.vdf +quit
Loading…
Cancel
Save