@@ -36,7 +36,9 @@ function copy-server() {
3636 else
3737 log " Installing dependencies"
3838 cd " ${serverPath} "
39- yarn
39+ # Ignore scripts to avoid also installing VS Code dependencies which has
40+ # already been done.
41+ yarn --ignore-scripts
4042 rm -r node_modules/@types/node # I keep getting type conflicts
4143 fi
4244}
@@ -62,6 +64,9 @@ function build-code-server() {
6264 # the same type of build you get with the vscode-linux-x64-min task).
6365 # Something like: yarn gulp "vscode-server-${target}-${arch}-min"
6466 cd " ${vscodeSourcePath} "
67+ git reset --hard
68+ git clean -fd
69+ git apply " ${rootPath} /scripts/vscode.patch"
6570 yarn gulp compile-client
6671
6772 rm -rf " ${codeServerBuildPath} "
@@ -105,7 +110,6 @@ function build-vscode() {
105110 npm rebuild || true
106111
107112 # Keep just what we need to keep the pre-built archive smaller.
108- rm -rf " ${vscodeSourcePath} /.git"
109113 rm -rf " ${vscodeSourcePath} /test"
110114 else
111115 log " ${vscodeSourceName} /node_modules already exists, skipping install"
@@ -192,7 +196,7 @@ function package-task() {
192196 rm -rf " ${archivePath} "
193197 mkdir -p " ${archivePath} "
194198
195- cp " ${buildPath} /code-server " " ${archivePath} "
199+ cp " ${buildPath} /${binaryName} " " ${archivePath} /code-server "
196200 cp " ${rootPath} /README.md" " ${archivePath} "
197201 cp " ${vscodeSourcePath} /LICENSE.txt" " ${archivePath} "
198202 cp " ${vscodeSourcePath} /ThirdPartyNotices.txt" " ${archivePath} "
@@ -216,8 +220,8 @@ function binary-task() {
216220 npm link @coder/nbin
217221 node " ${rootPath} /scripts/nbin.js" " ${target} " " ${arch} " " ${codeServerBuildPath} "
218222 rm node_modules/@coder/nbin
219- mv " ${codeServerBuildPath} /code-server" " ${buildPath} "
220- log " Binary at ${buildPath} /code-server "
223+ mv " ${codeServerBuildPath} /code-server" " ${buildPath} / ${binaryName} "
224+ log " Binary at ${buildPath} /${binaryName} "
221225}
222226
223227function main() {
@@ -237,6 +241,19 @@ function main() {
237241 # will compile everything in the build directory as well.
238242 local outPath=" ${OUT:- ${rootPath} } "
239243
244+ # If we're inside a vscode directory, assume we want to develop. In that case
245+ # we should set an OUT directory and not build in this directory.
246+ if [[ " ${outPath} " == " ${rootPath} " ]] ; then
247+ local maybeVscode
248+ local dirName
249+ maybeVscode=" $( realpath " ${outPath} /../../.." ) "
250+ dirName=" $( basename " ${maybeVscode} " ) "
251+ if [[ " ${dirName} " == " vscode" ]] ; then
252+ log " Set the OUT environment variable to something outside ${maybeVscode} " " error"
253+ exit 1
254+ fi
255+ fi
256+
240257 local releasePath=" ${outPath} /release"
241258 local buildPath=" ${outPath} /build"
242259
@@ -245,8 +262,9 @@ function main() {
245262 local vscodeSourcePath=" ${buildPath} /${vscodeSourceName} "
246263 local vscodeBuildPath=" ${buildPath} /${vscodeBuildName} "
247264
248- local codeServerBuildName=" code-server-${target} -${arch} -built"
265+ local codeServerBuildName=" code-server-${vscodeVersion} - ${ target} -${arch} -built"
249266 local codeServerBuildPath=" ${buildPath} /${codeServerBuildName} "
267+ local binaryName=" code-server-${vscodeVersion} -${target} -${arch} "
250268
251269 log " Running ${task} task"
252270 log " rootPath: ${rootPath} "
0 commit comments