From 6ccd9f3f7918a34e20195defa903b06b2a2e0994 Mon Sep 17 00:00:00 2001 From: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com> Date: Fri, 20 Aug 2021 09:57:32 -0400 Subject: [PATCH] [MIRROR] Juke Build 0.8.1 + Juke Build 0.8.1 Hotfix 1 + Skyrat Juke Build Hotfix (#7645) * Juke Build 0.8.1 (#60404) * Juke Build 0.8.1 Hotfix 1 (#60897) * Juke Build 0.8.1 Hotfix 1 * Do not restore Yarn cache on just DM build * Makes it so Skyrat's modular code is also checked for updates to see if it needs to rebuild * chmod's tools/bootstrap/nod Added a / just to make it so it'd let me commit * Trying to chmod again Co-authored-by: Aleksej Komarov --- .github/workflows/ci_suite.yml | 44 +++++++----- .gitignore | 3 + CLEAN.bat | 3 + RUN_SERVER.bat | 3 + dependencies.sh | 2 +- tools/build/build.js | 3 +- tools/build/cbt/dm.js | 108 ------------------------------ tools/build/cbt/fs.js | 24 ------- tools/build/cbt/winreg.js | 46 ------------- tools/build/cbt/yarn.js | 17 ----- tools/ci/template_dm_generator.py | 29 -------- 11 files changed, 40 insertions(+), 242 deletions(-) create mode 100644 CLEAN.bat create mode 100644 RUN_SERVER.bat mode change 100755 => 100644 tools/build/build.js delete mode 100644 tools/build/cbt/dm.js delete mode 100644 tools/build/cbt/fs.js delete mode 100644 tools/build/cbt/winreg.js delete mode 100644 tools/build/cbt/yarn.js delete mode 100755 tools/ci/template_dm_generator.py diff --git a/.github/workflows/ci_suite.yml b/.github/workflows/ci_suite.yml index 050caa6a238..81c664432a7 100644 --- a/.github/workflows/ci_suite.yml +++ b/.github/workflows/ci_suite.yml @@ -13,11 +13,16 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - name: Setup cache + - name: Restore SpacemanDMM cache uses: actions/cache@v2 with: - path: $HOME/SpacemanDMM - key: ${{ runner.os }}-spacemandmm + path: ~/SpacemanDMM + key: ${{ runner.os }}-spacemandmm-${{ secrets.CACHE_PURGE_KEY }} + - name: Restore Yarn cache + uses: actions/cache@v2 + with: + path: tgui/.yarn/cache + key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }} - name: Install Tools run: | pip3 install setuptools @@ -28,11 +33,9 @@ jobs: run: | bash tools/ci/check_filedirs.sh tgstation.dme bash tools/ci/check_changelogs.sh - find . -name "*.php" -print0 | xargs -0 -n1 php -l - find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/json_verifier.py - tgui/bin/tgui --lint - tgui/bin/tgui --test bash tools/ci/check_grep.sh + bash tools/ci/check_misc.sh + tools/build/build --ci lint tools/bootstrap/python -m dmi.test tools/bootstrap/python -m mapmerge2.dmm_test ~/dreamchecker > ${GITHUB_WORKSPACE}/output-annotations.txt 2>&1 @@ -48,17 +51,16 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 - - name: Setup cache + - name: Restore BYOND cache uses: actions/cache@v2 with: - path: $HOME/BYOND - key: ${{ runner.os }}-byond + path: ~/BYOND + key: ${{ runner.os }}-byond-${{ secrets.CACHE_PURGE_KEY }} - name: Compile All Maps run: | bash tools/ci/install_byond.sh source $HOME/BYOND/byond/bin/byondsetup - python3 tools/ci/template_dm_generator.py - tools/build/build dm -DCIBUILDING -DCITESTING -DALL_MAPS + tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS run_all_tests: if: "!contains(github.event.head_commit.message, '[ci skip]')" @@ -74,11 +76,16 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - uses: actions/checkout@v2 - - name: Setup cache + - name: Restore BYOND cache uses: actions/cache@v2 with: - path: $HOME/BYOND - key: ${{ runner.os }}-byond + path: ~/BYOND + key: ${{ runner.os }}-byond-${{ secrets.CACHE_PURGE_KEY }} + - name: Restore Yarn Cache + uses: actions/cache@v2 + with: + path: tgui/.yarn/cache + key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }} - name: Setup database run: | sudo systemctl start mysql @@ -96,7 +103,7 @@ jobs: run: | bash tools/ci/install_byond.sh source $HOME/BYOND/byond/bin/byondsetup - tools/build/build -DCIBUILDING + tools/build/build --ci -DCIBUILDING bash tools/ci/run_server.sh test_windows: @@ -105,6 +112,11 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v2 + - name: Restore Yarn Cache + uses: actions/cache@v2 + with: + path: tgui/.yarn/cache + key: ${{ runner.os }}-yarn-${{ secrets.CACHE_PURGE_KEY }} - name: Compile run: pwsh tools/ci/build.ps1 env: diff --git a/.gitignore b/.gitignore index 9334eb8f7bf..a5e3c908e57 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,11 @@ #Ignore compiled files and other files generated during compilation. *.mdme +*.mdme.* *.dmb *.rsc +*.m.dme +*.test.dme *.lk *.int *.backup diff --git a/CLEAN.bat b/CLEAN.bat new file mode 100644 index 00000000000..47293bb7693 --- /dev/null +++ b/CLEAN.bat @@ -0,0 +1,3 @@ +@echo off +call "%~dp0\tools\build\build.bat" dist-clean +pause diff --git a/RUN_SERVER.bat b/RUN_SERVER.bat new file mode 100644 index 00000000000..93438f0c2e4 --- /dev/null +++ b/RUN_SERVER.bat @@ -0,0 +1,3 @@ +@echo off +call "%~dp0\tools\build\build.bat" server %* +pause diff --git a/dependencies.sh b/dependencies.sh index d608fb493d3..6bf5943adbb 100755 --- a/dependencies.sh +++ b/dependencies.sh @@ -12,7 +12,7 @@ export RUST_G_VERSION=0.4.10 #node version export NODE_VERSION=12 -export NODE_VERSION_PRECISE=12.20.0 +export NODE_VERSION_PRECISE=12.22.4 # SpacemanDMM git tag export SPACEMAN_DMM_VERSION=suite-1.7 diff --git a/tools/build/build.js b/tools/build/build.js old mode 100755 new mode 100644 index f8d3a9a7dd7..1d49343bb33 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -61,6 +61,7 @@ export const DmTarget = new Juke.Target({ 'html/**', 'icons/**', 'interface/**', + 'modular_skyrat/**', ///SKYRAT EDIT ADDITION - Making the CBT work `${DME_NAME}.dme`, ], outputs: [ @@ -192,7 +193,7 @@ export const TguiLintTarget = new Juke.Target({ export const TguiDevTarget = new Juke.Target({ dependsOn: [YarnTarget], executes: async ({ args }) => { - await yarn('node', 'packages/tgui-dev-server/index.js', ...args); + await yarn('node', 'packages/tgui-dev-server/index.esm.js', ...args); }, }); diff --git a/tools/build/cbt/dm.js b/tools/build/cbt/dm.js deleted file mode 100644 index 64a3d90c7b1..00000000000 --- a/tools/build/cbt/dm.js +++ /dev/null @@ -1,108 +0,0 @@ -const Juke = require('../juke'); -const { stat } = require('./fs'); -const { regQuery } = require('./winreg'); -const fs = require('fs'); - -/** - * Cached path to DM compiler - */ -let dmPath; - -/** - * DM compiler - * - * @param {string} dmeFile - * @param {{ defines?: string[] }} options - */ -const dm = async (dmeFile, options = {}) => { - // Get path to DM compiler - if (!dmPath) { - dmPath = await (async () => { - // Search in array of paths - const paths = [ - ...((process.env.DM_EXE && process.env.DM_EXE.split(',')) || []), - 'C:\\Program Files\\BYOND\\bin\\dm.exe', - 'C:\\Program Files (x86)\\BYOND\\bin\\dm.exe', - ['reg', 'HKLM\\Software\\Dantom\\BYOND', 'installpath'], - ['reg', 'HKLM\\SOFTWARE\\WOW6432Node\\Dantom\\BYOND', 'installpath'], - ]; - const isFile = path => { - try { - const fstat = stat(path); - return fstat && fstat.isFile(); - } - catch (err) {} - return false; - }; - for (let path of paths) { - // Resolve a registry key - if (Array.isArray(path)) { - const [type, ...args] = path; - path = await regQuery(...args); - } - if (!path) { - continue; - } - // Check if path exists - if (isFile(path)) { - return path; - } - if (isFile(path + '/dm.exe')) { - return path + '/dm.exe'; - } - if (isFile(path + '/bin/dm.exe')) { - return path + '/bin/dm.exe'; - } - } - // Default paths - return ( - process.platform === 'win32' && 'dm.exe' - || 'DreamMaker' - ); - })(); - } - // Get project basename - const dmeBaseName = dmeFile.replace(/\.dme$/, ''); - // Make sure output files are writable - const testOutputFile = (name) => { - try { - fs.closeSync(fs.openSync(name, 'r+')); - } - catch (err) { - if (err && err.code === 'ENOENT') { - return; - } - if (err && err.code === 'EBUSY') { - Juke.logger.error(`File '${name}' is locked by the DreamDaemon process.`); - Juke.logger.error(`Stop the currently running server and try again.`); - throw new Juke.ExitCode(1); - } - throw err; - } - }; - testOutputFile(`${dmeBaseName}.dmb`); - testOutputFile(`${dmeBaseName}.rsc`); - // Compile - const { defines } = options; - if (defines && defines.length > 0) { - const injectedContent = defines - .map(x => `#define ${x}\n`) - .join(''); - fs.writeFileSync(`${dmeBaseName}.mdme`, injectedContent); - const dmeContent = fs.readFileSync(`${dmeBaseName}.dme`); - fs.appendFileSync(`${dmeBaseName}.mdme`, dmeContent); - await Juke.exec(dmPath, [`${dmeBaseName}.mdme`]); - fs.writeFileSync(`${dmeBaseName}.dmb`, fs.readFileSync(`${dmeBaseName}.mdme.dmb`)); - fs.writeFileSync(`${dmeBaseName}.rsc`, fs.readFileSync(`${dmeBaseName}.mdme.rsc`)); - fs.unlinkSync(`${dmeBaseName}.mdme.dmb`); - fs.unlinkSync(`${dmeBaseName}.mdme.rsc`); - fs.unlinkSync(`${dmeBaseName}.mdme`); - } - else { - await Juke.exec(dmPath, [dmeFile]); - } -}; - -module.exports = { - dm, -}; diff --git a/tools/build/cbt/fs.js b/tools/build/cbt/fs.js deleted file mode 100644 index 1095d1038a4..00000000000 --- a/tools/build/cbt/fs.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @file - * @copyright 2020 Aleksej Komarov - * @license MIT - */ - -const fs = require('fs'); - -/** - * Returns file stats for the provided path, or null if file is - * not accessible. - */ -const stat = path => { - try { - return fs.statSync(path); - } - catch { - return null; - } -}; - -module.exports = { - stat, -}; diff --git a/tools/build/cbt/winreg.js b/tools/build/cbt/winreg.js deleted file mode 100644 index a19aa66f489..00000000000 --- a/tools/build/cbt/winreg.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Tools for dealing with Windows Registry bullshit. - * - * Adapted from `tgui/packages/tgui-dev-server/winreg.js`. - * - * @file - * @copyright 2020 Aleksej Komarov - * @license MIT - */ - -const { exec } = require('child_process'); -const { promisify } = require('util'); - -const regQuery = async (path, key) => { - if (process.platform !== 'win32') { - return null; - } - try { - const command = `reg query "${path}" /v ${key}`; - const { stdout } = await promisify(exec)(command); - const keyPattern = ` ${key} `; - const indexOfKey = stdout.indexOf(keyPattern); - if (indexOfKey === -1) { - return null; - } - const indexOfEol = stdout.indexOf('\r\n', indexOfKey); - if (indexOfEol === -1) { - return null; - } - const indexOfValue = stdout.indexOf( - ' ', - indexOfKey + keyPattern.length); - if (indexOfValue === -1) { - return null; - } - const value = stdout.substring(indexOfValue + 4, indexOfEol); - return value; - } - catch (err) { - return null; - } -}; - -module.exports = { - regQuery, -}; diff --git a/tools/build/cbt/yarn.js b/tools/build/cbt/yarn.js deleted file mode 100644 index be43c02ef05..00000000000 --- a/tools/build/cbt/yarn.js +++ /dev/null @@ -1,17 +0,0 @@ -const { exec, resolveGlob } = require('../juke'); - -let yarnPath; - -const yarn = (...args) => { - if (!yarnPath) { - yarnPath = resolveGlob('./tgui/.yarn/releases/yarn-*.cjs')[0] - .replace('/tgui/', '/'); - } - return exec('node', [yarnPath, ...args], { - cwd: './tgui', - }); -}; - -module.exports = { - yarn, -}; diff --git a/tools/ci/template_dm_generator.py b/tools/ci/template_dm_generator.py deleted file mode 100755 index 970fba7db45..00000000000 --- a/tools/ci/template_dm_generator.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python - -import os -import sys - -folders = ["_maps/RandomRuins", "_maps/RandomZLevels", "_maps/shuttles", - "_maps/templates"] - -generated = "_maps/templates.dm" - -template_filenames = [] - -def find_dm(path): - L = [] - for dirpath, dirnames, filenames in os.walk(path): - for name in filenames: - if name.endswith(".dmm"): - s = os.path.join(dirpath, name) - s = s.replace("_maps/","") - L.append(s) - return L - -for folder in folders: - template_filenames.extend(find_dm(folder)) - -with open(generated, 'w') as f: - for template in template_filenames: - f.write('''#include "{}"\n'''.format(template)) -