mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
tsification + small package upgrade (semver) (#6841)
This commit is contained in:
@@ -69,7 +69,7 @@ import {
|
||||
import type {CompilerOutputOptions, ParseFiltersAndOutputOptions} from '../types/features/filters.interfaces.js';
|
||||
import {InstructionSet} from '../types/instructionsets.js';
|
||||
import type {Language} from '../types/languages.interfaces.js';
|
||||
import type {Library, LibraryVersion, SelectedLibraryVersion} from '../types/libraries/libraries.interfaces.js';
|
||||
import type {SelectedLibraryVersion} from '../types/libraries/libraries.interfaces.js';
|
||||
import type {ResultLine} from '../types/resultline/resultline.interfaces.js';
|
||||
import {type ToolResult, type ToolTypeKey} from '../types/tool.interfaces.js';
|
||||
|
||||
@@ -185,7 +185,7 @@ export class BaseCompiler implements ICompiler {
|
||||
protected cmakeBaseEnv: Record<string, string>;
|
||||
protected buildenvsetup: null | any;
|
||||
protected externalparser: null | ExternalParserBase;
|
||||
protected supportedLibraries?: Record<string, Library>;
|
||||
protected supportedLibraries?: Record<string, OptionsHandlerLibrary>;
|
||||
protected packager: Packager;
|
||||
protected executionType: string;
|
||||
protected sandboxType: string;
|
||||
@@ -758,15 +758,15 @@ export class BaseCompiler implements ICompiler {
|
||||
return options;
|
||||
}
|
||||
|
||||
findLibVersion(selectedLib: SelectedLibraryVersion): false | LibraryVersion {
|
||||
findLibVersion(selectedLib: SelectedLibraryVersion): false | VersionInfo {
|
||||
if (!this.supportedLibraries) return false;
|
||||
|
||||
const foundLib = _.find(this.supportedLibraries, (o, libId) => libId === selectedLib.id);
|
||||
if (!foundLib) return false;
|
||||
|
||||
const result: LibraryVersion | undefined = _.find(
|
||||
const result: VersionInfo | undefined = _.find(
|
||||
foundLib.versions,
|
||||
(o: LibraryVersion, versionId: string): boolean => {
|
||||
(o: VersionInfo, versionId: string): boolean => {
|
||||
if (versionId === selectedLib.version) return true;
|
||||
return !!(o.alias && o.alias.includes(selectedLib.version));
|
||||
},
|
||||
@@ -783,7 +783,7 @@ export class BaseCompiler implements ICompiler {
|
||||
}
|
||||
|
||||
findAutodetectStaticLibLink(linkname: string): SelectedLibraryVersion | false {
|
||||
const foundLib = _.findKey(this.supportedLibraries as Record<string, Library>, lib => {
|
||||
const foundLib = _.findKey(this.supportedLibraries!, lib => {
|
||||
return (
|
||||
lib.versions.autodetect &&
|
||||
lib.versions.autodetect.staticliblink &&
|
||||
@@ -799,7 +799,7 @@ export class BaseCompiler implements ICompiler {
|
||||
}
|
||||
|
||||
getSortedStaticLibraries(libraries: CompileChildLibraries[]) {
|
||||
const dictionary = {};
|
||||
const dictionary: Record<string, VersionInfo> = {};
|
||||
const links = unique(
|
||||
libraries
|
||||
.map(selectedLib => {
|
||||
@@ -826,7 +826,7 @@ export class BaseCompiler implements ICompiler {
|
||||
|
||||
let idxToInsert = sortedlinks.length;
|
||||
for (const [idx, libCompareName] of sortedlinks.entries()) {
|
||||
const libCompareObj: LibraryVersion = dictionary[libCompareName];
|
||||
const libCompareObj: VersionInfo = dictionary[libCompareName];
|
||||
|
||||
if (
|
||||
libToInsertObj &&
|
||||
@@ -1719,8 +1719,8 @@ export class BaseCompiler implements ICompiler {
|
||||
return maskedArgs;
|
||||
}
|
||||
|
||||
async getRequiredLibraryVersions(libraries): Promise<Record<string, LibraryVersion>> {
|
||||
const libraryDetails = {};
|
||||
async getRequiredLibraryVersions(libraries): Promise<Record<string, VersionInfo>> {
|
||||
const libraryDetails: Record<string, VersionInfo> = {};
|
||||
_.each(libraries, selectedLib => {
|
||||
const foundVersion = this.findLibVersion(selectedLib);
|
||||
if (foundVersion) libraryDetails[selectedLib.id] = foundVersion;
|
||||
@@ -1728,7 +1728,7 @@ export class BaseCompiler implements ICompiler {
|
||||
return libraryDetails;
|
||||
}
|
||||
|
||||
async setupBuildEnvironment(key: any, dirPath: string, binary: boolean): Promise<BuildEnvDownloadInfo[]> {
|
||||
async setupBuildEnvironment(key: CacheKey, dirPath: string, binary: boolean): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (this.buildenvsetup) {
|
||||
const libraryDetails = await this.getRequiredLibraryVersions(key.libraries);
|
||||
return this.buildenvsetup.setup(key, dirPath, libraryDetails, binary);
|
||||
@@ -1785,7 +1785,7 @@ export class BaseCompiler implements ICompiler {
|
||||
};
|
||||
}
|
||||
|
||||
async buildExecutableInFolder(key, dirPath: string): Promise<BuildResult> {
|
||||
async buildExecutableInFolder(key: CacheKey, dirPath: string): Promise<BuildResult> {
|
||||
const writeSummary = await this.writeAllFiles(dirPath, key.source, key.files, key.filters);
|
||||
const downloads = await this.setupBuildEnvironment(key, dirPath, true);
|
||||
|
||||
@@ -1827,11 +1827,11 @@ export class BaseCompiler implements ICompiler {
|
||||
});
|
||||
}
|
||||
|
||||
async afterBuild(key, dirPath: string, buildResult: BuildResult): Promise<BuildResult> {
|
||||
async afterBuild(key: CacheKey, dirPath: string, buildResult: BuildResult): Promise<BuildResult> {
|
||||
return buildResult;
|
||||
}
|
||||
|
||||
async getOrBuildExecutable(key, bypassCache: BypassCache) {
|
||||
async getOrBuildExecutable(key: CacheKey, bypassCache: BypassCache) {
|
||||
const dirPath = await this.newTempDir();
|
||||
|
||||
if (!bypassCompilationCache(bypassCache)) {
|
||||
@@ -1864,7 +1864,7 @@ export class BaseCompiler implements ICompiler {
|
||||
return compilationResult;
|
||||
}
|
||||
|
||||
async loadPackageWithExecutable(key, dirPath) {
|
||||
async loadPackageWithExecutable(key: CacheKey, dirPath: string) {
|
||||
const compilationResultFilename = 'compilation-result.json';
|
||||
try {
|
||||
const startTime = process.hrtime.bigint();
|
||||
@@ -1939,7 +1939,7 @@ export class BaseCompiler implements ICompiler {
|
||||
executeParameters.args.unshift(outputFilename);
|
||||
}
|
||||
|
||||
async handleInterpreting(key, executeParameters: ExecutableExecutionOptions): Promise<CompilationResult> {
|
||||
async handleInterpreting(key: CacheKey, executeParameters: ExecutableExecutionOptions): Promise<CompilationResult> {
|
||||
const source = key.source;
|
||||
const dirPath = await this.newTempDir();
|
||||
const outputFilename = this.getExecutableFilename(dirPath, this.outputFilebase);
|
||||
@@ -1971,7 +1971,7 @@ export class BaseCompiler implements ICompiler {
|
||||
}
|
||||
|
||||
async doExecution(
|
||||
key,
|
||||
key: CacheKey,
|
||||
executeParameters: ExecutableExecutionOptions,
|
||||
bypassCache: BypassCache,
|
||||
): Promise<CompilationResult> {
|
||||
@@ -3229,12 +3229,10 @@ but nothing was dumped. Possible causes are:
|
||||
}
|
||||
|
||||
initialiseLibraries(clientOptions: ClientOptionsType) {
|
||||
// TODO: Awful cast here because of OptionsHandlerLibrary vs Library. These might really be the same types and
|
||||
// OptionsHandlerLibrary should maybe be yeeted.
|
||||
this.supportedLibraries = this.getSupportedLibraries(
|
||||
this.compiler.libsArr,
|
||||
clientOptions.libs[this.lang.id] || [],
|
||||
) as any as Record<string, Library>;
|
||||
);
|
||||
}
|
||||
|
||||
async getTargetsAsOverrideValues(): Promise<CompilerOverrideOption[]> {
|
||||
|
||||
@@ -26,8 +26,11 @@ import path from 'path';
|
||||
|
||||
import _ from 'underscore';
|
||||
|
||||
import {LibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {CacheKey} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {CompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {CompilationEnvironment} from '../compilation-env.js';
|
||||
import {logger} from '../logger.js';
|
||||
import {VersionInfo} from '../options-handler.js';
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
import type {BuildEnvDownloadInfo} from './buildenv.interfaces.js';
|
||||
@@ -41,7 +44,7 @@ export class BuildEnvSetupBase {
|
||||
public compilerSupportsX86: boolean;
|
||||
public defaultLibCxx: string;
|
||||
|
||||
constructor(compilerInfo, env) {
|
||||
constructor(compilerInfo: CompilerInfo, env: CompilationEnvironment) {
|
||||
this.compiler = compilerInfo;
|
||||
this.env = env;
|
||||
|
||||
@@ -99,9 +102,9 @@ export class BuildEnvSetupBase {
|
||||
}
|
||||
|
||||
async setup(
|
||||
key,
|
||||
key: CacheKey,
|
||||
dirPath: string,
|
||||
selectedLibraries: Record<string, LibraryVersion>,
|
||||
selectedLibraries: Record<string, VersionInfo>,
|
||||
binary: boolean,
|
||||
): Promise<BuildEnvDownloadInfo[]> {
|
||||
return [];
|
||||
@@ -143,7 +146,7 @@ export class BuildEnvSetupBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
getLibcxx(key) {
|
||||
getLibcxx(key: CacheKey): string {
|
||||
const match = this.compiler.options.match(/-stdlib=(\S*)/i);
|
||||
if (match) {
|
||||
return match[1];
|
||||
@@ -160,7 +163,7 @@ export class BuildEnvSetupBase {
|
||||
}
|
||||
}
|
||||
|
||||
getTarget(key): string {
|
||||
getTarget(key: CacheKey): string {
|
||||
if (!this.compilerSupportsX86) return '';
|
||||
if (this.compilerArch) return this.compilerArch;
|
||||
|
||||
@@ -179,7 +182,7 @@ export class BuildEnvSetupBase {
|
||||
return 'x86_64';
|
||||
}
|
||||
|
||||
hasBinariesToLink(details: LibraryVersion) {
|
||||
hasBinariesToLink(details: VersionInfo) {
|
||||
return (
|
||||
details.libpath.length === 0 &&
|
||||
(details.staticliblink.length > 0 || details.liblink.length > 0) &&
|
||||
@@ -187,11 +190,11 @@ export class BuildEnvSetupBase {
|
||||
);
|
||||
}
|
||||
|
||||
hasPackagedHeaders(details: LibraryVersion) {
|
||||
hasPackagedHeaders(details: VersionInfo) {
|
||||
return !!details.packagedheaders;
|
||||
}
|
||||
|
||||
shouldDownloadPackage(details: LibraryVersion) {
|
||||
shouldDownloadPackage(details: VersionInfo) {
|
||||
return this.hasPackagedHeaders(details) || this.hasBinariesToLink(details);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class BuildEnvSetupCeConanFortranDirect extends BuildEnvSetupCeConanDirec
|
||||
return 'ceconan-fortran';
|
||||
}
|
||||
|
||||
override async getConanBuildProperties(key): Promise<ConanBuildProperties> {
|
||||
override async getConanBuildProperties(/*key*/): Promise<ConanBuildProperties> {
|
||||
const arch = this.getCompilerArch() || 'x86_64';
|
||||
const libcxx = 'std';
|
||||
const stdver = '';
|
||||
|
||||
@@ -30,11 +30,14 @@ import request from 'request';
|
||||
import tar from 'tar-stream';
|
||||
import _ from 'underscore';
|
||||
|
||||
import {LibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {CacheKey} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {CompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {logger} from '../logger.js';
|
||||
import {VersionInfo} from '../options-handler.js';
|
||||
|
||||
import {BuildEnvSetupBase} from './base.js';
|
||||
import type {BuildEnvDownloadInfo} from './buildenv.interfaces.js';
|
||||
// import { CompilationEnvironment } from '../compilation-env.js';
|
||||
|
||||
export type ConanBuildProperties = {
|
||||
os: string;
|
||||
@@ -56,11 +59,11 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
return 'ceconan';
|
||||
}
|
||||
|
||||
constructor(compilerInfo, env) {
|
||||
constructor(compilerInfo: CompilerInfo, env) {
|
||||
super(compilerInfo, env);
|
||||
|
||||
this.host = compilerInfo.buildenvsetup.props('host', false);
|
||||
this.onlyonstaticliblink = compilerInfo.buildenvsetup.props('onlyonstaticliblink', false);
|
||||
this.host = compilerInfo.buildenvsetup!.props('host', '');
|
||||
this.onlyonstaticliblink = compilerInfo.buildenvsetup!.props('onlyonstaticliblink', '');
|
||||
this.extractAllToRoot = false;
|
||||
|
||||
if (env.debug) request.debug = true;
|
||||
@@ -121,7 +124,12 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
}
|
||||
}
|
||||
|
||||
async downloadAndExtractPackage(libId, version, downloadPath, packageUrl): Promise<BuildEnvDownloadInfo> {
|
||||
async downloadAndExtractPackage(
|
||||
libId,
|
||||
version,
|
||||
downloadPath: string,
|
||||
packageUrl: string,
|
||||
): Promise<BuildEnvDownloadInfo> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const startTime = process.hrtime.bigint();
|
||||
const extract = tar.extract();
|
||||
@@ -207,7 +215,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
});
|
||||
}
|
||||
|
||||
async getConanBuildProperties(key): Promise<ConanBuildProperties> {
|
||||
async getConanBuildProperties(key: CacheKey): Promise<ConanBuildProperties> {
|
||||
const arch = this.getTarget(key);
|
||||
const libcxx = this.getLibcxx(key);
|
||||
const stdver = '';
|
||||
@@ -239,7 +247,11 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
});
|
||||
}
|
||||
|
||||
async download(key, dirPath, libraryDetails): Promise<BuildEnvDownloadInfo[]> {
|
||||
async download(
|
||||
key: CacheKey,
|
||||
dirPath: string,
|
||||
libraryDetails: Record<string, VersionInfo>,
|
||||
): Promise<BuildEnvDownloadInfo[]> {
|
||||
const allDownloads: Promise<BuildEnvDownloadInfo>[] = [];
|
||||
const allLibraryBuilds: any = [];
|
||||
|
||||
@@ -285,10 +297,10 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
}
|
||||
|
||||
override async setup(
|
||||
key,
|
||||
dirPath,
|
||||
libraryDetails: Record<string, LibraryVersion>,
|
||||
binary,
|
||||
key: CacheKey,
|
||||
dirPath: string,
|
||||
libraryDetails: Record<string, VersionInfo>,
|
||||
binary: boolean,
|
||||
): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (!this.host) return [];
|
||||
|
||||
@@ -296,7 +308,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
|
||||
const librariesToDownload = _.pick(libraryDetails, details => {
|
||||
return this.shouldDownloadPackage(details);
|
||||
}) as Record<string, LibraryVersion>;
|
||||
}) as Record<string, VersionInfo>;
|
||||
|
||||
return this.download(key, dirPath, librariesToDownload);
|
||||
}
|
||||
|
||||
2
lib/cache/multi.ts
vendored
2
lib/cache/multi.ts
vendored
@@ -33,7 +33,7 @@ import {BaseCache} from './base.js';
|
||||
export class MultiCache extends BaseCache {
|
||||
private readonly upstream: BaseCache[];
|
||||
|
||||
constructor(cacheName, ...upstream) {
|
||||
constructor(cacheName: string, ...upstream: any[]) {
|
||||
super(cacheName, 'Multi', 'multi');
|
||||
this.countersEnabled = false;
|
||||
this.upstream = upstream;
|
||||
|
||||
2
lib/cache/null.ts
vendored
2
lib/cache/null.ts
vendored
@@ -27,7 +27,7 @@ import type {GetResult} from '../../types/cache.interfaces.js';
|
||||
import {BaseCache} from './base.js';
|
||||
|
||||
export class NullCache extends BaseCache {
|
||||
constructor(cacheName) {
|
||||
constructor(cacheName: string) {
|
||||
super(cacheName, 'Null', 'null');
|
||||
}
|
||||
|
||||
|
||||
11
lib/cache/on-disk.ts
vendored
11
lib/cache/on-disk.ts
vendored
@@ -34,9 +34,11 @@ import {logger} from '../logger.js';
|
||||
import {BaseCache} from './base.js';
|
||||
|
||||
// With thanks to https://gist.github.com/kethinov/6658166
|
||||
function getAllFiles(root: string, dir?: string) {
|
||||
type relFile = {name: string; fullPath: string};
|
||||
|
||||
function getAllFiles(root: string, dir?: string): Array<relFile> {
|
||||
const actualDir = dir || root;
|
||||
return fs.readdirSync(actualDir).reduce((files: Array<string>, file: string) => {
|
||||
return fs.readdirSync(actualDir).reduce((files: Array<relFile>, file: string) => {
|
||||
const fullPath = path.join(actualDir, file);
|
||||
const name = path.relative(root, fullPath);
|
||||
const isDirectory = fs.statSync(fullPath).isDirectory();
|
||||
@@ -80,9 +82,14 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export class BaseCFGParser {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected filterTextSection(data: AssemblyLine[]) {
|
||||
protected filterTextSection(data: AssemblyLine[]): AssemblyLine[] {
|
||||
let useCurrentSection = true;
|
||||
const result: AssemblyLine[] = [];
|
||||
for (const i in data) {
|
||||
|
||||
@@ -36,7 +36,8 @@ export class ClangCFGParser extends BaseCFGParser {
|
||||
|
||||
override filterData(assembly: ResultLine[]) {
|
||||
const jmpLabelRegex = /\.LBB\d+_\d+:/;
|
||||
const isCode = x => x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
const isCode = (x: ResultLine) =>
|
||||
x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
|
||||
const removeComments = (x: ResultLine) => {
|
||||
const pos_x86 = x.text.indexOf('# ');
|
||||
|
||||
@@ -26,7 +26,7 @@ import _ from 'underscore';
|
||||
|
||||
import type {ResultLine} from '../../../types/resultline/resultline.interfaces.js';
|
||||
|
||||
import {BaseCFGParser} from './base.js';
|
||||
import {AssemblyLine, BaseCFGParser} from './base.js';
|
||||
|
||||
export class GccCFGParser extends BaseCFGParser {
|
||||
static override get key() {
|
||||
@@ -35,7 +35,8 @@ export class GccCFGParser extends BaseCFGParser {
|
||||
|
||||
override filterData(assembly: ResultLine[]) {
|
||||
const jmpLabelRegex = /\.L\d+:/;
|
||||
const isCode = x => x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
const isCode = (x: AssemblyLine) =>
|
||||
x && x.text && (x.source !== null || jmpLabelRegex.test(x.text) || this.isFunctionName(x));
|
||||
return this.filterTextSection(assembly).map(_.clone).filter(isCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@ import type {PropertyGetter} from './properties.interfaces.js';
|
||||
import {CompilerProps} from './properties.js';
|
||||
import {createStatsNoter, IStatsNoter} from './stats.js';
|
||||
|
||||
type PropFunc = (string, any?) => any;
|
||||
type PropFunc = (s: string, a?: any) => any;
|
||||
|
||||
export class CompilationEnvironment {
|
||||
ceProps: PropertyGetter;
|
||||
compilationQueue: CompilationQueue;
|
||||
compilerProps: CompilerProps;
|
||||
compilationQueue: CompilationQueue | undefined;
|
||||
compilerProps: PropFunc;
|
||||
okOptions: RegExp;
|
||||
badOptions: RegExp;
|
||||
cache: Cache;
|
||||
@@ -60,7 +60,7 @@ export class CompilationEnvironment {
|
||||
statsNoter: IStatsNoter;
|
||||
private logCompilerCacheAccesses: boolean;
|
||||
|
||||
constructor(compilerProps, compilationQueue, doCache) {
|
||||
constructor(compilerProps: CompilerProps, compilationQueue: CompilationQueue | undefined, doCache?: boolean) {
|
||||
this.ceProps = compilerProps.ceProps;
|
||||
this.compilationQueue = compilationQueue;
|
||||
this.compilerProps = compilerProps.get.bind(compilerProps);
|
||||
@@ -174,7 +174,7 @@ export class CompilationEnvironment {
|
||||
}
|
||||
|
||||
enqueue<T>(job: Job<T>, options?: EnqueueOptions) {
|
||||
return this.compilationQueue.enqueue(job, options);
|
||||
if (this.compilationQueue) return this.compilationQueue.enqueue(job, options);
|
||||
}
|
||||
|
||||
findBadOptions(options: string[]) {
|
||||
|
||||
@@ -28,6 +28,8 @@ import {executionAsyncId} from 'async_hooks';
|
||||
import {default as Queue} from 'p-queue';
|
||||
import PromClient from 'prom-client';
|
||||
|
||||
import {PropertyGetter} from './properties.interfaces.js';
|
||||
|
||||
// globals as essentially the compilation queue is a singleton, and if we make them members of the queue, tests fail as
|
||||
// when we create a second queue, the previous counters are still registered.
|
||||
const queueEnqueued = new PromClient.Counter({
|
||||
@@ -68,10 +70,10 @@ export class CompilationQueue {
|
||||
this._staleAfterMs = staleAfterMs;
|
||||
}
|
||||
|
||||
static fromProps(ceProps) {
|
||||
static fromProps(ceProps: PropertyGetter) {
|
||||
return new CompilationQueue(
|
||||
ceProps('maxConcurrentCompiles', 1),
|
||||
ceProps('compilationEnvTimeoutMs'),
|
||||
ceProps('compilationEnvTimeoutMs', 300_000),
|
||||
ceProps('compilationStaleAfterMs', 60_000),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ export class AdaCompiler extends BaseCompiler {
|
||||
this.compiler.supportsGnatDebugViews = true;
|
||||
}
|
||||
|
||||
override getExecutableFilename(dirPath: string, outputFilebase: string, key?) {
|
||||
override getExecutableFilename(dirPath: string, outputFilebase: string) {
|
||||
// The name here must match the value used in the pragma Source_File
|
||||
// in the user provided source.
|
||||
return path.join(dirPath, 'example');
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import {BypassCache, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {BypassCache, CacheKey, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {ExecutableExecutionOptions} from '../../types/execution/execution.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
@@ -87,7 +87,7 @@ export class CerberusCompiler extends BaseCompiler {
|
||||
return result;
|
||||
}
|
||||
|
||||
override async handleInterpreting(key, executeParameters: ExecutableExecutionOptions) {
|
||||
override async handleInterpreting(key: CacheKey, executeParameters: ExecutableExecutionOptions) {
|
||||
const compileResult = await this.getOrBuildExecutable(key, BypassCache.None);
|
||||
if (compileResult.code === 0) {
|
||||
executeParameters.args = [
|
||||
|
||||
@@ -36,6 +36,7 @@ import {unwrap} from '../assert.js';
|
||||
import {BaseCompiler, SimpleOutputFilenameCompiler} from '../base-compiler.js';
|
||||
import {CompilationEnvironment} from '../compilation-env.js';
|
||||
import {logger} from '../logger.js';
|
||||
import '../global.js';
|
||||
|
||||
import {JavaCompiler} from './java.js';
|
||||
import {KotlinCompiler} from './kotlin.js';
|
||||
@@ -82,7 +83,7 @@ export class D8Compiler extends BaseCompiler implements SimpleOutputFilenameComp
|
||||
): Promise<CompilationResult> {
|
||||
const preliminaryCompilePath = path.dirname(inputFilename);
|
||||
let outputFilename = '';
|
||||
let initialResult;
|
||||
let initialResult: CompilationResult | null = null;
|
||||
|
||||
const javaCompiler = unwrap(
|
||||
global.handler_config.compileHandler.findCompiler('java', this.javaId),
|
||||
@@ -136,7 +137,7 @@ export class D8Compiler extends BaseCompiler implements SimpleOutputFilenameComp
|
||||
|
||||
// D8 should not run if initial compile stage failed, the JavaCompiler
|
||||
// result can be returned instead.
|
||||
if (initialResult.code !== 0) {
|
||||
if (initialResult && initialResult.code !== 0) {
|
||||
return initialResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -423,7 +423,7 @@ export class Dex2OatCompiler extends BaseCompiler {
|
||||
return {asm: segments};
|
||||
}
|
||||
|
||||
parseAsm(oatdumpOut) {
|
||||
parseAsm(oatdumpOut: string) {
|
||||
const compileData: {
|
||||
insnSet?: string;
|
||||
insnSetFeatures?: string;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import type {CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {CacheKey, CompilationResult, ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import type {ExecutableExecutionOptions} from '../../types/execution/execution.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
@@ -55,7 +55,10 @@ export class HookCompiler extends BaseCompiler {
|
||||
return {HOOK_HOME: this.hook_home, ...env};
|
||||
}
|
||||
|
||||
override async handleInterpreting(key, executeParameters: ExecutableExecutionOptions): Promise<CompilationResult> {
|
||||
override async handleInterpreting(
|
||||
key: CacheKey,
|
||||
executeParameters: ExecutableExecutionOptions,
|
||||
): Promise<CompilationResult> {
|
||||
executeParameters.env = this.addHookHome(executeParameters.env);
|
||||
return super.handleInterpreting(key, executeParameters);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import fs from 'fs-extra';
|
||||
import Semver from 'semver';
|
||||
|
||||
import type {ParsedAsmResult, ParsedAsmResultLine} from '../../types/asmresult/asmresult.interfaces.js';
|
||||
import {BypassCache, CompilationResult} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {BypassCache, CacheKey, CompilationResult} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {ExecutableExecutionOptions} from '../../types/execution/execution.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
@@ -131,7 +131,10 @@ export class JavaCompiler extends BaseCompiler implements SimpleOutputFilenameCo
|
||||
return ['-Xlint:all', '-encoding', 'utf8'];
|
||||
}
|
||||
|
||||
override async handleInterpreting(key, executeParameters: ExecutableExecutionOptions): Promise<CompilationResult> {
|
||||
override async handleInterpreting(
|
||||
key: CacheKey,
|
||||
executeParameters: ExecutableExecutionOptions,
|
||||
): Promise<CompilationResult> {
|
||||
const compileResult = await this.getOrBuildExecutable(key, BypassCache.None);
|
||||
if (compileResult.code === 0) {
|
||||
const extraXXFlags: 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 {BypassCache, CompilationResult} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {BypassCache, CacheKey, CompilationResult} from '../../types/compilation/compilation.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {ExecutableExecutionOptions} from '../../types/execution/execution.interfaces.js';
|
||||
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
||||
@@ -97,7 +97,10 @@ export class KotlinCompiler extends JavaCompiler implements SimpleOutputFilename
|
||||
*
|
||||
* TODO(supergrecko): Find a better fix than this bandaid for execution
|
||||
*/
|
||||
override async handleInterpreting(key, executeParameters: ExecutableExecutionOptions): Promise<CompilationResult> {
|
||||
override async handleInterpreting(
|
||||
key: CacheKey,
|
||||
executeParameters: ExecutableExecutionOptions,
|
||||
): Promise<CompilationResult> {
|
||||
const alteredKey = {
|
||||
...key,
|
||||
options: ['-include-runtime', '-d', 'example.jar'],
|
||||
|
||||
@@ -35,6 +35,7 @@ import {SimpleOutputFilenameCompiler} from '../base-compiler.js';
|
||||
import {CompilationEnvironment} from '../compilation-env.js';
|
||||
import {logger} from '../logger.js';
|
||||
|
||||
import '../global.js';
|
||||
import {D8Compiler} from './d8.js';
|
||||
import {JavaCompiler} from './java.js';
|
||||
import {KotlinCompiler} from './kotlin.js';
|
||||
@@ -60,7 +61,7 @@ export class R8Compiler extends D8Compiler implements SimpleOutputFilenameCompil
|
||||
): Promise<CompilationResult> {
|
||||
const preliminaryCompilePath = path.dirname(inputFilename);
|
||||
let outputFilename = '';
|
||||
let initialResult;
|
||||
let initialResult: CompilationResult | null = null;
|
||||
|
||||
const javaCompiler = unwrap(
|
||||
global.handler_config.compileHandler.findCompiler('java', this.javaId),
|
||||
@@ -114,7 +115,7 @@ export class R8Compiler extends D8Compiler implements SimpleOutputFilenameCompil
|
||||
|
||||
// R8 should not run if initial compile stage failed, the JavaCompiler
|
||||
// result can be returned instead.
|
||||
if (initialResult.code !== 0) {
|
||||
if (initialResult && initialResult.code !== 0) {
|
||||
return initialResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ Please supply an ASIC from the following options:`,
|
||||
return {
|
||||
code: -1,
|
||||
okToCache: true,
|
||||
filenameTransform: x => x,
|
||||
filenameTransform: (x: string) => x,
|
||||
stdout: asicSelection.error,
|
||||
execTime: this.execTime(startTime, endTime),
|
||||
};
|
||||
@@ -168,7 +168,7 @@ Please supply an ASIC from the following options:`,
|
||||
return {
|
||||
code: -1,
|
||||
okToCache: true,
|
||||
filenameTransform: x => x,
|
||||
filenameTransform: (x: string) => x,
|
||||
stdout: 'Failed to emit intermediate SPIR-V result.',
|
||||
execTime: this.execTime(startTime, endTime),
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ import path from 'path';
|
||||
|
||||
import Semver from 'semver';
|
||||
|
||||
import {CacheKey} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {LLVMIrBackendOptions} from '../../types/compilation/ir.interfaces.js';
|
||||
import type {PreliminaryCompilerInfo} from '../../types/compiler.interfaces.js';
|
||||
import {ExecutableExecutionOptions} from '../../types/execution/execution.interfaces.js';
|
||||
@@ -119,7 +120,7 @@ export class TypeScriptNativeCompiler extends BaseCompiler {
|
||||
return this.llvmIr.process(output.stderr.map(l => l.text).join('\n'), irOptions);
|
||||
}
|
||||
|
||||
override async handleInterpreting(key, executeParameters: ExecutableExecutionOptions) {
|
||||
override async handleInterpreting(key: CacheKey, executeParameters: ExecutableExecutionOptions) {
|
||||
executeParameters.args = [
|
||||
'--emit=jit',
|
||||
this.tscSharedLib ? '--shared-libs=' + this.tscSharedLib : '-nogc',
|
||||
|
||||
@@ -89,7 +89,7 @@ export class WineVcCompiler extends BaseCompiler {
|
||||
const mapFilename = outputFilename + '.map';
|
||||
const mapFileReader = new MapFileReaderVS(mapFilename);
|
||||
|
||||
(filters as any).preProcessBinaryAsmLines = asmLines => {
|
||||
filters.preProcessBinaryAsmLines = (asmLines: string[]) => {
|
||||
const reconstructor = new PELabelReconstructor(asmLines, false, mapFileReader);
|
||||
reconstructor.run('output.s.obj');
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ function initialise(compilerEnv: CompilationEnvironment) {
|
||||
|
||||
let cyclesBusy = 0;
|
||||
setInterval(() => {
|
||||
const status = compilerEnv.compilationQueue.status();
|
||||
const status = compilerEnv.compilationQueue!.status();
|
||||
if (status.busy) {
|
||||
cyclesBusy++;
|
||||
logger.warn(
|
||||
@@ -524,17 +524,17 @@ export class CompileHandler implements ICompileHandler {
|
||||
if (req.body.files === undefined) throw new Error('Missing files property');
|
||||
|
||||
this.cmakeCounter.inc({language: compiler.lang.id});
|
||||
const options = this.parseRequest(req, compiler);
|
||||
const parsedRequest = this.parseRequest(req, compiler);
|
||||
this.compilerEnv.statsNoter.noteCompilation(
|
||||
compiler.getInfo().id,
|
||||
options,
|
||||
parsedRequest,
|
||||
req.body.files as FiledataPair[],
|
||||
KnownBuildMethod.CMake,
|
||||
);
|
||||
compiler
|
||||
// Backwards compatibility: bypassCache used to be a boolean.
|
||||
// Convert a boolean input to an enum's underlying numeric value
|
||||
.cmake(req.body.files, options, req.body.bypassCache * 1)
|
||||
.cmake(req.body.files, parsedRequest, req.body.bypassCache * 1)
|
||||
.then(result => {
|
||||
if (result.didExecute || (result.execResult && result.execResult.didExecute))
|
||||
this.cmakeExecuteCounter.inc({language: compiler.lang.id});
|
||||
|
||||
@@ -28,6 +28,7 @@ import {LLVMIrBackendOptions} from '../types/compilation/ir.interfaces.js';
|
||||
import {ParseFiltersAndOutputOptions} from '../types/features/filters.interfaces.js';
|
||||
|
||||
import {LLVMIRDemangler} from './demangler/llvm.js';
|
||||
import {PropertyGetter} from './properties.interfaces.js';
|
||||
import * as utils from './utils.js';
|
||||
|
||||
type MetaNode = {
|
||||
@@ -54,7 +55,7 @@ export class LlvmIrParser {
|
||||
private commentAtEOL: RegExp;
|
||||
|
||||
constructor(
|
||||
compilerProps,
|
||||
compilerProps: PropertyGetter,
|
||||
private readonly irDemangler: LLVMIRDemangler,
|
||||
) {
|
||||
this.maxIrLines = 5000;
|
||||
|
||||
@@ -43,6 +43,7 @@ import {asSafeVer, getHash, splitArguments, splitIntoArray} from './utils.js';
|
||||
|
||||
// TODO: Figure out if same as libraries.interfaces.ts?
|
||||
export type VersionInfo = {
|
||||
name?: string;
|
||||
version: string;
|
||||
staticliblink: string[];
|
||||
alias: string[];
|
||||
|
||||
@@ -142,14 +142,14 @@ export class PELabelReconstructor {
|
||||
let idx, info;
|
||||
for (idx = 0; idx < this.mapFileReader.segments.length; idx++) {
|
||||
info = this.mapFileReader.segments[idx];
|
||||
if (systemUnits.has(info.unitName)) {
|
||||
if (info.unitName && systemUnits.has(info.unitName)) {
|
||||
this.deleteLinesBetweenAddresses(info.addressInt, info.addressInt + info.segmentLength);
|
||||
}
|
||||
}
|
||||
|
||||
for (idx = 0; idx < this.mapFileReader.isegments.length; idx++) {
|
||||
info = this.mapFileReader.isegments[idx];
|
||||
if (systemUnits.has(info.unitName)) {
|
||||
if (info.unitName && systemUnits.has(info.unitName)) {
|
||||
this.deleteLinesBetweenAddresses(info.addressInt, info.addressInt + info.segmentLength);
|
||||
}
|
||||
}
|
||||
|
||||
17
lib/stats.ts
17
lib/stats.ts
@@ -25,7 +25,8 @@
|
||||
import {StorageClass} from '@aws-sdk/client-s3';
|
||||
import ems from 'enhanced-ms';
|
||||
|
||||
import {FiledataPair} from '../types/compilation/compilation.interfaces.js';
|
||||
import {CompileChildLibraries, FiledataPair} from '../types/compilation/compilation.interfaces.js';
|
||||
import {ConfiguredRuntimeTool} from '../types/execution/execution.interfaces.js';
|
||||
|
||||
import {ParsedRequest} from './handlers/compile.js';
|
||||
import {logger} from './logger.js';
|
||||
@@ -39,11 +40,11 @@ export enum KnownBuildMethod {
|
||||
}
|
||||
|
||||
export interface IStatsNoter {
|
||||
noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string);
|
||||
noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string): void;
|
||||
}
|
||||
|
||||
class NullStatsNoter implements IStatsNoter {
|
||||
noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string) {}
|
||||
noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string): void {}
|
||||
}
|
||||
|
||||
// A type for storing only compilation information deemed non-identifying; that is, no source or execution options.
|
||||
@@ -75,7 +76,7 @@ export function filterCompilerOptions(args: string[]): string[] {
|
||||
export function makeSafe(
|
||||
time: Date,
|
||||
compilerId: string,
|
||||
request: ParsedRequest | any,
|
||||
request: ParsedRequest,
|
||||
files: FiledataPair[],
|
||||
buildMethod: string,
|
||||
): CompilationRecord {
|
||||
@@ -99,14 +100,14 @@ export function makeSafe(
|
||||
),
|
||||
).map(item => `${item[0]}=${item[1] ? '1' : '0'}`),
|
||||
bypassCache: !!request.bypassCache,
|
||||
libraries: (request.libraries || []).map(lib => lib.id + '/' + lib.version),
|
||||
libraries: (request.libraries || []).map((lib: CompileChildLibraries) => lib.id + '/' + lib.version),
|
||||
tools: (request.tools || []).map(tool => tool.id),
|
||||
overrides: (request.backendOptions.overrides || [])
|
||||
.filter(item => item.name !== 'env' && item.value)
|
||||
.map(item => `${item.name}=${item.value}`),
|
||||
runtimeTools: (request.executeParameters.runtimeTools || [])
|
||||
.filter(item => item.name !== 'env')
|
||||
.map(item => item.name),
|
||||
.filter((item: ConfiguredRuntimeTool) => item.name !== 'env')
|
||||
.map((item: ConfiguredRuntimeTool) => item.name),
|
||||
buildMethod: buildMethod,
|
||||
};
|
||||
}
|
||||
@@ -152,7 +153,7 @@ class StatsNoter implements IStatsNoter {
|
||||
}
|
||||
}
|
||||
|
||||
noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string) {
|
||||
noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string): void {
|
||||
this._statsQueue.push(makeSafe(new Date(), compilerId, request, files, buildMethod));
|
||||
if (!this._flushJob) this._flushJob = setTimeout(() => this.flush(), this._flushAfterMs);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export class SymbolStore {
|
||||
softExclude(otherStore: SymbolStore) {
|
||||
for (const symbol in otherStore.uniqueSymbols) {
|
||||
let shouldExclude = false;
|
||||
let checksymbol;
|
||||
let checksymbol: string = '';
|
||||
for (checksymbol in this.uniqueSymbols) {
|
||||
if (checksymbol.endsWith(symbol)) {
|
||||
shouldExclude = true;
|
||||
|
||||
@@ -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 {Library} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {Tool, ToolResult} from '../../types/tool.interfaces.js';
|
||||
import {OptionsHandlerLibrary} from '../options-handler.js';
|
||||
import {PropertyGetter} from '../properties.interfaces.js';
|
||||
|
||||
export type ToolEnv = {
|
||||
@@ -37,6 +37,6 @@ export interface ITool extends Tool {
|
||||
inputFilepath?: string,
|
||||
args?: string[],
|
||||
stdin?: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
): Promise<ToolResult>;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,12 @@ import _ from 'underscore';
|
||||
|
||||
import {ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {UnprocessedExecResult} from '../../types/execution/execution.interfaces.js';
|
||||
import {Library, SelectedLibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {SelectedLibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {ResultLine} from '../../types/resultline/resultline.interfaces.js';
|
||||
import {ToolInfo, ToolResult} from '../../types/tool.interfaces.js';
|
||||
import * as exec from '../exec.js';
|
||||
import {logger} from '../logger.js';
|
||||
import {OptionsHandlerLibrary} from '../options-handler.js';
|
||||
import {parseOutput} from '../utils.js';
|
||||
|
||||
import {ITool, ToolEnv} from './base-tool.interface.js';
|
||||
@@ -110,7 +111,7 @@ export class BaseTool implements ITool {
|
||||
}
|
||||
|
||||
// mostly copy&paste from base-compiler.js
|
||||
findLibVersion(selectedLib: SelectedLibraryVersion, supportedLibraries: Record<string, Library>) {
|
||||
findLibVersion(selectedLib: SelectedLibraryVersion, supportedLibraries: Record<string, OptionsHandlerLibrary>) {
|
||||
const foundLib = _.find(supportedLibraries, (o, libId) => libId === selectedLib.id);
|
||||
if (!foundLib) return false;
|
||||
|
||||
@@ -118,7 +119,10 @@ export class BaseTool implements ITool {
|
||||
}
|
||||
|
||||
// mostly copy&paste from base-compiler.js
|
||||
getIncludeArguments(libraries: SelectedLibraryVersion[], supportedLibraries: Record<string, Library>): string[] {
|
||||
getIncludeArguments(
|
||||
libraries: SelectedLibraryVersion[],
|
||||
supportedLibraries: Record<string, OptionsHandlerLibrary>,
|
||||
): string[] {
|
||||
const includeFlag = '-I';
|
||||
|
||||
return libraries.flatMap(selectedLib => {
|
||||
@@ -129,7 +133,10 @@ export class BaseTool implements ITool {
|
||||
});
|
||||
}
|
||||
|
||||
getLibraryOptions(libraries: SelectedLibraryVersion[], supportedLibraries: Record<string, Library>): string[] {
|
||||
getLibraryOptions(
|
||||
libraries: SelectedLibraryVersion[],
|
||||
supportedLibraries: Record<string, OptionsHandlerLibrary>,
|
||||
): string[] {
|
||||
return libraries.flatMap(selectedLib => {
|
||||
const foundVersion = this.findLibVersion(selectedLib, supportedLibraries);
|
||||
if (!foundVersion) return [];
|
||||
@@ -143,7 +150,7 @@ export class BaseTool implements ITool {
|
||||
inputFilepath?: string,
|
||||
args?: string[],
|
||||
stdin?: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
) {
|
||||
if (this.tool.name) {
|
||||
toolCounter.inc({
|
||||
|
||||
@@ -26,7 +26,7 @@ import path from 'path';
|
||||
|
||||
import fs from 'fs-extra';
|
||||
|
||||
import {Library} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {OptionsHandlerLibrary} from '../options-handler.js';
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
import {BaseTool} from './base-tool.js';
|
||||
@@ -47,7 +47,7 @@ export class ClangTidyTool extends BaseTool {
|
||||
inputFilepath: string,
|
||||
args?: string[],
|
||||
stdin?: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
) {
|
||||
const sourcefile = inputFilepath;
|
||||
const options = compilationInfo.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 {Library} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {ToolResult} from '../../types/tool.interfaces.js';
|
||||
import {OptionsHandlerLibrary} from '../options-handler.js';
|
||||
import {getToolchainPath} from '../toolchain-utils.js';
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
@@ -102,7 +102,7 @@ export class CompilerDropinTool extends BaseTool {
|
||||
inputFilepath?: string,
|
||||
args?: string[],
|
||||
stdin?: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
): Promise<ToolResult> {
|
||||
const sourcefile = inputFilepath;
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
import path from 'path';
|
||||
|
||||
import {Library} from '../../types/libraries/libraries.interfaces.js';
|
||||
import {ToolInfo} from '../../types/tool.interfaces.js';
|
||||
import {unwrap} from '../assert.js';
|
||||
import {logger} from '../logger.js';
|
||||
import {OptionsHandlerLibrary} from '../options-handler.js';
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
import {ToolEnv} from './base-tool.interface.js';
|
||||
@@ -81,7 +81,7 @@ export class MicrosoftAnalysisTool extends BaseTool {
|
||||
inputFilepath?: string,
|
||||
args?: string[],
|
||||
stdin?: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
) {
|
||||
const sourcefile = inputFilepath;
|
||||
const options = compilationInfo.options;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
import path from 'path';
|
||||
|
||||
import {ExecutionOptions} from '../../types/compilation/compilation.interfaces.js';
|
||||
import {Library} from '../../types/libraries/libraries.interfaces.js';
|
||||
import type {
|
||||
Fix,
|
||||
Link,
|
||||
@@ -34,6 +33,7 @@ import type {
|
||||
ResultLineTag,
|
||||
} from '../../types/resultline/resultline.interfaces.js';
|
||||
import type {Artifact, ToolInfo, ToolResult} from '../../types/tool.interfaces.js';
|
||||
import {OptionsHandlerLibrary} from '../options-handler.js';
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
import {ToolEnv} from './base-tool.interface.js';
|
||||
@@ -180,7 +180,7 @@ export class SonarTool extends BaseTool {
|
||||
buildCompilationCMD(
|
||||
compilationInfo: Record<any, any>,
|
||||
inputFilePath: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
) {
|
||||
const cmd: any[] = [];
|
||||
cmd.push(compilationInfo.compiler.exe);
|
||||
@@ -211,7 +211,7 @@ export class SonarTool extends BaseTool {
|
||||
inputFilePath?: string,
|
||||
args?: string[],
|
||||
stdin?: string,
|
||||
supportedLibraries?: Record<string, Library>,
|
||||
supportedLibraries?: Record<string, OptionsHandlerLibrary>,
|
||||
): Promise<ToolResult> {
|
||||
if (inputFilePath == null) {
|
||||
return new Promise(resolve => {
|
||||
|
||||
20
package-lock.json
generated
20
package-lock.json
generated
@@ -20,6 +20,7 @@
|
||||
"@sentry/browser": "^7.114.0",
|
||||
"@sentry/node": "^7.114.0",
|
||||
"@types/morgan": "^1.9.9",
|
||||
"@types/semver": "^7.5.8",
|
||||
"big-integer": "^1.6.52",
|
||||
"body-parser": "^1.20.2",
|
||||
"bootstrap": "^4.6.2",
|
||||
@@ -61,7 +62,7 @@
|
||||
"response-time": "^2.3.2",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"scroll-into-view-if-needed": "^3.1.0",
|
||||
"semver": "^7.6.2",
|
||||
"semver": "^7.6.3",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"shell-quote": "^1.8.1",
|
||||
"systemd-socket": "0.0.0",
|
||||
@@ -4074,6 +4075,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz",
|
||||
"integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/jsonfile": "*",
|
||||
"@types/node": "*"
|
||||
@@ -4220,6 +4222,12 @@
|
||||
"form-data": "^2.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz",
|
||||
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/send": {
|
||||
"version": "0.17.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
|
||||
@@ -4311,7 +4319,8 @@
|
||||
"version": "1.11.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.15.tgz",
|
||||
"integrity": "sha512-HP38xE+GuWGlbSRq9WrZkousaQ7dragtZCruBVMi0oX1migFZavZ3OROKHSkNp/9ouq82zrWtZpg18jFnVN96g==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/webpack-env": {
|
||||
"version": "1.18.5",
|
||||
@@ -13900,9 +13909,10 @@
|
||||
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz",
|
||||
"integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==",
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
|
||||
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"@sentry/browser": "^7.114.0",
|
||||
"@sentry/node": "^7.114.0",
|
||||
"@types/morgan": "^1.9.9",
|
||||
"@types/semver": "^7.5.8",
|
||||
"big-integer": "^1.6.52",
|
||||
"body-parser": "^1.20.2",
|
||||
"bootstrap": "^4.6.2",
|
||||
@@ -70,7 +71,7 @@
|
||||
"response-time": "^2.3.2",
|
||||
"sanitize-filename": "^1.6.3",
|
||||
"scroll-into-view-if-needed": "^3.1.0",
|
||||
"semver": "^7.6.2",
|
||||
"semver": "^7.6.3",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"shell-quote": "^1.8.1",
|
||||
"systemd-socket": "0.0.0",
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
import {describe, expect, it} from 'vitest';
|
||||
|
||||
import {ParsedRequest} from '../lib/handlers/compile.js';
|
||||
import {filterCompilerOptions, KnownBuildMethod, makeSafe} from '../lib/stats.js';
|
||||
import {getHash} from '../lib/utils.js';
|
||||
import {ParseFiltersAndOutputOptions} from '../types/features/filters.interfaces.js';
|
||||
|
||||
describe('Stats', () => {
|
||||
const someDate = new Date(Date.UTC(2023, 6, 12, 2, 4, 6));
|
||||
@@ -136,7 +136,7 @@ describe('Stats', () => {
|
||||
optOutput: true,
|
||||
preProcessLines: lines => lines,
|
||||
preProcessBinaryAsmLines: lines => lines,
|
||||
} as unknown as ParsedRequest,
|
||||
} as ParseFiltersAndOutputOptions,
|
||||
bypassCache: 0,
|
||||
tools: undefined,
|
||||
executeParameters: executionParameters,
|
||||
|
||||
Reference in New Issue
Block a user