Java Code Examples for org.gradle.api.tasks.SourceSet#getName()
The following examples show how to use
org.gradle.api.tasks.SourceSet#getName() .
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: Web3jPlugin.java From web3j-gradle-plugin with Apache License 2.0 | 6 votes |
private SourceDirectorySet buildSourceDirectorySet(final SourceSet sourceSet) { final String displayName = capitalize((CharSequence) sourceSet.getName()) + " Solidity ABI"; final SourceDirectorySet directorySet = new DefaultSourceDirectorySet( sourceSet.getName(), displayName, new IdentityFileResolver(), new DefaultDirectoryFileTreeFactory()); directorySet.srcDir(buildOutputDir(sourceSet)); directorySet.include("**/*.abi"); return directorySet; }
Example 2
Source File: Web3jPlugin.java From web3j-gradle-plugin with Apache License 2.0 | 5 votes |
private File buildSourceDir(final Web3jExtension extension, final SourceSet sourceSet) { if (extension.getGeneratedFilesBaseDir().isEmpty()) { throw new InvalidUserDataException("Generated web3j package cannot be empty"); } return new File(extension.getGeneratedFilesBaseDir() + "/" + sourceSet.getName() + "/java"); }
Example 3
Source File: CodeGeneratorPlugin.java From gradle-plugins with MIT License | 5 votes |
@Override public void apply(Project project) { CodeGeneratorConfiguration codeGenerator = project.getExtensions().create("codeGenerator", CodeGeneratorConfiguration.class, project.getObjects()); Configuration codeGeneratorConfiguration = project.getConfigurations().create("codeGenerator"); JavaPluginConvention plugin = project.getConvention().getPlugin(JavaPluginConvention.class); for (SourceSet sourceSet : plugin.getSourceSets()) { String outputDir = project.getBuildDir() + "/generated-src/generator/" + sourceSet.getName(); File outputDirFile = new File(outputDir); project.getLogger().debug("Using output dir {}", outputDir); File inputDir = new File(project.getProjectDir() + "/src/code-generator/" + sourceSet.getName()); sourceSet.getJava().srcDir(inputDir); sourceSet.getJava().srcDir(outputDirFile); project.getLogger().debug("Using input dir {}", inputDir); String taskName = sourceSet.getTaskName("generate", "Code"); TaskProvider<GenerateCodeTask> generate = project.getTasks().register(taskName, GenerateCodeTask.class, s -> { s.setGroup("generate"); s.getOutputDir().set(outputDirFile); if(inputDir.isDirectory()) { s.getInputDir().set(inputDir); } s.getSourceSet().set(sourceSet.getName()); s.getCodeGeneratorClasspath().from(codeGeneratorConfiguration); s.getConfigurationValues().set(codeGenerator.getConfigurationValues()); s.dependsOn(codeGeneratorConfiguration); }); project.getTasks().named(sourceSet.getCompileJavaTaskName(), t -> t.dependsOn(generate)); } }
Example 4
Source File: DefaultAspectjSourceSet.java From gradle-plugins with MIT License | 5 votes |
public DefaultAspectjSourceSet(ObjectFactory objectFactory, SourceSet sourceSet) { super(sourceSet); String name = sourceSet.getName(); String displayName = ((DefaultSourceSet) sourceSet).getDisplayName(); aspectj = objectFactory.sourceDirectorySet("aspectj", displayName + " AspectJ source"); aspectj.getFilter().include("**/*.java", "**/*.aj"); allAspectj = objectFactory.sourceDirectorySet("all" + name, displayName + " AspectJ source"); allAspectj.source(aspectj); allAspectj.getFilter().include("**/*.aj"); }
Example 5
Source File: CodeGeneratorPlugin.java From gradle-plugins with MIT License | 5 votes |
@Override public void apply(Project project) { CodeGeneratorConfiguration codeGenerator = project.getExtensions().create("codeGenerator", CodeGeneratorConfiguration.class, project.getObjects()); Configuration codeGeneratorConfiguration = project.getConfigurations().create("codeGenerator"); JavaPluginConvention plugin = project.getConvention().getPlugin(JavaPluginConvention.class); for (SourceSet sourceSet : plugin.getSourceSets()) { String outputDir = project.getBuildDir() + "/generated-src/generator/" + sourceSet.getName(); File outputDirFile = new File(outputDir); project.getLogger().debug("Using output dir {}", outputDir); File inputDir = new File(project.getProjectDir() + "/src/code-generator/" + sourceSet.getName()); sourceSet.getJava().srcDir(inputDir); sourceSet.getJava().srcDir(outputDirFile); project.getLogger().debug("Using input dir {}", inputDir); String taskName = sourceSet.getTaskName("generate", "Code"); TaskProvider<GenerateCodeTask> generate = project.getTasks().register(taskName, GenerateCodeTask.class, s -> { s.setGroup("generate"); s.getOutputDir().set(outputDirFile); if(inputDir.isDirectory()) { s.getInputDir().set(inputDir); } s.getSourceSet().set(sourceSet.getName()); s.getCodeGeneratorClasspath().from(codeGeneratorConfiguration); s.getConfigurationValues().set(codeGenerator.getConfigurationValues()); s.dependsOn(codeGeneratorConfiguration); }); project.getTasks().named(sourceSet.getCompileJavaTaskName(), t -> t.dependsOn(generate)); } }
Example 6
Source File: DefaultAspectjSourceSet.java From gradle-plugins with MIT License | 5 votes |
public DefaultAspectjSourceSet(ObjectFactory objectFactory, SourceSet sourceSet) { super(sourceSet); String name = sourceSet.getName(); String displayName = ((DefaultSourceSet) sourceSet).getDisplayName(); aspectj = objectFactory.sourceDirectorySet("aspectj", displayName + " AspectJ source"); aspectj.getFilter().include("**/*.java", "**/*.aj"); allAspectj = objectFactory.sourceDirectorySet("all" + name, displayName + " AspectJ source"); allAspectj.source(aspectj); allAspectj.getFilter().include("**/*.aj"); }
Example 7
Source File: DefaultSourceSetContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultSourceSetContainer(FileResolver fileResolver, TaskResolver taskResolver, Instantiator classGenerator) { super(SourceSet.class, classGenerator, new Namer<SourceSet>() { public String determineName(SourceSet ss) { return ss.getName(); }}); this.fileResolver = fileResolver; this.taskResolver = taskResolver; this.instantiator = classGenerator; }
Example 8
Source File: DefaultSourceSetContainer.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultSourceSetContainer(FileResolver fileResolver, TaskResolver taskResolver, Instantiator classGenerator) { super(SourceSet.class, classGenerator, new Namer<SourceSet>() { public String determineName(SourceSet ss) { return ss.getName(); }}); this.fileResolver = fileResolver; this.taskResolver = taskResolver; this.instantiator = classGenerator; }
Example 9
Source File: DefaultSourceSetContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultSourceSetContainer(FileResolver fileResolver, TaskResolver taskResolver, Instantiator classGenerator) { super(SourceSet.class, classGenerator, new Namer<SourceSet>() { public String determineName(SourceSet ss) { return ss.getName(); }}); this.fileResolver = fileResolver; this.taskResolver = taskResolver; this.instantiator = classGenerator; }
Example 10
Source File: DefaultSourceSetContainer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DefaultSourceSetContainer(FileResolver fileResolver, TaskResolver taskResolver, Instantiator classGenerator) { super(SourceSet.class, classGenerator, new Namer<SourceSet>() { public String determineName(SourceSet ss) { return ss.getName(); }}); this.fileResolver = fileResolver; this.taskResolver = taskResolver; this.instantiator = classGenerator; }