mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 07:04:04 -05:00
Migrate to Biome for linting and formatting (#7033)
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
---
|
||||
plugins:
|
||||
- eslint-plugin-header
|
||||
rules:
|
||||
header/header:
|
||||
- off
|
||||
- line
|
||||
- - pattern: '^ Copyright \\(c\\) \\d{4}, .*$'
|
||||
template: ' Copyright (c) 2022, Compiler Explorer Authors'
|
||||
- ' All rights reserved.'
|
||||
- ''
|
||||
- ' Redistribution and use in source and binary forms, with or without'
|
||||
- ' modification, are permitted provided that the following conditions are met:'
|
||||
- ''
|
||||
- ' * Redistributions of source code must retain the above copyright notice,'
|
||||
- ' this list of conditions and the following disclaimer.'
|
||||
- ' * Redistributions in binary form must reproduce the above copyright'
|
||||
- ' notice, this list of conditions and the following disclaimer in the'
|
||||
- ' documentation and/or other materials provided with the distribution.'
|
||||
- ''
|
||||
- ' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"'
|
||||
- ' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE'
|
||||
- ' IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE'
|
||||
- ' ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE'
|
||||
- ' LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR'
|
||||
- ' CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF'
|
||||
- ' SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS'
|
||||
- ' INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN'
|
||||
- ' CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)'
|
||||
- ' ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE'
|
||||
- ' POSSIBILITY OF SUCH DAMAGE.'
|
||||
- 1
|
||||
@@ -1,12 +0,0 @@
|
||||
# If you change this file, please also modify .prettierignore
|
||||
# Uninteresting folders (node_modules and dotfiles/dotfolders ignored by default)
|
||||
coverage
|
||||
docs
|
||||
etc
|
||||
examples
|
||||
out
|
||||
views
|
||||
|
||||
# Autogenerated files
|
||||
lib/asm-docs/generated/asm-docs-*
|
||||
etc/scripts/docenizer/vendor/jvms.html
|
||||
181
.eslintrc.yml
181
.eslintrc.yml
@@ -1,181 +0,0 @@
|
||||
---
|
||||
root: true
|
||||
plugins:
|
||||
- import
|
||||
- jsdoc
|
||||
- n
|
||||
- promise
|
||||
- sonarjs
|
||||
- prettier
|
||||
- unicorn
|
||||
- '@typescript-eslint'
|
||||
- unused-imports
|
||||
extends:
|
||||
- ./.eslint-license-header.yml
|
||||
- eslint:recommended
|
||||
- plugin:import/recommended
|
||||
- plugin:n/recommended
|
||||
- plugin:unicorn/recommended
|
||||
- prettier
|
||||
- plugin:@typescript-eslint/eslint-recommended
|
||||
- plugin:@typescript-eslint/recommended
|
||||
- plugin:import/typescript
|
||||
env:
|
||||
node: true
|
||||
es6: true
|
||||
rules:
|
||||
prettier/prettier: error
|
||||
comma-dangle:
|
||||
- error
|
||||
- arrays: always-multiline
|
||||
objects: always-multiline
|
||||
imports: always-multiline
|
||||
exports: always-multiline
|
||||
functions: always-multiline
|
||||
eol-last:
|
||||
- error
|
||||
- always
|
||||
eqeqeq:
|
||||
- error
|
||||
- smart
|
||||
import/default: off # fs-extra trips this. the ts compiler catches actual errors
|
||||
import/extensions: error
|
||||
import/first: error
|
||||
import/newline-after-import: error
|
||||
import/no-absolute-path: error
|
||||
#import/no-cycle: error # TODO(jeremy-rifkin) disabled for now due to compilation types
|
||||
import/no-default-export: error
|
||||
import/no-deprecated: error
|
||||
import/no-mutable-exports: error
|
||||
import/no-named-as-default-member: off # Far too many things (express, morgan, fs) trip this
|
||||
import/no-self-import: error
|
||||
import/no-useless-path-segments: error
|
||||
import/no-webpack-loader-syntax: error
|
||||
import/no-unresolved: off # Doesn't like .js files
|
||||
import/order:
|
||||
- error
|
||||
- alphabetize:
|
||||
order: asc
|
||||
caseInsensitive: true
|
||||
newlines-between: always
|
||||
max-len:
|
||||
- error
|
||||
- 120
|
||||
- ignoreRegExpLiterals: true
|
||||
max-statements:
|
||||
- error
|
||||
- 100 # TODO reduce...was 50
|
||||
no-console: error
|
||||
no-control-regex: 0
|
||||
no-duplicate-imports: error
|
||||
no-useless-call: error
|
||||
no-useless-computed-key: error
|
||||
no-useless-concat: error
|
||||
'@typescript-eslint/no-useless-constructor': error
|
||||
no-useless-escape: error
|
||||
no-useless-rename: error
|
||||
no-useless-return: error
|
||||
no-empty:
|
||||
- error
|
||||
- allowEmptyCatch: true
|
||||
quote-props:
|
||||
- error
|
||||
- as-needed
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
- allowTemplateLiterals: true
|
||||
avoidEscape: true
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
space-before-function-paren:
|
||||
- error
|
||||
- anonymous: always
|
||||
asyncArrow: always
|
||||
named: never
|
||||
keyword-spacing:
|
||||
- error
|
||||
- after: true
|
||||
yoda:
|
||||
- error
|
||||
- never
|
||||
- onlyEquality: true
|
||||
prefer-const:
|
||||
- error
|
||||
- destructuring: all
|
||||
jsdoc/check-alignment: error
|
||||
jsdoc/check-param-names: error
|
||||
jsdoc/check-syntax: error
|
||||
jsdoc/check-tag-names: off
|
||||
jsdoc/check-types: error
|
||||
jsdoc/empty-tags: error
|
||||
jsdoc/require-hyphen-before-param-description: error
|
||||
jsdoc/valid-types: error
|
||||
no-multiple-empty-lines:
|
||||
- error
|
||||
- max: 1
|
||||
maxBOF: 0
|
||||
maxEOF: 0
|
||||
n/no-process-exit: off
|
||||
promise/catch-or-return: error
|
||||
promise/no-new-statics: error
|
||||
promise/no-return-wrap: error
|
||||
promise/param-names: error
|
||||
promise/valid-params: error
|
||||
sonarjs/no-collection-size-mischeck: error
|
||||
sonarjs/no-redundant-boolean: error
|
||||
sonarjs/no-unused-collection: error
|
||||
sonarjs/prefer-immediate-return: error
|
||||
sonarjs/prefer-object-literal: error
|
||||
sonarjs/prefer-single-boolean-return: error
|
||||
sort-imports:
|
||||
- error
|
||||
- ignoreCase: true
|
||||
ignoreDeclarationSort: true
|
||||
unicorn/catch-error-name: off
|
||||
unicorn/consistent-function-scoping: off
|
||||
unicorn/empty-brace-spaces: off
|
||||
unicorn/no-fn-reference-in-iterator: off
|
||||
unicorn/no-hex-escape: off
|
||||
unicorn/no-null: off
|
||||
unicorn/no-reduce: off
|
||||
unicorn/numeric-separators-style: off
|
||||
unicorn/prefer-add-event-listener: off
|
||||
unicorn/prefer-flat-map: error
|
||||
unicorn/prefer-optional-catch-binding: off
|
||||
unicorn/prefer-node-protocol: off # until we get node 16+
|
||||
unicorn/prefer-number-properties: off
|
||||
unicorn/prefer-string-slice: off
|
||||
unicorn/prevent-abbreviations: off
|
||||
# things we'd like to turn on but need fairly extensive code changes:
|
||||
unicorn/prefer-ternary: off
|
||||
unicorn/prefer-array-some: off
|
||||
unicorn/prefer-spread: off
|
||||
unicorn/no-lonely-if: off
|
||||
unicorn/no-array-reduce: off
|
||||
unicorn/prefer-array-flat: off # can't turn off yet without tests blowing up; lodash vs underscore?
|
||||
unicorn/no-array-callback-reference: off
|
||||
unicorn/prefer-switch: off
|
||||
unicorn/no-static-only-class: off
|
||||
unicorn/no-process-exit: off
|
||||
unicorn/no-useless-undefined:
|
||||
- error
|
||||
- checkArguments: false
|
||||
'unused-imports/no-unused-imports': error
|
||||
'@typescript-eslint/no-empty-function': off
|
||||
'@typescript-eslint/no-unused-vars': off
|
||||
'@typescript-eslint/no-explicit-any': off
|
||||
unicorn/prefer-at: off
|
||||
unicorn/prefer-negative-index: off
|
||||
parserOptions:
|
||||
sourceType: module
|
||||
ecmaVersion: 2020
|
||||
globals:
|
||||
BigInt: true
|
||||
settings:
|
||||
node:
|
||||
tryExtensions: [.js, .ts]
|
||||
import/parsers:
|
||||
'@typescript-eslint/parser': [.ts, .tsx]
|
||||
import/resolver: 'typescript'
|
||||
3
.idea/codeStyles/Project.xml
generated
3
.idea/codeStyles/Project.xml
generated
@@ -17,6 +17,9 @@
|
||||
<MarkdownNavigatorCodeStyleSettings>
|
||||
<option name="RIGHT_MARGIN" value="72" />
|
||||
</MarkdownNavigatorCodeStyleSettings>
|
||||
<ScalaCodeStyleSettings>
|
||||
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
|
||||
</ScalaCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
|
||||
1
.idea/compiler-explorer.iml
generated
1
.idea/compiler-explorer.iml
generated
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
|
||||
2
.idea/inspectionProfiles/Project_Default.xml
generated
2
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -4,7 +4,7 @@
|
||||
<inspection_tool class="ES6ConvertVarToLetConst" enabled="true" level="WARNING" enabled_by_default="false">
|
||||
<scope name="Server" level="WARNING" enabled="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="Eslint" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="Eslint" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="myValues">
|
||||
<value>
|
||||
|
||||
8
.idea/prettier.xml
generated
8
.idea/prettier.xml
generated
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PrettierConfiguration">
|
||||
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||
<option name="myRunOnSave" value="true" />
|
||||
<option name="myRunOnReformat" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,49 +0,0 @@
|
||||
#########################
|
||||
# From .gitignore
|
||||
|
||||
# build generated files
|
||||
/.node-bin
|
||||
/.npm-updated
|
||||
/node_modules
|
||||
/out
|
||||
/coverage
|
||||
|
||||
# generated from opcode docenzier.py scripts
|
||||
/asm-docs*
|
||||
|
||||
# user local customizations
|
||||
/etc/config/*.local.properties
|
||||
/lib/storage/data
|
||||
|
||||
# IDE project files
|
||||
/nbproject
|
||||
*.vscode
|
||||
*.code-workspace
|
||||
|
||||
# random bits
|
||||
f.out
|
||||
newrelic_agent.log
|
||||
*.heapsnapshot
|
||||
*.swp
|
||||
|
||||
# approval tests
|
||||
*.received.*
|
||||
|
||||
#########################
|
||||
# From .eslintignore
|
||||
|
||||
# Uninteresting folders (node_modules and dotfiles/dotfolders ignored by default)
|
||||
etc
|
||||
examples
|
||||
out
|
||||
cypress
|
||||
|
||||
# Autogenerated files
|
||||
lib/asm-docs/generated/asm-docs-*
|
||||
|
||||
|
||||
#########################
|
||||
# Files we ought to ignore
|
||||
|
||||
static/policies/*.html
|
||||
test/**/*.json
|
||||
@@ -1,17 +0,0 @@
|
||||
module.exports = {
|
||||
trailingComma: 'all',
|
||||
printWidth: 120,
|
||||
singleQuote: true,
|
||||
arrowParens: 'avoid',
|
||||
tabWidth: 4,
|
||||
bracketSpacing: false,
|
||||
proseWrap: 'always',
|
||||
overrides: [
|
||||
{
|
||||
files: '*.{yml,json,md}',
|
||||
options: {
|
||||
tabWidth: 2,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
4
Makefile
4
Makefile
@@ -57,10 +57,6 @@ lint: $(NODE_MODULES) ## Checks if the source currently matches code convention
|
||||
lint-fix: $(NODE_MODULES) ## Checks if everything matches code conventions & fixes those which are trivial to do so
|
||||
$(NPM) run lint
|
||||
|
||||
.PHONY: ci-lint
|
||||
ci-lint: $(NODE_MODULES)
|
||||
$(NPM) run ci-lint
|
||||
|
||||
.PHONY: test
|
||||
test: $(NODE_MODULES) ## Runs the tests
|
||||
$(NPM) run test
|
||||
|
||||
49
app.ts
49
app.ts
@@ -22,11 +22,11 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import child_process from 'child_process';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import process from 'process';
|
||||
import url from 'url';
|
||||
import child_process from 'node:child_process';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import url from 'node:url';
|
||||
|
||||
import * as Sentry from '@sentry/node';
|
||||
import compression from 'compression';
|
||||
@@ -67,7 +67,7 @@ import {cached, csp} from './lib/handlers/middleware.js';
|
||||
import {NoScriptHandler} from './lib/handlers/noscript.js';
|
||||
import {RouteAPI, ShortLinkMetaData} from './lib/handlers/route-api.js';
|
||||
import {languages as allLanguages} from './lib/languages.js';
|
||||
import {logger, logToLoki, logToPapertrail, makeLogStream, suppressConsoleLog} from './lib/logger.js';
|
||||
import {logToLoki, logToPapertrail, logger, makeLogStream, suppressConsoleLog} from './lib/logger.js';
|
||||
import {setupMetricsServer} from './lib/metrics-server.js';
|
||||
import {ClientOptionsHandler} from './lib/options-handler.js';
|
||||
import * as props from './lib/properties.js';
|
||||
@@ -270,13 +270,14 @@ const isDevMode = () => process.env.NODE_ENV !== 'production';
|
||||
function getFaviconFilename() {
|
||||
if (isDevMode()) {
|
||||
return 'favicon-dev.ico';
|
||||
} else if (opts.env && opts.env.includes('beta')) {
|
||||
return 'favicon-beta.ico';
|
||||
} else if (opts.env && opts.env.includes('staging')) {
|
||||
return 'favicon-staging.ico';
|
||||
} else {
|
||||
return 'favicon.ico';
|
||||
}
|
||||
if (opts.env?.includes('beta')) {
|
||||
return 'favicon-beta.ico';
|
||||
}
|
||||
if (opts.env?.includes('staging')) {
|
||||
return 'favicon-staging.ico';
|
||||
}
|
||||
return 'favicon.ico';
|
||||
}
|
||||
|
||||
const propHierarchy = [
|
||||
@@ -318,9 +319,8 @@ const languages = (() => {
|
||||
// Always keep cmake for IDE mode, just in case
|
||||
filteredLangs[allLanguages.cmake.id] = allLanguages.cmake;
|
||||
return filteredLangs;
|
||||
} else {
|
||||
return allLanguages;
|
||||
}
|
||||
return allLanguages;
|
||||
})();
|
||||
|
||||
if (Object.keys(languages).length === 0) {
|
||||
@@ -426,10 +426,9 @@ async function setupStaticMiddleware(router: express.Router) {
|
||||
pugRequireHandler = path => {
|
||||
if (Object.prototype.hasOwnProperty.call(staticManifest, path)) {
|
||||
return urljoin(staticRoot, staticManifest[path]);
|
||||
} else {
|
||||
}
|
||||
logger.error(`failed to locate static asset '${path}' in manifest`);
|
||||
return '';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -471,7 +470,7 @@ function startListening(server: express.Express) {
|
||||
if (ss) {
|
||||
// ms (5 min default)
|
||||
const idleTimeout = process.env.IDLE_TIMEOUT;
|
||||
const timeout = (idleTimeout === undefined ? 300 : parseInt(idleTimeout)) * 1000;
|
||||
const timeout = (idleTimeout === undefined ? 300 : Number.parseInt(idleTimeout)) * 1000;
|
||||
if (idleTimeout) {
|
||||
const exit = () => {
|
||||
logger.info('Inactivity timeout reached, exiting.');
|
||||
@@ -496,7 +495,7 @@ function startListening(server: express.Express) {
|
||||
});
|
||||
startupGauge.set(process.uptime());
|
||||
const startupDurationMs = Math.floor(process.uptime() * 1000);
|
||||
if (isNaN(parseInt(_port))) {
|
||||
if (Number.isNaN(Number.parseInt(_port))) {
|
||||
// unix socket, not a port number...
|
||||
logger.info(` Listening on socket: //${_port}/`);
|
||||
logger.info(` Startup duration: ${startupDurationMs}ms`);
|
||||
@@ -522,8 +521,8 @@ const awsProps = props.propsFor('aws');
|
||||
async function main() {
|
||||
await aws.initConfig(awsProps);
|
||||
// Initialise express and then sentry. Sentry as early as possible to catch errors during startup.
|
||||
const webServer = express(),
|
||||
router = express.Router();
|
||||
const webServer = express();
|
||||
const router = express.Router();
|
||||
|
||||
SetupSentry(aws.getConfig('sentryDsn'), ceProps, releaseBuildNumber, gitReleaseName, defArgs);
|
||||
|
||||
@@ -587,9 +586,8 @@ async function main() {
|
||||
if (initialFindResults.foundClash) {
|
||||
// If we are forced to have no clashes, throw an error with some explanation
|
||||
throw new Error('Clashing compilers in the current environment found!');
|
||||
} else {
|
||||
logger.info('No clashing ids found, continuing normally...');
|
||||
}
|
||||
logger.info('No clashing ids found, continuing normally...');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,8 +686,7 @@ async function main() {
|
||||
.use(Sentry.Handlers.errorHandler)
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
.use((err: any, req: express.Request, res: express.Response, _next: express.NextFunction) => {
|
||||
const status =
|
||||
err.status || err.statusCode || err.status_code || (err.output && err.output.statusCode) || 500;
|
||||
const status = err.status || err.statusCode || err.status_code || err.output?.statusCode || 500;
|
||||
const message = err.message || 'Internal Server Error';
|
||||
res.status(status);
|
||||
res.render('error', renderConfig({error: {code: status, message: message}}));
|
||||
@@ -736,7 +733,7 @@ async function main() {
|
||||
req: express.Request,
|
||||
res: express.Response,
|
||||
) {
|
||||
const embedded = req.query.embedded === 'true' ? true : false;
|
||||
const embedded = req.query.embedded === 'true';
|
||||
|
||||
res.render(
|
||||
embedded ? 'embed' : 'index',
|
||||
@@ -753,7 +750,7 @@ async function main() {
|
||||
);
|
||||
}
|
||||
|
||||
const embeddedHandler = function (req: express.Request, res: express.Response) {
|
||||
const embeddedHandler = (req: express.Request, res: express.Response) => {
|
||||
res.render(
|
||||
'embed',
|
||||
renderConfig(
|
||||
|
||||
76
biome.json
Normal file
76
biome.json
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"files": {
|
||||
"ignore": [
|
||||
"examples/**/*",
|
||||
"node_modules/**/*",
|
||||
"out/**/*",
|
||||
"coverage/**/*",
|
||||
"etc/**/*",
|
||||
"static/policies/*.html",
|
||||
"lib/storage/data/**/*",
|
||||
"lib/asm-docs/generated/**/*",
|
||||
"test/**/*.json",
|
||||
"tsconfig*.json"
|
||||
]
|
||||
},
|
||||
"linter": {
|
||||
"rules": {
|
||||
"suspicious": {
|
||||
"noExplicitAny": "off",
|
||||
"noImplicitAnyLet": "off",
|
||||
"noAssignInExpressions": "off",
|
||||
"noControlCharactersInRegex": "off",
|
||||
"noShadowRestrictedNames": "off",
|
||||
"noFallthroughSwitchClause": "off",
|
||||
"noDoubleEquals": "off",
|
||||
"noConfusingVoidType": "off"
|
||||
},
|
||||
"style": {
|
||||
"noParameterAssign": "off",
|
||||
"noNonNullAssertion": "off",
|
||||
"useLiteralEnumMembers": "off",
|
||||
"useImportType": "off",
|
||||
"useTemplate": "off"
|
||||
},
|
||||
"correctness": {
|
||||
"noVoidTypeReturn": "off",
|
||||
"noUnsafeOptionalChaining": "off"
|
||||
},
|
||||
"performance": {
|
||||
"noAccumulatingSpread": "off",
|
||||
"noDelete": "off"
|
||||
},
|
||||
"complexity": {
|
||||
"noStaticOnlyClass": "off",
|
||||
"noForEach": "off",
|
||||
"noBannedTypes": "off",
|
||||
"useLiteralKeys": "off"
|
||||
}
|
||||
}
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"attributePosition": "auto",
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 4,
|
||||
"lineWidth": 120,
|
||||
"lineEnding": "lf"
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"arrowParentheses": "asNeeded",
|
||||
"bracketSameLine": false,
|
||||
"bracketSpacing": false,
|
||||
"quoteProperties": "asNeeded",
|
||||
"semicolons": "always",
|
||||
"trailingCommas": "all",
|
||||
"quoteStyle": "single"
|
||||
}
|
||||
},
|
||||
"json": {
|
||||
"formatter": {
|
||||
"indentWidth": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,6 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
/* eslint-disable unicorn/prefer-top-level-await */
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import nopt from 'nopt';
|
||||
import _ from 'underscore';
|
||||
|
||||
@@ -109,11 +106,10 @@ class CompilerArgsApp {
|
||||
getParser() {
|
||||
if (compilerParsers[this.parserName as keyof typeof compilerParsers]) {
|
||||
return compilerParsers[this.parserName as keyof typeof compilerParsers];
|
||||
} else {
|
||||
}
|
||||
console.error('Unknown parser type');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
async doTheParsing() {
|
||||
const parser = this.getParser();
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// eslint-disable-next-line n/no-unpublished-import
|
||||
import {defineConfig} from 'cypress';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default defineConfig({
|
||||
viewportWidth: 1000,
|
||||
viewportHeight: 700,
|
||||
|
||||
@@ -92,7 +92,7 @@ describe('Known good state test', () => {
|
||||
cy.visit(
|
||||
// This URL manually created. If you need to update, run a local server like the docs/UsingCypress.md say,
|
||||
// then paste this into your browser, make the changes, and then re-share as a full link.
|
||||
// eslint-disable-next-line max-len
|
||||
|
||||
'/#z:OYLghAFBqd5TB8IAsQGMD2ATApgUWwEsAXTAJwBoiQIAzIgG1wDsBDAW1xAHIBGHpTqYWJAMro2zEHwAsQkSQCqAZ1wAFAB68ADIIBWMyozYtQ6AKQAmAELWblNc3QkiI2q2wBhTIwCuHCwgVpSeADJELLgAcgEARrjkIPIADpgqpG4sPv6BwZRpGa4iEVGxHAlJ8k64LlliJGzkJDkBQSE1dSINTSSlMfGJyY6Nza15HaN9kQMVQ7IAlI6YfuTo3DwA9JsA1AAqAJ4puDsHK%2BQ7WHg7KIm4lDsUO4yYbNg7pju4mpwpzAB0Fh0AEFIiQdioAI5%2BJq4CBgnYsAILHYWADsdhBO2xO3IuBIqxYiICOwAVMSOBYAMyY4HogAiPCWjF4AFZBEEeHpKJheF57PYIed1qirFSBJQSLomUsANYgVk6Yy8WSCDgKpWc7m8niCFQgJVSrlMyhwWBoLAsYTkDimdbUDzEMjkIjYIwmMwASTdlls9mWq3WvG2%2ByOJzOq0uOBOtzxDyeLzeHyJ31%2BAKBoNEEOhsPhWaRHBR6NpONx%2BMJFLJFOptIZJpZPHZlC1gh1PitFFtLBFADUiLgAO6JHYQQikJ7WcULQRGvQLJa3N5DCDMlVq4Ks5vSnm8PUGyXSpZmqBoch%2BFQkFBEKg0CBYDgpJiJaKcDbAAW2HZ4OhsPyMEiCLgToUK6RjCKIEhSNwcgKKIqgaNoxqUIYfCOLgzjFEEECeOMQSoeEMzlJURiFJkIi4SR6RkSw/REUMqGdJhPRjL4bRGIx9RTLRgxJAxUwUXxvTcXMvFLCQeK4KBOiro2HLbjqABK57ggAEp6Ck7H2g7Du%2Bfqft%2Bv7/iOY7OqK4oPD4D5Phck58NOB7GvOlCLngSQrsqPCqpQ6pWJuLY7rqjj7rOMqUPKshKg2VJyUhOozoepqIMeqAYJgVnMDetD3o%2BGUgMABl/iQlB4AAbkQ6xaQOADyxz%2BQw/6JPqEBxNucSRE0By8BKbXsOQBxVXE%2Bi1EaEr3lwohVSwjCdUheBxH4wBeFIjD6vwgh4F2wDSLN17DUQJW4Kt3LfLUfgkBsEpguh26MEQcTkB1Ph4Nu4lEOqa1LHQJjAColU1awXWCOB4iSNIMHA/BWjbihximOYH4OLdcT6pASyYCkmGra2B3kC6eAo%2B5HHuNhLDeKxeT4aTwnEahpGYQJBRUZh1P0WhGGcb0DNEywzHTGUPHsfx5N4SMQmEQLdkBms0GUAOpgkDVJCeh2CUNk2/k6jsul2PpuA/oVxnATZYp2fFjkLrgS5uXKGoeV5Pl%2BfJu5BYaCXJWgF5sOgsrnmwwD3Le2XWS%2BXC8NrgoFf%2BgFG6BqEwyowobCGhzHKc5xRtcsb3I8FyJu8nypg%2B6YggiUIwniebggWRYYhmpZ4gS5BEgWVYFjWGZ1pKElSTJ6tOzwPTezsqh%2ByclU6QjX564Z4KjkbZmoTslk5cOtn2SFTkucuMn2xuW6xc7%2Bqu45iXIGgKwkCkZ0OneaUr%2BQIdvpPkcAaEMduqhwOQWD8gQ2oUNIRhgOB6KRAa9xitqXgVUzpX3BJgOgWtn7TwNhAZe1kF7r0PBbK2tAd7rl8vvSBgUj4OTnKfc0IAzwXltOgcgmBvgpBvkHDKj8w5IP1lHN%2B448ZgUUN/aCv9FCQ0QtyeO6E9rExwsLIwBF%2BYiUokULIDM6ZZBZrxNmEieZC1yCLbmvM1GC05tIwSzQDGS3ErgSSbppIeT7gfHgSkLw7AALJezoTsfAmgUimAyCITS/YhwXHDrrDhs8TIThNhZO%2B6C15mznNg1yuC7b4MdvYvcx94lhRAAANkirwaKhDWzOw3jbKkaJ/hijFGiVkABONENS%2BB8CsFYNEHkrDrj4DoTU/c4kmmSklAZZ8QAnXQGdCgN8mg/XUKYdCYgUCYAHJyUa0STCYWmVERgcyFn%2BWYUMfKyD/yUF2Q/V8ztjnQPEPMxZ24RnAnID9Z2IyGjEE5EDPhoMBGwWUP/ERBh3RwwwAjYwd0CZowxlkLGPIcZ40OvAJYCdAwywvC89ZsyrlLJnBJQGssQFgNsRAopPBPGnVMsEmwU9Qkjn5HpBwHj56xNIaFLe1ssmKmSd5PeGtD7BTdklNAwB2AkDmgtCxAcsorOfKcngZKKUz2jtw2OXz%2BEyEEXBH50N2LiK6FhKROiZFU3FvI2mTMlHGMZookohqaYaO1bzLmWqmJcStazT2LE9UmL5rMGmYlu7WPAYUgKABxaIwI9g7HpLgeawB9gSX8dpIJ7CZ6G24QvKJ6VV4m0webZyltEnuQbLvAhXLiE8pPu7EA14mESpOaHaVibCryudIq%2BOidgy7BTuGdOVwYx3HjLnV4%2BcUw/CLrgQEJcsxl1zAiauqJa5YhxA3CsLdyRtxpB3NEjIu6WNAh9fFAadRhDCD2ZxOx1JxsCYgmlsqUHhONuZJe1aMG9M3rm7e7KHb7u5RkvpfKQAoDYCoWU6FGA%2BDjIHatrC61Xpfo2kCH8lUfJVV84RGqGIOqyB4UmDNZFetZio8iZr8M0WdeovR2i2JofZt0J1cjrWupaGa%2BjZifXbr9Xu4tgaVJeAfXic9E9oMHLCfSyJD7013tNoyl9OD81rg5UWnpLtJM2zZVFAlAVn3kKQBQ9GRVwNicgzKmDXCm3wZbYittoZU4RguN2m4vac7PAHcmL4w6/ijozKXHMFdp3IlnSWBd5Ym6VhXQEduIJO6ip3QIf1xbFZ8YTQJylc8U22TTffJ9Smc3SeU3kzyKTP0lu/UeX9Aq2BCsjQtKt%2BmpWGcE7Bnhn93lQSQ3/BCqGbWYUw2Td1oQDW0bwyagjPWiNmI6xzN1FGxvUbFv10j5GKai1MSRmQLGrEGhi/3YNobw0VejePBLOtyUv2TaZVLon0sMpKVlvNeC5OpKIekyTmmUqMEYCVDgit1BEGOLdKIlUb48AALR0BYJgQHxAVCSHINgQHJUpB%2BFwID9gXAVA8G3Mcgz9bOEbThswQHKgDgVF8EddaAQUjA7/IwQHHAcB/guvVxV9VzrkEB5ES0ahoSsFcFIQH3iVBqFWhKL%2BiHwZCPVUhNAr33ufe%2B%2BhGY/2xEYSAgAMT8N2TrxCHVAWVngbQSoMhzSaAAdVdJeDchpfV4rVmpg9R6T1xa%2Bz9mY8XL2HevUZZLp2RNoIyhlq7zKkkFvy8Wx7G9ntoH/YB4DDRgBVfvpjxLcrjNwd4RBEXqrvltcAZqqjOqsNmpw3RdRRHlGDeI7NnPmi7WMfQ9NpbFePVcxo7h0SW61s2OtwVzj3GxB7EDS72rSXb2pvOzEzNz6ElvqD3dgroesGstywUkPmX5SslkP8Pg2St/b539v%2BQDZ2kcs6d0tJT3%2BlDJSIwwOHpgDA87GV7FQEFXwaZ4kQHzKScIea6LtVWfRFGEizdF3U72LXUDxBSDoXWH5yeAuVgVdwjkExOwiXvR9wzSnAn2uzfXlCsBqQ3133wK3wAA531OUFMSEw9y10A6BY89N48assdX4n8TMjBFdhoVc1dtVeBJ1vNRAFheA28e52N%2B4vBld%2B9B8k1PdkDF5UDxMs1MkA8ZM8sZ9l9yDeUhlSpyoxUIANCgxAomCU9Gs09v8M8UNs9KNNEutsM%2BsW8FFqJS8LVy8bDzDbV5tdFa8tEZsnDFsGMesmNltzFLdgC2QbdeAI0ypewAl%2BM3djtJDxM0sx90DMsFDbsP0VDS0yFy1I8gNXsvAOAOA49g56DE8G1k8Gsv8f5kNxd/9nDOsSZutJtC8JZzU7DCMy9RsyMjFfD3D9F/DvCm9PCi8VsBC2MQDNsuMl48iB8GCkC4jR9fdLt59kiSD5NT9VDs1sDCCN8rBGlCDZAykdi9i0QqQPIl8FMKDBkKEANdNxVqta1xCSj9CyizNpYLMO005IxbMs4%2B1HMkwC5XNi5MxwRuC4QfNCw/M64AtG5m4SQQtKQ11wsN1MVWMrdgiCtgQnF9t4CQkJDh8zsZC/dFjX0WVp91Q2U0iitw9KFlIOBK1aDCi7iGCGcX8msKjWsAFqips896iFtGijVmj6ZWiHD2jujXDK8XCBimj6N%2Bj68nDVtBDRj7FHFwRnEz1MT7iPdcTvdH0Fjs0liSTghsl/gdAxQqQGlCCmlCDsk18aliDySz8St0B0BsAycJlsBsA8R%2BdFYMM1pKBlovT3AfS4gXhvYVB/SMUjk0ouxsAAB9CAvWIgbQdyDHIo6IurYqfENgJgUM8FAMiUR4xnJ8ZHXAaMlQPwOgBgRMz6Fkz5Nk35agbxekMndrX7VgTAMM7FIspJB6aqHM8M5oRgRsh8bcRiICaZfnJJbmSwgvawwY41Bw%2Bw6iYU3PavLo5c5vWcvoxjdciWeFW6D7Xs7FT2EgbMjXCUUVQc0BJCQA/cPwV0dsn0kqdGE8706LIQ%2BxQNLwbjPYCSTYBSPYMIKY4ojU4TFA7U8fJIokwPWTHyKkf4OpLfHQc0wgtEPgKkWQRUEIO0q7eUPgcpFC7Y2QQgmpbJAioikik4kIwKbCnJKwf4NEbJeiqwCKKwRC5CtEffXgQ/dUY/WfTLA/SijAnGXxIIWQIAA%3D%3D',
|
||||
{
|
||||
onBeforeLoad: win => {
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
"use_appcontainer": true,
|
||||
"pids_max": 72,
|
||||
"mem_max": 1342177280,
|
||||
"allowed_paths": [{
|
||||
"allowed_paths": [
|
||||
{
|
||||
"path": "NUL",
|
||||
"rw": true
|
||||
}],
|
||||
}
|
||||
],
|
||||
"allowed_registry": []
|
||||
}
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
---
|
||||
plugins:
|
||||
- jsdoc
|
||||
- sonarjs
|
||||
- unicorn
|
||||
- prettier
|
||||
extends:
|
||||
- ../.eslint-license-header.yml
|
||||
- eslint:recommended
|
||||
env:
|
||||
browser: true
|
||||
node: true
|
||||
es6: false
|
||||
rules:
|
||||
comma-dangle:
|
||||
- error
|
||||
- arrays: always-multiline
|
||||
objects: always-multiline
|
||||
imports: always-multiline
|
||||
exports: always-multiline
|
||||
functions: always-multiline
|
||||
eol-last:
|
||||
- error
|
||||
- always
|
||||
eqeqeq:
|
||||
- error
|
||||
- smart
|
||||
indent:
|
||||
- off
|
||||
#- 4
|
||||
#- SwitchCase: 1
|
||||
max-len:
|
||||
- error
|
||||
- 120
|
||||
- ignoreRegExpLiterals: true
|
||||
ignoreComments: true
|
||||
# TODO: Disabled for now
|
||||
#max-statements:
|
||||
# - error
|
||||
# - 50
|
||||
no-console: error
|
||||
no-control-regex: 0
|
||||
no-useless-call: error
|
||||
no-useless-computed-key: error
|
||||
no-useless-concat: error
|
||||
no-useless-escape: error
|
||||
no-useless-rename: error
|
||||
no-useless-return: error
|
||||
no-empty:
|
||||
- error
|
||||
- allowEmptyCatch: true
|
||||
quote-props:
|
||||
- error
|
||||
- as-needed
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
- allowTemplateLiterals: true
|
||||
avoidEscape: true
|
||||
semi:
|
||||
- error
|
||||
- always
|
||||
space-before-function-paren:
|
||||
- error
|
||||
- anonymous: always
|
||||
asyncArrow: always
|
||||
named: never
|
||||
yoda:
|
||||
- error
|
||||
- never
|
||||
- onlyEquality: true
|
||||
prefer-const:
|
||||
- error
|
||||
- destructuring: all
|
||||
jsdoc/check-alignment: warn
|
||||
jsdoc/check-param-names: warn
|
||||
jsdoc/check-syntax: warn
|
||||
jsdoc/check-tag-names: off
|
||||
jsdoc/check-types: warn
|
||||
jsdoc/empty-tags: warn
|
||||
jsdoc/require-hyphen-before-param-description: warn
|
||||
jsdoc/valid-types: warn
|
||||
sonarjs/no-collection-size-mischeck: error
|
||||
sonarjs/no-redundant-boolean: error
|
||||
sonarjs/no-unused-collection: error
|
||||
sonarjs/prefer-immediate-return: error
|
||||
sonarjs/prefer-object-literal: error
|
||||
sonarjs/prefer-single-boolean-return: error
|
||||
unicorn/filename-case: error
|
||||
parserOptions:
|
||||
ecmaVersion: 6
|
||||
globals:
|
||||
define: false
|
||||
__webpack_public_path__: true
|
||||
@@ -1,76 +0,0 @@
|
||||
// Copyright (c) 2023, Compiler Explorer Authors
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
module.exports = {
|
||||
root: false,
|
||||
plugins: ['promise', 'requirejs', 'unused-imports'],
|
||||
extends: ['./.eslint-ce-lib.yml'],
|
||||
rules: {
|
||||
'promise/catch-or-return': 'off',
|
||||
'promise/no-new-statics': 'error',
|
||||
'promise/no-return-wrap': 'error',
|
||||
'promise/param-names': 'error',
|
||||
'promise/valid-params': 'error',
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts'],
|
||||
plugins: ['import', '@typescript-eslint'],
|
||||
extends: [
|
||||
'./.eslint-ce-lib.yml',
|
||||
'plugin:@typescript-eslint/eslint-recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:import/recommended',
|
||||
'plugin:import/typescript',
|
||||
],
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
node: false,
|
||||
},
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 'latest',
|
||||
tsconfigRootDir: __dirname,
|
||||
project: '../tsconfig.json',
|
||||
},
|
||||
rules: {
|
||||
'import/no-unresolved': 'off',
|
||||
'n/no-missing-imports': 'off',
|
||||
'unused-imports/no-unused-imports': 'error',
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-var-requires': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'off', // Too much js code still exists
|
||||
'@typescript-eslint/ban-ts-comment': 'error',
|
||||
// TODO: Disabled for now
|
||||
//'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
//'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
//'@typescript-eslint/prefer-includes': 'error',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -56,10 +56,10 @@ export async function addArtifactToResult(
|
||||
}
|
||||
|
||||
export async function addHeaptrackResults(result: CompilationResult, dirPath?: string): Promise<void> {
|
||||
let dirPathToUse: string = '';
|
||||
let dirPathToUse = '';
|
||||
if (dirPath) {
|
||||
dirPathToUse = dirPath;
|
||||
} else if (result.buildResult && result.buildResult.dirPath) {
|
||||
} else if (result.buildResult?.dirPath) {
|
||||
dirPathToUse = result.buildResult.dirPath;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import * as fs from 'fs';
|
||||
import path from 'path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import {isString} from '../shared/common-utils.js';
|
||||
import {parse} from '../shared/stacktrace.js';
|
||||
@@ -33,9 +33,8 @@ const filePrefix = 'file://';
|
||||
function removeFileProtocol(path: string) {
|
||||
if (path.startsWith(filePrefix)) {
|
||||
return path.slice(filePrefix.length);
|
||||
} else {
|
||||
return path;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
function check_path(parent: URL, directory: string) {
|
||||
@@ -43,13 +42,12 @@ function check_path(parent: URL, directory: string) {
|
||||
const relative = path.relative(parent.pathname, directory);
|
||||
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
|
||||
return relative;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function get_diagnostic() {
|
||||
const e = new Error(); // eslint-disable-line unicorn/error-message
|
||||
const e = new Error();
|
||||
const trace = parse(e);
|
||||
if (trace.length >= 4) {
|
||||
const invoker_frame = trace[3];
|
||||
@@ -90,9 +88,8 @@ function fail(fail_message: string, user_message: string | undefined, args: any[
|
||||
const diagnostic = get_diagnostic();
|
||||
if (diagnostic) {
|
||||
throw new Error(assert_line + `, at ${diagnostic.file}:${diagnostic.line} \`${diagnostic.src}\``);
|
||||
} else {
|
||||
throw new Error(assert_line);
|
||||
}
|
||||
throw new Error(assert_line);
|
||||
}
|
||||
|
||||
// Using `unknown` instead of generic implementation due to:
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
import {EC2, Instance} from '@aws-sdk/client-ec2';
|
||||
import {SSM} from '@aws-sdk/client-ssm';
|
||||
import {fromNodeProviderChain} from '@aws-sdk/credential-providers';
|
||||
// eslint-disable-next-line import/extensions, n/no-missing-import
|
||||
|
||||
import {AwsCredentialIdentityProvider} from '@smithy/types/dist-types/identity/awsCredentialIdentity.js';
|
||||
|
||||
import {unwrap} from './assert.js';
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import * as PromClient from 'prom-client';
|
||||
@@ -40,8 +40,6 @@ import {
|
||||
BuildResult,
|
||||
BuildStep,
|
||||
BypassCache,
|
||||
bypassCompilationCache,
|
||||
bypassExecutionCache,
|
||||
CacheKey,
|
||||
CmakeCacheKey,
|
||||
CompilationCacheKey,
|
||||
@@ -53,6 +51,8 @@ import {
|
||||
FiledataPair,
|
||||
GccDumpOptions,
|
||||
LibsAndOptions,
|
||||
bypassCompilationCache,
|
||||
bypassExecutionCache,
|
||||
} from '../types/compilation/compilation.interfaces.js';
|
||||
import {
|
||||
CompilerOverrideOption,
|
||||
@@ -89,8 +89,8 @@ import {CompilerArguments} from './compiler-arguments.js';
|
||||
import {
|
||||
BaseParser,
|
||||
ClangCParser,
|
||||
ClangirParser,
|
||||
ClangParser,
|
||||
ClangirParser,
|
||||
GCCCParser,
|
||||
GCCParser,
|
||||
ICCParser,
|
||||
@@ -214,7 +214,7 @@ export class BaseCompiler {
|
||||
protected packager: Packager;
|
||||
protected executionType: string;
|
||||
protected sandboxType: string;
|
||||
protected defaultRpathFlag: string = '-Wl,-rpath,';
|
||||
protected defaultRpathFlag = '-Wl,-rpath,';
|
||||
private static objdumpAndParseCounter = new PromClient.Counter({
|
||||
name: 'ce_objdumpandparsetime_total',
|
||||
help: 'Time spent on objdump and parsing of objdumps',
|
||||
@@ -324,12 +324,11 @@ export class BaseCompiler {
|
||||
id: match[1],
|
||||
version: match[2],
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
id: lib,
|
||||
version: false,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const filterLibIds = new Set();
|
||||
@@ -564,9 +563,8 @@ export class BaseCompiler {
|
||||
|
||||
if (this.compiler.instructionSet) {
|
||||
return this.compiler.instructionSet;
|
||||
} else {
|
||||
return 'amd64';
|
||||
}
|
||||
return 'amd64';
|
||||
}
|
||||
|
||||
async runCompiler(
|
||||
@@ -655,7 +653,7 @@ export class BaseCompiler {
|
||||
if (this.externalparser) {
|
||||
const objResult = await this.externalparser.objdumpAndParseAssembly(result.dirPath, args, filters);
|
||||
if (objResult.parsingTime !== undefined) {
|
||||
objResult.objdumpTime = parseInt(result.execTime) - parseInt(result.parsingTime);
|
||||
objResult.objdumpTime = Number.parseInt(result.execTime) - Number.parseInt(result.parsingTime);
|
||||
delete objResult.execTime;
|
||||
}
|
||||
|
||||
@@ -771,7 +769,7 @@ export class BaseCompiler {
|
||||
optionsForBackend(backendOptions: Record<string, any>, outputFilename: string): string[] {
|
||||
let addOpts: string[] = [];
|
||||
|
||||
if (backendOptions.produceGccDump && backendOptions.produceGccDump.opened && this.compiler.supportsGccDump) {
|
||||
if (backendOptions.produceGccDump?.opened && this.compiler.supportsGccDump) {
|
||||
addOpts = addOpts.concat(this.getGccDumpOptions(backendOptions.produceGccDump, outputFilename));
|
||||
}
|
||||
|
||||
@@ -806,7 +804,7 @@ export class BaseCompiler {
|
||||
foundLib.versions,
|
||||
(o: VersionInfo, versionId: string): boolean => {
|
||||
if (versionId === selectedLib.version) return true;
|
||||
return !!(o.alias && o.alias.includes(selectedLib.version));
|
||||
return !!o.alias?.includes(selectedLib.version);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -822,11 +820,7 @@ export class BaseCompiler {
|
||||
|
||||
findAutodetectStaticLibLink(linkname: string): SelectedLibraryVersion | false {
|
||||
const foundLib = _.findKey(this.supportedLibraries!, lib => {
|
||||
return (
|
||||
lib.versions.autodetect &&
|
||||
lib.versions.autodetect.staticliblink &&
|
||||
lib.versions.autodetect.staticliblink.includes(linkname)
|
||||
);
|
||||
return lib.versions.autodetect?.staticliblink?.includes(linkname);
|
||||
});
|
||||
if (!foundLib) return false;
|
||||
|
||||
@@ -848,9 +842,8 @@ export class BaseCompiler {
|
||||
if (lib) {
|
||||
dictionary[lib] = foundVersion;
|
||||
return [lib, foundVersion.dependencies];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
})
|
||||
.flat(3),
|
||||
@@ -873,14 +866,14 @@ export class BaseCompiler {
|
||||
) {
|
||||
idxToInsert = idx;
|
||||
break;
|
||||
} else if (libToInsertObj && libToInsertObj.dependencies.includes(libCompareName)) {
|
||||
}
|
||||
if (libToInsertObj?.dependencies.includes(libCompareName)) {
|
||||
idxToInsert = idx;
|
||||
break;
|
||||
} else if (libCompareObj && libCompareObj.dependencies.includes(libToInsertName)) {
|
||||
continue;
|
||||
}
|
||||
if (libCompareObj?.dependencies.includes(libToInsertName)) {
|
||||
} else if (
|
||||
libToInsertObj &&
|
||||
libToInsertObj.staticliblink.includes(libToInsertName) &&
|
||||
libToInsertObj?.staticliblink.includes(libToInsertName) &&
|
||||
libToInsertObj.staticliblink.includes(libCompareName)
|
||||
) {
|
||||
if (
|
||||
@@ -888,13 +881,11 @@ export class BaseCompiler {
|
||||
libToInsertObj.staticliblink.indexOf(libCompareName)
|
||||
) {
|
||||
continue;
|
||||
} else {
|
||||
idxToInsert = idx;
|
||||
}
|
||||
idxToInsert = idx;
|
||||
break;
|
||||
} else if (
|
||||
libCompareObj &&
|
||||
libCompareObj.staticliblink.includes(libToInsertName) &&
|
||||
libCompareObj?.staticliblink.includes(libToInsertName) &&
|
||||
libCompareObj.staticliblink.includes(libCompareName)
|
||||
) {
|
||||
if (
|
||||
@@ -902,9 +893,8 @@ export class BaseCompiler {
|
||||
libCompareObj.staticliblink.indexOf(libCompareName)
|
||||
) {
|
||||
continue;
|
||||
} else {
|
||||
idxToInsert = idx;
|
||||
}
|
||||
idxToInsert = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -939,9 +929,8 @@ export class BaseCompiler {
|
||||
return foundVersion.liblink.map(lib => {
|
||||
if (lib) {
|
||||
return linkFlag + lib;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
})
|
||||
.filter(Boolean) as string[];
|
||||
@@ -1533,13 +1522,12 @@ export class BaseCompiler {
|
||||
compileTime: compileEnd - compileStart,
|
||||
parseTime: parseEnd - parseStart,
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
results: optPipeline,
|
||||
compileTime: compileEnd - compileStart,
|
||||
parseTime: parseEnd - parseStart,
|
||||
};
|
||||
}
|
||||
} catch (e: any) {
|
||||
return {
|
||||
error: e.toString(),
|
||||
@@ -1680,9 +1668,8 @@ export class BaseCompiler {
|
||||
|
||||
if (dirPath) {
|
||||
return path.join(dirPath, filename);
|
||||
} else {
|
||||
return filename;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
getExecutableFilename(dirPath: string, outputFilebase: string, key?: CacheKey | CompilationCacheKey) {
|
||||
@@ -1779,7 +1766,7 @@ export class BaseCompiler {
|
||||
name: match[2] + ' (' + match[1] + ')',
|
||||
command_prefix: `-fdump-${match[1]}-${match[2]}`,
|
||||
};
|
||||
else return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
async checkOutputFileAndDoPostProcess(
|
||||
@@ -1846,9 +1833,8 @@ export class BaseCompiler {
|
||||
if (this.buildenvsetup) {
|
||||
const libraryDetails = await this.getRequiredLibraryVersions(key.libraries);
|
||||
return this.buildenvsetup.setup(key, dirPath, libraryDetails, binary);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
protected async writeMultipleFiles(files: FiledataPair[], dirPath: string) {
|
||||
@@ -2167,7 +2153,7 @@ export class BaseCompiler {
|
||||
didExecute: true,
|
||||
buildResult: buildResult,
|
||||
});
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
code: -1,
|
||||
didExecute: false,
|
||||
@@ -2178,7 +2164,6 @@ export class BaseCompiler {
|
||||
timedOut: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const result = await this.runExecutable(
|
||||
buildResult.executableFilename,
|
||||
@@ -2293,9 +2278,8 @@ export class BaseCompiler {
|
||||
libsAndOptions.libraries = _.union(libsAndOptions.libraries, detectedLibs);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
sanitizeCompilerOverrides(overrides: ConfiguredOverrides): ConfiguredOverrides {
|
||||
@@ -2372,8 +2356,7 @@ export class BaseCompiler {
|
||||
const makeHaskellCore = backendOptions.produceHaskellCore && this.compiler.supportsHaskellCoreView;
|
||||
const makeHaskellStg = backendOptions.produceHaskellStg && this.compiler.supportsHaskellStgView;
|
||||
const makeHaskellCmm = backendOptions.produceHaskellCmm && this.compiler.supportsHaskellCmmView;
|
||||
const makeGccDump =
|
||||
backendOptions.produceGccDump && backendOptions.produceGccDump.opened && this.compiler.supportsGccDump;
|
||||
const makeGccDump = backendOptions.produceGccDump?.opened && this.compiler.supportsGccDump;
|
||||
|
||||
const [
|
||||
asmResult,
|
||||
@@ -2394,7 +2377,7 @@ export class BaseCompiler {
|
||||
inputFilename,
|
||||
options,
|
||||
backendOptions.produceIr,
|
||||
backendOptions.produceCfg && backendOptions.produceCfg.ir,
|
||||
backendOptions.produceCfg?.ir,
|
||||
filters,
|
||||
)
|
||||
: undefined,
|
||||
@@ -2504,13 +2487,14 @@ export class BaseCompiler {
|
||||
getCompilerEnvironmentVariables(compilerflags: string) {
|
||||
if (this.lang.id === 'c++') {
|
||||
return {...this.cmakeBaseEnv, CXXFLAGS: compilerflags};
|
||||
} else if (this.lang.id === 'fortran') {
|
||||
return {...this.cmakeBaseEnv, FFLAGS: compilerflags};
|
||||
} else if (this.lang.id === 'cuda') {
|
||||
return {...this.cmakeBaseEnv, CUDAFLAGS: compilerflags};
|
||||
} else {
|
||||
return {...this.cmakeBaseEnv, CFLAGS: compilerflags};
|
||||
}
|
||||
if (this.lang.id === 'fortran') {
|
||||
return {...this.cmakeBaseEnv, FFLAGS: compilerflags};
|
||||
}
|
||||
if (this.lang.id === 'cuda') {
|
||||
return {...this.cmakeBaseEnv, CUDAFLAGS: compilerflags};
|
||||
}
|
||||
return {...this.cmakeBaseEnv, CFLAGS: compilerflags};
|
||||
}
|
||||
|
||||
async doBuildstep(command: string, args: string[], execParams: ExecutionOptions) {
|
||||
@@ -2620,13 +2604,14 @@ export class BaseCompiler {
|
||||
getUsedEnvironmentVariableFlags(makeExecParams: ExecutionOptionsWithEnv) {
|
||||
if (this.lang.id === 'c++') {
|
||||
return splitArguments(makeExecParams.env.CXXFLAGS);
|
||||
} else if (this.lang.id === 'fortran') {
|
||||
return splitArguments(makeExecParams.env.FFLAGS);
|
||||
} else if (this.lang.id === 'cuda') {
|
||||
return splitArguments(makeExecParams.env.CUDAFLAGS);
|
||||
} else {
|
||||
return splitArguments(makeExecParams.env.CFLAGS);
|
||||
}
|
||||
if (this.lang.id === 'fortran') {
|
||||
return splitArguments(makeExecParams.env.FFLAGS);
|
||||
}
|
||||
if (this.lang.id === 'cuda') {
|
||||
return splitArguments(makeExecParams.env.CUDAFLAGS);
|
||||
}
|
||||
return splitArguments(makeExecParams.env.CFLAGS);
|
||||
}
|
||||
|
||||
async cmake(
|
||||
@@ -2791,7 +2776,7 @@ export class BaseCompiler {
|
||||
|
||||
fullResult.code = 0;
|
||||
if (fullResult.buildsteps) {
|
||||
_.each(fullResult.buildsteps, function (step) {
|
||||
_.each(fullResult.buildsteps, step => {
|
||||
fullResult.code += step.code;
|
||||
});
|
||||
}
|
||||
@@ -2960,7 +2945,7 @@ export class BaseCompiler {
|
||||
{abandonIfStale: true},
|
||||
);
|
||||
|
||||
if (result.execResult && result.execResult.buildResult) {
|
||||
if (result.execResult?.buildResult) {
|
||||
this.doTempfolderCleanup(result.execResult.buildResult);
|
||||
}
|
||||
}
|
||||
@@ -2977,7 +2962,7 @@ export class BaseCompiler {
|
||||
|
||||
if (backendOptions.executorRequest) {
|
||||
const execResult = await this.handleExecution(key, executeOptions, bypassCache);
|
||||
if (execResult && execResult.buildResult) {
|
||||
if (execResult?.buildResult) {
|
||||
this.doTempfolderCleanup(execResult.buildResult);
|
||||
}
|
||||
return execResult;
|
||||
@@ -3079,7 +3064,8 @@ export class BaseCompiler {
|
||||
result.filteredCount = res.filteredCount;
|
||||
if (res.languageId) result.languageId = res.languageId;
|
||||
if (result.objdumpTime) {
|
||||
const dumpAndParseTime = parseInt(result.objdumpTime) + parseInt(result.parsingTime);
|
||||
const dumpAndParseTime =
|
||||
Number.parseInt(result.objdumpTime) + Number.parseInt(result.parsingTime);
|
||||
BaseCompiler.objdumpAndParseCounter.inc(dumpAndParseTime);
|
||||
}
|
||||
} else {
|
||||
@@ -3191,8 +3177,8 @@ export class BaseCompiler {
|
||||
DebugLoc: {
|
||||
File: file,
|
||||
// Could use line.tag for these too:
|
||||
Line: parseInt(lineNum, 10),
|
||||
Column: parseInt(colNum, 10),
|
||||
Line: Number.parseInt(lineNum, 10),
|
||||
Column: Number.parseInt(colNum, 10),
|
||||
},
|
||||
optType: mapOptType(type, line),
|
||||
displayString: message,
|
||||
@@ -3274,7 +3260,7 @@ export class BaseCompiler {
|
||||
const versionMatch = versionRegex.exec(version);
|
||||
|
||||
if (versionMatch) {
|
||||
const versionNum = parseFloat(versionMatch[1]);
|
||||
const versionNum = Number.parseFloat(versionMatch[1]);
|
||||
return version.toLowerCase().includes('clang') && versionNum >= 3.3;
|
||||
}
|
||||
|
||||
@@ -3406,7 +3392,6 @@ but nothing was dumped. Possible causes are:
|
||||
return output;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
async extractDeviceCode(
|
||||
result: CompilationResult,
|
||||
_filters: ParseFiltersAndOutputOptions,
|
||||
@@ -3464,11 +3449,10 @@ but nothing was dumped. Possible causes are:
|
||||
}
|
||||
if (postProcess.length > 0) {
|
||||
return await this.execPostProcess(result, postProcess, outputFilename, maxSize);
|
||||
} else {
|
||||
}
|
||||
const contents = await fs.readFile(outputFilename);
|
||||
result.asm = contents.toString();
|
||||
return result;
|
||||
}
|
||||
})();
|
||||
return Promise.all([asmPromise, optPromise, stackUsagePromise]);
|
||||
}
|
||||
@@ -3509,16 +3493,21 @@ but nothing was dumped. Possible causes are:
|
||||
const exeFilename = path.basename(exe);
|
||||
if (exeFilename.includes('icc')) {
|
||||
return ICCParser;
|
||||
} else if (exe.includes('clangir')) {
|
||||
}
|
||||
if (exe.includes('clangir')) {
|
||||
return ClangirParser;
|
||||
} else if (exeFilename.includes('clang++') || exeFilename.includes('icpx')) {
|
||||
}
|
||||
if (exeFilename.includes('clang++') || exeFilename.includes('icpx')) {
|
||||
// check this first as "clang++" matches "g++"
|
||||
return ClangParser;
|
||||
} else if (exeFilename.includes('clang') || exeFilename.includes('icx')) {
|
||||
}
|
||||
if (exeFilename.includes('clang') || exeFilename.includes('icx')) {
|
||||
return ClangCParser;
|
||||
} else if (exeFilename.includes('gcc')) {
|
||||
}
|
||||
if (exeFilename.includes('gcc')) {
|
||||
return GCCCParser;
|
||||
} else if (exeFilename.includes('g++')) {
|
||||
}
|
||||
if (exeFilename.includes('g++')) {
|
||||
return GCCParser;
|
||||
}
|
||||
//there is a lot of code around that makes this assumption.
|
||||
@@ -3564,9 +3553,8 @@ but nothing was dumped. Possible causes are:
|
||||
value: target,
|
||||
};
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
async getPossibleStdversAsOverrideValues(): Promise<CompilerOverrideOption[]> {
|
||||
@@ -3751,7 +3739,7 @@ but nothing was dumped. Possible causes are:
|
||||
delete this.compiler.cachedPossibleArguments;
|
||||
}
|
||||
return this;
|
||||
} else {
|
||||
}
|
||||
const initResult = await this.getArgumentParserClass().parse(this);
|
||||
this.possibleArguments.possibleArguments = {};
|
||||
|
||||
@@ -3761,7 +3749,6 @@ but nothing was dumped. Possible causes are:
|
||||
logger.info(`${compiler} ${version} is ready`);
|
||||
return initResult;
|
||||
}
|
||||
}
|
||||
|
||||
getModificationTime(): number | undefined {
|
||||
return this.mtime ? this.mtime.getTime() : undefined;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import os from 'os';
|
||||
import os from 'node:os';
|
||||
|
||||
import {InstructionSet} from '../../types/instructionsets.js';
|
||||
import {executeDirect} from '../exec.js';
|
||||
@@ -85,8 +85,8 @@ export class BinaryInfoLinux {
|
||||
}
|
||||
|
||||
static removeComments(value: string): string {
|
||||
let filtered: string = '';
|
||||
let inComment: boolean = false;
|
||||
let filtered = '';
|
||||
let inComment = false;
|
||||
for (const c of value) {
|
||||
if (!inComment && c === '(') {
|
||||
inComment = true;
|
||||
@@ -106,16 +106,17 @@ export class BinaryInfoLinux {
|
||||
if (isElf) {
|
||||
return {
|
||||
os: OSType.linux,
|
||||
instructionSet: this.getInstructionSetForArchText(csv[1]),
|
||||
instructionSet: BinaryInfoLinux.getInstructionSetForArchText(csv[1]),
|
||||
};
|
||||
} else if (isPE) {
|
||||
const filteredLine = this.removeComments(csv[0]);
|
||||
}
|
||||
if (isPE) {
|
||||
const filteredLine = BinaryInfoLinux.removeComments(csv[0]);
|
||||
const lastWordPos = filteredLine.lastIndexOf(' ');
|
||||
const lastWord = filteredLine.substring(lastWordPos + 1);
|
||||
|
||||
return {
|
||||
os: OSType.windows,
|
||||
instructionSet: this.getInstructionSetForArchText(lastWord),
|
||||
instructionSet: BinaryInfoLinux.getInstructionSetForArchText(lastWord),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -128,10 +129,9 @@ export class BinaryInfoLinux {
|
||||
os: OSType.windows,
|
||||
instructionSet: 'amd64',
|
||||
};
|
||||
} else {
|
||||
const info = await executeDirect('/usr/bin/file', ['-b', filepath], {});
|
||||
if (info.code === 0) return this.parseFileInfo(info.stdout);
|
||||
}
|
||||
const info = await executeDirect('/usr/bin/file', ['-b', filepath], {});
|
||||
if (info.code === 0) return BinaryInfoLinux.parseFileInfo(info.stdout);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import * as fs from 'fs-extra';
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
@@ -79,9 +79,11 @@ export class BuildEnvSetupBase {
|
||||
let searchFor = arch as string;
|
||||
if (this.compiler.exe.includes('icpx')) {
|
||||
return arch === 'x86' || arch === 'x86_64';
|
||||
} else if (this.compiler.exe.includes('circle')) {
|
||||
}
|
||||
if (this.compiler.exe.includes('circle')) {
|
||||
return arch === 'x86' || arch === 'x86_64';
|
||||
} else if (this.compiler.group === 'icc') {
|
||||
}
|
||||
if (this.compiler.group === 'icc') {
|
||||
result = await execCompilerCached(this.compiler.exe, ['--help']);
|
||||
if (arch === 'x86') {
|
||||
searchFor = '-m32';
|
||||
@@ -91,9 +93,8 @@ export class BuildEnvSetupBase {
|
||||
} else if (this.compilerTypeOrGCC === 'gcc') {
|
||||
if (this.compiler.exe.includes('/icpx')) {
|
||||
return arch === 'x86' || arch === 'x86_64';
|
||||
} else {
|
||||
result = await execCompilerCached(this.compiler.exe, ['--target-help']);
|
||||
}
|
||||
result = await execCompilerCached(this.compiler.exe, ['--target-help']);
|
||||
} else if (this.compilerTypeOrGCC === 'clang') {
|
||||
const binpath = path.dirname(this.compiler.exe);
|
||||
const llc = path.join(binpath, 'llc');
|
||||
@@ -143,13 +144,11 @@ export class BuildEnvSetupBase {
|
||||
if (target && arch) {
|
||||
if (arch.length < target.length) {
|
||||
return arch;
|
||||
} else {
|
||||
}
|
||||
return target;
|
||||
}
|
||||
} else {
|
||||
if (target) return target;
|
||||
if (arch) return arch;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -158,7 +157,7 @@ export class BuildEnvSetupBase {
|
||||
const match = this.compiler.options.match(/-stdlib=(\S*)/i);
|
||||
if (match) {
|
||||
return match[1];
|
||||
} else {
|
||||
}
|
||||
const stdlibOption: string | undefined = _.find(key.options, option => {
|
||||
return option.startsWith('-stdlib=');
|
||||
});
|
||||
@@ -169,7 +168,6 @@ export class BuildEnvSetupBase {
|
||||
|
||||
return this.defaultLibCxx;
|
||||
}
|
||||
}
|
||||
|
||||
getTarget(key: CacheKey): string {
|
||||
if (!this.compilerSupportsX86) return '';
|
||||
@@ -177,7 +175,7 @@ export class BuildEnvSetupBase {
|
||||
|
||||
if (key.options.includes('-m32')) {
|
||||
return 'x86';
|
||||
} else {
|
||||
}
|
||||
const target: string | undefined = _.find(key.options, option => {
|
||||
return option.startsWith('-target=') || option.startsWith('--target=');
|
||||
});
|
||||
@@ -185,7 +183,6 @@ export class BuildEnvSetupBase {
|
||||
if (target) {
|
||||
return target.substring(target.indexOf('=') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return 'x86_64';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
@@ -61,17 +61,15 @@ export class BuildEnvSetupCeConanRustDirect extends BuildEnvSetupCeConanDirect {
|
||||
}
|
||||
|
||||
getArchFromTriple(triple: string) {
|
||||
if (triple && triple.split) {
|
||||
if (triple?.split) {
|
||||
const arr = triple.split('-');
|
||||
if (arr && arr[0]) {
|
||||
if (arr?.[0]) {
|
||||
return arr[0];
|
||||
} else {
|
||||
}
|
||||
return triple;
|
||||
}
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
override getTarget(key: CacheKey) {
|
||||
if (!this.compilerSupportsX86) return '';
|
||||
@@ -84,13 +82,12 @@ export class BuildEnvSetupCeConanRustDirect extends BuildEnvSetupCeConanDirect {
|
||||
if (target) {
|
||||
const triple = target.substring(target.indexOf('=') + 1);
|
||||
return this.getArchFromTriple(triple);
|
||||
} else {
|
||||
}
|
||||
const idx = key.options.indexOf('--target');
|
||||
if (idx !== -1) {
|
||||
const triple = key.options[idx + 1];
|
||||
return this.getArchFromTriple(triple);
|
||||
}
|
||||
}
|
||||
|
||||
return 'x86_64';
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import zlib from 'zlib';
|
||||
import path from 'node:path';
|
||||
import zlib from 'node:zlib';
|
||||
|
||||
import fs, {mkdirp} from 'fs-extra';
|
||||
import request from 'request';
|
||||
@@ -126,9 +126,8 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
if (this.extractAllToRoot) {
|
||||
const filename = path.basename(zippedPath);
|
||||
return path.join(downloadPath, filename);
|
||||
} else {
|
||||
return path.join(downloadPath, libId, zippedPath);
|
||||
}
|
||||
return path.join(downloadPath, libId, zippedPath);
|
||||
}
|
||||
|
||||
async downloadAndExtractPackage(
|
||||
@@ -245,11 +244,11 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
return _.all(buildProperties, (val, key) => {
|
||||
if ((key === 'compiler' || key === 'compiler.version') && elem.settings[key] === 'cshared') {
|
||||
return true;
|
||||
} else if (key === 'compiler.libcxx' && elem.settings['compiler'] === 'cshared') {
|
||||
return true;
|
||||
} else {
|
||||
return val === elem.settings[key];
|
||||
}
|
||||
if (key === 'compiler.libcxx' && elem.settings['compiler'] === 'cshared') {
|
||||
return true;
|
||||
}
|
||||
return val === elem.settings[key];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
4
lib/cache/from-config.ts
vendored
4
lib/cache/from-config.ts
vendored
@@ -32,8 +32,8 @@ import {OnDiskCache} from './on-disk.js';
|
||||
import {S3Cache} from './s3.js';
|
||||
|
||||
function paramInt(config: string, param: string): number {
|
||||
const result = parseInt(param);
|
||||
if (isNaN(result)) throw new Error(`Bad params: ${config}`);
|
||||
const result = Number.parseInt(param);
|
||||
if (Number.isNaN(result)) throw new Error(`Bad params: ${config}`);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
7
lib/cache/on-disk.ts
vendored
7
lib/cache/on-disk.ts
vendored
@@ -23,8 +23,8 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import {Buffer} from 'buffer';
|
||||
import crypto from 'crypto';
|
||||
import path from 'path';
|
||||
import crypto from 'node:crypto';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import {LRUCache} from 'lru-cache';
|
||||
@@ -85,11 +85,10 @@ export class OnDiskCache extends BaseCache {
|
||||
.filter(Boolean);
|
||||
|
||||
// Sort oldest first
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
||||
// @ts-ignore filter(Boolean) should have sufficed but doesn't
|
||||
info.sort((x, y) => x.sort - y.sort);
|
||||
for (const i of info) {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
this.cache.set(i.key, i.data);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ export class BaseCFGParser {
|
||||
public filterData(assembly: AssemblyLine[]) {
|
||||
const jmpLabelRegex = /\.L\d+:/;
|
||||
const isCode = (x: AssemblyLine) =>
|
||||
x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
x?.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
return this.filterTextSection(assembly).map(_.clone).filter(isCode);
|
||||
}
|
||||
|
||||
@@ -108,9 +108,12 @@ export class BaseCFGParser {
|
||||
let rangeBb: BBRange = {nameId: functionName, start: first, end: 0, actionPos: []};
|
||||
const result: BBRange[] = [];
|
||||
|
||||
const newRangeWith = function (oldRange: BBRange, nameId: string, start: number) {
|
||||
return {nameId: nameId, start: start, actionPos: [], end: oldRange.end};
|
||||
};
|
||||
const newRangeWith = (oldRange: BBRange, nameId: string, start: number) => ({
|
||||
nameId: nameId,
|
||||
start: start,
|
||||
actionPos: [],
|
||||
end: oldRange.end,
|
||||
});
|
||||
|
||||
while (first < last) {
|
||||
const inst = asmArr[first].text;
|
||||
@@ -194,12 +197,12 @@ export class BaseCFGParser {
|
||||
end: basicBlock.end,
|
||||
},
|
||||
];
|
||||
else if (actPosSz === 1)
|
||||
if (actPosSz === 1)
|
||||
return [
|
||||
{nameId: basicBlock.nameId, start: basicBlock.start, end: actionPos[0] + 1},
|
||||
{nameId: basicBlock.nameId + '@' + (actionPos[0] + 1), start: actionPos[0] + 1, end: basicBlock.end},
|
||||
];
|
||||
else {
|
||||
|
||||
let first = 0;
|
||||
const last = actPosSz;
|
||||
const blockName = basicBlock.nameId;
|
||||
@@ -219,7 +222,6 @@ export class BaseCFGParser {
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected concatInstructions(asmArr: AssemblyLine[], first: number, last: number) {
|
||||
return asmArr
|
||||
@@ -250,7 +252,7 @@ export class BaseCFGParser {
|
||||
return asm ? this.isBasicBlockEnd(asm.text, '') : false;
|
||||
};
|
||||
|
||||
const generateName = function (name: string, suffix: number) {
|
||||
const generateName = (name: string, suffix: number) => {
|
||||
const pos = name.indexOf('@');
|
||||
if (pos === -1) return `${name}@${suffix}`;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export class ClangCFGParser extends BaseCFGParser {
|
||||
override filterData(assembly: ResultLine[]) {
|
||||
const jmpLabelRegex = /\.LBB\d+_\d+:/;
|
||||
const isCode = (x: ResultLine) =>
|
||||
x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
x?.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
|
||||
const removeComments = (x: ResultLine) => {
|
||||
const pos_x86 = x.text.indexOf('# ');
|
||||
|
||||
@@ -36,7 +36,7 @@ export class GccCFGParser extends BaseCFGParser {
|
||||
override filterData(assembly: ResultLine[]) {
|
||||
const jmpLabelRegex = /\.L\d+:/;
|
||||
const isCode = (x: AssemblyLine) =>
|
||||
x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
x?.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
return this.filterTextSection(assembly).map(_.clone).filter(isCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ export class LlvmIrCfgParser extends BaseCFGParser {
|
||||
const result: BBRange[] = [];
|
||||
let i = fn.start + 1;
|
||||
let bbStart = i;
|
||||
let currentName: string = '';
|
||||
let currentName = '';
|
||||
let namePrefix: string = fnName + '\n\n';
|
||||
while (i < fn.end) {
|
||||
const match = code[i].text.match(this.labelRe);
|
||||
@@ -160,7 +160,8 @@ export class LlvmIrCfgParser extends BaseCFGParser {
|
||||
lastInst--;
|
||||
}
|
||||
return this.concatInstructions(asmArr, lastInst, end + 1);
|
||||
} else if (
|
||||
}
|
||||
if (
|
||||
lastInst >= 1 &&
|
||||
asmArr[lastInst].text.includes('unwind label') &&
|
||||
asmArr[lastInst - 1].text.trim().includes('invoke ')
|
||||
@@ -169,7 +170,8 @@ export class LlvmIrCfgParser extends BaseCFGParser {
|
||||
// invoke void @__cxa_throw(ptr nonnull %exception, ptr nonnull @typeinfo for int, ptr null) #3
|
||||
// to label %unreachable unwind label %lpad
|
||||
return this.concatInstructions(asmArr, lastInst - 1, lastInst + 1);
|
||||
} else if (
|
||||
}
|
||||
if (
|
||||
lastInst >= 1 &&
|
||||
asmArr[lastInst - 1].text.includes('landingpad') &&
|
||||
asmArr[lastInst].text.includes('catch')
|
||||
@@ -178,7 +180,8 @@ export class LlvmIrCfgParser extends BaseCFGParser {
|
||||
// %0 = landingpad { ptr, i32 }
|
||||
// catch ptr null
|
||||
return this.concatInstructions(asmArr, lastInst - 1, lastInst + 1);
|
||||
} else if (
|
||||
}
|
||||
if (
|
||||
lastInst >= 1 &&
|
||||
asmArr[lastInst - 1].text.includes('callbr') &&
|
||||
asmArr[lastInst].text.trim().startsWith('to label')
|
||||
@@ -187,9 +190,8 @@ export class LlvmIrCfgParser extends BaseCFGParser {
|
||||
// %2 = callbr i32 asm "mov ${1:l}, $0", "=r,!i,~{dirflag},~{fpsr},~{flags}"() #2
|
||||
// to label %asm.fallthrough1 [label %err.split2]
|
||||
return this.concatInstructions(asmArr, lastInst - 1, lastInst + 1);
|
||||
} else {
|
||||
return asmArr[lastInst].text;
|
||||
}
|
||||
return asmArr[lastInst].text;
|
||||
})();
|
||||
let terminator;
|
||||
if (terminatingInstruction.includes('invoke ')) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import {EdgeColor} from '../../../types/compilation/cfg.interfaces.js';
|
||||
import {logger} from '../../logger.js';
|
||||
import {BaseInstructionSetInfo, InstructionType} from '../instruction-sets/base.js';
|
||||
|
||||
import {AssemblyLine, BaseCFGParser, BBRange, CanonicalBB, Edge, Range} from './base.js';
|
||||
import {AssemblyLine, BBRange, BaseCFGParser, CanonicalBB, Edge, Range} from './base.js';
|
||||
|
||||
// This currently only covers the default arm64 output. To support dex2oat's
|
||||
// other ISAs, we just need to make sure the correct isJmpInstruction() is being
|
||||
@@ -153,14 +153,12 @@ export class OatCFGParser extends BaseCFGParser {
|
||||
actionPos: [],
|
||||
};
|
||||
|
||||
const newRangeWith = function (oldRange: BBRange, nameId: string, start: number) {
|
||||
return {
|
||||
const newRangeWith = (oldRange: BBRange, nameId: string, start: number) => ({
|
||||
nameId: nameId,
|
||||
start: start,
|
||||
actionPos: [],
|
||||
end: oldRange.end,
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
const result: BBRange[] = [];
|
||||
while (first < last) {
|
||||
@@ -212,7 +210,7 @@ export class OatCFGParser extends BaseCFGParser {
|
||||
end: basicBlock.end,
|
||||
},
|
||||
];
|
||||
else if (actPosSz === 1)
|
||||
if (actPosSz === 1)
|
||||
return [
|
||||
{nameId: basicBlock.nameId, start: basicBlock.start, end: actionPos[0] + 1},
|
||||
{
|
||||
@@ -221,7 +219,7 @@ export class OatCFGParser extends BaseCFGParser {
|
||||
end: basicBlock.end,
|
||||
},
|
||||
];
|
||||
else {
|
||||
|
||||
let first = 0;
|
||||
const last = actPosSz;
|
||||
const blockName = basicBlock.nameId;
|
||||
@@ -245,7 +243,6 @@ export class OatCFGParser extends BaseCFGParser {
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
override makeEdges(asmArr: AssemblyLine[], arrOfCanonicalBasicBlock: CanonicalBB[]) {
|
||||
const edges: Edge[] = [];
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
import type {CompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
import {AssemblyLine, Edge, getParserByKey, Node} from './cfg-parsers/index.js';
|
||||
import {AssemblyLine, Edge, Node, getParserByKey} from './cfg-parsers/index.js';
|
||||
import {OatCFGParser} from './cfg-parsers/oat.js';
|
||||
import {getInstructionSetByKey} from './instruction-sets/index.js';
|
||||
|
||||
@@ -60,8 +60,7 @@ export function generateStructure(compilerInfo: CompilerInfo, asmArr: AssemblyLi
|
||||
|
||||
// dex2oat is a special case because it can output different instruction
|
||||
// sets. Create an OAT parser instead of searching by ISA.
|
||||
const parser =
|
||||
compilerGroup && compilerGroup.includes('dex2oat')
|
||||
const parser = compilerGroup?.includes('dex2oat')
|
||||
? new OatCFGParser(instructionSet)
|
||||
: new (getParserByKey(compilerGroup))(instructionSet);
|
||||
|
||||
|
||||
@@ -63,24 +63,24 @@ export class ArmInstructionSetInfo extends BaseInstructionSetInfo {
|
||||
`b\\.?${ArmInstructionSetInfo.conditions}(?:\\.w)?`,
|
||||
`bx${ArmInstructionSetInfo.conditions}`,
|
||||
`bxj${ArmInstructionSetInfo.conditions}`,
|
||||
`cbz`,
|
||||
`cbnz`,
|
||||
`tbz`,
|
||||
`tbnz`,
|
||||
'cbz',
|
||||
'cbnz',
|
||||
'tbz',
|
||||
'tbnz',
|
||||
]
|
||||
.map(re => `(?:${re})`)
|
||||
.join('|') +
|
||||
')\\b',
|
||||
);
|
||||
static unconditionalJumps = new RegExp(
|
||||
'\\b(?:' + [`b(?:\\.w)?`, `bx`, `bxj`].map(re => `(?:${re})`).join('|') + ')\\b',
|
||||
'\\b(?:' + ['b(?:\\.w)?', 'bx', 'bxj'].map(re => `(?:${re})`).join('|') + ')\\b',
|
||||
);
|
||||
static returnInstruction = new RegExp(
|
||||
'(?:' +
|
||||
[`bx`, `ret`].map(re => `(?:${re})`).join('|') +
|
||||
['bx', 'ret'].map(re => `(?:${re})`).join('|') +
|
||||
')\\b.*' +
|
||||
`|pop\\s*\\{(?:r(?:\\d{2,}|[4-9]),\\s*)*pc\\}.*` +
|
||||
`|mov\\s*pc\\s*,.*`,
|
||||
'|pop\\s*\\{(?:r(?:\\d{2,}|[4-9]),\\s*)*pc\\}.*' +
|
||||
'|mov\\s*pc\\s*,.*',
|
||||
);
|
||||
|
||||
static override get key(): InstructionSet[] {
|
||||
@@ -97,11 +97,10 @@ export class ArmInstructionSetInfo extends BaseInstructionSetInfo {
|
||||
override getInstructionType(instruction: string) {
|
||||
const opcode = instruction.trim().split(' ')[0].toLowerCase();
|
||||
if (ArmInstructionSetInfo.conditionalJumps.test(opcode)) return InstructionType.conditionalJmpInst;
|
||||
else if (ArmInstructionSetInfo.unconditionalJumps.test(opcode)) return InstructionType.jmp;
|
||||
else if (ArmInstructionSetInfo.returnInstruction.test(instruction.trim().toLocaleLowerCase())) {
|
||||
if (ArmInstructionSetInfo.unconditionalJumps.test(opcode)) return InstructionType.jmp;
|
||||
if (ArmInstructionSetInfo.returnInstruction.test(instruction.trim().toLocaleLowerCase())) {
|
||||
return InstructionType.retInst;
|
||||
} else {
|
||||
}
|
||||
return InstructionType.notRetInst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
import {InstructionSet} from '../../../types/instructionsets.js';
|
||||
|
||||
export enum InstructionType {
|
||||
jmp,
|
||||
conditionalJmpInst,
|
||||
notRetInst,
|
||||
retInst,
|
||||
jmp = 0,
|
||||
conditionalJmpInst = 1,
|
||||
notRetInst = 2,
|
||||
retInst = 3,
|
||||
}
|
||||
|
||||
export class BaseInstructionSetInfo {
|
||||
@@ -46,11 +46,10 @@ export class BaseInstructionSetInfo {
|
||||
|
||||
getInstructionType(inst: string) {
|
||||
if (inst.includes('jmp') || inst.includes(' b ')) return InstructionType.jmp;
|
||||
else if (this.isJmpInstruction(inst)) return InstructionType.conditionalJmpInst;
|
||||
else if (inst.includes(' ret')) {
|
||||
if (this.isJmpInstruction(inst)) return InstructionType.conditionalJmpInst;
|
||||
if (inst.includes(' ret')) {
|
||||
return InstructionType.retInst;
|
||||
} else {
|
||||
}
|
||||
return InstructionType.notRetInst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,9 +378,8 @@ class GoldenLayoutComponents {
|
||||
filename: session.filename,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return editor;
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
|
||||
createTreeComponent(tree: ClientStateTree, customTreeId?: number): GoldenLayoutComponentStruct {
|
||||
@@ -885,13 +884,12 @@ export class ClientStateGoldenifier extends GoldenLayoutComponents {
|
||||
createSourceContentArray(state: ClientState, leftSession: number, rightSession: number): BasicGoldenLayoutStruct[] {
|
||||
if (leftSession === rightSession) {
|
||||
return [this.createPresentationModeComponents(state.sessions[leftSession], 1, 100)];
|
||||
} else {
|
||||
}
|
||||
return [
|
||||
this.createPresentationModeComponents(state.sessions[leftSession], 1),
|
||||
this.createPresentationModeComponents(state.sessions[rightSession], 2),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
getPresentationModeEmptyLayout() {
|
||||
return {
|
||||
|
||||
@@ -121,7 +121,7 @@ export class ClientStateCompiler {
|
||||
export class ClientStateExecutor {
|
||||
compilerVisible = false;
|
||||
compilerOutputVisible = false;
|
||||
arguments: string = '';
|
||||
arguments = '';
|
||||
argumentsVisible = false;
|
||||
stdin = '';
|
||||
stdinVisible = false;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import child_process from 'child_process';
|
||||
import child_process from 'node:child_process';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -39,7 +39,7 @@ import {FormattingService} from './formatting-service.js';
|
||||
import {logger} from './logger.js';
|
||||
import type {PropertyGetter} from './properties.interfaces.js';
|
||||
import {CompilerProps, PropFunc} from './properties.js';
|
||||
import {createStatsNoter, IStatsNoter} from './stats.js';
|
||||
import {IStatsNoter, createStatsNoter} from './stats.js';
|
||||
|
||||
export class CompilationEnvironment {
|
||||
ceProps: PropertyGetter;
|
||||
@@ -146,7 +146,7 @@ export class CompilationEnvironment {
|
||||
const key = BaseCache.hash(object);
|
||||
const result = await this.compilerCache.get(key);
|
||||
if (this.logCompilerCacheAccesses) {
|
||||
logger.info(`hash ${key} (${(object && object['compiler']) || '???'}) ${result.hit ? 'hit' : 'miss'}`);
|
||||
logger.info(`hash ${key} (${object?.['compiler'] || '???'}) ${result.hit ? 'hit' : 'miss'}`);
|
||||
logger.debug(`Cache get ${JSON.stringify(object)}`);
|
||||
}
|
||||
if (!result.hit) return null;
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
||||
import {executionAsyncId} from 'async_hooks';
|
||||
import {executionAsyncId} from 'node:async_hooks';
|
||||
|
||||
import {default as Queue} from 'p-queue';
|
||||
import PromClient from 'prom-client';
|
||||
@@ -90,7 +89,7 @@ export class CompilationQueue {
|
||||
() => {
|
||||
const dequeuedAt = Date.now();
|
||||
queueDequeued.inc();
|
||||
if (options && options.abandonIfStale && dequeuedAt > enqueuedAt + this._staleAfterMs) {
|
||||
if (options?.abandonIfStale && dequeuedAt > enqueuedAt + this._staleAfterMs) {
|
||||
queueCompleted.inc();
|
||||
queueStale.inc();
|
||||
const queueTimeSecs = (dequeuedAt - enqueuedAt) / 1000;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -124,15 +124,20 @@ export class CompilerArguments implements ICompilerArguments {
|
||||
// prefer optimization flags or standard if statistics are not available
|
||||
if (a[1].description.includes('optimization')) {
|
||||
return -1;
|
||||
} else if (b[1].description.includes('optimization')) {
|
||||
}
|
||||
if (b[1].description.includes('optimization')) {
|
||||
return 1;
|
||||
} else if (a[1].description.includes('optimize')) {
|
||||
}
|
||||
if (a[1].description.includes('optimize')) {
|
||||
return -1;
|
||||
} else if (b[1].description.includes('optimize')) {
|
||||
}
|
||||
if (b[1].description.includes('optimize')) {
|
||||
return 1;
|
||||
} else if (a[1].description.includes('std')) {
|
||||
}
|
||||
if (a[1].description.includes('std')) {
|
||||
return -1;
|
||||
} else if (b[1].description.includes('std')) {
|
||||
}
|
||||
if (b[1].description.includes('std')) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
import path from 'path';
|
||||
import {promisify} from 'util';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import path from 'node:path';
|
||||
import {promisify} from 'node:util';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -358,7 +358,7 @@ export class CompilerFinder {
|
||||
const pathParts = bits[1].split('/');
|
||||
return {
|
||||
host: bits[0],
|
||||
port: parseInt(unwrap(pathParts.shift())),
|
||||
port: Number.parseInt(unwrap(pathParts.shift())),
|
||||
uriBase: pathParts.join('/'),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {splitArguments} from '../../shared/common-utils.js';
|
||||
import type {ConfiguredOverrides} from '../../types/compilation/compiler-overrides.interfaces.js';
|
||||
@@ -72,13 +72,13 @@ export class AdaCompiler extends BaseCompiler {
|
||||
// - "foo.o" may be used by intermediary file, so "-o foo.o" will not
|
||||
// work if building an executable.
|
||||
|
||||
if (key && key.filters && key.filters.binary) {
|
||||
if (key?.filters?.binary) {
|
||||
return path.join(dirPath, 'example');
|
||||
} else if (key && key.filters && key.filters.binaryObject) {
|
||||
return path.join(dirPath, 'example.o');
|
||||
} else {
|
||||
return path.join(dirPath, 'example.s');
|
||||
}
|
||||
if (key?.filters?.binaryObject) {
|
||||
return path.join(dirPath, 'example.o');
|
||||
}
|
||||
return path.join(dirPath, 'example.s');
|
||||
}
|
||||
|
||||
override prepareArguments(
|
||||
@@ -174,13 +174,16 @@ export class AdaCompiler extends BaseCompiler {
|
||||
if (a === '-cargs') {
|
||||
part = 1;
|
||||
continue;
|
||||
} else if (a === '-largs') {
|
||||
}
|
||||
if (a === '-largs') {
|
||||
part = 2;
|
||||
continue;
|
||||
} else if (a === '-bargs') {
|
||||
}
|
||||
if (a === '-bargs') {
|
||||
part = 3;
|
||||
continue;
|
||||
} else if (a === '-margs') {
|
||||
}
|
||||
if (a === '-margs') {
|
||||
part = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import process from 'process';
|
||||
import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
|
||||
import * as Sentry from '@sentry/node';
|
||||
import fs from 'fs-extra';
|
||||
@@ -59,7 +59,7 @@ export class BaseParser {
|
||||
}
|
||||
|
||||
static getExampleFilepath(): string {
|
||||
let filename = path.join(this.getExamplesRoot(), this.getDefaultExampleFilename());
|
||||
let filename = path.join(BaseParser.getExamplesRoot(), BaseParser.getDefaultExampleFilename());
|
||||
if (!path.isAbsolute(filename)) filename = path.join(process.cwd(), filename);
|
||||
|
||||
return filename;
|
||||
@@ -71,18 +71,19 @@ export class BaseParser {
|
||||
|
||||
utils.eachLine(stdout, line => {
|
||||
const match1 = line.match(optionWithDescRegex);
|
||||
if (match1 && match1[1] && match1[2]) {
|
||||
if (match1?.[1] && match1[2]) {
|
||||
previousOption = match1[1].trim();
|
||||
if (previousOption) {
|
||||
options[previousOption] = {
|
||||
description: this.spaceCompress(match1[2].trim()),
|
||||
description: BaseParser.spaceCompress(match1[2].trim()),
|
||||
timesused: 0,
|
||||
};
|
||||
}
|
||||
return;
|
||||
} else if (optionWithoutDescRegex) {
|
||||
}
|
||||
if (optionWithoutDescRegex) {
|
||||
const match2 = line.match(optionWithoutDescRegex);
|
||||
if (match2 && match2[1]) {
|
||||
if (match2?.[1]) {
|
||||
previousOption = match2[1].trim();
|
||||
|
||||
if (previousOption) {
|
||||
@@ -107,7 +108,7 @@ export class BaseParser {
|
||||
}
|
||||
}
|
||||
|
||||
options[previousOption].description = this.spaceCompress(options[previousOption].description);
|
||||
options[previousOption].description = BaseParser.spaceCompress(options[previousOption].description);
|
||||
} else {
|
||||
previousOption = false;
|
||||
}
|
||||
@@ -134,11 +135,11 @@ export class BaseParser {
|
||||
}
|
||||
|
||||
static async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const optionFinder1 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) +(.*)/i;
|
||||
const optionFinder1 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) {2,}(.*)/i;
|
||||
const optionFinder2 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, [helpArg]);
|
||||
const options =
|
||||
result.code === 0 ? this.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2) : {};
|
||||
result.code === 0 ? BaseParser.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2) : {};
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -166,21 +167,21 @@ export class GCCParser extends BaseParser {
|
||||
static override async setCompilerSettingsFromOptions(compiler: BaseCompiler, options: Record<string, Argument>) {
|
||||
const keys = _.keys(options);
|
||||
logger.debug(`gcc-like compiler options: ${keys.join(' ')}`);
|
||||
if (this.hasSupport(options, '-masm=')) {
|
||||
await this.checkAndSetMasmIntelIfSupported(compiler);
|
||||
if (GCCParser.hasSupport(options, '-masm=')) {
|
||||
await GCCParser.checkAndSetMasmIntelIfSupported(compiler);
|
||||
}
|
||||
if (this.hasSupport(options, '-fstack-usage')) {
|
||||
if (GCCParser.hasSupport(options, '-fstack-usage')) {
|
||||
compiler.compiler.stackUsageArg = '-fstack-usage';
|
||||
compiler.compiler.supportsStackUsageOutput = true;
|
||||
}
|
||||
if (this.hasSupport(options, '-fdiagnostics-color')) {
|
||||
if (GCCParser.hasSupport(options, '-fdiagnostics-color')) {
|
||||
if (compiler.compiler.options) compiler.compiler.options += ' ';
|
||||
compiler.compiler.options += '-fdiagnostics-color=always';
|
||||
}
|
||||
if (this.hasSupport(options, '-fverbose-asm')) {
|
||||
if (GCCParser.hasSupport(options, '-fverbose-asm')) {
|
||||
compiler.compiler.supportsVerboseAsm = true;
|
||||
}
|
||||
if (this.hasSupport(options, '-fopt-info')) {
|
||||
if (GCCParser.hasSupport(options, '-fopt-info')) {
|
||||
compiler.compiler.optArg = '-fopt-info-all';
|
||||
compiler.compiler.supportsOptOutput = true;
|
||||
}
|
||||
@@ -193,22 +194,22 @@ export class GCCParser extends BaseParser {
|
||||
// not produce anything.
|
||||
compiler.compiler.removeEmptyGccDump = true;
|
||||
}
|
||||
if (this.hasSupportStartsWith(options, '-march=')) compiler.compiler.supportsMarch = true;
|
||||
if (this.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (this.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
if (GCCParser.hasSupportStartsWith(options, '-march=')) compiler.compiler.supportsMarch = true;
|
||||
if (GCCParser.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (GCCParser.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
}
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([
|
||||
this.getOptions(compiler, '-fsyntax-only --help'),
|
||||
this.getOptions(compiler, '-fsyntax-only --target-help'),
|
||||
this.getOptions(compiler, '-fsyntax-only --help=common'),
|
||||
this.getOptions(compiler, '-fsyntax-only --help=warnings'),
|
||||
this.getOptions(compiler, '-fsyntax-only --help=optimizers'),
|
||||
this.getOptions(compiler, '-fsyntax-only --help=target'),
|
||||
GCCParser.getOptions(compiler, '-fsyntax-only --help'),
|
||||
GCCParser.getOptions(compiler, '-fsyntax-only --target-help'),
|
||||
GCCParser.getOptions(compiler, '-fsyntax-only --help=common'),
|
||||
GCCParser.getOptions(compiler, '-fsyntax-only --help=warnings'),
|
||||
GCCParser.getOptions(compiler, '-fsyntax-only --help=optimizers'),
|
||||
GCCParser.getOptions(compiler, '-fsyntax-only --help=target'),
|
||||
]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await GCCParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@@ -218,9 +219,8 @@ export class GCCParser extends BaseParser {
|
||||
const match = result.stdout.match(re);
|
||||
if (match) {
|
||||
return match[1].split(' ');
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
static getLanguageSpecificHelpFlags(): string[] {
|
||||
@@ -229,7 +229,7 @@ export class GCCParser extends BaseParser {
|
||||
|
||||
static override async getPossibleStdvers(compiler: BaseCompiler): Promise<CompilerOverrideOptions> {
|
||||
const possible: CompilerOverrideOptions = [];
|
||||
const options = await this.getOptionsStrict(compiler, this.getLanguageSpecificHelpFlags());
|
||||
const options = await GCCParser.getOptionsStrict(compiler, GCCParser.getLanguageSpecificHelpFlags());
|
||||
for (const opt in options) {
|
||||
if (opt.startsWith('-std=') && !options[opt].description?.startsWith('Deprecated')) {
|
||||
const stdver = opt.substring(5);
|
||||
@@ -243,11 +243,11 @@ export class GCCParser extends BaseParser {
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const optionFinder1 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) +(.*)/i;
|
||||
const optionFinder1 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) {2,}(.*)/i;
|
||||
const optionFinder2 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArg.split(' '));
|
||||
const options =
|
||||
result.code === 0 ? this.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2) : {};
|
||||
result.code === 0 ? GCCParser.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2) : {};
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ export class GCCParser extends BaseParser {
|
||||
static async getOptionsStrict(compiler: BaseCompiler, helpArgs: string[]) {
|
||||
const optionFinder = /^ {2}(--?[\d+,<=>[\]a-z|-]*) *(.*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArgs);
|
||||
return result.code === 0 ? this.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
return result.code === 0 ? GCCParser.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,51 +270,52 @@ export class ClangParser extends BaseParser {
|
||||
logger.error(`compiler options appear empty for ${compiler.compiler.id}`);
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '-fsave-optimization-record')) {
|
||||
if (ClangParser.hasSupport(options, '-fsave-optimization-record')) {
|
||||
compiler.compiler.optArg = '-fsave-optimization-record';
|
||||
compiler.compiler.supportsOptOutput = true;
|
||||
}
|
||||
if (this.hasSupport(options, '-fstack-usage')) {
|
||||
if (ClangParser.hasSupport(options, '-fstack-usage')) {
|
||||
compiler.compiler.stackUsageArg = '-fstack-usage';
|
||||
compiler.compiler.supportsStackUsageOutput = true;
|
||||
}
|
||||
if (this.hasSupport(options, '-fverbose-asm')) {
|
||||
if (ClangParser.hasSupport(options, '-fverbose-asm')) {
|
||||
compiler.compiler.supportsVerboseAsm = true;
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '-emit-llvm')) {
|
||||
if (ClangParser.hasSupport(options, '-emit-llvm')) {
|
||||
compiler.compiler.supportsIrView = true;
|
||||
compiler.compiler.irArg = ['-Xclang', '-emit-llvm', '-fsyntax-only'];
|
||||
compiler.compiler.minIrArgs = ['-emit-llvm'];
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '-emit-cir')) {
|
||||
if (ClangParser.hasSupport(options, '-emit-cir')) {
|
||||
compiler.compiler.supportsClangirView = true;
|
||||
}
|
||||
|
||||
if (
|
||||
this.hasSupport(options, '-mllvm') &&
|
||||
this.mllvmOptions.has('--print-before-all') &&
|
||||
this.mllvmOptions.has('--print-after-all')
|
||||
ClangParser.hasSupport(options, '-mllvm') &&
|
||||
ClangParser.mllvmOptions.has('--print-before-all') &&
|
||||
ClangParser.mllvmOptions.has('--print-after-all')
|
||||
) {
|
||||
compiler.compiler.optPipeline = {
|
||||
arg: ['-mllvm', '--print-before-all', '-mllvm', '--print-after-all'],
|
||||
moduleScopeArg: [],
|
||||
noDiscardValueNamesArg: [],
|
||||
};
|
||||
if (this.mllvmOptions.has('--print-module-scope')) {
|
||||
if (ClangParser.mllvmOptions.has('--print-module-scope')) {
|
||||
compiler.compiler.optPipeline.moduleScopeArg = ['-mllvm', '-print-module-scope'];
|
||||
}
|
||||
if (this.hasSupport(options, '-fno-discard-value-names')) {
|
||||
if (ClangParser.hasSupport(options, '-fno-discard-value-names')) {
|
||||
compiler.compiler.optPipeline.noDiscardValueNamesArg = ['-fno-discard-value-names'];
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '-fcolor-diagnostics')) compiler.compiler.options += ' -fcolor-diagnostics';
|
||||
if (this.hasSupport(options, '-fno-crash-diagnostics')) compiler.compiler.options += ' -fno-crash-diagnostics';
|
||||
if (ClangParser.hasSupport(options, '-fcolor-diagnostics')) compiler.compiler.options += ' -fcolor-diagnostics';
|
||||
if (ClangParser.hasSupport(options, '-fno-crash-diagnostics'))
|
||||
compiler.compiler.options += ' -fno-crash-diagnostics';
|
||||
|
||||
if (this.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (this.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
if (ClangParser.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (ClangParser.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
}
|
||||
|
||||
static getMainHelpOptions(): string[] {
|
||||
@@ -335,14 +336,21 @@ export class ClangParser extends BaseParser {
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
try {
|
||||
const options = await this.getOptions(compiler, this.getMainHelpOptions().join(' '));
|
||||
const options = await ClangParser.getOptions(compiler, ClangParser.getMainHelpOptions().join(' '));
|
||||
|
||||
const filename = this.getExampleFilepath();
|
||||
const filename = ClangParser.getExampleFilepath();
|
||||
|
||||
this.mllvmOptions = new Set(
|
||||
_.keys(await this.getOptions(compiler, this.getHiddenHelpOptions(filename).join(' '), false, true)),
|
||||
ClangParser.mllvmOptions = new Set(
|
||||
_.keys(
|
||||
await ClangParser.getOptions(
|
||||
compiler,
|
||||
ClangParser.getHiddenHelpOptions(filename).join(' '),
|
||||
false,
|
||||
true,
|
||||
),
|
||||
),
|
||||
);
|
||||
this.setCompilerSettingsFromOptions(compiler, options);
|
||||
ClangParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
} catch (error) {
|
||||
const err = `Error while trying to generate llvm backend arguments for ${compiler.compiler.id}: ${error}`;
|
||||
logger.error(err);
|
||||
@@ -377,22 +385,22 @@ export class ClangParser extends BaseParser {
|
||||
const re4 = /note: use '([\w+:]*)', '([\w+:]*)', '([\w+:]*)', or '([\w+:]*)' for '(.*)' standard/;
|
||||
for (const line of lines) {
|
||||
let match = line.match(re1);
|
||||
let stdvers = this.getRegexMatchesAsStdver(match, 2);
|
||||
let stdvers = ClangParser.getRegexMatchesAsStdver(match, 2);
|
||||
possible.push(...stdvers);
|
||||
if (stdvers.length > 0) continue;
|
||||
|
||||
match = line.match(re2);
|
||||
stdvers = this.getRegexMatchesAsStdver(match, 3);
|
||||
stdvers = ClangParser.getRegexMatchesAsStdver(match, 3);
|
||||
possible.push(...stdvers);
|
||||
if (stdvers.length > 0) continue;
|
||||
|
||||
match = line.match(re3);
|
||||
stdvers = this.getRegexMatchesAsStdver(match, 4);
|
||||
stdvers = ClangParser.getRegexMatchesAsStdver(match, 4);
|
||||
possible.push(...stdvers);
|
||||
if (stdvers.length > 0) continue;
|
||||
|
||||
match = line.match(re4);
|
||||
stdvers = this.getRegexMatchesAsStdver(match, 5);
|
||||
stdvers = ClangParser.getRegexMatchesAsStdver(match, 5);
|
||||
possible.push(...stdvers);
|
||||
}
|
||||
return possible;
|
||||
@@ -402,16 +410,20 @@ export class ClangParser extends BaseParser {
|
||||
let possible: CompilerOverrideOptions = [];
|
||||
|
||||
// clang doesn't have a --help option to get the std versions, we'll have to compile with a fictional stdversion to coax a response
|
||||
const filename = this.getExampleFilepath();
|
||||
const filename = ClangParser.getExampleFilepath();
|
||||
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, this.getStdVersHelpOptions(filename), {
|
||||
const result = await compiler.execCompilerCached(
|
||||
compiler.compiler.exe,
|
||||
ClangParser.getStdVersHelpOptions(filename),
|
||||
{
|
||||
...compiler.getDefaultExecOptions(),
|
||||
createAndUseTempDir: true,
|
||||
});
|
||||
},
|
||||
);
|
||||
if (result.stderr) {
|
||||
const lines = utils.splitLines(result.stderr);
|
||||
|
||||
possible = this.extractPossibleStdvers(lines);
|
||||
possible = ClangParser.extractPossibleStdvers(lines);
|
||||
possible.sort((a, b) => {
|
||||
return a.value === b.value ? 0 : a.value > b.value ? 1 : -1;
|
||||
});
|
||||
@@ -427,16 +439,15 @@ export class ClangParser extends BaseParser {
|
||||
const match = line.match(re);
|
||||
if (match) {
|
||||
return match[1];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.filter(Boolean) as string[];
|
||||
}
|
||||
|
||||
static override async getPossibleTargets(compiler: BaseCompiler): Promise<string[]> {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, this.getTargetsHelpOptions());
|
||||
return this.extractPossibleTargets(utils.splitLines(result.stdout));
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, ClangParser.getTargetsHelpOptions());
|
||||
return ClangParser.extractPossibleTargets(utils.splitLines(result.stdout));
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string, populate = true, isolate = false) {
|
||||
@@ -447,7 +458,7 @@ export class ClangParser extends BaseParser {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArg.split(' '), execOptions);
|
||||
const options =
|
||||
result.code === 0
|
||||
? this.parseLines(result.stdout + result.stderr, optionFinderWithDesc, optionFinderWithoutDesc)
|
||||
? ClangParser.parseLines(result.stdout + result.stderr, optionFinderWithDesc, optionFinderWithoutDesc)
|
||||
: {};
|
||||
if (populate) compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
@@ -496,10 +507,10 @@ export class ClangCParser extends ClangParser {
|
||||
|
||||
export class CircleParser extends ClangParser {
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const optionFinder1 = /^ +(--?[\w#,.<=>[\]|-]*) +- (.*)/i;
|
||||
const optionFinder1 = /^ +(--?[\w#,.<=>[\]|-]*) {2,}- (.*)/i;
|
||||
const optionFinder2 = /^ +(--?[\w#,.<=>[\]|-]*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArg.split(' '));
|
||||
const options = result.code === 0 ? this.parseLines(result.stdout, optionFinder1, optionFinder2) : {};
|
||||
const options = result.code === 0 ? CircleParser.parseLines(result.stdout, optionFinder1, optionFinder2) : {};
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -513,7 +524,8 @@ export class CircleParser extends ClangParser {
|
||||
if (!isInStdVerSection && line.startsWith(' --std=')) {
|
||||
isInStdVerSection = true;
|
||||
continue;
|
||||
} else if (isInStdVerSection && line.startsWith(' --')) {
|
||||
}
|
||||
if (isInStdVerSection && line.startsWith(' --')) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -535,44 +547,44 @@ export class CircleParser extends ClangParser {
|
||||
|
||||
export class LDCParser extends BaseParser {
|
||||
static override async setCompilerSettingsFromOptions(compiler: BaseCompiler, options: Record<string, Argument>) {
|
||||
if (this.hasSupport(options, '--fsave-optimization-record')) {
|
||||
if (LDCParser.hasSupport(options, '--fsave-optimization-record')) {
|
||||
compiler.compiler.optArg = '--fsave-optimization-record';
|
||||
compiler.compiler.supportsOptOutput = true;
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '-fverbose-asm')) {
|
||||
if (LDCParser.hasSupport(options, '-fverbose-asm')) {
|
||||
compiler.compiler.supportsVerboseAsm = true;
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '--print-before-all') && this.hasSupport(options, '--print-after-all')) {
|
||||
if (LDCParser.hasSupport(options, '--print-before-all') && LDCParser.hasSupport(options, '--print-after-all')) {
|
||||
compiler.compiler.optPipeline = {
|
||||
arg: ['--print-before-all', '--print-after-all'],
|
||||
moduleScopeArg: [],
|
||||
noDiscardValueNamesArg: [],
|
||||
};
|
||||
if (this.hasSupport(options, '--print-module-scope')) {
|
||||
if (LDCParser.hasSupport(options, '--print-module-scope')) {
|
||||
compiler.compiler.optPipeline.moduleScopeArg = ['--print-module-scope'];
|
||||
}
|
||||
if (this.hasSupport(options, '--fno-discard-value-names')) {
|
||||
if (LDCParser.hasSupport(options, '--fno-discard-value-names')) {
|
||||
compiler.compiler.optPipeline.noDiscardValueNamesArg = ['--fno-discard-value-names'];
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasSupport(options, '--enable-color')) {
|
||||
if (LDCParser.hasSupport(options, '--enable-color')) {
|
||||
compiler.compiler.options += ' --enable-color';
|
||||
}
|
||||
}
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const options = await this.getOptions(compiler, '--help-hidden');
|
||||
this.setCompilerSettingsFromOptions(compiler, options);
|
||||
const options = await LDCParser.getOptions(compiler, '--help-hidden');
|
||||
LDCParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string, populate = true) {
|
||||
const optionFinder = /^\s*(--?[\d+,<=>[\]a-z|-]*)\s*(.*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArg.split(' '));
|
||||
const options = result.code === 0 ? this.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
const options = result.code === 0 ? LDCParser.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
if (populate) {
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
}
|
||||
@@ -582,21 +594,21 @@ export class LDCParser extends BaseParser {
|
||||
|
||||
export class ElixirParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '--help');
|
||||
await ElixirParser.getOptions(compiler, '--help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class ErlangParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await ErlangParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class PascalParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await PascalParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
@@ -604,11 +616,11 @@ export class PascalParser extends BaseParser {
|
||||
export class ICCParser extends GCCParser {
|
||||
static override async setCompilerSettingsFromOptions(compiler: BaseCompiler, options: Record<string, Argument>) {
|
||||
const keys = _.keys(options);
|
||||
if (this.hasSupport(options, '-masm=')) {
|
||||
if (ICCParser.hasSupport(options, '-masm=')) {
|
||||
compiler.compiler.intelAsm = '-masm=intel';
|
||||
compiler.compiler.supportsIntel = true;
|
||||
}
|
||||
if (this.hasSupport(options, '-fdiagnostics-color')) {
|
||||
if (ICCParser.hasSupport(options, '-fdiagnostics-color')) {
|
||||
if (compiler.compiler.options) compiler.compiler.options += ' ';
|
||||
compiler.compiler.options += '-fdiagnostics-color=always';
|
||||
}
|
||||
@@ -616,9 +628,9 @@ export class ICCParser extends GCCParser {
|
||||
compiler.compiler.supportsGccDump = true;
|
||||
compiler.compiler.removeEmptyGccDump = true;
|
||||
}
|
||||
if (this.hasSupportStartsWith(options, '-march=')) compiler.compiler.supportsMarch = true;
|
||||
if (this.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (this.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
if (ICCParser.hasSupportStartsWith(options, '-march=')) compiler.compiler.supportsMarch = true;
|
||||
if (ICCParser.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (ICCParser.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
}
|
||||
|
||||
static extractPossibleStdvers(lines: string[]): CompilerOverrideOptions {
|
||||
@@ -658,35 +670,35 @@ export class ICCParser extends GCCParser {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, ['--help']);
|
||||
const lines = utils.splitLines(result.stdout);
|
||||
|
||||
return this.extractPossibleStdvers(lines);
|
||||
return ICCParser.extractPossibleStdvers(lines);
|
||||
}
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([this.getOptions(compiler, '-fsyntax-only --help')]);
|
||||
const results = await Promise.all([ICCParser.getOptions(compiler, '-fsyntax-only --help')]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await ICCParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class ISPCParser extends BaseParser {
|
||||
static override async setCompilerSettingsFromOptions(compiler: BaseCompiler, options: Record<string, Argument>) {
|
||||
if (this.hasSupport(options, '--x86-asm-syntax')) {
|
||||
if (ISPCParser.hasSupport(options, '--x86-asm-syntax')) {
|
||||
compiler.compiler.intelAsm = '--x86-asm-syntax=intel';
|
||||
compiler.compiler.supportsIntel = true;
|
||||
}
|
||||
}
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const options = await this.getOptions(compiler, '--help');
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
const options = await ISPCParser.getOptions(compiler, '--help');
|
||||
await ISPCParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, [helpArg]);
|
||||
const optionFinder = /^\s*\[(--?[\d\s()+,/<=>a-z{|}-]*)]\s*(.*)/i;
|
||||
const options = result.code === 0 ? this.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
const options = result.code === 0 ? ISPCParser.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -694,28 +706,28 @@ export class ISPCParser extends BaseParser {
|
||||
|
||||
export class JavaParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await JavaParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class KotlinParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await KotlinParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class ScalaParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await ScalaParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class VCParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '/help');
|
||||
await VCParser.getOptions(compiler, '/help');
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@@ -807,13 +819,13 @@ export class VCParser extends BaseParser {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, ['/help']);
|
||||
const lines = utils.splitLines(result.stdout);
|
||||
|
||||
return this.extractPossibleStdvers(lines);
|
||||
return VCParser.extractPossibleStdvers(lines);
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, [helpArg]);
|
||||
const optionFinder = /^\s*(\/[\w#+,.:<=>[\]{|}-]*)\s*(.*)/i;
|
||||
const options = result.code === 0 ? this.parseLines(result.stdout, optionFinder) : {};
|
||||
const options = result.code === 0 ? VCParser.parseLines(result.stdout, optionFinder) : {};
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -821,22 +833,22 @@ export class VCParser extends BaseParser {
|
||||
|
||||
export class RustParser extends BaseParser {
|
||||
static override async setCompilerSettingsFromOptions(compiler: BaseCompiler, options: Record<string, Argument>) {
|
||||
if (this.hasSupport(options, '--color')) {
|
||||
if (RustParser.hasSupport(options, '--color')) {
|
||||
if (compiler.compiler.options) compiler.compiler.options += ' ';
|
||||
compiler.compiler.options += '--color=always';
|
||||
}
|
||||
if (this.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (this.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
if (RustParser.hasSupportStartsWith(options, '--target=')) compiler.compiler.supportsTargetIs = true;
|
||||
if (RustParser.hasSupportStartsWith(options, '--target ')) compiler.compiler.supportsTarget = true;
|
||||
}
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([
|
||||
this.getOptions(compiler, '--help'),
|
||||
this.getOptions(compiler, '-C help'),
|
||||
this.getOptions(compiler, '--help -v'),
|
||||
RustParser.getOptions(compiler, '--help'),
|
||||
RustParser.getOptions(compiler, '-C help'),
|
||||
RustParser.getOptions(compiler, '--help -v'),
|
||||
]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await RustParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@@ -845,7 +857,7 @@ export class RustParser extends BaseParser {
|
||||
const re = /--edition ([\d|]*)/;
|
||||
|
||||
const match = result.stdout.match(re);
|
||||
if (match && match[1]) {
|
||||
if (match?.[1]) {
|
||||
return match[1].split('|');
|
||||
}
|
||||
|
||||
@@ -884,7 +896,7 @@ export class RustParser extends BaseParser {
|
||||
previousOption = false;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
if (match1) {
|
||||
previousOption = match1[1].trim();
|
||||
if (match1[2]) description = match1[2].trim();
|
||||
@@ -895,7 +907,6 @@ export class RustParser extends BaseParser {
|
||||
previousOption = match3[1].trim();
|
||||
if (match3[2]) description = match3[2].trim();
|
||||
}
|
||||
}
|
||||
|
||||
if (previousOption) {
|
||||
options[previousOption] = {
|
||||
@@ -915,9 +926,9 @@ export class RustParser extends BaseParser {
|
||||
if (helpArg === '-C help') {
|
||||
const optionFinder = /^\s*(-c\s*[\d=a-z-]*)\s--\s(.*)/i;
|
||||
|
||||
options = this.parseLines(result.stdout + result.stderr, optionFinder);
|
||||
options = RustParser.parseLines(result.stdout + result.stderr, optionFinder);
|
||||
} else {
|
||||
options = this.parseRustHelpLines(result.stdout + result.stderr);
|
||||
options = RustParser.parseRustHelpLines(result.stdout + result.stderr);
|
||||
}
|
||||
}
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
@@ -927,29 +938,29 @@ export class RustParser extends BaseParser {
|
||||
|
||||
export class ZksolcParser extends RustParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const options = await this.getOptions(compiler, '--help');
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
const options = await ZksolcParser.getOptions(compiler, '--help');
|
||||
await ZksolcParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class MrustcParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '--help');
|
||||
await MrustcParser.getOptions(compiler, '--help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class NimParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await NimParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class CrystalParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, 'build');
|
||||
await CrystalParser.getOptions(compiler, 'build');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
@@ -957,7 +968,7 @@ export class CrystalParser extends BaseParser {
|
||||
export class TableGenParser extends BaseParser {
|
||||
static async getPossibleActions(compiler: BaseCompiler): Promise<CompilerOverrideOptions> {
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, ['--help']);
|
||||
return this.extractPossibleActions(utils.splitLines(result.stdout));
|
||||
return TableGenParser.extractPossibleActions(utils.splitLines(result.stdout));
|
||||
}
|
||||
|
||||
static extractPossibleActions(lines: string[]): CompilerOverrideOptions {
|
||||
@@ -991,21 +1002,21 @@ export class TableGenParser extends BaseParser {
|
||||
|
||||
export class TypeScriptNativeParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '--help');
|
||||
await TypeScriptNativeParser.getOptions(compiler, '--help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class TurboCParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '');
|
||||
await TurboCParser.getOptions(compiler, '');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
|
||||
export class ToitParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '-help');
|
||||
await ToitParser.getOptions(compiler, '-help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
@@ -1018,13 +1029,13 @@ export class JuliaParser extends BaseParser {
|
||||
compiler.compilerWrapperPath,
|
||||
helpArg,
|
||||
]);
|
||||
const options = result.code === 0 ? this.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
const options = result.code === 0 ? JuliaParser.parseLines(result.stdout + result.stderr, optionFinder) : {};
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
|
||||
static override async parse(compiler: JuliaCompiler) {
|
||||
await this.getOptions(compiler, '--help');
|
||||
await JuliaParser.getOptions(compiler, '--help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
@@ -1045,7 +1056,7 @@ export class Z88dkParser extends BaseParser {
|
||||
|
||||
export class WasmtimeParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '--help');
|
||||
await WasmtimeParser.getOptions(compiler, '--help');
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
@@ -1084,12 +1095,12 @@ export class FlangParser extends ClangParser {
|
||||
}
|
||||
|
||||
static override async setCompilerSettingsFromOptions(compiler: BaseCompiler, options: Record<string, Argument>) {
|
||||
super.setCompilerSettingsFromOptions(compiler, options);
|
||||
ClangParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
|
||||
// flang does not allow -emit-llvm to be used as it is with clang
|
||||
// as -Xflang -emit-llvm. Instead you just give -emit-llvm to flang
|
||||
// directly.
|
||||
if (this.hasSupport(options, '-emit-llvm')) {
|
||||
if (FlangParser.hasSupport(options, '-emit-llvm')) {
|
||||
compiler.compiler.supportsIrView = true;
|
||||
compiler.compiler.irArg = ['-emit-llvm'];
|
||||
compiler.compiler.minIrArgs = ['-emit-llvm'];
|
||||
@@ -1111,7 +1122,7 @@ export class FlangParser extends ClangParser {
|
||||
const re1 = /error: Only -std=([\w+]*) is allowed currently./;
|
||||
for (const line of lines) {
|
||||
const match = line.match(re1);
|
||||
if (match && match[1]) {
|
||||
if (match?.[1]) {
|
||||
possible.push({
|
||||
name: match[1],
|
||||
value: match[1],
|
||||
@@ -1124,9 +1135,9 @@ export class FlangParser extends ClangParser {
|
||||
|
||||
export class GHCParser extends GCCParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([this.getOptions(compiler, '--help')]);
|
||||
const results = await Promise.all([GHCParser.getOptions(compiler, '--help')]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await GHCParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@@ -1134,7 +1145,7 @@ export class GHCParser extends GCCParser {
|
||||
const optionFinder1 = /^ {4}(-[\w[\]]+)\s+(.*)/i;
|
||||
const optionFinder2 = /^ {4}(-[\w[\]]+)/;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArg.split(' '));
|
||||
const options = result.code === 0 ? this.parseLines(result.stdout, optionFinder1, optionFinder2) : {};
|
||||
const options = result.code === 0 ? GHCParser.parseLines(result.stdout, optionFinder1, optionFinder2) : {};
|
||||
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
@@ -1143,9 +1154,9 @@ export class GHCParser extends GCCParser {
|
||||
|
||||
export class SwiftParser extends ClangParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([this.getOptions(compiler, '--help')]);
|
||||
const results = await Promise.all([SwiftParser.getOptions(compiler, '--help')]);
|
||||
const options = Object.assign({}, ...results);
|
||||
this.setCompilerSettingsFromOptions(compiler, options);
|
||||
SwiftParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@@ -1160,16 +1171,16 @@ export class SwiftParser extends ClangParser {
|
||||
|
||||
export class TendraParser extends GCCParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([this.getOptions(compiler, '--help')]);
|
||||
const results = await Promise.all([TendraParser.getOptions(compiler, '--help')]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await TendraParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const optionFinder = /^ *(-[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) : +(.*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, helpArg.split(' '));
|
||||
const options = this.parseLines(result.stdout + result.stderr, optionFinder);
|
||||
const options = TendraParser.parseLines(result.stdout + result.stderr, optionFinder);
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -1190,10 +1201,13 @@ export class GolangParser extends GCCParser {
|
||||
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([
|
||||
this.getOptions(compiler, 'build -o ./output.s "-gcflags=-S --help" ' + this.getExampleFilepath()),
|
||||
GolangParser.getOptions(
|
||||
compiler,
|
||||
'build -o ./output.s "-gcflags=-S --help" ' + GolangParser.getExampleFilepath(),
|
||||
),
|
||||
]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await GolangParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
@@ -1204,7 +1218,7 @@ export class GolangParser extends GCCParser {
|
||||
...compiler.getDefaultExecOptions(),
|
||||
createAndUseTempDir: true,
|
||||
});
|
||||
const options = this.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2);
|
||||
const options = GolangParser.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2);
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -1217,7 +1231,7 @@ export class GnuCobolParser extends GCCParser {
|
||||
|
||||
static override async getPossibleStdvers(compiler: BaseCompiler): Promise<CompilerOverrideOptions> {
|
||||
const possible: CompilerOverrideOptions = [];
|
||||
const options = await this.getOptionsStrict(compiler, this.getLanguageSpecificHelpFlags());
|
||||
const options = await GnuCobolParser.getOptionsStrict(compiler, GnuCobolParser.getLanguageSpecificHelpFlags());
|
||||
for (const opt in options) {
|
||||
if (opt.startsWith('-std=')) {
|
||||
const vers = options[opt].description
|
||||
@@ -1240,16 +1254,16 @@ export class GnuCobolParser extends GCCParser {
|
||||
|
||||
export class MadpascalParser extends GCCParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
const results = await Promise.all([this.getOptions(compiler, '')]);
|
||||
const results = await Promise.all([MadpascalParser.getOptions(compiler, '')]);
|
||||
const options = Object.assign({}, ...results);
|
||||
await this.setCompilerSettingsFromOptions(compiler, options);
|
||||
await MadpascalParser.setCompilerSettingsFromOptions(compiler, options);
|
||||
return compiler;
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const optionFinder = /^(-[\w:<>]*) *(.*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, []);
|
||||
const options = this.parseLines(result.stdout + result.stderr, optionFinder);
|
||||
const options = MadpascalParser.parseLines(result.stdout + result.stderr, optionFinder);
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
@@ -1265,16 +1279,16 @@ export class MadpascalParser extends GCCParser {
|
||||
|
||||
export class GlslangParser extends BaseParser {
|
||||
static override async parse(compiler: BaseCompiler) {
|
||||
await this.getOptions(compiler, '--help');
|
||||
await GlslangParser.getOptions(compiler, '--help');
|
||||
return compiler;
|
||||
}
|
||||
|
||||
static override async getOptions(compiler: BaseCompiler, helpArg: string) {
|
||||
const optionFinder1 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) +(.*)/i;
|
||||
const optionFinder1 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*) {2,}(.*)/i;
|
||||
const optionFinder2 = /^ *(--?[\d#+,<=>[\]a-z|-]* ?[\d+,<=>[\]a-z|-]*)/i;
|
||||
const result = await compiler.execCompilerCached(compiler.compiler.exe, [helpArg]);
|
||||
// glslang will return a return code of 1 when calling --help (since it means nothing was compiled)
|
||||
const options = this.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2);
|
||||
const options = GlslangParser.parseLines(result.stdout + result.stderr, optionFinder1, optionFinder2);
|
||||
compiler.possibleArguments.populateOptions(options);
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
@@ -101,9 +101,11 @@ export class AssemblyCompiler extends BaseCompiler {
|
||||
const output = result.stdout.map(line => line.text).join('\n');
|
||||
if (output.includes('ELF32') && output.includes('80386')) {
|
||||
return 'x86';
|
||||
} else if (output.includes('ELF64') && output.includes('X86-64')) {
|
||||
}
|
||||
if (output.includes('ELF64') && output.includes('X86-64')) {
|
||||
return 'x86_64';
|
||||
} else if (output.includes('Mach-O 64-bit x86-64')) {
|
||||
}
|
||||
if (output.includes('Mach-O 64-bit x86-64')) {
|
||||
// note: this is to support readelf=objdump on Mac
|
||||
return 'x86_64';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
@@ -50,7 +50,7 @@ export class AvrGcc6502Compiler extends BaseCompiler {
|
||||
|
||||
public override getOutputFilename(dirPath: string, outputFilebase: string, key?: any) {
|
||||
let filename;
|
||||
if (key && key.backendOptions && key.backendOptions.customOutputFilename) {
|
||||
if (key?.backendOptions?.customOutputFilename) {
|
||||
filename = key.backendOptions.customOutputFilename;
|
||||
} else {
|
||||
filename = `${outputFilebase}.6502.asm`;
|
||||
@@ -58,9 +58,8 @@ export class AvrGcc6502Compiler extends BaseCompiler {
|
||||
|
||||
if (dirPath) {
|
||||
return path.join(dirPath, filename);
|
||||
} else {
|
||||
return filename;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
protected override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string): string[] {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -83,7 +83,7 @@ export class CarbonCompiler extends BaseCompiler {
|
||||
// Hook to parse out the "result: 123" line at the end of the interpreted execution run.
|
||||
const re = /^result: (\d+)$/;
|
||||
const match = re.exec(this.lastLine(result.asm as ResultLine[]));
|
||||
const code = match ? parseInt(match[1]) : -1;
|
||||
const code = match ? Number.parseInt(match[1]) : -1;
|
||||
result.execResult = {
|
||||
stdout: result.stdout,
|
||||
stderr: [],
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -67,9 +67,8 @@ export class Cc65Compiler extends BaseCompiler {
|
||||
override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string) {
|
||||
if (filters.binary) {
|
||||
return ['-g', '-o', this.filename(outputFilename)];
|
||||
} else {
|
||||
return ['-g', '-S', '-c', '-o', this.filename(outputFilename)];
|
||||
}
|
||||
return ['-g', '-S', '-c', '-o', this.filename(outputFilename)];
|
||||
}
|
||||
|
||||
override getCompilerEnvironmentVariables(compilerflags: string) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {ParsedAsmResult} from '../../types/asmresult/asmresult.interfaces.js';
|
||||
import {BypassCache, CacheKey, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
@@ -106,7 +106,7 @@ export class CerberusCompiler extends BaseCompiler {
|
||||
didExecute: true,
|
||||
buildResult: compileResult,
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
stdout: compileResult.stdout,
|
||||
stderr: compileResult.stderr,
|
||||
@@ -116,7 +116,6 @@ export class CerberusCompiler extends BaseCompiler {
|
||||
timedOut: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
override async processAsm(result): Promise<ParsedAsmResult> {
|
||||
// Handle "error" documents.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
@@ -298,9 +298,8 @@ export class ClangCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
return fs.readFileSync(llvmirFile, 'utf8');
|
||||
} else {
|
||||
return '<error: no llvm-dis found to disassemble bitcode>';
|
||||
}
|
||||
return '<error: no llvm-dis found to disassemble bitcode>';
|
||||
}
|
||||
|
||||
async processDeviceAssembly(deviceName: string, deviceAsm: string, filters, compilationInfo: CompilationInfo) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {LLVMIrBackendOptions} from '../../types/compilation/ir.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -39,9 +39,8 @@ export class CleanCompiler extends BaseCompiler {
|
||||
override optionsForFilter(filters: ParseFiltersAndOutputOptions) {
|
||||
if (filters.binary) {
|
||||
return [];
|
||||
} else {
|
||||
return ['-S'];
|
||||
}
|
||||
return ['-S'];
|
||||
}
|
||||
|
||||
override getOutputFilename(dirPath: string) {
|
||||
@@ -80,11 +79,8 @@ export class CleanCompiler extends BaseCompiler {
|
||||
if (matches) {
|
||||
if (matches[3] === '') {
|
||||
return '<source>:' + matches[1] + ',' + matches[2] + ': error: ' + matches[4];
|
||||
} else {
|
||||
return (
|
||||
'<source>:' + matches[1] + ',' + matches[2] + ': error: (' + matches[3] + ') ' + matches[4]
|
||||
);
|
||||
}
|
||||
return '<source>:' + matches[1] + ',' + matches[2] + ': error: (' + matches[3] + ') ' + matches[4];
|
||||
}
|
||||
|
||||
return line;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import semverParser from 'semver';
|
||||
import _ from 'underscore';
|
||||
@@ -80,17 +80,15 @@ export class CrystalCompiler extends BaseCompiler {
|
||||
override getIrOutputFilename(inputFilename: string, filters: ParseFiltersAndOutputOptions): string {
|
||||
if (this.usesNewEmitFilenames()) {
|
||||
return this.getOutputFilename(path.dirname(inputFilename), this.outputFilebase).replace('.s', '.ll');
|
||||
} else {
|
||||
return super.getIrOutputFilename(inputFilename, filters);
|
||||
}
|
||||
return super.getIrOutputFilename(inputFilename, filters);
|
||||
}
|
||||
|
||||
override getOutputFilename(dirPath: string, outputFilebase: string) {
|
||||
if (this.usesNewEmitFilenames()) {
|
||||
return path.join(dirPath, `${outputFilebase}.s`);
|
||||
} else {
|
||||
return path.join(dirPath, `${path.basename(this.compileFilename, this.lang.extensions[0])}.s`);
|
||||
}
|
||||
return path.join(dirPath, `${path.basename(this.compileFilename, this.lang.extensions[0])}.s`);
|
||||
}
|
||||
|
||||
override getExecutableFilename(dirPath: string, outputFilebase: string) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import Semver from 'semver';
|
||||
|
||||
@@ -80,9 +80,8 @@ export class DartCompiler extends BaseCompiler {
|
||||
const dartCompileIntroduction = '2.10.0';
|
||||
if (Semver.lt(utils.asSafeVer(this.compiler.semver), dartCompileIntroduction, true)) {
|
||||
return ['-k', 'aot', '-o', this.filename(outputFilename)];
|
||||
} else {
|
||||
return ['compile', 'aot-snapshot', '-o', this.filename(outputFilename)];
|
||||
}
|
||||
return ['compile', 'aot-snapshot', '-o', this.filename(outputFilename)];
|
||||
}
|
||||
|
||||
override getArgumentParserClass() {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -106,7 +106,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
this.methodRegex = /^\s+\d+:\s+(.*)\s+\(dex_method_idx=\d+\)$/;
|
||||
this.methodSizeRegex = /^\s+CODE:\s+\(code_offset=(0x\w+)\s+size=(\d+).*$/;
|
||||
this.insnRegex = /^\s+(0x\w+):\s+\w+\s+(.*)$/;
|
||||
// eslint-disable-next-line unicorn/better-regex
|
||||
|
||||
this.stackMapRegex = /^\s+(StackMap\[\d+\])\s+\((.*)\).*$/;
|
||||
|
||||
// Similar to insnRegex above, but this applies after oatdump output has
|
||||
@@ -253,7 +253,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
let match;
|
||||
if (this.versionPrefixRegex.test(this.compiler.id)) {
|
||||
match = this.compiler.id.match(this.versionPrefixRegex);
|
||||
versionPrefix = parseInt(match![2]);
|
||||
versionPrefix = Number.parseInt(match![2]);
|
||||
} else if (this.latestVersionRegex.test(this.compiler.id)) {
|
||||
isLatest = true;
|
||||
}
|
||||
@@ -582,7 +582,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
override async processAsm(result, filters: ParseFiltersAndOutputOptions) {
|
||||
let asm: string = '';
|
||||
let asm = '';
|
||||
|
||||
if (typeof result.asm === 'string') {
|
||||
const asmLines = utils.splitLines(result.asm);
|
||||
@@ -590,15 +590,13 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
return {
|
||||
asm: [{text: asmLines[0], source: null}],
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
asm: [{text: JSON.stringify(asmLines), source: null}],
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// result.asm is an array, but we only expect it to have one value.
|
||||
asm = result.asm[0].text;
|
||||
}
|
||||
|
||||
const segments: ParsedAsmResultLine[] = [];
|
||||
if (this.fullOutput || !filters.directives) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -121,7 +121,7 @@ export class DosboxCompiler extends BaseCompiler {
|
||||
result = await (this.env.enqueue(async () =>
|
||||
this.exec(compiler, args, options),
|
||||
) as Promise<UnprocessedExecResult>);
|
||||
if (result && result.okToCache) {
|
||||
if (result?.okToCache) {
|
||||
this.env
|
||||
.compilerCachePut(key as any, result, undefined)
|
||||
.then(() => {
|
||||
@@ -170,9 +170,8 @@ export class DosboxCompiler extends BaseCompiler {
|
||||
options.map(option => {
|
||||
if (option === inputFilename) {
|
||||
return path.basename(option);
|
||||
} else {
|
||||
return option;
|
||||
}
|
||||
return option;
|
||||
}),
|
||||
inputFilename,
|
||||
execOptions,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -771,9 +771,8 @@ do()
|
||||
if (fs.existsSync(versionFilePath)) {
|
||||
const versionString = await fs.readFile(versionFilePath);
|
||||
return versionString.toString();
|
||||
} else {
|
||||
return '<unknown version>';
|
||||
}
|
||||
return '<unknown version>';
|
||||
}
|
||||
|
||||
async runCorerunForDisasm(
|
||||
@@ -833,7 +832,6 @@ do()
|
||||
const targetFramework = targetFrameworkDirs[0];
|
||||
const ilspyPath = path.join(ilspyToolsDir, targetFramework, 'any', 'ilspycmd.dll');
|
||||
|
||||
// prettier-ignore
|
||||
const ilspyOptions = [ilspyPath, dllPath, '--disable-updatecheck', '-r', this.clrBuildDir].concat(options);
|
||||
const compilerPath = useDotNetHost ? this.compiler.exe : this.corerunPath;
|
||||
const compilerExecResult = await this.exec(compilerPath, ilspyOptions, execOptions);
|
||||
@@ -850,7 +848,6 @@ do()
|
||||
}
|
||||
|
||||
async runIlDasm(execOptions: ExecutionOptions, dllPath: string, options: string[], outputPath: string) {
|
||||
// prettier-ignore
|
||||
const ildasmOptions = [dllPath, '-utf8'].concat(options);
|
||||
|
||||
const compilerExecResult = await this.exec(this.ildasmPath, ildasmOptions, execOptions);
|
||||
@@ -876,12 +873,14 @@ do()
|
||||
options: string[],
|
||||
outputPath: string,
|
||||
) {
|
||||
// prettier-ignore
|
||||
const crossgen2Options = [
|
||||
'-r', path.join(bclPath, '/'),
|
||||
'-r', this.disassemblyLoaderPath,
|
||||
'-r',
|
||||
path.join(bclPath, '/'),
|
||||
'-r',
|
||||
this.disassemblyLoaderPath,
|
||||
dllPath,
|
||||
'-o', `${AssemblyName}.r2r.dll`,
|
||||
'-o',
|
||||
`${AssemblyName}.r2r.dll`,
|
||||
].concat(options);
|
||||
|
||||
const corelibPath = path.join(this.clrBuildDir, 'corelib', arch, 'System.Private.CoreLib.dll');
|
||||
@@ -920,13 +919,16 @@ do()
|
||||
outputPath: string,
|
||||
buildToBinary: boolean,
|
||||
) {
|
||||
// prettier-ignore
|
||||
const ilcOptions = [
|
||||
dllPath,
|
||||
'-o', `${AssemblyName}.obj`,
|
||||
'-r', this.disassemblyLoaderPath,
|
||||
'-r', path.join(this.clrBuildDir, 'aotsdk', '*.dll'),
|
||||
'-r', path.join(this.clrBuildDir, '*.dll'),
|
||||
'-o',
|
||||
`${AssemblyName}.obj`,
|
||||
'-r',
|
||||
this.disassemblyLoaderPath,
|
||||
'-r',
|
||||
path.join(this.clrBuildDir, 'aotsdk', '*.dll'),
|
||||
'-r',
|
||||
path.join(this.clrBuildDir, '*.dll'),
|
||||
'--initassembly:System.Private.CoreLib',
|
||||
'--initassembly:System.Private.StackTraceMetadata',
|
||||
'--initassembly:System.Private.TypeLoader',
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
import {SelectedLibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
import {CompilerArguments} from '../compiler-arguments.js';
|
||||
|
||||
export class FakeCompiler {
|
||||
@@ -59,9 +60,8 @@ export class FakeCompiler {
|
||||
this.possibleArguments = new CompilerArguments('fake-for-test');
|
||||
}
|
||||
|
||||
initialise(mtime: Date, clientOptions: any, isPrediscovered: boolean) {
|
||||
initialise(mtime: Date, clientOptions: any, isPrediscovered: boolean): Promise<BaseCompiler | null> {
|
||||
throw new Error('Method not implemented.');
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
getInfo() {
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import * as fs from 'fs';
|
||||
import path from 'path';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {CompilationResult, ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {SelectedLibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {BaseCompiler} from '../base-compiler.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
@@ -101,7 +101,7 @@ export class GnuCobolCompiler extends BaseCompiler {
|
||||
|
||||
override getOutputFilename(dirPath: string, outputFilebase: string, key?: any): string {
|
||||
let filename;
|
||||
if (key && key.backendOptions && key.backendOptions.customOutputFilename) {
|
||||
if (key?.backendOptions?.customOutputFilename) {
|
||||
filename = key.backendOptions.customOutputFilename;
|
||||
} else if (key.filters.binary) {
|
||||
// note: interesting fact about gnucobol, if you name the outputfile output.s it will always output assembly
|
||||
@@ -114,9 +114,8 @@ export class GnuCobolCompiler extends BaseCompiler {
|
||||
|
||||
if (dirPath) {
|
||||
return path.join(dirPath, filename);
|
||||
} else {
|
||||
return filename;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
override getExecutableFilename(dirPath: string, outputFilebase: string) {
|
||||
|
||||
@@ -243,11 +243,10 @@ export class GolangCompiler extends BaseCompiler {
|
||||
|
||||
if (filters.binary) {
|
||||
return ['build', '-o', outputFilename, '-gcflags=' + unwrap(userOptions).join(' ')];
|
||||
} else {
|
||||
}
|
||||
// Add userOptions to -gcflags to preserve previous behavior.
|
||||
return ['build', '-o', outputFilename, '-gcflags=-S ' + unwrap(userOptions).join(' ')];
|
||||
}
|
||||
}
|
||||
|
||||
override filterUserOptions(userOptions: string[]) {
|
||||
if (this.compiler.id === '6g141') {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -65,7 +65,6 @@ export class HLSLCompiler extends BaseCompiler {
|
||||
return version.includes('libdxcompiler');
|
||||
}
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
override optionsForFilter(
|
||||
filters: ParseFiltersAndOutputOptions,
|
||||
outputFilename: string,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {
|
||||
CacheKey,
|
||||
@@ -96,7 +96,7 @@ export class HookCompiler extends BaseCompiler {
|
||||
}
|
||||
const match = text.match(instructionRegex);
|
||||
if (match) {
|
||||
const lineNo = parseInt(match[1]);
|
||||
const lineNo = Number.parseInt(match[1]);
|
||||
item.source = {line: lineNo, file: null};
|
||||
lastLineNo = lineNo;
|
||||
continue;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import Semver from 'semver';
|
||||
@@ -199,7 +199,7 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
didExecute: true,
|
||||
buildResult: compileResult,
|
||||
};
|
||||
} else {
|
||||
}
|
||||
return {
|
||||
stdout: compileResult.stdout,
|
||||
stderr: compileResult.stderr,
|
||||
@@ -209,7 +209,6 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
timedOut: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async getMainClassName(dirPath: string) {
|
||||
const maxSize = this.env.ceProps('max-asm-size', 64 * 1024 * 1024);
|
||||
@@ -448,9 +447,8 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
firstSourceLine: methods.reduce((prev, method) => {
|
||||
if (method.startLine) {
|
||||
return prev === -1 ? method.startLine : Math.min(prev, method.startLine);
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
return prev;
|
||||
}, -1),
|
||||
methods: methods,
|
||||
textsBeforeMethod,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {CompilationResult, ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import semverParser from 'semver';
|
||||
@@ -70,13 +70,13 @@ export class LDCCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
override getOutputFilename(dirPath: string, outputFilebase: string, key?: any): string {
|
||||
if (key && key.filters && key.filters.binary) {
|
||||
if (key?.filters?.binary) {
|
||||
return path.join(dirPath, 'output');
|
||||
} else if (key && key.filters && key.filters.binaryObject) {
|
||||
return path.join(dirPath, 'output.o');
|
||||
} else {
|
||||
return path.join(dirPath, 'output.s');
|
||||
}
|
||||
if (key?.filters?.binaryObject) {
|
||||
return path.join(dirPath, 'output.o');
|
||||
}
|
||||
return path.join(dirPath, 'output.s');
|
||||
}
|
||||
|
||||
override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {CompilationResult, FiledataPair} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -57,27 +57,24 @@ export class MadPascalCompiler extends BaseCompiler {
|
||||
const filename = `${outputFilebase}.a65`;
|
||||
if (dirPath) {
|
||||
return path.join(dirPath, filename);
|
||||
} else {
|
||||
return filename;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
getAssemblerOutputFilename(dirPath: string, outputFilebase: string) {
|
||||
const filename = `${outputFilebase}.obx`;
|
||||
if (dirPath) {
|
||||
return path.join(dirPath, filename);
|
||||
} else {
|
||||
return filename;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
getListingFilename(dirPath: string, outputFilebase: string) {
|
||||
const filename = `${outputFilebase}.lst`;
|
||||
if (dirPath) {
|
||||
return path.join(dirPath, filename);
|
||||
} else {
|
||||
return filename;
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
override getOutputFilename(dirPath: string, outputFilebase: string, key?: any): string {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -71,14 +71,14 @@ export class NimCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
expectedExtensionFromCommand(command: string) {
|
||||
const isC = ['compile', 'compileToC', 'c'],
|
||||
isCpp = ['compileToCpp', 'cpp', 'cc'],
|
||||
isObjC = ['compileToOC', 'objc'];
|
||||
const isC = ['compile', 'compileToC', 'c'];
|
||||
const isCpp = ['compileToCpp', 'cpp', 'cc'];
|
||||
const isObjC = ['compileToOC', 'objc'];
|
||||
|
||||
if (isC.includes(command)) return '.c.o';
|
||||
else if (isCpp.includes(command)) return '.cpp.o';
|
||||
else if (isObjC.includes(command)) return '.m.o';
|
||||
else return null;
|
||||
if (isCpp.includes(command)) return '.cpp.o';
|
||||
if (isObjC.includes(command)) return '.m.o';
|
||||
return null;
|
||||
}
|
||||
|
||||
getCacheFile(options: string[], inputFilename: string, cacheDir: string) {
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import * as fs from 'fs/promises';
|
||||
import Path from 'path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import Path from 'node:path';
|
||||
|
||||
import Semver from 'semver';
|
||||
import _ from 'underscore';
|
||||
@@ -121,11 +121,10 @@ export class NvccCompiler extends BaseCompiler {
|
||||
}
|
||||
if (postProcess.length > 0) {
|
||||
return await this.execPostProcess(result, postProcess, outputFilename, maxSize);
|
||||
} else {
|
||||
}
|
||||
const contents = await fs.readFile(outputFilename, {encoding: 'utf8'});
|
||||
result.asm = contents.toString();
|
||||
return result;
|
||||
}
|
||||
})()
|
||||
).then(asm => {
|
||||
result.asm = typeof asm === 'string' ? asm : asm.asm;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import * as fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import * as fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
|
||||
import {CompilationInfo, CompilationResult} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import Path from 'path';
|
||||
import Path from 'node:path';
|
||||
|
||||
import Semver from 'semver';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {CompilerOutputOptions, ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
@@ -167,7 +167,7 @@ export class OdinCompiler extends BaseCompiler {
|
||||
for (const line of asmLines) {
|
||||
const match = line.match(fileFind);
|
||||
if (match) {
|
||||
const lineNum = parseInt(match[1]);
|
||||
const lineNum = Number.parseInt(match[1]);
|
||||
if (match[4] && !line.includes('.cv_file')) {
|
||||
// Clang-style file directive '.file X "dir" "filename"'
|
||||
if (match[4].startsWith('/')) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
@@ -86,9 +86,8 @@ export class PascalWinCompiler extends BaseCompiler {
|
||||
override filename(fn: string) {
|
||||
if (process.platform === 'linux' || process.platform === 'darwin') {
|
||||
return 'Z:' + fn;
|
||||
} else {
|
||||
return super.filename(fn);
|
||||
}
|
||||
return super.filename(fn);
|
||||
}
|
||||
|
||||
override async objdump(outputFilename: string, result, maxSize: number, intelAsm: boolean) {
|
||||
@@ -114,11 +113,11 @@ export class PascalWinCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
async saveDummyProjectFile(filename: string, unitName: string, unitPath: string) {
|
||||
// biome-ignore format: keep as-is for readability
|
||||
await fs.writeFile(
|
||||
filename,
|
||||
// prettier-ignore
|
||||
'program prog;\n' +
|
||||
'uses ' + unitName + ' in \'' + unitPath + '\';\n' +
|
||||
'uses ' + unitName + " in '" + unitPath + "';\n" +
|
||||
'begin\n' +
|
||||
'end.\n',
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import _ from 'underscore';
|
||||
@@ -92,8 +92,7 @@ export class FPCCompiler extends BaseCompiler {
|
||||
for (let j = 0; j < result.asm.length; ++j) {
|
||||
result.asm[j].text = this.demangler.demangleIfNeeded(result.asm[j].text);
|
||||
if (
|
||||
result.asm[j].source &&
|
||||
result.asm[j].source.file &&
|
||||
result.asm[j].source?.file &&
|
||||
!result.asm[j].source.mainsource &&
|
||||
this.isTheSameFileProbably(result.inputFilename, result.asm[j].source.file)
|
||||
) {
|
||||
@@ -178,9 +177,8 @@ export class FPCCompiler extends BaseCompiler {
|
||||
if (endOfProc === -1) {
|
||||
newSource = newSource + input.substring(furtherLookback) + '\n';
|
||||
break;
|
||||
} else {
|
||||
newSource = newSource + input.substring(furtherLookback, endOfProc + 3) + '\n';
|
||||
}
|
||||
newSource = newSource + input.substring(furtherLookback, endOfProc + 3) + '\n';
|
||||
|
||||
foundSourceAt = input.indexOf('/app/', endOfProc + 3);
|
||||
}
|
||||
@@ -193,11 +191,11 @@ export class FPCCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
async saveDummyProjectFile(filename: string, unitName: string, unitPath: string) {
|
||||
// biome-ignore format: keep as-is for readability
|
||||
await fs.writeFile(
|
||||
filename,
|
||||
// prettier-ignore
|
||||
'program prog;\n' +
|
||||
'uses ' + unitName + ' in \'' + unitPath + '\';\n' +
|
||||
'uses ' + unitName + " in '" + unitPath + "';\n" +
|
||||
'begin\n' +
|
||||
'end.\n',
|
||||
);
|
||||
@@ -298,14 +296,13 @@ export class FPCCompiler extends BaseCompiler {
|
||||
|
||||
if (Number.isNaN(Number(valueInBrackets))) {
|
||||
return ` .file ${currentFileId} "${valueInBrackets}"`;
|
||||
} else {
|
||||
}
|
||||
return ` .loc ${currentFileId} ${valueInBrackets} 0`;
|
||||
}
|
||||
} else if (asm.startsWith('.Le')) {
|
||||
if (asm.startsWith('.Le')) {
|
||||
return ' .cfi_endproc';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
tryGetFilenumber(asm: string, files: Record<string, number>) {
|
||||
@@ -324,7 +321,7 @@ export class FPCCompiler extends BaseCompiler {
|
||||
if (Number.isNaN(Number(valueInBrackets))) {
|
||||
if (!files[valueInBrackets]) {
|
||||
let maxFileId = _.max(files);
|
||||
if (maxFileId === -Infinity) {
|
||||
if (maxFileId === Number.NEGATIVE_INFINITY) {
|
||||
maxFileId = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {CompilationResult, ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {LLVMIrBackendOptions} from '../../types/compilation/ir.interfaces.js';
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {CompilationResult, ExecutionOptionsWithEnv} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
@@ -49,7 +49,7 @@ export class PtxAssembler extends BaseCompiler {
|
||||
parsePtxOutput(lines: string, inputFilename: string, pathPrefix: string) {
|
||||
const re = /^ptxas\s*<source>, line (\d+);(.*)/;
|
||||
const result: ResultLine[] = [];
|
||||
utils.eachLine(lines, function (line) {
|
||||
utils.eachLine(lines, line => {
|
||||
if (pathPrefix) line = line.replace(pathPrefix, '');
|
||||
if (inputFilename) {
|
||||
line = line.split(inputFilename).join('<source>');
|
||||
@@ -66,7 +66,7 @@ export class PtxAssembler extends BaseCompiler {
|
||||
lineObj.text = `<source>:${match[1]} ${match[2].trim()}`;
|
||||
lineObj.tag = {
|
||||
severity: 0,
|
||||
line: parseInt(match[1]),
|
||||
line: Number.parseInt(match[1]),
|
||||
column: 0,
|
||||
text: match[2].trim(),
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ export class PythonCompiler extends BaseCompiler {
|
||||
const match = line.match(lineRe);
|
||||
|
||||
if (match) {
|
||||
const lineno = parseInt(match[1]);
|
||||
const lineno = Number.parseInt(match[1]);
|
||||
sourceLoc = {line: lineno, file: null};
|
||||
lastLineNo = lineno;
|
||||
} else if (line) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import path from 'path';
|
||||
import path from 'node:path';
|
||||
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
@@ -50,7 +50,7 @@ export class PythranCompiler extends BaseCompiler {
|
||||
}
|
||||
|
||||
override getCompilerResultLanguageId(filters?: ParseFiltersAndOutputOptions): string | undefined {
|
||||
if (filters !== undefined && filters.binary) return 'asm';
|
||||
else return 'cppp';
|
||||
if (filters?.binary) return 'asm';
|
||||
return 'cppp';
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user