Java Code Examples for org.gradle.util.GUtil#elvis()

The following examples show how to use org.gradle.util.GUtil#elvis() . 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 File: DefaultLibraryResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private NativeLibraryBinary resolve(Set<? extends NativeLibraryBinary> candidates) {
    for (NativeLibraryBinary candidate : candidates) {
        if (flavor != null && !flavor.getName().equals(candidate.getFlavor().getName())) {
            continue;
        }
        if (platform != null && !platform.getName().equals(candidate.getTargetPlatform().getName())) {
            continue;
        }
        if (buildType != null && !buildType.getName().equals(candidate.getBuildType().getName())) {
            continue;
        }

        return candidate;
    }

    String typeName = GUtil.elvis(requirement.getLinkage(), "shared");
    throw new LibraryResolveException(String.format("No %s library binary available for library '%s' with [flavor: '%s', platform: '%s', buildType: '%s']",
            typeName, requirement.getLibraryName(), flavor.getName(), platform.getName(), buildType.getName()));
}
 
Example 2
Source File: TaskView.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Instantiates an immutable view of a task. This is only meant to be called internally whenever generating a hierarchy of projects and tasks.
 */
/*package*/ TaskView(ProjectView project, String name, String description, boolean isDefault) {
    this.project = project;
    this.name = name;
    this.isDefault = isDefault;
    this.description = GUtil.elvis(description, "");
}
 
Example 3
Source File: ProjectView.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Instantiates an immutable view of a project. This is only meant to be called internally whenever generating a hierarchy of projects and tasks.
 */
/*package*/ ProjectView(ProjectView parentProject, String name, File buildFile, String description) {
    this.parentProject = parentProject;
    this.name = name;
    this.buildFile = buildFile;
    this.description = GUtil.elvis(description, "");
    if (parentProject != null) {
        parentProject.addSubProject(this);
    }
}
 
Example 4
Source File: ParsedModuleStringNotation.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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];
    }
}
 
Example 5
Source File: ProjectView.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Instantiates an immutable view of a project. This is only meant to be called internally whenever generating a hierarchy of projects and tasks.
 */
/*package*/ ProjectView(ProjectView parentProject, String name, File buildFile, String description) {
    this.parentProject = parentProject;
    this.name = name;
    this.buildFile = buildFile;
    this.description = GUtil.elvis(description, "");
    if (parentProject != null) {
        parentProject.addSubProject(this);
    }
}
 
Example 6
Source File: ParsedModuleStringNotation.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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];
    }
}
 
Example 7
Source File: DefaultExcludeRuleConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultExcludeRule createExcludeRule(String configurationName, ExcludeRule excludeRule) {
    String org = GUtil.elvis(excludeRule.getGroup(), PatternMatcher.ANY_EXPRESSION);
    String module = GUtil.elvis(excludeRule.getModule(), PatternMatcher.ANY_EXPRESSION);
    DefaultExcludeRule ivyExcludeRule = new DefaultExcludeRule(new ArtifactId(
            IvyUtil.createModuleId(org, module), PatternMatcher.ANY_EXPRESSION,
            PatternMatcher.ANY_EXPRESSION,
            PatternMatcher.ANY_EXPRESSION),
            ExactPatternMatcher.INSTANCE, null);
    ivyExcludeRule.addConfiguration(configurationName);
    return ivyExcludeRule;
}
 
Example 8
Source File: IvyUtil.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static String emptyStringIfNull(String value) {
    return GUtil.elvis(value, "");
}
 
Example 9
Source File: DefaultMavenPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String getPackaging() {
    return GUtil.elvis(packaging, mavenPublication.determinePackagingFromArtifacts());
}
 
Example 10
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String getPackaging() {
    return GUtil.elvis(packaging, mavenPublication.determinePackagingFromArtifacts());
}
 
Example 11
Source File: ArchivePublishArtifact.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String getExtension() {
    return GUtil.elvis(extension, archiveTask.getExtension());
}
 
Example 12
Source File: DefaultProjectRegistry.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Set<T> getSubProjects(String path) {
    return GUtil.elvis(subProjects.get(path), new HashSet<T>());
}
 
Example 13
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String getType() {
    return GUtil.elvis(type, archiveTask.getExtension());
}
 
Example 14
Source File: DefaultProjectRegistry.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Set<T> getSubProjects(String path) {
    return GUtil.elvis(subProjects.get(path), new HashSet<T>());
}
 
Example 15
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String getPackaging() {
    return GUtil.elvis(packaging, mavenPublication.determinePackagingFromArtifacts());
}
 
Example 16
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Date getDate() {
    return GUtil.elvis(date, new Date(archiveTask.getArchivePath().lastModified()));
}
 
Example 17
Source File: ArchivePublishArtifact.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public String getExtension() {
    return GUtil.elvis(extension, archiveTask.getExtension());
}
 
Example 18
Source File: IvyUtil.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static String emptyStringIfNull(String value) {
    return GUtil.elvis(value, "");
}
 
Example 19
Source File: ArchivePublishArtifact.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Date getDate() {
    return GUtil.elvis(date, new Date(archiveTask.getArchivePath().lastModified()));
}
 
Example 20
Source File: AbstractModuleDependency.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected AbstractModuleDependency(String configuration) {
    this.configuration = GUtil.elvis(configuration, Dependency.DEFAULT_CONFIGURATION);
}