Search in sources :

Example 1 with ComponentModuleMetadataDetails

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

the class ComponentModuleMetadataContainer method module.

public ComponentModuleMetadataDetails module(final Object sourceModule) {
    final NotationParser<Object, ModuleIdentifier> parser = parser(moduleIdentifierFactory);
    final ModuleIdentifier source = parser.parseNotation(sourceModule);
    return new ComponentModuleMetadataDetails() {

        @Override
        public void replacedBy(Object moduleNotation) {
            replacedBy(moduleNotation, null);
        }

        @Override
        public void replacedBy(final Object targetModule, @Nullable String reason) {
            ModuleIdentifier target = parser.parseNotation(targetModule);
            detectCycles(replacements, source, target);
            replacements.put(source, new Replacement(target, reason));
            targets.add(target);
        }

        @Override
        public ModuleIdentifier getId() {
            return source;
        }

        @Override
        public ModuleIdentifier getReplacedBy() {
            return unwrap(replacements.get(source));
        }
    };
}
Also used : ComponentModuleMetadataDetails(org.gradle.api.artifacts.ComponentModuleMetadataDetails) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 ComponentModuleMetadataDetails (org.gradle.api.artifacts.ComponentModuleMetadataDetails)1 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)1