org.gradle.api.provider.Provider Java Examples

The following examples show how to use org.gradle.api.provider.Provider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResolveJavadocLinks.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Stream<Configuration> findConfigurations(Object classpath) {
    if (classpath instanceof FileCollection) {
        return findConfigurations((FileCollection) classpath);
    }
    else if (classpath instanceof Provider) {
        Provider<?> provider = (Provider<?>) classpath;
        if (provider.isPresent()) {
            return findConfigurations(provider.get());
        }
        else {
            return Stream.empty();
        }
    }
    else {
        return Stream.empty();
    }
}
 
Example #2
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Provider<License> getLicense() {
    return getRepo().flatMap(repo ->
            project.provider(() -> {
                String url = Optional.ofNullable(repo.getLicense())
                        .map(License::getUrl)
                        .orElse(null);

                if (url != null) {
                    return githubService.getLicense(url).execute().body();
                }
                else {
                    return null;
                }
            })
    );
}
 
Example #3
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Provider<License> getLicense() {
    return getRepo().flatMap(repo ->
            project.provider(() -> {
                String url = Optional.ofNullable(repo.getLicense())
                        .map(License::getUrl)
                        .orElse(null);

                if (url != null) {
                    return githubService.getLicense(url).execute().body();
                }
                else {
                    return null;
                }
            })
    );
}
 
Example #4
Source File: ResolveJavadocLinks.java    From gradle-plugins with MIT License 6 votes vote down vote up
private Stream<Configuration> findConfigurations(Object classpath) {
    if (classpath instanceof FileCollection) {
        return findConfigurations((FileCollection) classpath);
    }
    else if (classpath instanceof Provider) {
        Provider<?> provider = (Provider<?>) classpath;
        if (provider.isPresent()) {
            return findConfigurations(provider.get());
        }
        else {
            return Stream.empty();
        }
    }
    else {
        return Stream.empty();
    }
}
 
Example #5
Source File: CppHeaderLibraryPlugin.java    From native-samples with Apache License 2.0 5 votes vote down vote up
private static TaskProvider<GenerateDummyCppSource> createTask(TaskContainer tasks, Project project) {
    return tasks.register("generateCppHeaderSourceFile", GenerateDummyCppSource.class, (task) -> {
        Provider<RegularFile> sourceFile = project.getLayout().getBuildDirectory().file("dummy-source.cpp");
        task.getOutputFile().set(sourceFile);
        task.getSymbolName().set("__" + toSymbol(project.getPath()) + "_" + toSymbol(project.getName()) + "__");
    });
}
 
Example #6
Source File: GithubExtension.java    From gradle-plugins with MIT License 5 votes vote down vote up
public Provider<String> getRepo() {
    return slug.map(sl -> {
        Matcher matcher = slugPattern.matcher(sl);
        if (matcher.matches()) {
            return matcher.group(2);
        }
        return "";
    });
}
 
Example #7
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private Provider<User> getUser() {
    return githubExtension.getOwner().flatMap(owner ->
            project.provider(() ->
                    githubService.getUser(owner).execute().body()
            )
    );
}
 
Example #8
Source File: GithubExtension.java    From gradle-plugins with MIT License 5 votes vote down vote up
public Provider<String> getOwner() {
    return slug.map(sl -> {
        Matcher matcher = slugPattern.matcher(sl);
        if (matcher.matches()) {
            return matcher.group(1);
        }
        return "";
    });
}
 
Example #9
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private Provider<Repo> getRepo() {
    return githubExtension.getSlug().flatMap(slug ->
            project.provider(() ->
                    githubService.getRepository(slug).execute().body()
            )
    );
}
 
