Search in sources :

Example 1 with ClientModule

use of org.gradle.api.artifacts.ClientModule in project gradle by gradle.

the class ModuleFactoryDelegateTest method module.

@Test
public void module() {
    final String clientModuleNotation = "someNotation";
    final Closure configureClosure = TestUtil.toClosure("{}");
    final ClientModule clientModuleDummy = context.mock(ClientModule.class);
    context.checking(new Expectations() {

        {
            allowing(dependencyFactoryStub).createModule(clientModuleNotation, configureClosure);
            will(returnValue(clientModuleDummy));
        }
    });
    moduleFactoryDelegate.module(clientModuleNotation, configureClosure);
    assertThat(this.clientModule.getDependencies(), Matchers.equalTo(WrapUtil.<ModuleDependency>toSet(clientModuleDummy)));
}
Also used : Expectations(org.jmock.Expectations) ModuleDependency(org.gradle.api.artifacts.ModuleDependency) Closure(groovy.lang.Closure) ClientModule(org.gradle.api.artifacts.ClientModule) DefaultClientModule(org.gradle.api.internal.artifacts.dependencies.DefaultClientModule) Test(org.junit.Test)

Example 2 with ClientModule

use of org.gradle.api.artifacts.ClientModule in project gradle by gradle.

the class ClientModuleResolver method resolve.

public void resolve(ComponentIdentifier identifier, ComponentOverrideMetadata componentOverrideMetadata, BuildableComponentResolveResult result) {
    resolver.resolve(identifier, componentOverrideMetadata, result);
    if (result.getFailure() != null) {
        return;
    }
    ClientModule clientModule = componentOverrideMetadata.getClientModule();
    if (clientModule != null) {
        MutableModuleComponentResolveMetadata clientModuleMetaData = ((ModuleComponentResolveMetadata) result.getMetaData()).asMutable();
        addClientModuleDependencies(clientModule, clientModuleMetaData);
        setClientModuleArtifact(clientModuleMetaData);
        result.setMetaData(clientModuleMetaData.asImmutable());
    }
}
Also used : MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) MutableModuleComponentResolveMetadata(org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata) ModuleComponentResolveMetadata(org.gradle.internal.component.external.model.ModuleComponentResolveMetadata) ClientModule(org.gradle.api.artifacts.ClientModule)

Aggregations

ClientModule (org.gradle.api.artifacts.ClientModule)2 Closure (groovy.lang.Closure)1 ModuleDependency (org.gradle.api.artifacts.ModuleDependency)1 DefaultClientModule (org.gradle.api.internal.artifacts.dependencies.DefaultClientModule)1 ModuleComponentResolveMetadata (org.gradle.internal.component.external.model.ModuleComponentResolveMetadata)1 MutableModuleComponentResolveMetadata (org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata)1 Expectations (org.jmock.Expectations)1 Test (org.junit.Test)1