diff options
author | Jean-Philippe Lesot <jplesot@google.com> | 2015-04-01 17:00:34 +0200 |
---|---|---|
committer | Jean-Philippe Lesot <jplesot@google.com> | 2015-04-01 18:07:52 +0200 |
commit | 011ec29c12763f9cc655933414b5c0a5c9a7b6ca (patch) | |
tree | cb92aea7a4539cb0c9cbc678143ca589e269f42d /jack-server/src/com | |
parent | 98efb7bb82b1a2a3c5ada01c7b2265ecf408db82 (diff) | |
download | toolchain_jack-011ec29c12763f9cc655933414b5c0a5c9a7b6ca.zip toolchain_jack-011ec29c12763f9cc655933414b5c0a5c9a7b6ca.tar.gz toolchain_jack-011ec29c12763f9cc655933414b5c0a5c9a7b6ca.tar.bz2 |
Add local setting, add id url to Jack simple server
Change-Id: I8e4b2e51a271fe8e625c40daa13d07395981c2cf
Diffstat (limited to 'jack-server/src/com')
5 files changed, 51 insertions, 0 deletions
diff --git a/jack-server/src/com/android/jack/server/JackSimpleServer.java b/jack-server/src/com/android/jack/server/JackSimpleServer.java index fa2184c..e939de5 100644 --- a/jack-server/src/com/android/jack/server/JackSimpleServer.java +++ b/jack-server/src/com/android/jack/server/JackSimpleServer.java @@ -131,6 +131,12 @@ public class JackSimpleServer { return rnd.nextInt(30); } + + @Override + @Nonnull + public String getVersion() { + return "0-0"; + } }; @Nonnull @@ -210,6 +216,7 @@ public class JackSimpleServer { router.addContainer(new PathParser("/jack"), new JackRun()); router.addContainer(new PathParser("/gc"), new JackGc()); router.addContainer(new PathParser("/stat"), new JackStat()); + router.addContainer(new PathParser("/id"), new JackId()); ContainerSocketProcessor processor = new ContainerSocketProcessor(router, nbInstance); connection = new SocketConnection(processor); @@ -615,6 +622,27 @@ public class JackSimpleServer { } } + private static class JackId implements Container { + @Override + public void handle(@Nonnull Request request, @Nonnull Response response) { + try { + response.setStatus(Status.OK); + PrintStream printer = response.getPrintStream(); + + printer.println("server.version: 1"); + printer.println("jack.version: " + service.getVersion()); + } catch (IOException e) { + logger.log(Level.SEVERE, "Exception during IO: ", e); + } finally { + try { + response.close(); + } catch (IOException e) { + logger.log(Level.SEVERE, "Exception during close: ", e); + } + } + } + } + static void printMemoryUsage(@Nonnull PrintStream printer, @Nonnull String suffix, @CheckForNull MemoryUsage usage) { if (usage != null) { diff --git a/jack-server/src/com/android/jack/server/Server.java b/jack-server/src/com/android/jack/server/Server.java index 8ab3153..483e301 100644 --- a/jack-server/src/com/android/jack/server/Server.java +++ b/jack-server/src/com/android/jack/server/Server.java @@ -76,6 +76,12 @@ public class Server { return rnd.nextInt(30); } + + @Override + @Nonnull + public String getVersion() { + return "0-0"; + } }; @Nonnull diff --git a/jack-server/src/com/android/jack/server/ServerTask.java b/jack-server/src/com/android/jack/server/ServerTask.java index b89f76c..78eff36 100644 --- a/jack-server/src/com/android/jack/server/ServerTask.java +++ b/jack-server/src/com/android/jack/server/ServerTask.java @@ -29,4 +29,7 @@ import javax.annotation.Nonnull; public interface ServerTask { int run(@Nonnull PrintStream out, @Nonnull PrintStream err, @Nonnull File workingDir, @Nonnull TokenIterator args); + + @Nonnull + String getVersion(); }
\ No newline at end of file diff --git a/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java b/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java index 7331c9e..47907c9 100644 --- a/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java +++ b/jack-server/src/com/android/jack/server/ServerTaskInsideVm.java @@ -17,6 +17,7 @@ package com.android.jack.server; import com.android.jack.CommandLine; +import com.android.jack.Jack; import com.android.jack.Main; import com.android.jack.Options; import com.android.sched.util.config.cli.TokenIterator; @@ -92,4 +93,10 @@ public class ServerTaskInsideVm extends CommandLine implements ServerTask { return runJack(err, options); } + + @Override + @Nonnull + public String getVersion() { + return Jack.getVersion().getReleaseCode() + "-" + Jack.getVersion().getSubReleaseCode(); + } } diff --git a/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java b/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java index a8ef6ab..c017d9e 100644 --- a/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java +++ b/jack-server/src/com/android/jack/server/ServerTaskSpawningVM.java @@ -16,6 +16,7 @@ package com.android.jack.server; +import com.android.jack.Jack; import com.android.jack.util.ExecuteFile; import com.android.sched.util.config.cli.TokenIterator; import com.android.sched.util.file.CannotReadException; @@ -149,4 +150,10 @@ public class ServerTaskSpawningVM implements ServerTask { return tokenizer; } + + @Override + @Nonnull + public String getVersion() { + return Jack.getVersion().getReleaseCode() + "-" + Jack.getVersion().getSubReleaseCode(); + } } |