use of org.gradle.platform.base.DependencySpec in project gradle by gradle.
the class JvmLocalLibraryMetaDataAdapter method createLocalComponentMetaData.
@Override
@SuppressWarnings("unchecked")
public DefaultLibraryLocalComponentMetadata createLocalComponentMetaData(Binary selectedBinary, String projectPath, boolean toAssembly) {
EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage = new EnumMap<UsageKind, Iterable<DependencySpec>>(UsageKind.class);
EnumMap<UsageKind, List<PublishArtifact>> artifacts = new EnumMap<UsageKind, List<PublishArtifact>>(UsageKind.class);
initializeUsages(dependenciesPerUsage, artifacts);
if (selectedBinary instanceof JarBinarySpecInternal) {
JarBinarySpecInternal jarBinarySpec = (JarBinarySpecInternal) selectedBinary;
createJarBinarySpecLocalComponentMetaData(artifacts, jarBinarySpec, dependenciesPerUsage, toAssembly);
}
if (selectedBinary instanceof WithJvmAssembly) {
// a local component that provides a JVM assembly
JvmAssembly assembly = ((WithJvmAssembly) selectedBinary).getAssembly();
createJvmAssemblyLocalComponentMetaData(artifacts, assembly, dependenciesPerUsage, toAssembly);
}
return createResolvedMetaData((BinarySpecInternal) selectedBinary, projectPath, dependenciesPerUsage, artifacts);
}
use of org.gradle.platform.base.DependencySpec 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;
}
use of org.gradle.platform.base.DependencySpec in project gradle by gradle.
the class JvmTestSuiteBasePlugin method runtimeDependencies.
private static List<DependencySpec> runtimeDependencies(JvmTestSuiteBinarySpecInternal testBinary) {
List<DependencySpec> dependencies = Lists.newArrayList(testBinary.getDependencies());
JvmBinarySpec testedBinary = testBinary.getTestedBinary();
dependencies.add(DefaultLibraryBinaryDependencySpec.of(testBinary.getId()));
if (testedBinary != null) {
JvmBinarySpecInternal binary = (JvmBinarySpecInternal) testedBinary;
LibraryBinaryIdentifier id = binary.getId();
dependencies.add(DefaultLibraryBinaryDependencySpec.of(id));
}
addSourceSetSpecificDependencies(dependencies, testBinary.getSources());
addSourceSetSpecificDependencies(dependencies, testBinary.getTestSuite().getSources());
return dependencies;
}
use of org.gradle.platform.base.DependencySpec in project gradle by gradle.
the class JvmLocalLibraryMetaDataAdapter method createJarBinarySpecLocalComponentMetaData.
@SuppressWarnings("unchecked")
private void createJarBinarySpecLocalComponentMetaData(EnumMap<UsageKind, List<PublishArtifact>> artifacts, JarBinarySpecInternal jarBinarySpec, EnumMap<UsageKind, Iterable<DependencySpec>> dependenciesPerUsage, boolean toAssembly) {
JarFile apiJar = jarBinarySpec.getApiJar();
configureUsageMetadata(UsageKind.API, jarBinarySpec.getApiDependencies(), dependenciesPerUsage);
JarFile runtimeJar = jarBinarySpec.getRuntimeJar();
JvmLibrarySpec library = jarBinarySpec.getLibrary();
configureUsageMetadata(UsageKind.RUNTIME, library != null ? collectDependencies(jarBinarySpec, library, library.getDependencies().getDependencies(), jarBinarySpec.getApiDependencies()) : Collections.<DependencySpec>emptyList(), dependenciesPerUsage);
if (!toAssembly) {
addArtifact(UsageKind.API, apiJar, artifacts);
addArtifact(UsageKind.RUNTIME, runtimeJar, artifacts);
}
}
Aggregations