Search in sources :

Example 1 with ParsedModuleStringNotation

use of org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation in project atlas by alibaba.

the class ApDependency method addDependency.

// ----- PRIVATE TASK API -----
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);
}
Also used : ParsedModuleStringNotation(org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier) DefaultModuleIdentifier(org.gradle.api.internal.artifacts.DefaultModuleIdentifier)

Example 2 with ParsedModuleStringNotation

use of org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation in project atlas by alibaba.

the class ApDependency method getAwbDependencies.

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;
}
Also used : ParsedModuleStringNotation(org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation) ModuleIdentifier(org.gradle.api.artifacts.ModuleIdentifier) DefaultModuleIdentifier(org.gradle.api.internal.artifacts.DefaultModuleIdentifier)

Example 3 with ParsedModuleStringNotation

use of org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation in project gradle by gradle.

the class DependencyStringNotationConverter method createDependencyFromString.

private T createDependencyFromString(String notation) {
    ParsedModuleStringNotation parsedNotation = splitModuleFromExtension(notation);
    StrictVersionParser.RichVersion version = strictVersionParser.parse(parsedNotation.getVersion());
    T moduleDependency = instantiator.newInstance(wantedType, stringInterner.intern(parsedNotation.getGroup()), stringInterner.intern(parsedNotation.getName()), stringInterner.intern(version.require));
    maybeEnrichVersion(version, moduleDependency);
    if (moduleDependency instanceof ExternalDependency) {
        ModuleFactoryHelper.addExplicitArtifactsIfDefined((ExternalDependency) moduleDependency, parsedNotation.getArtifactType(), parsedNotation.getClassifier());
    }
    return moduleDependency;
}
Also used : ParsedModuleStringNotation(org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation) ExternalDependency(org.gradle.api.artifacts.ExternalDependency) StrictVersionParser(org.gradle.api.internal.catalog.parser.StrictVersionParser)

Example 4 with ParsedModuleStringNotation

use of org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation in project gradle by gradle.

the class DependencyStringNotationConverter method splitModuleFromExtension.

private ParsedModuleStringNotation splitModuleFromExtension(String notation) {
    int idx = notation.lastIndexOf('@');
    if (idx == -1 || ClientModule.class.isAssignableFrom(wantedType)) {
        return new ParsedModuleStringNotation(notation, null);
    }
    int versionIndx = notation.lastIndexOf(':');
    if (versionIndx < idx) {
        return new ParsedModuleStringNotation(notation.substring(0, idx), notation.substring(idx + 1));
    }
    return new ParsedModuleStringNotation(notation, null);
}
Also used : ParsedModuleStringNotation(org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation) ClientModule(org.gradle.api.artifacts.ClientModule) DependencyConstraint(org.gradle.api.artifacts.DependencyConstraint) MutableVersionConstraint(org.gradle.api.artifacts.MutableVersionConstraint)

Aggregations

ParsedModuleStringNotation (org.gradle.api.internal.artifacts.dsl.ParsedModuleStringNotation)4 ModuleIdentifier (org.gradle.api.artifacts.ModuleIdentifier)2 DefaultModuleIdentifier (org.gradle.api.internal.artifacts.DefaultModuleIdentifier)2 ClientModule (org.gradle.api.artifacts.ClientModule)1 DependencyConstraint (org.gradle.api.artifacts.DependencyConstraint)1 ExternalDependency (org.gradle.api.artifacts.ExternalDependency)1 MutableVersionConstraint (org.gradle.api.artifacts.MutableVersionConstraint)1 StrictVersionParser (org.gradle.api.internal.catalog.parser.StrictVersionParser)1