Package org.jfrog.build.api.dependency.pattern

Examples of org.jfrog.build.api.dependency.pattern.BuildDependencyPattern


    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);
                }
View Full Code Here



            List<BuildDependencyPattern> buildDependencyPatterns = dependencyPatterns.get(artifacts.getBuildName()).get(
                    artifactsRequests.get(i).getBuildNumber());
            for (int j = 0; j < buildDependencyPatterns.size(); j++) {
                BuildDependencyPattern buildDependencyPattern = buildDependencyPatterns.get(j);
                if (!buildDependencyPattern.getBuildName().equals(artifacts.getBuildName())) {
                    throw new IllegalArgumentException(String.format("Build names don't match: [%s] != [%s]",
                            buildDependencyPattern.getBuildName(), artifacts.getBuildName()));
                }

                final String message = String.format("Dependency on build [%s], number [%s]",
                        buildDependencyPattern.getBuildName(), buildDependencyPattern.getBuildNumber());

                /**
                 * Build number response is null for unresolved dependencies (wrong build name or build number).
                 */
                if (artifacts.getBuildNumber() == null) {
                    log.info(
                            message + " - no results found, check correctness of dependency build name and build number.");
                } else {
                    PatternResult patternResult = artifacts.getPatternResults().get(j);
                    List<PatternArtifact> patternArtifacts = patternResult.getPatternArtifacts();
                    log.info(message + String.format(", pattern [%s] - [%s] result%s found.",
                            buildDependencyPattern.getPattern(), patternArtifacts.size(),
                            (patternArtifacts.size() == 1 ? "" : "s")));

                    for (PatternArtifact patternArtifact : patternArtifacts) {
                        final String uri = patternArtifact.getUri(); // "libs-release-local/com/goldin/plugins/gradle/0.1.1/gradle-0.1.1.jar"
                        final int indexOfFirstSlash = uri.indexOf('/');

                        assert (indexOfFirstSlash > 0) : String.format("Failed to locate '/' in [%s]", uri);

                        final String repoUrl = patternArtifact.getArtifactoryUrl() + '/' + uri.substring(0,
                                indexOfFirstSlash);
                        final String filePath = uri.substring(indexOfFirstSlash + 1);
                        downloadableArtifacts.add(
                                new DownloadableArtifact(repoUrl, buildDependencyPattern.getTargetDirectory(), filePath,
                                        buildDependencyPattern.getMatrixParams(), buildDependencyPattern.getPattern(),
                                        buildDependencyPattern.getPatternType()));
                    }

                    if (!patternArtifacts.isEmpty()) {
                        BuildDependency buildDependency = new BuildDependencyBuilder()
                                .name(artifacts.getBuildName())
View Full Code Here

                matrixParams = StringUtils.substring(buildDependencyPattern, pattern.length() + 1, index1);
                if (StringUtils.isNotBlank(matrixParams)) {
                    buildDependencyPattern = StringUtils.substring(buildDependencyPattern, 0,
                            index1 - matrixParams.length() - 1);
                }
                return new BuildDependencyPattern(buildDependencyPattern, matrixParams, targetPattern,
                        getPatternType(patternLine), buildName, buildNumber);
            }
        } else {
            return new DependencyPattern(pattern, matrixParams, targetPattern, getPatternType(patternLine));
        }
View Full Code Here

TOP

Related Classes of org.jfrog.build.api.dependency.pattern.BuildDependencyPattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.