From f8069474b2bc14971066f940f4e925ae3307cfe9 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 1 Aug 2017 15:00:20 +0100 Subject: [PATCH] gapic: Add "-gapir-args" and "-gapis-args" flags. --- gapic/src/main/com/google/gapid/Main.java | 2 ++ .../com/google/gapid/server/GapisProcess.java | 23 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/gapic/src/main/com/google/gapid/Main.java b/gapic/src/main/com/google/gapid/Main.java index be7bac9006..607a4ca715 100644 --- a/gapic/src/main/com/google/gapid/Main.java +++ b/gapic/src/main/com/google/gapid/Main.java @@ -177,6 +177,8 @@ public void dispose() { GapisProcess.disableGapisTimeout, Server.gapis, Server.gapisAuthToken, + GapisProcess.gapirArgs, + GapisProcess.gapisArgs, Logging.logLevel, Logging.logDir, Follower.logFollowRequests, diff --git a/gapic/src/main/com/google/gapid/server/GapisProcess.java b/gapic/src/main/com/google/gapid/server/GapisProcess.java index 841bd485dc..02b4688f92 100644 --- a/gapic/src/main/com/google/gapid/server/GapisProcess.java +++ b/gapic/src/main/com/google/gapid/server/GapisProcess.java @@ -46,6 +46,11 @@ public class GapisProcess extends ChildProcess { public static final Flag disableGapisTimeout = Flags.value( "disable-gapis-timeout", false, "Disables the GAPIS timeout. Useful for debugging."); + public static final Flag gapisArgs = Flags.value( + "gapis-args", "", "Additional argument to pass to gapis."); + public static final Flag gapirArgs = Flags.value( + "gapir-args", "", "Additional argument to pass to gapir."); + private static final Logger LOG = Logger.getLogger(GapisProcess.class.getName()); private static final Pattern PORT_PATTERN = Pattern.compile("^Bound on port '(\\d+)'$", 0); @@ -82,15 +87,25 @@ protected Exception prepare(ProcessBuilder pb) { List args = Lists.newArrayList(); args.add(GapiPaths.gapis().getAbsolutePath()); + String gapirFlags = ""; + File logDir = Logging.getLogDir(); if (logDir != null) { args.add("-log-file"); args.add(new File(logDir, "gapis.log").getAbsolutePath()); args.add("-log-level"); args.add(logLevel.get().gapisLevel); + + gapirFlags = "--log " + new File(logDir, "gapir.log").getAbsolutePath() + + " --log-level " + logLevel.get().gapirLevel; + if (!gapirArgs.get().isEmpty()) { + gapirFlags += " " + gapirArgs.get(); + } + } + + if (!gapirFlags.isEmpty()) { args.add("-gapir-args"); - args.add("--log " + new File(logDir, "gapir.log").getAbsolutePath() + - " --log-level " + logLevel.get().gapirLevel); + args.add(gapirFlags); } File strings = GapiPaths.strings(); @@ -113,6 +128,10 @@ protected Exception prepare(ProcessBuilder pb) { args.add(adb); } + if (!gapisArgs.get().isEmpty()) { + args.add(gapisArgs.get()); + } + pb.command(args); return null; }