Search in sources :

Example 1 with LanguageSourceSet

use of org.gradle.language.base.LanguageSourceSet in project gradle by gradle.

the class DefaultJvmBinarySpec method collectDependencies.

public static List<DependencySpec> collectDependencies(final BinarySpec binary, @Nullable final SourceComponentSpec owner, final Collection<DependencySpec>... specificDependencies) {
    List<DependencySpec> dependencies = Lists.newArrayList();
    if (specificDependencies != null) {
        for (Collection<DependencySpec> deps : specificDependencies) {
            dependencies.addAll(deps);
        }
    }
    Collection<LanguageSourceSet> binarySources = binary.getSources().values();
    Iterable<LanguageSourceSet> sourceSets = owner != null ? Iterables.concat(owner.getSources().values(), binarySources) : binarySources;
    for (LanguageSourceSet sourceSet : sourceSets) {
        if (sourceSet instanceof DependentSourceSet) {
            dependencies.addAll(((DependentSourceSet) sourceSet).getDependencies().getDependencies());
        }
    }
    return dependencies;
}
Also used : DependentSourceSet(org.gradle.language.base.DependentSourceSet) LanguageSourceSet(org.gradle.language.base.LanguageSourceSet) DependencySpec(org.gradle.platform.base.DependencySpec)

Example 2 with LanguageSourceSet

use of org.gradle.language.base.LanguageSourceSet in project gradle by gradle.

the class SourceSetNativeDependencyResolver method resolve.

@Override
public void resolve(NativeBinaryResolveResult nativeBinaryResolveResult) {
    for (NativeBinaryRequirementResolveResult resolution : nativeBinaryResolveResult.getPendingResolutions()) {
        if (resolution.getInput() instanceof LanguageSourceSet) {
            LanguageSourceSet input = (LanguageSourceSet) resolution.getInput();
            resolution.setNativeDependencySet(createNativeDependencySet(input));
        }
    }
    delegate.resolve(nativeBinaryResolveResult);
}
Also used : LanguageSourceSet(org.gradle.language.base.LanguageSourceSet)

Example 3 with LanguageSourceSet

use of org.gradle.language.base.LanguageSourceSet in project gradle by gradle.

the class DefaultVisualStudioProject method getSourceFiles.

public List<File> getSourceFiles() {
    Set<File> allSource = new LinkedHashSet<File>();
    allSource.addAll(additionalFiles);
    for (LanguageSourceSet sourceSet : sources) {
        if (!(sourceSet instanceof WindowsResourceSet)) {
            allSource.addAll(sourceSet.getSource().getFiles());
        }
    }
    return new ArrayList<File>(allSource);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) WindowsResourceSet(org.gradle.language.rc.WindowsResourceSet) LanguageSourceSet(org.gradle.language.base.LanguageSourceSet) ArrayList(java.util.ArrayList) XmlConfigFile(org.gradle.ide.visualstudio.XmlConfigFile) File(java.io.File)

Example 4 with LanguageSourceSet

use of org.gradle.language.base.LanguageSourceSet in project gradle by gradle.

the class PlayIdeaPlugin method configureIdeaModule.

