Make parameter names more descriptive
This commit is contained in:
Родитель
c41d287cae
Коммит
5ab09ae291
|
@ -8,8 +8,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const path = __importStar(require("path"));
|
||||
const codeql_1 = require("./codeql");
|
||||
const sharedEnv = __importStar(require("./shared-environment"));
|
||||
const util = __importStar(require("./util"));
|
||||
|
@ -35,16 +33,7 @@ async function run() {
|
|||
}
|
||||
core.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = codeql_1.getCodeQL();
|
||||
const cmdName = process.platform === 'win32' ? 'autobuild.cmd' : 'autobuild.sh';
|
||||
const autobuildCmd = path.join(codeQL.getDir(), language, 'tools', cmdName);
|
||||
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
|
||||
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
|
||||
// and Maven not properly handling closed connections
|
||||
// Otherwise long build processes will timeout when pulling down Java packages
|
||||
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
|
||||
let javaToolOptions = process.env['JAVA_TOOL_OPTIONS'] || "";
|
||||
process.env['JAVA_TOOL_OPTIONS'] = [...javaToolOptions.split(/\s+/), '-Dhttp.keepAlive=false', '-Dmaven.wagon.http.pool=false'].join(' ');
|
||||
await exec.exec(autobuildCmd);
|
||||
await codeQL.runAutobuild(language);
|
||||
core.endGroup();
|
||||
}
|
||||
catch (error) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"autobuild.js","sourceRoot":"","sources":["../src/autobuild.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAsC;AACtC,oDAAsC;AACtC,2CAA6B;AAE7B,qCAAqC;AACrC,gEAAkD;AAClD,6CAA+B;AAE/B,KAAK,UAAU,GAAG;;IAChB,IAAI;QACF,IAAI,IAAI,CA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= path.resolve(database, 'working', 'env.tmp');
|
||||
const compilerSpecArg = compilerSpec ? "--compiler-spec=" + compilerSpec : [];
|
||||
getTracerEnv: async function (databasePath, compilerSpec) {
|
||||
let envFile = path.resolve(databasePath, 'working', 'env.tmp');
|
||||
const compilerSpecArg = compilerSpec ? ["--compiler-spec=" + compilerSpec] : [];
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'trace-command',
|
||||
database,
|
||||
databasePath,
|
||||
...compilerSpecArg,
|
||||
process.execPath,
|
||||
path.resolve(__dirname, 'tracer-env.js'),
|
||||
|
@ -95,16 +95,28 @@ function getCodeQLForCmd(cmd) {
|
|||
]);
|
||||
return JSON.parse(fs.readFileSync(envFile, 'utf-8'));
|
||||
},
|
||||
databaseInit: async function (database, language, sourceRoot) {
|
||||
databaseInit: async function (databasePath, language, sourceRoot) {
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'init',
|
||||
database,
|
||||
databasePath,
|
||||
'--language=' + language,
|
||||
'--source-root=' + sourceRoot,
|
||||
]);
|
||||
},
|
||||
extractScannedLanguage: async function (database, language) {
|
||||
runAutobuild: async function (language) {
|
||||
const cmdName = process.platform === 'win32' ? 'autobuild.cmd' : 'autobuild.sh';
|
||||
const autobuildCmd = path.join(path.dirname(cmd), language, 'tools', cmdName);
|
||||
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
|
||||
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
|
||||
// and Maven not properly handling closed connections
|
||||
// Otherwise long build processes will timeout when pulling down Java packages
|
||||
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
|
||||
let javaToolOptions = process.env['JAVA_TOOL_OPTIONS'] || "";
|
||||
process.env['JAVA_TOOL_OPTIONS'] = [...javaToolOptions.split(/\s+/), '-Dhttp.keepAlive=false', '-Dmaven.wagon.http.pool=false'].join(' ');
|
||||
await exec.exec(autobuildCmd);
|
||||
},
|
||||
extractScannedLanguage: async function (databasePath, language) {
|
||||
// Get extractor location
|
||||
let extractorPath = '';
|
||||
await exec.exec(cmd, [
|
||||
|
@ -126,16 +138,16 @@ function getCodeQLForCmd(cmd) {
|
|||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'trace-command',
|
||||
path.join(database, language),
|
||||
databasePath,
|
||||
'--',
|
||||
traceCommand
|
||||
]);
|
||||
},
|
||||
finalizeDatabase: async function (database, language) {
|
||||
finalizeDatabase: async function (databasePath) {
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'finalize',
|
||||
path.join(database, language)
|
||||
databasePath
|
||||
]);
|
||||
},
|
||||
resolveQueries: async function (queries) {
|
||||
|
@ -154,13 +166,13 @@ function getCodeQLForCmd(cmd) {
|
|||
});
|
||||
return JSON.parse(output);
|
||||
},
|
||||
databaseAnalyze: async function (database, sarifFile, querySuite) {
|
||||
databaseAnalyze: async function (databasePath, sarifFile, querySuite) {
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'analyze',
|
||||
util.getMemoryFlag(),
|
||||
util.getThreadsFlag(),
|
||||
database,
|
||||
databasePath,
|
||||
'--format=sarif-latest',
|
||||
'--output=' + sarifFile,
|
||||
'--no-sarif-add-snippets',
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -42,7 +42,7 @@ async function createdDBForScannedLanguages(databaseFolder) {
|
|||
const codeql = codeql_1.getCodeQL();
|
||||
for (const language of scannedLanguages.split(',')) {
|
||||
core.startGroup('Extracting ' + language);
|
||||
await codeql.extractScannedLanguage(databaseFolder, language);
|
||||
await codeql.extractScannedLanguage(path.join(databaseFolder, language), language);
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ async function finalizeDatabaseCreation(databaseFolder) {
|
|||
const codeql = codeql_1.getCodeQL();
|
||||
for (const language of languages.split(',')) {
|
||||
core.startGroup('Finalizing ' + language);
|
||||
await codeql.finalizeDatabase(databaseFolder, language);
|
||||
await codeql.finalizeDatabase(path.join(databaseFolder, language));
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,6 +1,4 @@
|
|||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as path from 'path';
|
||||
|
||||
import { getCodeQL } from './codeql';
|
||||
import * as sharedEnv from './shared-environment';
|
||||
|
@ -32,18 +30,8 @@ async function run() {
|
|||
|
||||
core.startGroup(`Attempting to automatically build ${language} code`);
|
||||
const codeQL = getCodeQL();
|
||||
const cmdName = process.platform === 'win32' ? 'autobuild.cmd' : 'autobuild.sh';
|
||||
const autobuildCmd = path.join(codeQL.getDir(), language, 'tools', cmdName);
|
||||
await codeQL.runAutobuild(language);
|
||||
|
||||
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
|
||||
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
|
||||
// and Maven not properly handling closed connections
|
||||
// Otherwise long build processes will timeout when pulling down Java packages
|
||||
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
|
||||
let javaToolOptions = process.env['JAVA_TOOL_OPTIONS'] || "";
|
||||
process.env['JAVA_TOOL_OPTIONS'] = [...javaToolOptions.split(/\s+/), '-Dhttp.keepAlive=false', '-Dmaven.wagon.http.pool=false'].join(' ');
|
||||
|
||||
await exec.exec(autobuildCmd);
|
||||
core.endGroup();
|
||||
|
||||
} catch (error) {
|
||||
|
|
|
@ -20,11 +20,15 @@ export interface CodeQL {
|
|||
* Run 'codeql database trace-command' on 'tracer-env.js' and parse
|
||||
* the result to get environment variables set by CodeQL.
|
||||
*/
|
||||
getTracerEnv(database: string, compilerSpec: string | undefined): Promise<{ [key: string]: string }>;
|
||||
getTracerEnv(databasePath: string, compilerSpec: string | undefined): Promise<{ [key: string]: string }>;
|
||||
/**
|
||||
* Run 'codeql database init'.
|
||||
*/
|
||||
databaseInit(database: string, language: string, sourceRoot: string): Promise<void>;
|
||||
databaseInit(databasePath: string, language: string, sourceRoot: string): Promise<void>;
|
||||
/**
|
||||
* Runs the autobuilder for the given language.
|
||||
*/
|
||||
runAutobuild(language: string): Promise<void>;
|
||||
/**
|
||||
* Extract code for a scanned language using 'codeql database trace-command'
|
||||
* and running the language extracter.
|
||||
|
@ -33,15 +37,15 @@ export interface CodeQL {
|
|||
/**
|
||||
* Finalize a database using 'codeql database finalize'.
|
||||
*/
|
||||
finalizeDatabase(database: string, language: string): Promise<void>;
|
||||
finalizeDatabase(databasePath: string): Promise<void>;
|
||||
/**
|
||||
* Run 'codeql resolve queries'.
|
||||
*/
|
||||
resolveQueries(queries): Promise<ResolveQueriesOutput>;
|
||||
resolveQueries(queries: string[]): Promise<ResolveQueriesOutput>;
|
||||
/**
|
||||
* Run 'codeql database analyze'.
|
||||
*/
|
||||
databaseAnalyze(database: string, sarifFile: string, querySuite: string): Promise<void>;
|
||||
databaseAnalyze(databasePath: string, sarifFile: string, querySuite: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ResolveQueriesOutput {
|
||||
|
@ -132,13 +136,13 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
|||
'--format=json'
|
||||
]);
|
||||
},
|
||||
getTracerEnv: async function(database: string, compilerSpec: string | undefined) {
|
||||
let envFile = path.resolve(database, 'working', 'env.tmp');
|
||||
const compilerSpecArg = compilerSpec ? "--compiler-spec=" + compilerSpec : [];
|
||||
getTracerEnv: async function(databasePath: string, compilerSpec: string | undefined) {
|
||||
let envFile = path.resolve(databasePath, 'working', 'env.tmp');
|
||||
const compilerSpecArg = compilerSpec ? ["--compiler-spec=" + compilerSpec] : [];
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'trace-command',
|
||||
database,
|
||||
databasePath,
|
||||
...compilerSpecArg,
|
||||
process.execPath,
|
||||
path.resolve(__dirname, 'tracer-env.js'),
|
||||
|
@ -146,16 +150,30 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
|||
]);
|
||||
return JSON.parse(fs.readFileSync(envFile, 'utf-8'));
|
||||
},
|
||||
databaseInit: async function(database: string, language: string, sourceRoot: string) {
|
||||
databaseInit: async function(databasePath: string, language: string, sourceRoot: string) {
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'init',
|
||||
database,
|
||||
databasePath,
|
||||
'--language=' + language,
|
||||
'--source-root=' + sourceRoot,
|
||||
]);
|
||||
},
|
||||
extractScannedLanguage: async function(database: string, language: string) {
|
||||
runAutobuild: async function(language: string) {
|
||||
const cmdName = process.platform === 'win32' ? 'autobuild.cmd' : 'autobuild.sh';
|
||||
const autobuildCmd = path.join(path.dirname(cmd), language, 'tools', cmdName);
|
||||
|
||||
// Update JAVA_TOOL_OPTIONS to contain '-Dhttp.keepAlive=false'
|
||||
// This is because of an issue with Azure pipelines timing out connections after 4 minutes
|
||||
// and Maven not properly handling closed connections
|
||||
// Otherwise long build processes will timeout when pulling down Java packages
|
||||
// https://developercommunity.visualstudio.com/content/problem/292284/maven-hosted-agent-connection-timeout.html
|
||||
let javaToolOptions = process.env['JAVA_TOOL_OPTIONS'] || "";
|
||||
process.env['JAVA_TOOL_OPTIONS'] = [...javaToolOptions.split(/\s+/), '-Dhttp.keepAlive=false', '-Dmaven.wagon.http.pool=false'].join(' ');
|
||||
|
||||
await exec.exec(autobuildCmd);
|
||||
},
|
||||
extractScannedLanguage: async function(databasePath: string, language: string) {
|
||||
// Get extractor location
|
||||
let extractorPath = '';
|
||||
await exec.exec(
|
||||
|
@ -182,16 +200,16 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
|||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'trace-command',
|
||||
path.join(database, language),
|
||||
databasePath,
|
||||
'--',
|
||||
traceCommand
|
||||
]);
|
||||
},
|
||||
finalizeDatabase: async function(database: string, language: string) {
|
||||
finalizeDatabase: async function(databasePath: string) {
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'finalize',
|
||||
path.join(database, language)
|
||||
databasePath
|
||||
]);
|
||||
},
|
||||
resolveQueries: async function(queries: string[]) {
|
||||
|
@ -214,13 +232,13 @@ function getCodeQLForCmd(cmd: string): CodeQL {
|
|||
|
||||
return JSON.parse(output);
|
||||
},
|
||||
databaseAnalyze: async function(database: string, sarifFile: string, querySuite: string) {
|
||||
databaseAnalyze: async function(databasePath: string, sarifFile: string, querySuite: string) {
|
||||
await exec.exec(cmd, [
|
||||
'database',
|
||||
'analyze',
|
||||
util.getMemoryFlag(),
|
||||
util.getThreadsFlag(),
|
||||
database,
|
||||
databasePath,
|
||||
'--format=sarif-latest',
|
||||
'--output=' + sarifFile,
|
||||
'--no-sarif-add-snippets',
|
||||
|
|
|
@ -37,7 +37,7 @@ async function createdDBForScannedLanguages(databaseFolder: string) {
|
|||
const codeql = getCodeQL();
|
||||
for (const language of scannedLanguages.split(',')) {
|
||||
core.startGroup('Extracting ' + language);
|
||||
await codeql.extractScannedLanguage(databaseFolder, language);
|
||||
await codeql.extractScannedLanguage(path.join(databaseFolder, language), language);
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ async function finalizeDatabaseCreation(databaseFolder: string) {
|
|||
const codeql = getCodeQL();
|
||||
for (const language of languages.split(',')) {
|
||||
core.startGroup('Finalizing ' + language);
|
||||
await codeql.finalizeDatabase(databaseFolder, language);
|
||||
await codeql.finalizeDatabase(path.join(databaseFolder, language));
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче