Java Code Examples for org.gradle.api.internal.artifacts.DefaultModuleIdentifier

The following examples show how to use org.gradle.api.internal.artifacts.DefaultModuleIdentifier. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: pushfish-android   Author: PushFish   File: ExternalResourceResolver.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void listModuleVersions(DependencyMetaData dependency, BuildableModuleVersionSelectionResolveResult result) {
    ModuleIdentifier module  = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName());
    VersionList versionList = versionLister.getVersionList(module);
    // List modules based on metadata files
    ModuleVersionArtifactMetaData metaDataArtifact = getMetaDataArtifactFor(dependency);
    listVersionsForAllPatterns(getIvyPatterns(), metaDataArtifact, versionList);

    // List modules with missing metadata files
    if (isAllownomd()) {
        for (ModuleVersionArtifactMetaData otherArtifact : getDefaultMetaData(dependency).getArtifacts()) {
            listVersionsForAllPatterns(getArtifactPatterns(), otherArtifact, versionList);
        }
    }
    DefaultModuleVersionListing moduleVersions = new DefaultModuleVersionListing();
    for (VersionList.ListedVersion listedVersion : versionList.getVersions()) {
        moduleVersions.add(listedVersion.getVersion());
    }
    result.listed(moduleVersions);
}
 
Example #2
Source Project: Pushjet-Android   Author: Pushjet   File: ExternalResourceResolver.java    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void listModuleVersions(DependencyMetaData dependency, BuildableModuleVersionSelectionResolveResult result) {
    ModuleIdentifier module  = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName());
    VersionList versionList = versionLister.getVersionList(module);
    // List modules based on metadata files
    ModuleVersionArtifactMetaData metaDataArtifact = getMetaDataArtifactFor(dependency);
    listVersionsForAllPatterns(getIvyPatterns(), metaDataArtifact, versionList);

    // List modules with missing metadata files
    if (isAllownomd()) {
        for (ModuleVersionArtifactMetaData otherArtifact : getDefaultMetaData(dependency).getArtifacts()) {
            listVersionsForAllPatterns(getArtifactPatterns(), otherArtifact, versionList);
        }
    }
    DefaultModuleVersionListing moduleVersions = new DefaultModuleVersionListing();
    for (VersionList.ListedVersion listedVersion : versionList.getVersions()) {
        moduleVersions.add(listedVersion.getVersion());
    }
    result.listed(moduleVersions);
}
 
Example #3
Source Project: pushfish-android   Author: PushFish   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModuleForcingResolveRule(Collection<? extends ModuleVersionSelector> forcedModules) {
    if (!forcedModules.isEmpty()) {
        this.forcedModules = new HashMap<ModuleIdentifier, String>();
        for (ModuleVersionSelector module : forcedModules) {
            this.forcedModules.put(new DefaultModuleIdentifier(module.getGroup(), module.getName()), module.getVersion());
        }
    } else {
        this.forcedModules = null;
    }
}
 
Example #4
Source Project: pushfish-android   Author: PushFish   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void execute(DependencyResolveDetailsInternal details) {
    if (forcedModules == null) {
        return;
    }
    ModuleIdentifier key = new DefaultModuleIdentifier(details.getRequested().getGroup(), details.getRequested().getName());
    if (forcedModules.containsKey(key)) {
        details.useVersion(forcedModules.get(key), VersionSelectionReasons.FORCED);
    }
}
 
Example #5
Source Project: pushfish-android   Author: PushFish   File: ExternalResourceResolver.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void doListModuleVersions(DependencyMetaData dependency, BuildableModuleComponentVersionSelectionResolveResult result) {
    ModuleIdentifier module  = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName());
    Set<String> versions = new LinkedHashSet<String>();
    VersionPatternVisitor visitor = versionLister.newVisitor(module, versions, result);

    // List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns())
    IvyArtifactName metaDataArtifact = getMetaDataArtifactName(dependency.getRequested().getName());
    listVersionsForAllPatterns(ivyPatterns, metaDataArtifact, visitor);

    // List modules with missing metadata files
    for (IvyArtifactName otherArtifact : getDependencyArtifactNames(dependency)) {
        listVersionsForAllPatterns(artifactPatterns, otherArtifact, visitor);
    }
    result.listed(versions);
}
 
Example #6
Source Project: pushfish-android   Author: PushFish   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModuleForcingResolveRule(Collection<? extends ModuleVersionSelector> forcedModules) {
    if (!forcedModules.isEmpty()) {
        this.forcedModules = new HashMap<ModuleIdentifier, String>();
        for (ModuleVersionSelector module : forcedModules) {
            this.forcedModules.put(new DefaultModuleIdentifier(module.getGroup(), module.getName()), module.getVersion());
        }
    } else {
        this.forcedModules = null;
    }
}
 
