buildSrc/src/main/java/com/uber/okbuck/core/model/jvm/JvmTarget.java [499:572]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private List<String> readKotlinCompilerArguments() {
    try {
      // Note: this is bad juju on Gradle 5.0, which would prefer you get the provider and lazily
      // eval.
      // We don't differentiate between test and non-test right now because Android projects don't
      // support test-only configuration. Non-android projects theoretically can, but let's wait for
      // someone to ask for that support first as it's not very common.
      Optional<KotlinCompile> kotlinCompileTask =
          getProject().getTasks().withType(KotlinCompile.class).stream().findFirst();
      if (!kotlinCompileTask.isPresent()) {
        return Collections.emptyList();
      }
      ImmutableMap.Builder<String, Optional<String>> optionBuilder = ImmutableMap.builder();
      KotlinJvmOptions options = kotlinCompileTask.get().getKotlinOptions();
      LinkedHashMap<String, Optional<String>> freeArgs = Maps.newLinkedHashMap();
      options.getFreeCompilerArgs().forEach(arg -> freeArgs.put(arg, Optional.empty()));
      optionBuilder.putAll(freeArgs);

      // Args from CommonToolArguments.kt and KotlinCommonToolOptions.kt
      if (options.getAllWarningsAsErrors()) {
        optionBuilder.put("-Werror", Optional.empty());
      }
      if (options.getSuppressWarnings()) {
        optionBuilder.put("-nowarn", Optional.empty());
      }
      if (options.getVerbose()) {
        optionBuilder.put("-verbose", Optional.empty());
      }

      // Args from K2JVMCompilerArguments.kt and KotlinJvmOptions.kt
      optionBuilder.put("-jvm-target", Optional.of(options.getJvmTarget()));
      if (options.getIncludeRuntime()) {
        optionBuilder.put("-include-runtime", Optional.empty());
      }
      String jdkHome = options.getJdkHome();
      if (jdkHome != null) {
        optionBuilder.put("-jdk-home", Optional.of(jdkHome));
      }
      if (options.getNoJdk()) {
        optionBuilder.put("-no-jdk", Optional.empty());
      }
      if (options.getNoStdlib()) {
        optionBuilder.put("-no-stdlib", Optional.empty());
      }
      if (options.getNoReflect()) {
        optionBuilder.put("-no-reflect", Optional.empty());
      }
      if (options.getJavaParameters()) {
        optionBuilder.put("-java-parameters", Optional.empty());
      }

      // In the future, could add any other compileKotlin configurations here

      // Return de-duping keys and sorting by them.
      return optionBuilder
          .build()
          .entrySet()
          .stream()
          .filter(distinctByKey(Map.Entry::getKey))
          .sorted(Comparator.comparing(Map.Entry::getKey, String.CASE_INSENSITIVE_ORDER))
          .flatMap(
              entry -> {
                if (entry.getValue().isPresent()) {
                  return ImmutableList.of(entry.getKey(), entry.getValue().get()).stream();
                } else {
                  return ImmutableList.of(entry.getKey()).stream();
                }
              })
          .collect(Collectors.toList());
    } catch (UnknownDomainObjectException ignored) {
      // Because why return null when you can throw an exception
      return Collections.emptyList();
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



plugin/src/main/java/com/uber/okbuck/core/model/jvm/JvmTarget.java [499:572]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private List<String> readKotlinCompilerArguments() {
    try {
      // Note: this is bad juju on Gradle 5.0, which would prefer you get the provider and lazily
      // eval.
      // We don't differentiate between test and non-test right now because Android projects don't
      // support test-only configuration. Non-android projects theoretically can, but let's wait for
      // someone to ask for that support first as it's not very common.
      Optional<KotlinCompile> kotlinCompileTask =
          getProject().getTasks().withType(KotlinCompile.class).stream().findFirst();
      if (!kotlinCompileTask.isPresent()) {
        return Collections.emptyList();
      }
      ImmutableMap.Builder<String, Optional<String>> optionBuilder = ImmutableMap.builder();
      KotlinJvmOptions options = kotlinCompileTask.get().getKotlinOptions();
      LinkedHashMap<String, Optional<String>> freeArgs = Maps.newLinkedHashMap();
      options.getFreeCompilerArgs().forEach(arg -> freeArgs.put(arg, Optional.empty()));
      optionBuilder.putAll(freeArgs);

      // Args from CommonToolArguments.kt and KotlinCommonToolOptions.kt
      if (options.getAllWarningsAsErrors()) {
        optionBuilder.put("-Werror", Optional.empty());
      }
      if (options.getSuppressWarnings()) {
        optionBuilder.put("-nowarn", Optional.empty());
      }
      if (options.getVerbose()) {
        optionBuilder.put("-verbose", Optional.empty());
      }

      // Args from K2JVMCompilerArguments.kt and KotlinJvmOptions.kt
      optionBuilder.put("-jvm-target", Optional.of(options.getJvmTarget()));
      if (options.getIncludeRuntime()) {
        optionBuilder.put("-include-runtime", Optional.empty());
      }
      String jdkHome = options.getJdkHome();
      if (jdkHome != null) {
        optionBuilder.put("-jdk-home", Optional.of(jdkHome));
      }
      if (options.getNoJdk()) {
        optionBuilder.put("-no-jdk", Optional.empty());
      }
      if (options.getNoStdlib()) {
        optionBuilder.put("-no-stdlib", Optional.empty());
      }
      if (options.getNoReflect()) {
        optionBuilder.put("-no-reflect", Optional.empty());
      }
      if (options.getJavaParameters()) {
        optionBuilder.put("-java-parameters", Optional.empty());
      }

      // In the future, could add any other compileKotlin configurations here

      // Return de-duping keys and sorting by them.
      return optionBuilder
          .build()
          .entrySet()
          .stream()
          .filter(distinctByKey(Map.Entry::getKey))
          .sorted(Comparator.comparing(Map.Entry::getKey, String.CASE_INSENSITIVE_ORDER))
          .flatMap(
              entry -> {
                if (entry.getValue().isPresent()) {
                  return ImmutableList.of(entry.getKey(), entry.getValue().get()).stream();
                } else {
                  return ImmutableList.of(entry.getKey()).stream();
                }
              })
          .collect(Collectors.toList());
    } catch (UnknownDomainObjectException ignored) {
      // Because why return null when you can throw an exception
      return Collections.emptyList();
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