Example #10
Source File: PlayRoutesPlugin.java    From playframework with Apache License 2.0 5 votes vote down vote up
private void createDefaultRoutesCompileTask(Project project, SourceDirectorySet sourceDirectory, Configuration compilerConfiguration, PlayExtension playExtension, Provider<Boolean> injectedRoutesGenerator) {
    project.getTasks().register(ROUTES_COMPILE_TASK_NAME, RoutesCompile.class, routesCompile -> {
        routesCompile.setDescription("Generates routes for the '" + sourceDirectory.getDisplayName() + "' source set.");
        routesCompile.getPlatform().set(project.provider(() -> playExtension.getPlatform()));
        routesCompile.getAdditionalImports().set(new ArrayList<>());
        routesCompile.setSource(sourceDirectory);
        routesCompile.getOutputDirectory().set(getOutputDir(project, sourceDirectory));
        routesCompile.getInjectedRoutesGenerator().set(injectedRoutesGenerator);
        routesCompile.getRoutesCompilerClasspath().setFrom(compilerConfiguration);
    });
}
 
Example #11
Source File: AspectJPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private void configureSourceSet(SourceSet sourceSet) {
    DefaultAspectjSourceSet aspectjSourceSet = new DefaultAspectjSourceSet(project.getObjects(), sourceSet);
    new DslObject(sourceSet).getConvention().getPlugins().put("aspectj", aspectjSourceSet);

    aspectjSourceSet.getAspectj().srcDir("src/" + sourceSet.getName() + "/aspectj");
    sourceSet.getResources().getFilter().exclude(element -> aspectjSourceSet.getAspectj().contains(element.getFile()));
    sourceSet.getAllJava().source(aspectjSourceSet.getAspectj());
    sourceSet.getAllSource().source(aspectjSourceSet.getAspectj());

    Configuration aspect = project.getConfigurations().create(aspectjSourceSet.getAspectConfigurationName());
    aspectjSourceSet.setAspectPath(aspect);

    Configuration inpath = project.getConfigurations().create(aspectjSourceSet.getInpathConfigurationName());
    aspectjSourceSet.setInPath(inpath);

    project.getConfigurations().getByName(sourceSet.getImplementationConfigurationName()).extendsFrom(aspect);

    project.getConfigurations().getByName(sourceSet.getCompileOnlyConfigurationName()).extendsFrom(inpath);

    final Provider<AspectjCompile> compileTask = project.getTasks().register(sourceSet.getCompileTaskName("aspectj"), AspectjCompile.class, compile -> {
        JvmPluginsHelper.configureForSourceSet(sourceSet, aspectjSourceSet.getAspectj(), compile, compile.getOptions(), project);
        compile.dependsOn(sourceSet.getCompileJavaTaskName());
        compile.setDescription("Compiles the " + sourceSet.getName() + " AspectJ source.");
        compile.setSource(aspectjSourceSet.getAspectj());
        compile.getAjcOptions().getAspectpath().from(aspectjSourceSet.getAspectPath());
        compile.getAjcOptions().getInpath().from(aspectjSourceSet.getInPath());
    });
    JvmPluginsHelper.configureOutputDirectoryForSourceSet(sourceSet, aspectjSourceSet.getAspectj(), project, compileTask, compileTask.map(AspectjCompile::getOptions));

    project.getTasks().named(sourceSet.getClassesTaskName(), task -> task.dependsOn(compileTask));
}
 
Example #12
Source File: GitPublishPlugin.java    From gradle-git-publish with Apache License 2.0 5 votes vote down vote up
private GitPublishCommit createCommitTask(Project project, GitPublishExtension extension, Provider<Grgit> grgitProvider) {
  return project.getTasks().create(COMMIT_TASK, GitPublishCommit.class, task -> {
    task.setGroup("publishing");
    task.setDescription("Commits changes to be published to git.");
    task.getGrgit().set(grgitProvider);
    task.getMessage().set(extension.getCommitMessage());
    task.getSign().set(extension.getSign());
  });
}
 
