public static void configureDevSource(JavaPluginConvention javaConvention, Function<SourceSet, SourceDirectorySet> languageMapper) { SourceSet main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); SourceSet test = javaConvention.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME); SourceSet dev = javaConvention.getSourceSets().getByName(DEV_SOURCE_SET_NAME); languageMapper.apply(dev).source(languageMapper.apply(test)); languageMapper.apply(dev).source(languageMapper.apply(main)); } }
public static void configureDevSource(JavaPluginConvention javaConvention, Function<SourceSet, SourceDirectorySet> languageMapper) { SourceSet main = javaConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME); SourceSet test = javaConvention.getSourceSets().getByName(SourceSet.TEST_SOURCE_SET_NAME); SourceSet dev = javaConvention.getSourceSets().getByName(DEV_SOURCE_SET_NAME); languageMapper.apply(dev).source(languageMapper.apply(test)); languageMapper.apply(dev).source(languageMapper.apply(main)); } }
public DefaultJavaScriptSourceSet(String displayName, FileResolver fileResolver) { this.name = displayName; DefaultDirectoryFileTreeFactory ddftf = new DefaultDirectoryFileTreeFactory(); javascript = new DefaultSourceDirectorySet(name, fileResolver, ddftf); allJavascript = new DefaultSourceDirectorySet(name, fileResolver, ddftf); allJavascript.source(javascript); }
public DefaultFregeSourceSet(String displayName, FregeSourceSetDirectoryFactory sourceSetFactory) { this.frege = sourceSetFactory.newSourceSetDirectory(String.format("%s Frege source", new Object[]{displayName})); this.frege.getFilter().include(new String[]{"**/*.fr"}); this.allFrege = sourceSetFactory.newSourceSetDirectory(String.format("%s Frege source", new Object[]{displayName})); this.allFrege.source(this.frege); this.allFrege.getFilter().include(new String[]{"**/*.fr"}); }
public DefaultGosuSourceSet( String name, SourceDirectorySetFactory sourceDirectorySetFactory ) { this.name = name; this.baseName = name.equals(SourceSet.MAIN_SOURCE_SET_NAME) ? "" : GUtil.toCamelCase(name); displayName = GUtil.toWords(this.name); _gosu = sourceDirectorySetFactory.create("gosu", displayName + " Gosu source"); _gosu.getFilter().include(_gosuAndJavaExtensions); _allGosu = sourceDirectorySetFactory.create("gosu", displayName + " Gosu source"); _allGosu.getFilter().include(_gosuExtensionsOnly); _allGosu.source(_gosu); }
final String srcDir = String.format("src/%s/velocity", sourceSet.getName()); velocitySourceSet.getVelocity().srcDir(srcDir); sourceSet.getAllSource().source(velocitySourceSet.getVelocity());
public void execute(final SourceSet sourceSet) { FregeSourceSetDirectoryFactory factory = new FregeSourceSetDirectoryFactory((ProjectInternal) project, fileResolver); final DefaultFregeSourceSet fregeSourceSet = new DefaultFregeSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), factory); new DslObject(sourceSet).getConvention().getPlugins().put("frege", fregeSourceSet); final String defaultSourcePath = String.format("src/%s/frege", sourceSet.getName()); fregeSourceSet.getFrege().srcDir(defaultSourcePath); sourceSet.getResources().getFilter().exclude(new Spec<FileTreeElement>() { public boolean isSatisfiedBy(FileTreeElement element) { return fregeSourceSet.getFrege().contains(element.getFile()); } }); sourceSet.getAllJava().source(fregeSourceSet.getFrege()); sourceSet.getAllSource().source(fregeSourceSet.getFrege()); String compileTaskName = sourceSet.getCompileTaskName("frege"); FregeCompile compile = project.getTasks().create(compileTaskName, FregeCompile.class); compile.setModule(project.file(defaultSourcePath).getAbsolutePath()); javaBasePlugin.configureForSourceSet(sourceSet, compile); compile.getConventionMapping().map("fregepath", new Callable() { public Object call() throws Exception { return sourceSet.getCompileClasspath(); } }); compile.dependsOn(sourceSet.getCompileJavaTaskName()); compile.setDescription(String.format("Compiles the %s Frege source.", sourceSet.getName())); compile.setSource(fregeSourceSet.getFrege()); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(compileTaskName); sourceSet.compiledBy(compile); } });
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) { _project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all( sourceSet -> { DefaultGosuSourceSet gosuSourceSet = new DefaultGosuSourceSet(((DefaultSourceSet) sourceSet).getDisplayName(), _fileResolver); new DslObject(sourceSet).getConvention().getPlugins().put("gosu", gosuSourceSet); gosuSourceSet.getGosu().srcDir("src/" + sourceSet.getName() + "/gosu"); sourceSet.getResources().getFilter().exclude( element -> { return gosuSourceSet.getGosu().contains(element.getFile()); }); sourceSet.getAllSource().source(gosuSourceSet.getGosu()); configureGosuCompile(javaBasePlugin, sourceSet, gosuSourceSet); }); }
private void configureSourceSetDefaults(final JavaBasePlugin javaBasePlugin) { _project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> { GosuSourceSet gosuSourceSet = new DefaultGosuSourceSet(sourceSet.getName(), _sourceDirectorySetFactory); Convention sourceSetConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention"); sourceSetConvention.getPlugins().put("gosu", gosuSourceSet); gosuSourceSet.getGosu().srcDir("src/" + sourceSet.getName() + "/gosu"); sourceSet.getResources().getFilter().exclude(element -> gosuSourceSet.getGosu().contains(element.getFile())); sourceSet.getAllSource().source(gosuSourceSet.getGosu()); configureGosuCompile(javaBasePlugin, sourceSet, gosuSourceSet); }); }
sourceSet.getAllSource().source(clojureSourceSet.getClojure());
private void configureSourceSetDefaults(Project project, ClojureExtension extension) { project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all(sourceSet -> { ClojureSourceSet clojureSourceSet = new DefaultClojureSourceSet("clojure", sourceDirectorySetFactory); 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); ((DefaultSourceSetOutput) sourceSet.getOutput()).addClassesDir(() -> build.getOutputDir().get().getAsFile()); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("compile")); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("check")); sourceSet.getOutput().dir(project.provider(() -> { if (build.isCompilerConfigured()) { return clojureSourceSet.getClojure().getSourceDirectories(); } else { return build.getOutputDir(); } })); }); }
private void configureSourceSetDefaults(Project project, ClojureScriptExtension extension) { project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().all((SourceSet sourceSet) -> { ClojureScriptSourceSet clojurescriptSourceSet = new DefaultClojureScriptSourceSet("clojurescript", sourceDirectorySetFactory); 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); sourceSet.getOutput().dir(build.getOutputDir()); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("compile")); sourceSet.getOutput().dir(project.provider(() -> { if (build.isCompilerConfigured()) { return clojurescriptSourceSet.getClojureScript().getSourceDirectories(); } else { return build.getOutputDir(); } })); }); }
private void configureSourceSetDefaults(Project project, ClojureExtension extension) { project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().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); ((DefaultSourceSetOutput) sourceSet.getOutput()).addClassesDir(() -> build.getOutputDir().get().getAsFile()); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("compile")); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("check")); sourceSet.getOutput().dir(project.provider(() -> { if (build.isCompilerConfigured()) { return build.getOutputDir(); } else { return clojureSourceSet.getClojure().getSourceDirectories(); } })); }); }
private void configureSourceSetDefaults(Project project, ClojureScriptExtension extension) { project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().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); sourceSet.getOutput().dir(build.getOutputDir()); project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(build.getTaskName("compile")); sourceSet.getOutput().dir(project.provider(() -> { if (build.isCompilerConfigured()) { return build.getOutputDir(); } else { return clojurescriptSourceSet.getClojureScript().getSourceDirectories(); } })); }); }
.exclude(element -> etaSourceSet.getEta().contains(element.getFile())); sourceSet.getAllSource().source(etaSourceDirectorySet);
ExtensionHelper.getConvention(sourceProvider, EtaSourceSet.class); if (etaSourceSet != null) { etaSourceDirectorySet.source(etaSourceSet.getEta());