@Mutate
public void configureIdeaModule(@Path("tasks.ideaModule") GenerateIdeaModule ideaModule, @Path("binaries.playBinary") final PlayApplicationBinarySpec playApplicationBinarySpec, @Path("buildDir") final File buildDir, ConfigurationContainer configurations, final FileResolver fileResolver) {
    IdeaModule module = ideaModule.getModule();
    module.setScopes(buildScopes(configurations));
    ConventionMapping conventionMapping = conventionMappingFor(module);
    conventionMapping.map("sourceDirs", new Callable<Set<File>>() {

        @Override
        public Set<File> call() throws Exception {
            // TODO: Assets should probably be a source set too
            Set<File> sourceDirs = Sets.newHashSet(playApplicationBinarySpec.getAssets().getAssetDirs());
            return CollectionUtils.inject(sourceDirs, playApplicationBinarySpec.getInputs(), new Action<CollectionUtils.InjectionStep<Set<File>, LanguageSourceSet>>() {

                @Override
                public void execute(CollectionUtils.InjectionStep<Set<File>, LanguageSourceSet> step) {
                    step.getTarget().addAll(step.getItem().getSource().getSrcDirs());
                }
            });
        }
    });
    conventionMapping.map("testSourceDirs", new Callable<Set<File>>() {

        @Override
        public Set<File> call() throws Exception {
            // TODO: This should be modeled as a source set
            return Collections.singleton(fileResolver.resolve("test"));
        }
    });
    conventionMapping.map("singleEntryLibraries", new Callable<Map<String, Iterable<File>>>() {

        @Override
        public Map<String, Iterable<File>> call() throws Exception {
            return ImmutableMap.<String, Iterable<File>>builder().put("COMPILE", Collections.singleton(playApplicationBinarySpec.getClasses().getClassesDir())).put("RUNTIME", playApplicationBinarySpec.getClasses().getResourceDirs()).put("TEST", Collections.singleton(new File(buildDir, "playBinary/testClasses"))).build();
        }
    });
    module.setScalaPlatform(playApplicationBinarySpec.getTargetPlatform().getScalaPlatform());
    conventionMapping.map("targetBytecodeVersion", new Callable<JavaVersion>() {

        @Override
        public JavaVersion call() throws Exception {
            return getTargetJavaVersion(playApplicationBinarySpec);
        }
    });
    conventionMapping.map("languageLevel", new Callable<IdeaLanguageLevel>() {

        @Override
        public IdeaLanguageLevel call() throws Exception {
            return new IdeaLanguageLevel(getTargetJavaVersion(playApplicationBinarySpec));
        }
    });
    ideaModule.dependsOn(playApplicationBinarySpec.getInputs());
    ideaModule.dependsOn(playApplicationBinarySpec.getAssets());
}
Also used : Action(org.gradle.api.Action) LanguageSourceSet(org.gradle.language.base.LanguageSourceSet) Set(java.util.Set) CollectionUtils(org.gradle.util.CollectionUtils) IdeaLanguageLevel(org.gradle.plugins.ide.idea.model.IdeaLanguageLevel) JavaVersion(org.gradle.api.JavaVersion) ConventionMapping(org.gradle.api.internal.ConventionMapping) GenerateIdeaModule(org.gradle.plugins.ide.idea.GenerateIdeaModule) IdeaModule(org.gradle.plugins.ide.idea.model.IdeaModule) LanguageSourceSet(org.gradle.language.base.LanguageSourceSet) File(java.io.File) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) Mutate(org.gradle.model.Mutate)

Example 5 with LanguageSourceSet

use of org.gradle.language.base.LanguageSourceSet in project gradle by gradle.

the class DefaultVisualStudioProject method getHeaderFiles.

public List<File> getHeaderFiles() {
    Set<File> allHeaders = new LinkedHashSet<File>();
    for (LanguageSourceSet sourceSet : sources) {
        if (sourceSet instanceof HeaderExportingSourceSet) {
            HeaderExportingSourceSet exportingSourceSet = (HeaderExportingSourceSet) sourceSet;
            allHeaders.addAll(exportingSourceSet.getExportedHeaders().getFiles());
            allHeaders.addAll(exportingSourceSet.getImplicitHeaders().getFiles());
        }
    }
    return new ArrayList<File>(allHeaders);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) LanguageSourceSet(org.gradle.language.base.LanguageSourceSet) HeaderExportingSourceSet(org.gradle.language.nativeplatform.HeaderExportingSourceSet) ArrayList(java.util.ArrayList) XmlConfigFile(org.gradle.ide.visualstudio.XmlConfigFile) File(java.io.File)

Aggregations

LanguageSourceSet (org.gradle.language.base.LanguageSourceSet)6 File (java.io.File)3 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)2 XmlConfigFile (org.gradle.ide.visualstudio.XmlConfigFile)2 HeaderExportingSourceSet (org.gradle.language.nativeplatform.HeaderExportingSourceSet)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 Map (java.util.Map)1 Set (java.util.Set)1 Action (org.gradle.api.Action)1 JavaVersion (org.gradle.api.JavaVersion)1 Transformer (org.gradle.api.Transformer)1 FileCollection (org.gradle.api.file.FileCollection)1 ConventionMapping (org.gradle.api.internal.ConventionMapping)1 UnionFileCollection (org.gradle.api.internal.file.UnionFileCollection)1 FileCollectionAdapter (org.gradle.api.internal.file.collections.FileCollectionAdapter)1 Spec (org.gradle.api.specs.Spec)1 DependentSourceSet (org.gradle.language.base.DependentSourceSet)1 WindowsResourceSet (org.gradle.language.rc.WindowsResourceSet)1 Mutate (org.gradle.model.Mutate)1