org.gradle.api.internal.jvm.ClassDirectoryBinarySpecInternal Java Examples
The following examples show how to use
org.gradle.api.internal.jvm.ClassDirectoryBinarySpecInternal.
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: LegacyJavaComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void apply(final Project target) { target.getPlugins().apply(LanguageBasePlugin.class); BinaryContainer binaryContainer = target.getExtensions().getByType(BinaryContainer.class); binaryContainer.registerFactory(ClassDirectoryBinarySpec.class, new NamedDomainObjectFactory<ClassDirectoryBinarySpec>() { public ClassDirectoryBinarySpec create(String name) { return instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, name, toolChain, new DefaultJavaPlatform(JavaVersion.current())); } }); binaryContainer.withType(ClassDirectoryBinarySpecInternal.class).all(new Action<ClassDirectoryBinarySpecInternal>() { public void execute(ClassDirectoryBinarySpecInternal binary) { createBinaryLifecycleTask(binary, target); setClassesDirConvention(binary, target); createProcessResourcesTaskForBinary(binary, target); createCompileJavaTaskForBinary(binary, target); } }); }
Example #2
Source File: LegacyJavaComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void createProcessResourcesTaskForBinary(final ClassDirectoryBinarySpecInternal binary, final Project target) { final BinaryNamingScheme namingScheme = binary.getNamingScheme(); binary.getSource().withType(JvmResourceSet.class).all(new Action<JvmResourceSet>() { public void execute(JvmResourceSet resourceSet) { Copy resourcesTask = target.getTasks().create(namingScheme.getTaskName("process", "resources"), ProcessResources.class); resourcesTask.setDescription(String.format("Processes %s.", resourceSet)); new DslObject(resourcesTask).getConventionMapping().map("destinationDir", new Callable<File>() { public File call() throws Exception { return binary.getResourcesDir(); } }); binary.getTasks().add(resourcesTask); binary.builtBy(resourcesTask); resourcesTask.from(resourceSet.getSource()); } }); }
Example #3
Source File: LegacyJavaComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void apply(final Project target) { target.getPlugins().apply(LanguageBasePlugin.class); BinaryContainer binaryContainer = target.getExtensions().getByType(BinaryContainer.class); binaryContainer.registerFactory(ClassDirectoryBinarySpec.class, new NamedDomainObjectFactory<ClassDirectoryBinarySpec>() { public ClassDirectoryBinarySpec create(String name) { return instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, name, toolChain, new DefaultJavaPlatform(JavaVersion.current())); } }); binaryContainer.withType(ClassDirectoryBinarySpecInternal.class).all(new Action<ClassDirectoryBinarySpecInternal>() { public void execute(ClassDirectoryBinarySpecInternal binary) { createBinaryLifecycleTask(binary, target); setClassesDirConvention(binary, target); createProcessResourcesTaskForBinary(binary, target); createCompileJavaTaskForBinary(binary, target); } }); }
Example #4
Source File: LegacyJavaComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void createProcessResourcesTaskForBinary(final ClassDirectoryBinarySpecInternal binary, final Project target) { final BinaryNamingScheme namingScheme = binary.getNamingScheme(); binary.getSource().withType(JvmResourceSet.class).all(new Action<JvmResourceSet>() { public void execute(JvmResourceSet resourceSet) { Copy resourcesTask = target.getTasks().create(namingScheme.getTaskName("process", "resources"), ProcessResources.class); resourcesTask.setDescription(String.format("Processes %s.", resourceSet)); new DslObject(resourcesTask).getConventionMapping().map("destinationDir", new Callable<File>() { public File call() throws Exception { return binary.getResourcesDir(); } }); binary.getTasks().add(resourcesTask); binary.builtBy(resourcesTask); resourcesTask.from(resourceSet.getSource()); } }); }
Example #5
Source File: LegacyJavaComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void setClassesDirConvention(ClassDirectoryBinarySpecInternal binary, final Project target) { final BinaryNamingScheme namingScheme = binary.getNamingScheme(); ConventionMapping conventionMapping = new DslObject(binary).getConventionMapping(); conventionMapping.map("classesDir", new Callable<File>() { public File call() throws Exception { return new File(new File(target.getBuildDir(), "classes"), namingScheme.getOutputDirectoryBase()); } }); }
Example #6
Source File: LegacyJavaComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void createCompileJavaTaskForBinary(final ClassDirectoryBinarySpecInternal binary, final Project target) { final BinaryNamingScheme namingScheme = binary.getNamingScheme(); binary.getSource().withType(JavaSourceSet.class).all(new Action<JavaSourceSet>() { public void execute(JavaSourceSet javaSourceSet) { JavaCompile compileTask = target.getTasks().create(namingScheme.getTaskName("compile", "java"), JavaCompile.class); configureCompileTask(compileTask, javaSourceSet, binary); binary.getTasks().add(compileTask); binary.builtBy(compileTask); } }); }
Example #7
Source File: JavaBasePlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
private BridgedBinaries configureSourceSetDefaults(final JavaPluginConvention pluginConvention) { final Project project = pluginConvention.getProject(); final List<ClassDirectoryBinarySpecInternal> binaries = Lists.newArrayList(); pluginConvention.getSourceSets().all(new Action<SourceSet>() { public void execute(final SourceSet sourceSet) { ConventionMapping outputConventionMapping = ((IConventionAware) sourceSet.getOutput()).getConventionMapping(); ConfigurationContainer configurations = project.getConfigurations(); defineConfigurationsForSourceSet(sourceSet, configurations); definePathsForSourceSet(sourceSet, outputConventionMapping, project); createProcessResourcesTaskForBinary(sourceSet, sourceSet.getResources(), project); createCompileJavaTaskForBinary(sourceSet, sourceSet.getJava(), project); createBinaryLifecycleTask(sourceSet, project); DefaultComponentSpecIdentifier binaryId = new DefaultComponentSpecIdentifier(project.getPath(), sourceSet.getName()); ClassDirectoryBinarySpecInternal binary = instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, binaryId, sourceSet, javaToolChain, DefaultJavaPlatform.current(), instantiator, taskFactory); Classpath compileClasspath = new SourceSetCompileClasspath(sourceSet); DefaultJavaSourceSet javaSourceSet = instantiator.newInstance(DefaultJavaSourceSet.class, binaryId.child("java"), sourceSet.getJava(), compileClasspath); JvmResourceSet resourceSet = instantiator.newInstance(DefaultJvmResourceSet.class, binaryId.child("resources"), sourceSet.getResources()); binary.addSourceSet(javaSourceSet); binary.addSourceSet(resourceSet); attachTasksToBinary(binary, sourceSet, project); binaries.add(binary); } }); return new BridgedBinaries(binaries); }
Example #8
Source File: JavaBasePlugin.java From javaide with GNU General Public License v3.0 | 5 votes |
private void attachTasksToBinary(ClassDirectoryBinarySpecInternal binary, SourceSet sourceSet, Project target) { Task compileTask = target.getTasks().getByPath(sourceSet.getCompileJavaTaskName()); Task resourcesTask = target.getTasks().getByPath(sourceSet.getProcessResourcesTaskName()); Task classesTask = target.getTasks().getByPath(sourceSet.getClassesTaskName()); binary.getTasks().add(compileTask); binary.getTasks().add(resourcesTask); binary.getTasks().add(classesTask); binary.setBuildTask(classesTask); }
Example #9
Source File: LegacyJavaComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void setClassesDirConvention(ClassDirectoryBinarySpecInternal binary, final Project target) { final BinaryNamingScheme namingScheme = binary.getNamingScheme(); ConventionMapping conventionMapping = new DslObject(binary).getConventionMapping(); conventionMapping.map("classesDir", new Callable<File>() { public File call() throws Exception { return new File(new File(target.getBuildDir(), "classes"), namingScheme.getOutputDirectoryBase()); } }); }
Example #10
Source File: LegacyJavaComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void createCompileJavaTaskForBinary(final ClassDirectoryBinarySpecInternal binary, final Project target) { final BinaryNamingScheme namingScheme = binary.getNamingScheme(); binary.getSource().withType(JavaSourceSet.class).all(new Action<JavaSourceSet>() { public void execute(JavaSourceSet javaSourceSet) { JavaCompile compileTask = target.getTasks().create(namingScheme.getTaskName("compile", "java"), JavaCompile.class); configureCompileTask(compileTask, javaSourceSet, binary); binary.getTasks().add(compileTask); binary.builtBy(compileTask); } }); }
Example #11
Source File: LegacyJavaComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private void createBinaryLifecycleTask(ClassDirectoryBinarySpecInternal binary, Project target) { Task binaryLifecycleTask = target.task(binary.getNamingScheme().getLifecycleTaskName()); binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP); binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary)); binary.setBuildTask(binaryLifecycleTask); }
Example #12
Source File: JavaBasePlugin.java From javaide with GNU General Public License v3.0 | 4 votes |
public BridgedBinaries(List<ClassDirectoryBinarySpecInternal> binaries) { this.binaries = binaries; }
Example #13
Source File: JavaBasePlugin.java From javaide with GNU General Public License v3.0 | 4 votes |
@Mutate void attachBridgedSourceSets(ProjectSourceSet projectSourceSet, BridgedBinaries bridgedBinaries) { for (ClassDirectoryBinarySpecInternal binary : bridgedBinaries.binaries) { projectSourceSet.addAll(binary.getInputs()); } }
Example #14
Source File: LegacyJavaComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private void createBinaryLifecycleTask(ClassDirectoryBinarySpecInternal binary, Project target) { Task binaryLifecycleTask = target.task(binary.getNamingScheme().getLifecycleTaskName()); binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP); binaryLifecycleTask.setDescription(String.format("Assembles %s.", binary)); binary.setBuildTask(binaryLifecycleTask); }