Skip to content

Commit

Permalink
gapic: Add "-gapir-args" and "-gapis-args" flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-clayton committed Aug 1, 2017
1 parent 8a4c48a commit f806947
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions gapic/src/main/com/google/gapid/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public void dispose() {
GapisProcess.disableGapisTimeout,
Server.gapis,
Server.gapisAuthToken,
GapisProcess.gapirArgs,
GapisProcess.gapisArgs,
Logging.logLevel,
Logging.logDir,
Follower.logFollowRequests,
Expand Down
23 changes: 21 additions & 2 deletions gapic/src/main/com/google/gapid/server/GapisProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public class GapisProcess extends ChildProcess<Integer> {
public static final Flag<Boolean> disableGapisTimeout = Flags.value(
"disable-gapis-timeout", false, "Disables the GAPIS timeout. Useful for debugging.");

public static final Flag<String> gapisArgs = Flags.value(
"gapis-args", "", "Additional argument to pass to gapis.");
public static final Flag<String> 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);
Expand Down Expand Up @@ -82,15 +87,25 @@ protected Exception prepare(ProcessBuilder pb) {
List<String> 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();
Expand All @@ -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;
}
Expand Down

0 comments on commit f806947

Please sign in to comment.