diff --git a/.github/RUNNING_A_SERVER.md b/.github/RUNNING_A_SERVER.md index ef2a035d18e82..6a1b8d95d8b57 100644 --- a/.github/RUNNING_A_SERVER.md +++ b/.github/RUNNING_A_SERVER.md @@ -4,7 +4,7 @@ BYOND installed. You can get it from https://www.byond.com/download. Once you've that, extract the game files to wherever you want to keep them. This is a sourcecode-only release, so the next step is to compile the server files. -Double-click `Build.bat` in the root directory of the source code. This'll take +Double-click `BUILD.bat` in the root directory of the source code. This'll take a little while, and if everything's done right you'll get a message like this: ``` diff --git a/Build.bat b/BUILD.bat similarity index 100% rename from Build.bat rename to BUILD.bat diff --git a/README.md b/README.md index 8a89ebffcb28c..c3ee34e348581 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,18 @@ Space Station 13 is a paranoia-laden round-based roleplaying game set against th [Maps and Away Missions](.github/MAPS_AND_AWAY_MISSIONS.md) +## :exclamation: How to compile :exclamation: + +On **2021-01-04** we have changed the way to compile the codebase. + +Find `BUILD.bat` here in the root folder of tgstation, and double click it to initiate the build. It consists of multiple steps and might take around 1-5 minutes to compile. + +After it finishes, you can then [setup the server](.github/RUNNING_A_SERVER.md) normally by opening `tgstation.dmb` in DreamDaemon. + +**Building tgstation in DreamMaker directly is now deprecated and might produce errors**, such as `'tgui.bundle.js': cannot find file`. + +**[How to compile in VSCode and other build options](tools/build/README.md).** + ## Requirements for contributors [Guidelines for Contributors](.github/CONTRIBUTING.md) diff --git a/tools/bootstrap/node_.ps1 b/tools/bootstrap/node_.ps1 index 3fdd311271b1b..38538c14f2574 100644 --- a/tools/bootstrap/node_.ps1 +++ b/tools/bootstrap/node_.ps1 @@ -17,7 +17,7 @@ function Download-Node { if (Test-Path $NodeTarget -PathType Leaf) { return } - Write-Output "Downloading Node v$NodeVersion" + Write-Output "Downloading Node v$NodeVersion (may take a while)" New-Item $NodeTargetDir -ItemType Directory -ErrorAction silentlyContinue | Out-Null $WebClient = New-Object Net.WebClient $WebClient.DownloadFile($NodeSource, $NodeTarget) diff --git a/tools/build/README.md b/tools/build/README.md index 288c324f264f8..1444321f97238 100644 --- a/tools/build/README.md +++ b/tools/build/README.md @@ -2,18 +2,20 @@ This build script is the recommended way to compile the game, including not only the DM code but also the JavaScript and any other dependencies. -- VSCode: use `Ctrl+Shift+B` to build or `F5` to build and run. - -- Windows: double-click `Build.bat` in the repository root to build. - -- Linux: run `tools/build/build` from the repository root. +- VSCode: + a) Press `Ctrl+Shift+B` to build. + b) Press `F5` to build and run with debugger attached. +- Windows: + a) Double-click `BUILD.bat` in the repository root to build (will wait for a key press before it closes). + b) Double-click `tools/build/build.bat` to build (will exit as soon as it finishes building). +- Linux: + a) Run `tools/build/build` from the repository root. The script will skip build steps whose inputs have not changed since the last run. ## Dependencies -- On Windows, `Build.bat` will automatically install a private copy of Node. - +- On Windows, `BUILD.bat` will automatically install a private (vendored) copy of Node. - On Linux, install Node using your package manager or from . ## Why? diff --git a/tools/build/build.js b/tools/build/build.js index c60c8d7c8398b..908aa1082a835 100755 --- a/tools/build/build.js +++ b/tools/build/build.js @@ -5,15 +5,30 @@ * @license MIT */ -const { resolve: resolvePath } = require('path'); +// Change working directory to project root +process.chdir(require('path').resolve(__dirname, '../../')); + +// Validate NodeJS version +const NODE_VERSION = parseInt(process.versions.node.match(/(\d+)/)[1]); +const NODE_VERSION_TARGET = parseInt(require('fs') + .readFileSync('dependencies.sh', 'utf-8') + .match(/NODE_VERSION=(\d+)/)[1]); +if (NODE_VERSION < NODE_VERSION_TARGET) { + console.error('Your current Node.js version is out of date.'); + console.error('You have two options:'); + console.error(' a) Go to https://nodejs.org/ and install the latest LTS release of Node.js'); + console.error(' b) Uninstall Node.js (our build system automatically downloads one)'); + process.exit(1); +} + +// Main +// -------------------------------------------------------- + const { resolveGlob, stat } = require('./cbt/fs'); const { exec } = require('./cbt/process'); const { Task, runTasks } = require('./cbt/task'); const { regQuery } = require('./cbt/winreg'); -// Change working directory to project root -process.chdir(resolvePath(__dirname, '../../')); - const taskTgui = new Task('tgui') .depends('tgui/.yarn/releases/*') .depends('tgui/.yarn/install-state.gz')