Example #13
Source File: JdkDownloadPlugin.java    From crate with Apache License 2.0 5 votes vote down vote up
private static TaskProvider<?> createExtractTask(
    String taskName,
    Project rootProject,
    boolean isWindows,
    Provider<Directory> extractPath,
    Supplier<File> jdkBundle) {
    if (isWindows) {
        Action<CopySpec> removeRootDir = copy -> {
            // remove extra unnecessary directory levels
            copy.eachFile(details -> {
                Path newPathSegments = trimArchiveExtractPath(details.getRelativePath().getPathString());
                String[] segments = StreamSupport.stream(newPathSegments.spliterator(), false)
                    .map(Path::toString)
                    .toArray(String[]::new);
                details.setRelativePath(new RelativePath(true, segments));
            });
            copy.setIncludeEmptyDirs(false);
        };

        return rootProject.getTasks().register(taskName, Copy.class, copyTask -> {
            copyTask.doFirst(t -> rootProject.delete(extractPath));
            copyTask.into(extractPath);
            Callable<FileTree> fileGetter = () -> rootProject.zipTree(jdkBundle.get());
            copyTask.from(fileGetter, removeRootDir);
        });
    } else {
        /*
         * Gradle TarFileTree does not resolve symlinks, so we have to manually
         * extract and preserve the symlinks. cf. https://github.com/gradle/gradle/issues/3982
         * and https://discuss.gradle.org/t/tar-and-untar-losing-symbolic-links/2039
         */
        return rootProject.getTasks().register(taskName, SymbolicLinkPreservingUntarTask.class, task -> {
            task.getTarFile().fileProvider(rootProject.provider(jdkBundle::get));
            task.getExtractPath().set(extractPath);
            task.setTransform(JdkDownloadPlugin::trimArchiveExtractPath);
        });
    }
}
 
Example #14
Source File: QuarkusPluginExtension.java    From quarkus with Apache License 2.0 5 votes vote down vote up
public Path appJarOrClasses() {
    final Jar jarTask = (Jar) project.getTasks().findByName(JavaPlugin.JAR_TASK_NAME);
    if (jarTask == null) {
        throw new RuntimeException("Failed to locate task 'jar' in the project.");
    }
    final Provider<RegularFile> jarProvider = jarTask.getArchiveFile();
    Path classesDir = null;
    if (jarProvider.isPresent()) {
        final File f = jarProvider.get().getAsFile();
        if (f.exists()) {
            classesDir = f.toPath();
        }
    }
    if (classesDir == null) {
        final Convention convention = project.getConvention();
        JavaPluginConvention javaConvention = convention.findPlugin(JavaPluginConvention.class);
        if (javaConvention != null) {
            final SourceSet mainSourceSet = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME);
            final String classesPath = QuarkusGradleUtils.getClassesDir(mainSourceSet, jarTask.getTemporaryDir());
            if (classesPath != null) {
                classesDir = Paths.get(classesPath);
            }
        }
    }
    if (classesDir == null) {
        throw new RuntimeException("Failed to locate project's classes directory");
    }
    return classesDir;
}
 
Example #15
Source File: GitPublishPlugin.java    From gradle-git-publish with Apache License 2.0 5 votes vote down vote up
private GitPublishPush createPushTask(Project project, GitPublishExtension extension, Provider<Grgit> grgitProvider) {
  return project.getTasks().create(PUSH_TASK, GitPublishPush.class, task -> {
    task.setGroup("publishing");
    task.setDescription("Pushes changes to git.");
    task.getGrgit().set(grgitProvider);
    task.getBranch().set(extension.getBranch());
  });
}
 
