Skip to content

Commit

Permalink
Move compile for android into caliper runner
Browse files Browse the repository at this point in the history
RELNOTES=Compile android benchmarks before running them
PiperOrigin-RevId: 612883351
  • Loading branch information
java-team-github-bot authored and Caliper Team committed Mar 5, 2024
1 parent 2328ccc commit 151a691
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected void startUp() throws Exception {

selectDevice(deviceSerialNumber);
install(getWorkerApk());
compile(CALIPER_PACKAGE_NAME);

// This method waits for the server to be running. We need to get it here rather than injecting
// the port since both the AdbDevice and the ServerSocketService need to be started up by the
Expand All @@ -135,7 +136,7 @@ protected void startUp() throws Exception {
setReversePortForwarding();

startActivity(
"com.google.caliper/.worker.CaliperProxyActivity",
CALIPER_PACKAGE_NAME + "/.worker.CaliperProxyActivity",
ImmutableMap.of(
"com.google.caliper.runner_port",
"" + port,
Expand Down Expand Up @@ -206,6 +207,13 @@ private void install(File apk) {
shell.execute(adbCommand("install", "-r", apk.getAbsolutePath())).orThrow();
}

private void compile(String packageName) {
stdout.println("adb: compiling package " + packageName);
shell
.execute(adbCommand("shell", "cmd", "package", "compile", "-m", "speed", "-f", packageName))
.orThrow();
}

/** Uninstalls the package with the given name from the device. */
private void uninstall(String packageName) {
stdout.println("adb: uninstalling package " + packageName);
Expand Down

0 comments on commit 151a691

Please sign in to comment.