diff --git a/dist/index.js b/dist/index.js index 6818bc2..7ee99d9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4041,14 +4041,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); const exec = __importStar(__webpack_require__(230)); const io = __importStar(__webpack_require__(954)); const tc = __importStar(__webpack_require__(602)); +const IS_WINDOWS = process.platform === 'win32'; function instrument(agentVersion) { return __awaiter(this, void 0, void 0, function* () { - const workdir = process.cwd(); - const scopeAgentPath = yield tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-agent/" + agentVersion + "/scope-agent-" + agentVersion + ".jar"); + let scopeAgentPath = yield tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-agent/" + agentVersion + "/scope-agent-" + agentVersion + ".jar"); if (!scopeAgentPath.endsWith(".jar")) { yield io.mv(scopeAgentPath, scopeAgentPath + ".jar"); } - yield exec.exec("sh -c \"docker run -v " + workdir + ":/home/project -e \\\"SCOPE_AGENT_PATH=" + scopeAgentPath + ".jar\\\" codescope/scope-instrumentation-for-maven\""); + let mavenInstrumentatorPath = yield tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-instrumentation-for-maven/0.1.0/scope-instrumentation-for-maven-0.1.0.jar"); + if (!mavenInstrumentatorPath.endsWith(".jar")) { + yield io.mv(mavenInstrumentatorPath, mavenInstrumentatorPath + ".jar"); + } + if (IS_WINDOWS) { + scopeAgentPath = scopeAgentPath.replace("\\", "\\\\"); + mavenInstrumentatorPath = mavenInstrumentatorPath.replace("\\", "\\\\"); + } + yield exec.exec("sh -c \"find . -name \\\"pom.xml\\\" -exec java -jar " + mavenInstrumentatorPath + ".jar \\\"" + scopeAgentPath + ".jar\\\" {} \\;\""); }); } exports.instrument = instrument; diff --git a/src/executor.ts b/src/executor.ts index 9b8cdbe..c709b63 100644 --- a/src/executor.ts +++ b/src/executor.ts @@ -5,10 +5,14 @@ import * as tc from '@actions/tool-cache'; export async function instrument(agentVersion:string): Promise { const workdir = process.cwd(); const scopeAgentPath = await tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-agent/"+agentVersion+"/scope-agent-"+agentVersion+".jar"); - if(!scopeAgentPath.endsWith(".jar")) { await io.mv(scopeAgentPath, scopeAgentPath+".jar"); } - await exec.exec("sh -c \"docker run -v "+workdir+":/home/project -e \\\"SCOPE_AGENT_PATH="+scopeAgentPath+".jar\\\" codescope/scope-instrumentation-for-maven\""); + const mavenInstrumentatorPath = await tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-instrumentation-for-maven/0.1.0/scope-instrumentation-for-maven-0.1.0.jar"); + if(!mavenInstrumentatorPath.endsWith(".jar")){ + await io.mv(mavenInstrumentatorPath, mavenInstrumentatorPath+".jar"); + } + + await exec.exec("sh -c \"find "+workdir+" -name \\\"pom.xml\\\" -exec java -jar "+mavenInstrumentatorPath+".jar \\\""+scopeAgentPath+".jar\\\" {} \\;\""); } \ No newline at end of file