Example #16
Source File: AspectJPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private void configureSourceSet(SourceSet sourceSet) {
    DefaultAspectjSourceSet aspectjSourceSet = new DefaultAspectjSourceSet(project.getObjects(), sourceSet);
    new DslObject(sourceSet).getConvention().getPlugins().put("aspectj", aspectjSourceSet);

    aspectjSourceSet.getAspectj().srcDir("src/" + sourceSet.getName() + "/aspectj");
    sourceSet.getResources().getFilter().exclude(element -> aspectjSourceSet.getAspectj().contains(element.getFile()));
    sourceSet.getAllJava().source(aspectjSourceSet.getAspectj());
    sourceSet.getAllSource().source(aspectjSourceSet.getAspectj());

    Configuration aspect = project.getConfigurations().create(aspectjSourceSet.getAspectConfigurationName());
    aspectjSourceSet.setAspectPath(aspect);

    Configuration inpath = project.getConfigurations().create(aspectjSourceSet.getInpathConfigurationName());
    aspectjSourceSet.setInPath(inpath);

    project.getConfigurations().getByName(sourceSet.getImplementationConfigurationName()).extendsFrom(aspect);

    project.getConfigurations().getByName(sourceSet.getCompileOnlyConfigurationName()).extendsFrom(inpath);

    final Provider<AspectjCompile> compileTask = project.getTasks().register(sourceSet.getCompileTaskName("aspectj"), AspectjCompile.class, compile -> {
        JvmPluginsHelper.configureForSourceSet(sourceSet, aspectjSourceSet.getAspectj(), compile, compile.getOptions(), project);
        compile.dependsOn(sourceSet.getCompileJavaTaskName());
        compile.setDescription("Compiles the " + sourceSet.getName() + " AspectJ source.");
        compile.setSource(aspectjSourceSet.getAspectj());
        compile.getAjcOptions().getAspectpath().from(aspectjSourceSet.getAspectPath());
        compile.getAjcOptions().getInpath().from(aspectjSourceSet.getInPath());
    });
    JvmPluginsHelper.configureOutputDirectoryForSourceSet(sourceSet, aspectjSourceSet.getAspectj(), project, compileTask, compileTask.map(AspectjCompile::getOptions));

    project.getTasks().named(sourceSet.getClassesTaskName(), task -> task.dependsOn(compileTask));
}
 
Example #17
Source File: GcloudTask.java    From curiostack with MIT License 5 votes vote down vote up
@TaskAction
public void exec() {
  GcloudExtension config =
      getProject().getRootProject().getExtensions().getByType(GcloudExtension.class);

  var toolManager = DownloadedToolManager.get(getProject());

  String command = Os.isFamily(Os.FAMILY_WINDOWS) ? COMMAND + ".cmd" : COMMAND;
  Path executable = toolManager.getBinDir("gcloud").resolve(command);
  List<Object> fullArgs =
      ImmutableList.builder()
          .add("--project=" + config.getClusterProject().get())
          .add("--quiet")
          .addAll(
              args.get().stream().map(o -> o instanceof Provider ? ((Provider) o).get() : o)
                  ::iterator)
          .build();
  getProject()
      .exec(
          exec -> {
            exec.executable(executable);
            exec.args(fullArgs);

            toolManager.addAllToPath(exec);
            exec.environment(
                "CLOUDSDK_PYTHON", toolManager.getBinDir("miniconda-build").resolve("python"));
            exec.environment("CLOUDSDK_PYTHON_SITEPACKAGES", "1");
            exec.setStandardInput(System.in);
          });
}
 
Example #18
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private Provider<User> getUser() {
    return githubExtension.getOwner().flatMap(owner ->
            project.provider(() ->
                    githubService.getUser(owner).execute().body()
            )
    );
}
 
Example #19
Source File: GithubPomPlugin.java    From gradle-plugins with MIT License 5 votes vote down vote up
private Provider<Repo> getRepo() {
    return githubExtension.getSlug().flatMap(slug ->
            project.provider(() ->
                    githubService.getRepository(slug).execute().body()
            )
    );
}
 
Example #20
Source File: GithubExtension.java    From gradle-plugins with MIT License 5 votes vote down vote up
public Provider<String> getRepo() {
    return slug.map(sl -> {
        Matcher matcher = slugPattern.matcher(sl);
        if (matcher.matches()) {
            return matcher.group(2);
        }
        return "";
    });
}
 
