Search in sources :

Example 1 with DefaultLibraryBinaryIdentifier

use of org.gradle.internal.component.local.model.DefaultLibraryBinaryIdentifier in project gradle by gradle.

the class JvmTestSuiteBasePlugin method createResolveContext.

private static JvmLibraryResolveContext createResolveContext(JvmTestSuiteBinarySpecInternal testBinary, ModelSchema<? extends JvmTestSuiteBinarySpec> schema, ImmutableModuleIdentifierFactory moduleIdentifierFactory) {
    // TODO:Cedric find out why if we use the same ID directly, it fails resolution by trying to get the artifacts
    // from the resolving metadata instead of the resolved metadata
    LibraryBinaryIdentifier id = testBinary.getId();
    LibraryBinaryIdentifier thisId = new DefaultLibraryBinaryIdentifier(id.getProjectPath(), id.getLibraryName() + "Test", id.getVariant());
    return new JvmLibraryResolveContext(thisId, DefaultVariantsMetaData.extractFrom(testBinary, schema), runtimeDependencies(testBinary), UsageKind.RUNTIME, testBinary.getDisplayName(), moduleIdentifierFactory);
}
Also used : DefaultLibraryBinaryIdentifier(org.gradle.internal.component.local.model.DefaultLibraryBinaryIdentifier) LibraryBinaryIdentifier(org.gradle.api.artifacts.component.LibraryBinaryIdentifier) DefaultLibraryBinaryIdentifier(org.gradle.internal.component.local.model.DefaultLibraryBinaryIdentifier) JvmLibraryResolveContext(org.gradle.jvm.internal.resolve.JvmLibraryResolveContext)

Example 2 with DefaultLibraryBinaryIdentifier

use of org.gradle.internal.component.local.model.DefaultLibraryBinaryIdentifier in project gradle by gradle.

the class ComponentIdentifierSerializer method read.

@Override
public ComponentIdentifier read(Decoder decoder) throws IOException {
    byte id = decoder.readByte();
    if (Implementation.ROOT_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        String projectName = decoder.readString();
        return new DefaultProjectComponentIdentifier(buildIdentifier, Path.ROOT, Path.ROOT, projectName);
    } else if (Implementation.ROOT_BUILD_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        Path projectPath = Path.path(decoder.readString());
        return new DefaultProjectComponentIdentifier(buildIdentifier, projectPath, projectPath, projectPath.getName());
    } else if (Implementation.OTHER_BUILD_ROOT_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        Path identityPath = Path.path(decoder.readString());
        return new DefaultProjectComponentIdentifier(buildIdentifier, identityPath, Path.ROOT, identityPath.getName());
    } else if (Implementation.OTHER_BUILD_PROJECT.getId() == id) {
        BuildIdentifier buildIdentifier = buildIdentifierSerializer.read(decoder);
        Path identityPath = Path.path(decoder.readString());
        Path projectPath = Path.path(decoder.readString());
        return new DefaultProjectComponentIdentifier(buildIdentifier, identityPath, projectPath, identityPath.getName());
    } else if (Implementation.MODULE.getId() == id) {
        return new DefaultModuleComponentIdentifier(DefaultModuleIdentifier.newId(decoder.readString(), decoder.readString()), decoder.readString());
    } else if (Implementation.SNAPSHOT.getId() == id) {
        return new MavenUniqueSnapshotComponentIdentifier(DefaultModuleIdentifier.newId(decoder.readString(), decoder.readString()), decoder.readString(), decoder.readString());
    } else if (Implementation.LIBRARY.getId() == id) {
        return new DefaultLibraryBinaryIdentifier(decoder.readString(), decoder.readString(), decoder.readString());
    } else if (Implementation.OPAQUE.getId() == id) {
        return new OpaqueComponentArtifactIdentifier(new File(decoder.readString()));
    }
    throw new IllegalArgumentException("Unable to find component identifier type with id: " + id);
}
Also used : Path(org.gradle.util.Path) DefaultLibraryBinaryIdentifier(org.gradle.internal.component.local.model.DefaultLibraryBinaryIdentifier) MavenUniqueSnapshotComponentIdentifier(org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier) DefaultModuleComponentIdentifier(org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier) OpaqueComponentArtifactIdentifier(org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) DefaultProjectComponentIdentifier(org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier) File(java.io.File)

Aggregations

DefaultLibraryBinaryIdentifier (org.gradle.internal.component.local.model.DefaultLibraryBinaryIdentifier)2 File (java.io.File)1 BuildIdentifier (org.gradle.api.artifacts.component.BuildIdentifier)1 LibraryBinaryIdentifier (org.gradle.api.artifacts.component.LibraryBinaryIdentifier)1 DefaultProjectComponentIdentifier (org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier)1 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)1 DefaultModuleComponentIdentifier (org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier)1 OpaqueComponentArtifactIdentifier (org.gradle.internal.component.local.model.OpaqueComponentArtifactIdentifier)1 JvmLibraryResolveContext (org.gradle.jvm.internal.resolve.JvmLibraryResolveContext)1 Path (org.gradle.util.Path)1