Example #7
Source Project: pushfish-android   Author: PushFish   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void execute(DependencyResolveDetailsInternal details) {
    if (forcedModules == null) {
        return;
    }
    ModuleIdentifier key = new DefaultModuleIdentifier(details.getRequested().getGroup(), details.getRequested().getName());
    if (forcedModules.containsKey(key)) {
        details.useVersion(forcedModules.get(key), VersionSelectionReasons.FORCED);
    }
}
 
Example #8
Source Project: atlas   Author: alibaba   File: ApDependency.java    License: Apache License 2.0 5 votes vote down vote up
private Map<ModuleIdentifier, String> getAwbDependencies(String awb) {
    ParsedModuleStringNotation parsedNotation = new ParsedModuleStringNotation(awb,"awb");
    String group = parsedNotation.getGroup();
    String name = parsedNotation.getName();
    ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(group, name);
    Map<ModuleIdentifier, String> awbDependencies = mAwbDependenciesMap.get(moduleIdentifier);
    if (awbDependencies == null) {
        awbDependencies = Maps.newHashMap();
        mAwbDependenciesMap.put(moduleIdentifier, awbDependencies);
    }
    return awbDependencies;
}
 
Example #9
Source Project: atlas   Author: alibaba   File: ApDependency.java    License: Apache License 2.0 5 votes vote down vote up
private void addDependency(String dependencyString, Map<ModuleIdentifier, String> awb) {
    ParsedModuleStringNotation parsedNotation = new ParsedModuleStringNotation(dependencyString,dependencyString.split("@")[1]);
    ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(parsedNotation.getGroup(),
            parsedNotation.getName());
    String version = parsedNotation.getVersion();
    awb.put(moduleIdentifier, version);
    mFlatDependenciesMap.put(moduleIdentifier, version);
}
 
Example #10
Source Project: Pushjet-Android   Author: Pushjet   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModuleForcingResolveRule(Collection<? extends ModuleVersionSelector> forcedModules) {
    if (!forcedModules.isEmpty()) {
        this.forcedModules = new HashMap<ModuleIdentifier, String>();
        for (ModuleVersionSelector module : forcedModules) {
            this.forcedModules.put(new DefaultModuleIdentifier(module.getGroup(), module.getName()), module.getVersion());
        }
    } else {
        this.forcedModules = null;
    }
}
 
Example #11
Source Project: Pushjet-Android   Author: Pushjet   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void execute(DependencyResolveDetailsInternal details) {
    if (forcedModules == null) {
        return;
    }
    ModuleIdentifier key = new DefaultModuleIdentifier(details.getRequested().getGroup(), details.getRequested().getName());
    if (forcedModules.containsKey(key)) {
        details.useVersion(forcedModules.get(key), VersionSelectionReasons.FORCED);
    }
}
 
Example #12
Source Project: Pushjet-Android   Author: Pushjet   File: ExternalResourceResolver.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void doListModuleVersions(DependencyMetaData dependency, BuildableModuleComponentVersionSelectionResolveResult result) {
    ModuleIdentifier module  = new DefaultModuleIdentifier(dependency.getRequested().getGroup(), dependency.getRequested().getName());
    Set<String> versions = new LinkedHashSet<String>();
    VersionPatternVisitor visitor = versionLister.newVisitor(module, versions, result);

    // List modules based on metadata files (artifact version is not considered in listVersionsForAllPatterns())
    IvyArtifactName metaDataArtifact = getMetaDataArtifactName(dependency.getRequested().getName());
    listVersionsForAllPatterns(ivyPatterns, metaDataArtifact, visitor);

    // List modules with missing metadata files
    for (IvyArtifactName otherArtifact : getDependencyArtifactNames(dependency)) {
        listVersionsForAllPatterns(artifactPatterns, otherArtifact, visitor);
    }
    result.listed(versions);
}
 
Example #13
Source Project: Pushjet-Android   Author: Pushjet   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModuleForcingResolveRule(Collection<? extends ModuleVersionSelector> forcedModules) {
    if (!forcedModules.isEmpty()) {
        this.forcedModules = new HashMap<ModuleIdentifier, String>();
        for (ModuleVersionSelector module : forcedModules) {
            this.forcedModules.put(new DefaultModuleIdentifier(module.getGroup(), module.getName()), module.getVersion());
        }
    } else {
        this.forcedModules = null;
    }
}
 
Example #14
Source Project: Pushjet-Android   Author: Pushjet   File: ModuleForcingResolveRule.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void execute(DependencyResolveDetailsInternal details) {
    if (forcedModules == null) {
        return;
    }
    ModuleIdentifier key = new DefaultModuleIdentifier(details.getRequested().getGroup(), details.getRequested().getName());
    if (forcedModules.containsKey(key)) {
        details.useVersion(forcedModules.get(key), VersionSelectionReasons.FORCED);
    }
}
 
Example #15
public ModuleKey read(Decoder decoder) throws Exception {
    String resolverId = decoder.readString();
    String group = decoder.readString();
    String module = decoder.readString();
    return new ModuleKey(resolverId, new DefaultModuleIdentifier(group, module));
}
 
Example #16
private DefaultModuleIdentifier getCacheKey(ModuleVersionSelector requested) {
    return new DefaultModuleIdentifier(requested.getGroup(), requested.getName());
}
 