Example #21
Source File: GithubExtension.java    From gradle-plugins with MIT License 5 votes vote down vote up
public Provider<String> getOwner() {
    return slug.map(sl -> {
        Matcher matcher = slugPattern.matcher(sl);
        if (matcher.matches()) {
            return matcher.group(1);
        }
        return "";
    });
}
 
Example #22
Source File: WrappedNativeLibraryPlugin.java    From native-samples with Apache License 2.0 5 votes vote down vote up
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) {
    this.baseName = baseName;

    AttributeContainer publicationAttributes = immutableAttributesFactory.mutable();
    publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage);
    publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE);
    this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory);
}
 
Example #23
Source File: ClojureScriptBasePlugin.java    From clojurephant with Apache License 2.0 5 votes vote down vote up
private void configureSourceSetDefaults(Project project, ClojureScriptExtension extension) {
  project.getExtensions().getByType(SourceSetContainer.class).all((SourceSet sourceSet) -> {
    ClojureScriptSourceSet clojurescriptSourceSet = new DefaultClojureScriptSourceSet("clojurescript", objects);
    new DslObject(sourceSet).getConvention().getPlugins().put("clojurescript", clojurescriptSourceSet);

    clojurescriptSourceSet.getClojureScript().srcDir(String.format("src/%s/clojurescript", sourceSet.getName()));
    // in case the clojure source overlaps with the resources source
    sourceSet.getResources().getFilter().exclude(element -> clojurescriptSourceSet.getClojureScript().contains(element.getFile()));
    sourceSet.getAllSource().source(clojurescriptSourceSet.getClojureScript());

    ClojureScriptBuild build = extension.getBuilds().create(sourceSet.getName());
    build.getSourceSet().set(sourceSet);

    project.getTasks().named(sourceSet.getClassesTaskName(), task -> {
      task.dependsOn(build.getTaskName("compile"));
    });

    Provider<FileCollection> output = project.provider(() -> {
      if (build.isCompilerConfigured()) {
        return project.files(build.getOutputDir());
      } else {
        return clojurescriptSourceSet.getClojureScript().getSourceDirectories();
      }
    });

    ((DefaultSourceSetOutput) sourceSet.getOutput()).getClassesDirs().from(output);

    project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("compile"));
  });
}
 
Example #24
Source File: ClojureBasePlugin.java    From clojurephant with Apache License 2.0 5 votes vote down vote up
private void configureSourceSetDefaults(Project project, ClojureExtension extension) {
  project.getExtensions().getByType(SourceSetContainer.class).all(sourceSet -> {
    ClojureSourceSet clojureSourceSet = new DefaultClojureSourceSet("clojure", objects);
    new DslObject(sourceSet).getConvention().getPlugins().put("clojure", clojureSourceSet);

    clojureSourceSet.getClojure().srcDir(String.format("src/%s/clojure", sourceSet.getName()));
    // in case the clojure source overlaps with the resources source
    sourceSet.getResources().getFilter().exclude(element -> clojureSourceSet.getClojure().contains(element.getFile()));
    sourceSet.getAllSource().source(clojureSourceSet.getClojure());

    ClojureBuild build = extension.getBuilds().create(sourceSet.getName());
    build.getSourceSet().set(sourceSet);

    project.getTasks().named(sourceSet.getClassesTaskName(), task -> {
      task.dependsOn(build.getTaskName("compile"));
      task.dependsOn(build.getTaskName("check"));
    });

    Provider<FileCollection> output = project.provider(() -> {
      if (build.isCompilerConfigured()) {
        return project.files(build.getOutputDir());
      } else {
        return clojureSourceSet.getClojure().getSourceDirectories();
      }
    });

    ((DefaultSourceSetOutput) sourceSet.getOutput()).getClassesDirs().from(output);
    project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("compile"));
    project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("check"));
  });
}
 
