Example #1
0
  @Subscribe
  public void gotOptions(GotOptionsEvent event) {
    BuildData.Builder builder = BuildData.newBuilder();
    BuildData.CommandLine.Builder cmdLineBuilder = BuildData.CommandLine.newBuilder();
    for (UnparsedOptionValueDescription option :
        event.getStartupOptions().asListOfUnparsedOptions()) {
      cmdLineBuilder.addStartupOptions(getOption(option));
    }

    for (UnparsedOptionValueDescription option : event.getOptions().asListOfUnparsedOptions()) {
      if (option.getName().equals("client_env")) {
        String env[] = option.getUnparsedValue().split("=");
        if (env.length == 1) {
          builder.addClientEnv(
              EnvironmentVar.newBuilder().setName(env[0]).setValue("true").build());
        } else if (env.length == 2) {
          builder.addClientEnv(
              EnvironmentVar.newBuilder().setName(env[0]).setValue(env[1]).build());
        }
      } else {
        cmdLineBuilder.addOptions(getOption(option));
      }
    }

    for (String residue : event.getOptions().getResidue()) {
      cmdLineBuilder.addResidue(residue);
    }
    builder.setCommandLine(cmdLineBuilder.build());

    // This can be called before handleOptions, so the BuildData is stored until we know if it
    // should be sent somewhere.
    optionsBuildData = builder.build();
  }
Example #2
0
 @Subscribe
 public void commandStartEvent(CommandStartEvent event) {
   BuildData.Builder builder =
       BuildData.newBuilder()
           .setBuildId(event.getCommandId().toString())
           .setCommandName(event.getCommandName())
           .setWorkingDir(event.getWorkingDirectory().getPathString());
   sender.send("start", builder.build());
 }
Example #3
0
 @Subscribe
 public void parsingComplete(TargetParsingCompleteEvent event) {
   BuildData.Builder builder = BuildData.newBuilder();
   for (Target target : event.getTargets()) {
     builder
         .addTargetsBuilder()
         .setLabel(target.getLabel().toString())
         .setRuleKind(target.getTargetKind())
         .build();
   }
   sender.send("targets", builder.build());
 }
Example #4
0
 @Subscribe
 public void testFinished(TestResult result) {
   BuildData.Builder builder = BuildData.newBuilder();
   BuildData.Target.Builder targetBuilder = BuildData.Target.newBuilder();
   targetBuilder.setLabel(result.getLabel());
   TestData.Builder testDataBuilder = TestData.newBuilder();
   testDataBuilder.setPassed(result.getData().getTestPassed());
   if (!result.getData().getTestPassed()) {
     testDataBuilder.setLog(getLog(result.getTestLogPath().toString()));
   }
   targetBuilder.setTestData(testDataBuilder);
   builder.addTargets(targetBuilder);
   sender.send("test", builder.build());
 }