org.gradle.language.jvm.JvmResourceSet Java Examples

The following examples show how to use org.gradle.language.jvm.JvmResourceSet. 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: JvmResourcesPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public SourceTransformTaskConfig getTransformTask() {
    return new SourceTransformTaskConfig() {
        public String getTaskPrefix() {
            return "process";
        }

        public Class<? extends DefaultTask> getTaskType() {
            return ProcessResources.class;
        }

        public void configureTask(Task task, BinarySpec binary, LanguageSourceSet sourceSet) {
            ProcessResources resourcesTask = (ProcessResources) task;
            JvmResourceSet resourceSet = (JvmResourceSet) sourceSet;
            JvmBinarySpec jvmBinary = (JvmBinarySpec) binary;
            resourcesTask.from(resourceSet.getSource());
            resourcesTask.setDestinationDir(jvmBinary.getResourcesDir());
            jvmBinary.getTasks().getJar().dependsOn(resourcesTask);
        }
    };
}
 
Example #2
Source File: LegacyJavaComponentPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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: JvmResourcesPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public SourceTransformTaskConfig getTransformTask() {
    return new SourceTransformTaskConfig() {
        public String getTaskPrefix() {
            return "process";
        }

        public Class<? extends DefaultTask> getTaskType() {
            return ProcessResources.class;
        }

        public void configureTask(Task task, BinarySpec binary, LanguageSourceSet sourceSet) {
            ProcessResources resourcesTask = (ProcessResources) task;
            JvmResourceSet resourceSet = (JvmResourceSet) sourceSet;
            JvmBinarySpec jvmBinary = (JvmBinarySpec) binary;
            resourcesTask.from(resourceSet.getSource());
            resourcesTask.setDestinationDir(jvmBinary.getResourcesDir());
            jvmBinary.getTasks().getJar().dependsOn(resourcesTask);
        }
    };
}
 
Example #4
Source File: LegacyJavaComponentPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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: JavaBasePlugin.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
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 #6
Source File: JvmResourcesPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Class<JvmResourceSet> getSourceSetType() {
    return JvmResourceSet.class;
}
 
Example #7
Source File: JvmResourcesPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Class<? extends JvmResourceSet> getSourceSetImplementation() {
    return DefaultJvmResourceSet.class;
}
 
Example #8
Source File: JvmResourcesPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Class<JvmResourceSet> getSourceSetType() {
    return JvmResourceSet.class;
}
 
Example #9
Source File: JvmResourcesPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Class<? extends JvmResourceSet> getSourceSetImplementation() {
    return DefaultJvmResourceSet.class;
}