Merge branch 'main' into daverlo/python-v2
This commit is contained in:
commit
23a1a65b43
6132 changed files with 570436 additions and 216076 deletions
32
lib/init.js
generated
32
lib/init.js
generated
|
|
@ -16,7 +16,7 @@ const configUtils = __importStar(require("./config-utils"));
|
|||
const tracer_config_1 = require("./tracer-config");
|
||||
const util = __importStar(require("./util"));
|
||||
async function initCodeQL(codeqlURL, githubAuth, githubUrl, tempDir, toolsDir, mode, logger) {
|
||||
logger.startGroup('Setup CodeQL tools');
|
||||
logger.startGroup("Setup CodeQL tools");
|
||||
const codeql = await codeql_1.setupCodeQL(codeqlURL, githubAuth, githubUrl, tempDir, toolsDir, mode, logger);
|
||||
await codeql.printVersion();
|
||||
logger.endGroup();
|
||||
|
|
@ -24,7 +24,7 @@ async function initCodeQL(codeqlURL, githubAuth, githubUrl, tempDir, toolsDir, m
|
|||
}
|
||||
exports.initCodeQL = initCodeQL;
|
||||
async function initConfig(languagesInput, queriesInput, configFile, repository, tempDir, toolCacheDir, codeQL, checkoutPath, githubAuth, githubUrl, logger) {
|
||||
logger.startGroup('Load language configuration');
|
||||
logger.startGroup("Load language configuration");
|
||||
const config = await configUtils.initConfig(languagesInput, queriesInput, configFile, repository, tempDir, toolCacheDir, codeQL, checkoutPath, githubAuth, githubUrl, logger);
|
||||
analysisPaths.printPathFiltersWarning(config, logger);
|
||||
logger.endGroup();
|
||||
|
|
@ -35,7 +35,7 @@ async function runInit(codeql, config) {
|
|||
const sourceRoot = path.resolve();
|
||||
fs.mkdirSync(util.getCodeQLDatabasesDir(config.tempDir), { recursive: true });
|
||||
// TODO: replace this code once CodeQL supports multi-language tracing
|
||||
for (let language of config.languages) {
|
||||
for (const language of config.languages) {
|
||||
// Init language database
|
||||
await codeql.databaseInit(util.getCodeQLDatabasePath(config.tempDir, language), language, sourceRoot);
|
||||
}
|
||||
|
|
@ -110,35 +110,37 @@ async function injectWindowsTracer(processName, processLevel, config, codeql, tr
|
|||
|
||||
Invoke-Expression "&$tracer --inject=$id"`;
|
||||
}
|
||||
const injectTracerPath = path.join(config.tempDir, 'inject-tracer.ps1');
|
||||
const injectTracerPath = path.join(config.tempDir, "inject-tracer.ps1");
|
||||
fs.writeFileSync(injectTracerPath, script);
|
||||
await new toolrunnner.ToolRunner('powershell', [
|
||||
'-ExecutionPolicy', 'Bypass',
|
||||
'-file', injectTracerPath,
|
||||
path.resolve(path.dirname(codeql.getPath()), 'tools', 'win64', 'tracer.exe'),
|
||||
], { env: { 'ODASA_TRACER_CONFIGURATION': tracerConfig.spec } }).exec();
|
||||
await new toolrunnner.ToolRunner("powershell", [
|
||||
"-ExecutionPolicy",
|
||||
"Bypass",
|
||||
"-file",
|
||||
injectTracerPath,
|
||||
path.resolve(path.dirname(codeql.getPath()), "tools", "win64", "tracer.exe"),
|
||||
], { env: { ODASA_TRACER_CONFIGURATION: tracerConfig.spec } }).exec();
|
||||
}
|
||||
exports.injectWindowsTracer = injectWindowsTracer;
|
||||
async function installPythonDeps(codeql, logger) {
|
||||
logger.startGroup('Setup Python dependencies');
|
||||
const scriptsFolder = path.resolve(__dirname, '../python-setup');
|
||||
logger.startGroup("Setup Python dependencies");
|
||||
const scriptsFolder = path.resolve(__dirname, "../python-setup");
|
||||
// Setup tools
|
||||
try {
|
||||
await new toolrunnner.ToolRunner(path.join(scriptsFolder, 'install_tools.sh')).exec();
|
||||
await new toolrunnner.ToolRunner(path.join(scriptsFolder, "install_tools.sh")).exec();
|
||||
}
|
||||
catch (e) {
|
||||
// This script tries to install some needed tools in the runner. It should not fail, but if it does
|
||||
// we just abort the process without failing the action
|
||||
logger.endGroup();
|
||||
throw new Error('Unable to download and extract the scripts needed for installing the python dependecies');
|
||||
throw new Error("Unable to download and extract the scripts needed for installing the python dependecies");
|
||||
}
|
||||
// Install dependencies
|
||||
try {
|
||||
await new toolrunnner.ToolRunner(path.join(scriptsFolder, 'auto_install_packages.py'), [path.dirname(codeql.getPath())]).exec();
|
||||
await new toolrunnner.ToolRunner(path.join(scriptsFolder, "auto_install_packages.py"), [path.dirname(codeql.getPath())]).exec();
|
||||
}
|
||||
catch (e) {
|
||||
logger.endGroup();
|
||||
throw new Error('We were unable to install your python dependencies.');
|
||||
throw new Error("We were unable to install your python dependencies.");
|
||||
}
|
||||
logger.endGroup();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue