Search in sources :

Example 1 with IvyResourcePattern

use of org.gradle.api.internal.artifacts.repositories.resolver.IvyResourcePattern in project gradle by gradle.

the class LocallyAvailableResourceFinderFactory method addForPattern.

private void addForPattern(List<LocallyAvailableResourceFinder<ModuleComponentArtifactMetadata>> finders, String pattern) {
    int wildcardPos = pattern.indexOf("/*/");
    int patternPos = pattern.indexOf("/[");
    if (wildcardPos < 0 && patternPos < 0) {
        throw new IllegalArgumentException(String.format("Unsupported pattern '%s'", pattern));
    }
    int chopAt;
    if (wildcardPos >= 0 && patternPos >= 0) {
        chopAt = Math.min(wildcardPos, patternPos);
    } else if (wildcardPos >= 0) {
        chopAt = wildcardPos;
    } else {
        chopAt = patternPos;
    }
    String pathPart = pattern.substring(0, chopAt);
    String patternPart = pattern.substring(chopAt + 1);
    for (File rootCachesDirectory : rootCachesDirectories) {
        addForPattern(finders, new File(rootCachesDirectory, pathPart), new IvyResourcePattern(patternPart));
    }
}
Also used : IvyResourcePattern(org.gradle.api.internal.artifacts.repositories.resolver.IvyResourcePattern) File(java.io.File)

Aggregations

File (java.io.File)1 IvyResourcePattern (org.gradle.api.internal.artifacts.repositories.resolver.IvyResourcePattern)1