Example #25
Source File: ClojureBasePlugin.java    From clojurephant with Apache License 2.0 5 votes vote down vote up
private void configureBuildDefaults(Project project, ClojureExtension extension) {
  extension.getRootOutputDir().set(project.getLayout().getBuildDirectory().dir("clojure"));

  extension.getBuilds().all(build -> {
    Provider<FileCollection> classpath = build.getSourceSet().map(sourceSet -> {
      return sourceSet.getCompileClasspath()
          .plus(project.files(sourceSet.getJava().getOutputDir()))
          .plus(project.files(sourceSet.getOutput().getResourcesDir()));
    });

    String checkTaskName = build.getTaskName("check");
    project.getTasks().register(checkTaskName, ClojureCheck.class, task -> {
      task.setDescription(String.format("Checks the Clojure source for the %s build.", build.getName()));
      task.getSourceRoots().from(build.getSourceRoots());
      task.getClasspath().from(classpath);
      task.getReflection().set(build.getReflection());
      task.getNamespaces().set(build.getCheckNamespaces());
      task.dependsOn(build.getSourceSet().map(SourceSet::getCompileJavaTaskName));
      task.dependsOn(build.getSourceSet().map(SourceSet::getProcessResourcesTaskName));
    });

    String compileTaskName = build.getTaskName("compile");
    project.getTasks().register(compileTaskName, ClojureCompile.class, task -> {
      task.setDescription(String.format("Compiles the Clojure source for the %s build.", build.getName()));
      task.getDestinationDir().set(build.getOutputDir());
      task.getSourceRoots().from(build.getSourceRoots());
      task.getClasspath().from(classpath);
      task.setOptions(build.getCompiler());
      task.getNamespaces().set(build.getAotNamespaces());
      task.dependsOn(build.getSourceSet().map(SourceSet::getCompileJavaTaskName));
      task.dependsOn(build.getSourceSet().map(SourceSet::getProcessResourcesTaskName));
    });
  });
}
 
Example #26
Source File: WrappedNativeLibraryPlugin.java    From native-samples with Apache License 2.0 5 votes vote down vote up
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) {
    this.baseName = baseName;

    AttributeContainer publicationAttributes = immutableAttributesFactory.mutable();
    publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage);
    publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE);
    this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory);
}
 
Example #27
Source File: WrappedNativeLibraryPlugin.java    From native-samples with Apache License 2.0 5 votes vote down vote up
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) {
    this.baseName = baseName;

    AttributeContainer publicationAttributes = immutableAttributesFactory.mutable();
    publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage);
    publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE);
    this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory);
}
 
Example #28
Source File: WrappedNativeLibraryPlugin.java    From native-samples with Apache License 2.0 5 votes vote down vote up
public DefaultMainPublication(Provider<String> baseName, Usage apiUsage, Configuration api, ImmutableAttributesFactory immutableAttributesFactory, ObjectFactory objectFactory) {
    this.baseName = baseName;

    AttributeContainer publicationAttributes = immutableAttributesFactory.mutable();
    publicationAttributes.attribute(Usage.USAGE_ATTRIBUTE, apiUsage);
    publicationAttributes.attribute(ArtifactAttributes.ARTIFACT_FORMAT, ZIP_TYPE);
    this.mainVariant = new MainLibraryVariant("api", apiUsage, api, publicationAttributes, objectFactory);
}
 
Example #29
Source File: Make.java    From native-samples with Apache License 2.0 4 votes vote down vote up
public void binary(Provider<String> path) {
    binary.set(outputDirectory.file(path));
}
 
Example #30
Source File: AvroPlugin.java    From gradle-avro-plugin with Apache License 2.0 4 votes vote down vote up
private static Provider<Directory> getGeneratedOutputDir(Project project, SourceSet sourceSet, String extension) {
    String generatedOutputDirName = String.format("generated-%s-avro-%s", sourceSet.getName(), extension);
    return project.getLayout().getBuildDirectory().dir(generatedOutputDirName);
}