Skip to content
This repository was archived by the owner on Aug 14, 2020. It is now read-only.

Commit e035f37

Browse files
Use jar library directly
1 parent a2b48a3 commit e035f37

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

dist/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4041,14 +4041,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
40414041
const exec = __importStar(__webpack_require__(230));
40424042
const io = __importStar(__webpack_require__(954));
40434043
const tc = __importStar(__webpack_require__(602));
4044+
const IS_WINDOWS = process.platform === 'win32';
40444045
function instrument(agentVersion) {
40454046
return __awaiter(this, void 0, void 0, function* () {
4046-
const workdir = process.cwd();
4047-
const scopeAgentPath = yield tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-agent/" + agentVersion + "/scope-agent-" + agentVersion + ".jar");
4047+
let scopeAgentPath = yield tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-agent/" + agentVersion + "/scope-agent-" + agentVersion + ".jar");
40484048
if (!scopeAgentPath.endsWith(".jar")) {
40494049
yield io.mv(scopeAgentPath, scopeAgentPath + ".jar");
40504050
}
4051-
yield exec.exec("sh -c \"docker run -v " + workdir + ":/home/project -e \\\"SCOPE_AGENT_PATH=" + scopeAgentPath + ".jar\\\" codescope/scope-instrumentation-for-maven\"");
4051+
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");
4052+
if (!mavenInstrumentatorPath.endsWith(".jar")) {
4053+
yield io.mv(mavenInstrumentatorPath, mavenInstrumentatorPath + ".jar");
4054+
}
4055+
if (IS_WINDOWS) {
4056+
scopeAgentPath = scopeAgentPath.replace("\\", "\\\\");
4057+
mavenInstrumentatorPath = mavenInstrumentatorPath.replace("\\", "\\\\");
4058+
}
4059+
yield exec.exec("sh -c \"find . -name \\\"pom.xml\\\" -exec java -jar " + mavenInstrumentatorPath + ".jar \\\"" + scopeAgentPath + ".jar\\\" {} \\;\"");
40524060
});
40534061
}
40544062
exports.instrument = instrument;

src/executor.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import * as tc from '@actions/tool-cache';
55
export async function instrument(agentVersion:string): Promise<void> {
66
const workdir = process.cwd();
77
const scopeAgentPath = await tc.downloadTool("https://repo1.maven.org/maven2/com/undefinedlabs/scope/scope-agent/"+agentVersion+"/scope-agent-"+agentVersion+".jar");
8-
98
if(!scopeAgentPath.endsWith(".jar")) {
109
await io.mv(scopeAgentPath, scopeAgentPath+".jar");
1110
}
1211

13-
await exec.exec("sh -c \"docker run -v "+workdir+":/home/project -e \\\"SCOPE_AGENT_PATH="+scopeAgentPath+".jar\\\" codescope/scope-instrumentation-for-maven\"");
12+
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");
13+
if(!mavenInstrumentatorPath.endsWith(".jar")){
14+
await io.mv(mavenInstrumentatorPath, mavenInstrumentatorPath+".jar");
15+
}
16+
17+
await exec.exec("sh -c \"find "+workdir+" -name \\\"pom.xml\\\" -exec java -jar "+mavenInstrumentatorPath+".jar \\\""+scopeAgentPath+".jar\\\" {} \\;\"");
1418
}

0 commit comments

Comments
 (0)