Example #17
Source Project: pushfish-android   Author: PushFish   File: DependencyGraphBuilder.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ModuleVersionSelectorResolveState(DependencyMetaData dependencyMetaData, DependencyToComponentIdResolver resolver, ResolveState resolveState) {
    this.dependencyMetaData = dependencyMetaData;
    this.resolver = resolver;
    this.resolveState = resolveState;
    targetModule = resolveState.getModule(new DefaultModuleIdentifier(dependencyMetaData.getRequested().getGroup(), dependencyMetaData.getRequested().getName()));
}
 
Example #18
public ModuleKey read(Decoder decoder) throws Exception {
    String resolverId = decoder.readString();
    String group = decoder.readString();
    String module = decoder.readString();
    return new ModuleKey(resolverId, new DefaultModuleIdentifier(group, module));
}
 
Example #19
Source Project: pushfish-android   Author: PushFish   File: ResolveIvyFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleIdentifier transform(ModuleVersionSelector original) {
    return new DefaultModuleIdentifier(original.getGroup(), original.getName());
}
 
Example #20
Source Project: pushfish-android   Author: PushFish   File: ResolveIvyFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleIdentifier transform(ModuleVersionSelector original) {
    return new DefaultModuleIdentifier(original.getGroup(), original.getName() + ":" + original.getVersion());
}
 
Example #21
Source Project: pushfish-android   Author: PushFish   File: DependencyGraphBuilder.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ModuleVersionSelectorResolveState(DependencyMetaData dependencyMetaData, DependencyToModuleVersionIdResolver resolver, ResolveState resolveState) {
    this.dependencyMetaData = dependencyMetaData;
    this.resolver = resolver;
    this.resolveState = resolveState;
    targetModule = resolveState.getModule(new DefaultModuleIdentifier(dependencyMetaData.getRequested().getGroup(), dependencyMetaData.getRequested().getName()));
}
 
Example #22
Source Project: quarkus   Author: quarkusio   File: AppModelGradleResolver.java    License: Apache License 2.0 4 votes vote down vote up
private static ModuleIdentifier getModuleId(ResolvedArtifact a) {
    final String[] split = a.getModuleVersion().toString().split(":");
    return DefaultModuleIdentifier.newId(split[0], split[1]);
}
 
Example #23
Source Project: atlas   Author: alibaba   File: ApDependency.java    License: Apache License 2.0 4 votes vote down vote up
public Map<ModuleIdentifier, String> getAwbDependencies(String group, String name) {
    ModuleIdentifier moduleIdentifier = DefaultModuleIdentifier.newId(group, name);
    Map<ModuleIdentifier, String> awbDependencies = mAwbDependenciesMap.get(moduleIdentifier);
    return awbDependencies;
}
 
Example #24
Source Project: atlas   Author: alibaba   File: ApDependency.java    License: Apache License 2.0 4 votes vote down vote up
public boolean isMainLibrary(ResolvedDependencyInfo dependencyInfo) {
    return mMainDependenciesMap.containsKey(
            DefaultModuleIdentifier.newId(dependencyInfo.getGroup(), dependencyInfo.getName()));
}
 
Example #25
public ModuleKey read(Decoder decoder) throws Exception {
    String resolverId = decoder.readString();
    String group = decoder.readString();
    String module = decoder.readString();
    return new ModuleKey(resolverId, new DefaultModuleIdentifier(group, module));
}
 
Example #26
private DefaultModuleIdentifier getCacheKey(ModuleVersionSelector requested) {
    return new DefaultModuleIdentifier(requested.getGroup(), requested.getName());
}
 
Example #27
Source Project: Pushjet-Android   Author: Pushjet   File: DependencyGraphBuilder.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
private ModuleVersionSelectorResolveState(DependencyMetaData dependencyMetaData, DependencyToComponentIdResolver resolver, ResolveState resolveState) {
    this.dependencyMetaData = dependencyMetaData;
    this.resolver = resolver;
    this.resolveState = resolveState;
    targetModule = resolveState.getModule(new DefaultModuleIdentifier(dependencyMetaData.getRequested().getGroup(), dependencyMetaData.getRequested().getName()));
}
 
Example #28
public ModuleKey read(Decoder decoder) throws Exception {
    String resolverId = decoder.readString();
    String group = decoder.readString();
    String module = decoder.readString();
    return new ModuleKey(resolverId, new DefaultModuleIdentifier(group, module));
}
 
Example #29
Source Project: Pushjet-Android   Author: Pushjet   File: ResolveIvyFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleIdentifier transform(ModuleVersionSelector original) {
    return new DefaultModuleIdentifier(original.getGroup(), original.getName());
}
 
Example #30
Source Project: Pushjet-Android   Author: Pushjet   File: ResolveIvyFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleIdentifier transform(ModuleVersionSelector original) {
    return new DefaultModuleIdentifier(original.getGroup(), original.getName() + ":" + original.getVersion());
}