Skip to content

Commit

Permalink
fix Teamscale finding
Browse files Browse the repository at this point in the history
  • Loading branch information
karottenreibe committed Nov 30, 2023
1 parent 6f1b50b commit e20f6ba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
15 changes: 3 additions & 12 deletions agent/src/main/java/com/teamscale/jacoco/agent/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,15 @@
import com.beust.jcommander.ParameterException;
import com.teamscale.jacoco.agent.commandline.Validator;
import com.teamscale.jacoco.agent.convert.ConvertCommand;
import com.teamscale.jacoco.agent.util.AgentUtils;
import com.teamscale.jacoco.agent.util.LoggingUtils;
import org.conqat.lib.commons.string.StringUtils;
import org.jacoco.core.JaCoCo;
import org.slf4j.Logger;

import java.util.ResourceBundle;

/** Provides a command line interface for interacting with JaCoCo. */
public class Main {

/** Version of this program. */
public static final String VERSION;

static {
ResourceBundle bundle = ResourceBundle.getBundle("com.teamscale.jacoco.agent.app");
VERSION = bundle.getString("version");
}

/** The logger. */
private final Logger logger = LoggingUtils.getLogger(this);

Expand Down Expand Up @@ -53,7 +44,7 @@ private void parseCommandLineAndRun(String[] args) throws Exception {
}

if (defaultArguments.help) {
System.out.println("CQSE JaCoCo agent " + VERSION + " compiled against JaCoCo " + JaCoCo.VERSION);
System.out.println("CQSE JaCoCo agent " + AgentUtils.VERSION + " compiled against JaCoCo " + JaCoCo.VERSION);
jCommander.usage();
return;
}
Expand All @@ -63,7 +54,7 @@ private void parseCommandLineAndRun(String[] args) throws Exception {
handleInvalidCommandLine(jCommander, StringUtils.LINE_FEED + validator.getErrorMessage());
}

logger.info("Starting CQSE JaCoCo agent " + VERSION + " compiled against JaCoCo " + JaCoCo.VERSION);
logger.info("Starting CQSE JaCoCo agent " + AgentUtils.VERSION + " compiled against JaCoCo " + JaCoCo.VERSION);
command.run();
}

Expand Down
3 changes: 2 additions & 1 deletion agent/src/main/java/com/teamscale/jacoco/agent/PreMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.teamscale.jacoco.agent.options.JacocoAgentOptionsBuilder;
import com.teamscale.jacoco.agent.testimpact.TestwiseCoverageAgent;
import com.teamscale.jacoco.agent.upload.UploaderException;
import com.teamscale.jacoco.agent.util.AgentUtils;
import com.teamscale.jacoco.agent.util.DebugLogDirectoryPropertyDefiner;
import com.teamscale.jacoco.agent.util.LogDirectoryPropertyDefiner;
import com.teamscale.jacoco.agent.util.LoggingUtils;
Expand Down Expand Up @@ -39,7 +40,7 @@ public static void premain(String options, Instrumentation instrumentation) thro

Logger logger = LoggingUtils.getLogger(Agent.class);

logger.info("Teamscale Java profiler version " + Main.VERSION);
logger.info("Teamscale Java profiler version " + AgentUtils.VERSION);
logger.info("Starting JaCoCo's agent");
JacocoAgentOptionsBuilder agentBuilder = new JacocoAgentOptionsBuilder(agentOptions);
JaCoCoPreMain.premain(agentBuilder.createJacocoAgentOptions(), instrumentation, logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ResourceBundle;

/** General utilities for working with the agent. */
public class AgentUtils {

/** Version of this program. */
public static final String VERSION;

static {
ResourceBundle bundle = ResourceBundle.getBundle("com.teamscale.jacoco.agent.app");
VERSION = bundle.getString("version");
}

/** Returns the directory that contains the agent or null if it can't be resolved. */
public static Path getAgentDirectory() {
try {
Expand Down

0 comments on commit e20f6ba

Please sign in to comment.