From 4b39893c5d9701c4667a378810b17213ea9ec0d2 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Fri, 23 Feb 2024 14:30:49 +0700 Subject: [PATCH] UBERF-5694: Attempt to fix build cache Signed-off-by: Andrey Sobolev --- common/config/rush/command-line.json | 12 +++++++----- common/config/rush/experiments.json | 2 +- dev/tool/package.json | 4 ++-- packages/platform-rig/bin/compile.js | 16 ++++++++-------- packages/platform-rig/bin/format.js | 4 +++- rush.json | 2 +- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index 8e1d1f07f71..ad8584aa408 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -86,16 +86,18 @@ ], "commands": [ { - "commandKind": "bulk", + "commandKind": "phased", "name": "build:watch", "summary": "Build and watch", + "phases": ["_phase:build", "_phase:validate"], "description": "Perform build with tsc and watch for changes with rush", "enableParallelism": true, "incremental": true, - "ignoreMissingScript": true, - "watchForChanges": true, "safeForSimultaneousRushProcesses": true, - "disableBuildCache": false + "watchOptions": { + "alwaysWatch": true, + "watchPhases": ["_phase:build", "_phase:validate"] + } }, { "commandKind": "bulk", @@ -130,7 +132,7 @@ "phases": ["_phase:validate"], "summary": "validate", "enableParallelism": true, - "incremental": true + "incremental": true }, { "commandKind": "phased", diff --git a/common/config/rush/experiments.json b/common/config/rush/experiments.json index 56160d97174..b8710566880 100644 --- a/common/config/rush/experiments.json +++ b/common/config/rush/experiments.json @@ -34,7 +34,7 @@ * If true, build caching will respect the allowWarningsInSuccessfulBuild flag and cache builds with warnings. * This will not replay warnings from the cached build. */ - // "buildCacheWithAllowWarningsInSuccessfulBuild": true, + "buildCacheWithAllowWarningsInSuccessfulBuild": true, /** * If true, the phased commands feature is enabled. To use this feature, create a "phased" command diff --git a/dev/tool/package.json b/dev/tool/package.json index ca76bff9947..8b787124a35 100644 --- a/dev/tool/package.json +++ b/dev/tool/package.json @@ -18,8 +18,8 @@ "docker:build": "docker build -t hardcoreeng/tool .", "docker:staging": "../../common/scripts/docker_tag.sh hardcoreeng/tool staging", "docker:push": "../../common/scripts/docker_tag.sh hardcoreeng/tool", - "run-local": "cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node -r ts-node/register --max-old-space-size=18000 ./src/__start.ts", - "run": "cross-env node -r ts-node/register --max-old-space-size=8000 MODEL_VERSION=$(node ../../common/scripts/show_version.js) ./src/__start.ts", + "run-local": "rush bundle --to @hcengineering/tool >/dev/null && cross-env SERVER_SECRET=secret MINIO_ACCESS_KEY=minioadmin MINIO_SECRET_KEY=minioadmin MINIO_ENDPOINT=localhost MONGO_URL=mongodb://localhost:27017 TRANSACTOR_URL=ws://localhost:3333 TELEGRAM_DATABASE=telegram-service ELASTIC_URL=http://localhost:9200 REKONI_URL=http://localhost:4004 MODEL_VERSION=$(node ../../common/scripts/show_version.js) GIT_REVISION=$(git describe --all --long) node --max-old-space-size=18000 ./bundle/bundle.js", + "run": "rush bundle --to @hcengineering/tool >/dev/null && cross-env node --max-old-space-size=8000 ./bundle/bundle.js", "upgrade": "rushx run-local upgrade", "format": "format src", "test": "jest --passWithNoTests --silent --forceExit", diff --git a/packages/platform-rig/bin/compile.js b/packages/platform-rig/bin/compile.js index 305818afbe9..d2b9c3c5e86 100755 --- a/packages/platform-rig/bin/compile.js +++ b/packages/platform-rig/bin/compile.js @@ -5,19 +5,19 @@ const { spawn } = require('child_process') const esbuild = require('esbuild') const { copy } = require('esbuild-plugin-copy') -async function execProcess(cmd, logFile, args) { +async function execProcess(cmd, logFile, args, buildDir= '.build') { let compileRoot = dirname(dirname(process.argv[1])) console.log('Running from',) console.log("Compiling...\n", process.cwd(), args) - if (!existsSync(join(process.cwd(), '.build'))) { - mkdirSync(join(process.cwd(), '.build')) + if (!existsSync(join(process.cwd(), buildDir))) { + mkdirSync(join(process.cwd(), buildDir)) } const compileOut = spawn(cmd, args) - const stdoutFilePath = `.build/${logFile}.log` - const stderrFilePath = `.build/${logFile}-err.log` + const stdoutFilePath = `${buildDir}/${logFile}.log` + const stderrFilePath = `${buildDir}/${logFile}-err.log` const outPromise = new Promise((resolve) => { @@ -159,14 +159,14 @@ async function validateTSC(st) { } await execProcess( 'tsc', - 'tsc', + 'validate', [ '-pretty', "--emitDeclarationOnly", - "--incremental", + "--incremental", "--tsBuildInfoFile", ".validate/tsBuildInfoFile.info", "--declarationDir", "types", ...args.splice(1) - ]) + ], '.validate') } diff --git a/packages/platform-rig/bin/format.js b/packages/platform-rig/bin/format.js index f473a7a40b2..6fb9a011b8b 100755 --- a/packages/platform-rig/bin/format.js +++ b/packages/platform-rig/bin/format.js @@ -97,7 +97,9 @@ if( filesToCheck.length > 0 ) { } console.log(`running eslint ${filesToCheck.length}`) - const eslint = spawnSync(join(process.cwd(), 'node_modules/.bin/eslint'), ["--color", "--fix", ...filesToCheck]) + const eslint = spawnSync(join(process.cwd(), 'node_modules/.bin/eslint'), ["--color", "--fix", ...filesToCheck], { + env: {...process.env, NODE_ENV: '--max-old-space-size=4096' }, + }) if(eslint.stdout != null) { writeFileSync('.format/eslint.log', eslint.stdout) if( prettier.status === null || prettier.status === 0) { diff --git a/rush.json b/rush.json index c32ba1a4c6e..07566d96b87 100644 --- a/rush.json +++ b/rush.json @@ -16,7 +16,7 @@ * path segment in the "$schema" field for all your Rush config files. This will ensure * correct error-underlining and tab-completion for editors such as VS Code. */ - "rushVersion": "5.113.4", + "rushVersion": "5.115.0", /** * The next field selects which package manager should be installed and determines its version.