Java 类org.gradle.api.IllegalDependencyNotation 实例源码

项目:Reer    文件:ModuleVersionSelectorParsers.java   
public void convert(String notation, NotationConvertResult<? super ModuleVersionSelector> result) throws TypeConversionException {
    ParsedModuleStringNotation parsed;
    try {
        parsed = new ParsedModuleStringNotation(notation, null);
    } catch (IllegalDependencyNotation e) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. The correct notation is a 3-part group:name:version notation, "
                        + "e.g: 'org.gradle:gradle-core:1.0'");
    }

    if (parsed.getGroup() == null || parsed.getName() == null || parsed.getVersion() == null) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. Group, name and version cannot be empty. Correct example: "
                        + "'org.gradle:gradle-core:1.0'");
    }
    result.converted(newSelector(parsed.getGroup(), parsed.getName(), parsed.getVersion()));
}
项目:Reer    文件:ComponentSelectorParsers.java   
public void convert(String notation, NotationConvertResult<? super ComponentSelector> result) throws TypeConversionException {
    ParsedModuleStringNotation parsed;
    try {
        parsed = new ParsedModuleStringNotation(notation, null);
    } catch (IllegalDependencyNotation e) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. The correct notation is a 3-part group:name:version notation, "
                        + "e.g: 'org.gradle:gradle-core:1.0'");
    }

    if (parsed.getGroup() == null || parsed.getName() == null || parsed.getVersion() == null) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. Group, name and version cannot be empty. Correct example: "
                        + "'org.gradle:gradle-core:1.0'");
    }
    result.converted(newSelector(parsed.getGroup(), parsed.getName(), parsed.getVersion()));
}
项目:Reer    文件:ParsedModuleStringNotation.java   
private void assignValuesFromModuleNotation(String moduleNotation) {
    int count = 0;
    int idx = 0;
    int cur = -1;
    while (++cur < moduleNotation.length()) {
        if (':' == moduleNotation.charAt(cur)) {
            String fragment = moduleNotation.substring(idx, cur);
            assignValue(count, fragment);
            idx = cur + 1;
            count++;
        }
    }
    assignValue(count, moduleNotation.substring(idx, cur));
    count++;
    if (count < 2 || count > 4) {
        throw new IllegalDependencyNotation("Supplied String module notation '" + moduleNotation + "' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.");
    }
}
项目:atlas    文件:ParsedModuleStringNotation.java   
private void assignValuesFromModuleNotation(String moduleNotation) {
    int count = 0;
    int idx = 0;
    int cur = -1;
    while (++cur < moduleNotation.length()) {
        if (':' == moduleNotation.charAt(cur)) {
            String fragment = moduleNotation.substring(idx, cur);
            assignValue(count, fragment);
            idx = cur + 1;
            count++;
        }
    }
    assignValue(count, moduleNotation.substring(idx, cur));
    count++;
    if (count < 2 || count > 5) {
        throw new IllegalDependencyNotation("Supplied String module notation '" + moduleNotation
                                            + "' is invalid. Example notations: 'org.gradle:gradle-core:2.2', "
                                            + "'org.mockito:mockito-core:1.9.5:javadoc'.");
    }
}
项目:Pushjet-Android    文件:ModuleVersionSelectorParsers.java   
public void convert(String notation, NotationConvertResult<? super ModuleVersionSelector> result) throws TypeConversionException {
    ParsedModuleStringNotation parsed;
    try {
        parsed = new ParsedModuleStringNotation(notation, null);
    } catch (IllegalDependencyNotation e) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. The correct notation is a 3-part group:name:version notation, "
                        + "e.g: 'org.gradle:gradle-core:1.0'");
    }

    if (parsed.getGroup() == null || parsed.getName() == null || parsed.getVersion() == null) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. Group, name and version cannot be empty. Correct example: "
                        + "'org.gradle:gradle-core:1.0'");
    }
    result.converted(newSelector(parsed.getGroup(), parsed.getName(), parsed.getVersion()));
}
项目:Pushjet-Android    文件:ModuleVersionSelectorParsers.java   
public ModuleVersionSelector parseType(CharSequence notation) {
    ParsedModuleStringNotation parsed;
    try {
        parsed = new ParsedModuleStringNotation(notation.toString(), null);
    } catch (IllegalDependencyNotation e) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. The Correct notation is a 3-part group:name:version notation, "
                        + "e.g: 'org.gradle:gradle-core:1.0'");
    }

    if (parsed.getGroup() == null || parsed.getName() == null || parsed.getVersion() == null) {
        throw new InvalidUserDataException(
                "Invalid format: '" + notation + "'. Group, name and version cannot be empty. Correct example: "
                        + "'org.gradle:gradle-core:1.0'");
    }
    return newSelector(parsed.getGroup(), parsed.getName(), parsed.getVersion());
}
项目:Reer    文件:DefaultModuleDependencySpec.java   
public DefaultModuleDependencySpec(String group, String name, String version) {
    if (group == null || name == null) {
        throw new IllegalDependencyNotation("A module dependency must have at least a group and a module name specified.");
    }
    this.group = group;
    this.name = name;
    this.version = version;
}
项目:Reer    文件:DefaultLibraryBinaryDependencySpec.java   
public DefaultLibraryBinaryDependencySpec(String projectPath, String libraryName, String variant) {
    if (libraryName == null || projectPath == null || variant == null) {
        throw new IllegalDependencyNotation("A direct library binary dependency must have all of project, library name and variant specified.");
    }
    this.libraryName = libraryName;
    this.projectPath = projectPath;
    this.variant = variant;
}
项目:Reer    文件:DefaultProjectDependencySpec.java   
public DefaultProjectDependencySpec(String libraryName, String projectPath) {
    if (libraryName == null && projectPath == null) {
        throw new IllegalDependencyNotation("A project dependency must have at least a project or library name specified.");
    }
    this.libraryName = libraryName;
    this.projectPath = projectPath;
}
项目:Pushjet-Android    文件:ParsedModuleStringNotation.java   
private void assignValuesFromModuleNotation(String moduleNotation) {
    String[] moduleNotationParts = moduleNotation.split(":");
    if (moduleNotationParts.length < 2 || moduleNotationParts.length > 4) {
        throw new IllegalDependencyNotation("Supplied String module notation '" + moduleNotation + "' is invalid. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core:1.9.5:javadoc'.");
    }
    group = GUtil.elvis(moduleNotationParts[0], null);
    name = moduleNotationParts[1];
    version = moduleNotationParts.length == 2 ? null : moduleNotationParts[2];
    if (moduleNotationParts.length == 4) {
        classifier = moduleNotationParts[3];
    }
}
项目:Pushjet-Android    文件:ParsedModuleStringNotation.java   
private void assignValuesFromModuleNotation(String moduleNotation) {
    String[] moduleNotationParts = moduleNotation.split(":");
    if (moduleNotationParts.length < 2 || moduleNotationParts.length > 4) {
        throw new IllegalDependencyNotation("The description " + moduleNotation + " is invalid");
    }
    group = GUtil.elvis(moduleNotationParts[0], null);
    name = moduleNotationParts[1];
    version = moduleNotationParts.length == 2 ? null : moduleNotationParts[2];
    if (moduleNotationParts.length == 4) {
        classifier = moduleNotationParts[3];
    }
}
项目:Reer    文件:DefaultModuleDependencySpec.java   
private void checkNotSet(String name, String value) {
    if (value != null) {
        throw new IllegalDependencyNotation(String.format("Cannot set '%s' multiple times for module dependency.", name));
    }
}
项目:Reer    文件:DefaultModuleDependencySpec.java   
private IllegalDependencyNotation illegalNotation(String moduleId) {
    return new IllegalDependencyNotation(
        String.format(
            "'%s' is not a valid module dependency notation. Example notations: 'org.gradle:gradle-core:2.2', 'org.mockito:mockito-core'.",
            moduleId));
}
项目:Reer    文件:DefaultProjectDependencySpec.java   
private void checkNotSet(String name, String value) {
    if (value != null) {
        throw new IllegalDependencyNotation(String.format("Cannot set '%s' multiple times for project dependency.", name));
    }
}
项目:Reer    文件:DefaultProjectDependencySpec.java   
private void validate() {
    if (projectPath == null && libraryName != null && libraryName.contains(":")) {
        throw new IllegalDependencyNotation(
            String.format("'%s' is not a valid library name. Did you mean to refer to a module instead?", libraryName));
    }
}