Search in sources :

Example 1 with DependencyPattern

use of org.jfrog.build.api.dependency.pattern.DependencyPattern in project build-info by JFrogDev.

the class PatternFactoryTest method testBuildDependencies.

public void testBuildDependencies() throws Exception {
    DependencyPattern pattern = PatternFactory.create("repo:**/*;a=1;b+=2@build#13=>relative\\path");
    assertBuildDependency(pattern, "repo:**/*", "a=1;b+=2", "relative/path", PatternType.NORMAL, "build", "13");
    pattern = PatternFactory.create("repo:**/*;c+=4;@build#13=>");
    assertBuildDependency(pattern, "repo:**/*", "c+=4;", "", PatternType.NORMAL, "build", "13");
    pattern = PatternFactory.create("repo:*/*/*/*.jar@build-name#13=>path");
    assertBuildDependency(pattern, "repo:*/*/*/*.jar", "", "path", PatternType.NORMAL, "build-name", "13");
    pattern = PatternFactory.create("repo:*/*.jar@build-name#10=!>path");
    assertBuildDependency(pattern, "repo:*/*.jar", "", "path", PatternType.DELETE, "build-name", "10");
    pattern = PatternFactory.create("repo:*/*.jar;a+=a;b=b@build#11=!>");
    assertBuildDependency(pattern, "repo:*/*.jar", "a+=a;b=b", "", PatternType.DELETE, "build", "11");
    pattern = PatternFactory.create("repo:*/*.jar@build#11=!>");
    assertBuildDependency(pattern, "repo:*/*.jar", "", "", PatternType.DELETE, "build", "11");
}
Also used : BuildDependencyPattern(org.jfrog.build.api.dependency.pattern.BuildDependencyPattern) DependencyPattern(org.jfrog.build.api.dependency.pattern.DependencyPattern)

Example 2 with DependencyPattern

use of org.jfrog.build.api.dependency.pattern.DependencyPattern in project build-info by JFrogDev.

the class BuildDependenciesHelper method getBuildDependencies.

private Map<String, Map<String, List<BuildDependencyPattern>>> getBuildDependencies(List<String> patternLines) {
    Map<String, Map<String, List<BuildDependencyPattern>>> buildsMap = Maps.newHashMap();
    for (String patternLine : patternLines) {
        DependencyPattern dependencyPattern = PatternFactory.create(patternLine);
        if (dependencyPattern instanceof BuildDependencyPattern) {
            BuildDependencyPattern buildDependencyPattern = (BuildDependencyPattern) dependencyPattern;
            String buildName = buildDependencyPattern.getBuildName();
            Map<String, List<BuildDependencyPattern>> numbersMap = buildsMap.get(buildName);
            if (numbersMap == null) {
                buildsMap.put(buildName, Maps.<String, List<BuildDependencyPattern>>newHashMap());
                numbersMap = buildsMap.get(buildName);
            }
            String buildNumber = buildDependencyPattern.getBuildNumber();
            List<BuildDependencyPattern> dependencyPatternList = numbersMap.get(buildNumber);
            if (dependencyPatternList == null) {
                numbersMap.put(buildNumber, Lists.<BuildDependencyPattern>newLinkedList());
                dependencyPatternList = numbersMap.get(buildNumber);
            }
            dependencyPatternList.add(buildDependencyPattern);
        }
    }
    return buildsMap;
}
Also used : List(java.util.List) BuildDependencyPattern(org.jfrog.build.api.dependency.pattern.BuildDependencyPattern) Map(java.util.Map) BuildDependencyPattern(org.jfrog.build.api.dependency.pattern.BuildDependencyPattern) DependencyPattern(org.jfrog.build.api.dependency.pattern.DependencyPattern)

Example 3 with DependencyPattern

use of org.jfrog.build.api.dependency.pattern.DependencyPattern in project build-info by JFrogDev.

the class PatternFactoryTest method testDependencies.

public void testDependencies() throws Exception {
    DependencyPattern dependencyPattern = PatternFactory.create("win-demo:*/*/*.dll;type+=32;OS+=win-7=>property");
    assertDependency(dependencyPattern, "win-demo:*/*/*.dll", "type+=32;OS+=win-7", "property", PatternType.NORMAL);
    dependencyPattern = PatternFactory.create("win-demo:**/*;type+=64;OS+=win-7=>starstar");
    assertDependency(dependencyPattern, "win-demo:**/*", "type+=64;OS+=win-7", "starstar", PatternType.NORMAL);
    dependencyPattern = PatternFactory.create("repo:win-7/**/*;OS+=win-7;type+=64=>path/deep");
    assertDependency(dependencyPattern, "repo:win-7/**/*", "OS+=win-7;type+=64", "path/deep", PatternType.NORMAL);
    dependencyPattern = PatternFactory.create("win-demo:*/*/*.dll=>all");
    assertDependency(dependencyPattern, "win-demo:*/*/*.dll", "", "all", PatternType.NORMAL);
    dependencyPattern = PatternFactory.create("repo:*/*/*.*;type=32;type=64=>all-withproperty");
    assertDependency(dependencyPattern, "repo:*/*/*.*", "type=32;type=64", "all-withproperty", PatternType.NORMAL);
    dependencyPattern = PatternFactory.create("win-demo:*/*/*.*;type=32;OS=linux");
    assertDependency(dependencyPattern, "win-demo:*/*/*.*", "type=32;OS=linux", "", PatternType.NORMAL);
    dependencyPattern = PatternFactory.create("win-demo:*/*/*.*;type=32;OS=linux=!>test\\sep");
    assertDependency(dependencyPattern, "win-demo:*/*/*.*", "type=32;OS=linux", "test/sep", PatternType.DELETE);
    dependencyPattern = PatternFactory.create("win-demo:**/*.*=!>");
    assertDependency(dependencyPattern, "win-demo:**/*.*", "", "", PatternType.DELETE);
}
Also used : BuildDependencyPattern(org.jfrog.build.api.dependency.pattern.BuildDependencyPattern) DependencyPattern(org.jfrog.build.api.dependency.pattern.DependencyPattern)

Aggregations

BuildDependencyPattern (org.jfrog.build.api.dependency.pattern.BuildDependencyPattern)3 DependencyPattern (org.jfrog.build.api.dependency.pattern.DependencyPattern)3 List (java.util.List)1 Map (java.util.Map)1