当前位置: 首页>>代码示例>>Java>>正文


Java ModuleVersionIdentifier类代码示例

本文整理汇总了Java中org.gradle.api.artifacts.ModuleVersionIdentifier的典型用法代码示例。如果您正苦于以下问题:Java ModuleVersionIdentifier类的具体用法?Java ModuleVersionIdentifier怎么用?Java ModuleVersionIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModuleVersionIdentifier类属于org.gradle.api.artifacts包,在下文中一共展示了ModuleVersionIdentifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureUploadArchivesTask

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
private void configureUploadArchivesTask() {
    configurationActionContainer.add(new Action<Project>() {
        public void execute(Project project) {
            Upload uploadArchives = project.getTasks().withType(Upload.class).findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME);
            if (uploadArchives == null) {
                return;
            }

            ConfigurationInternal configuration = (ConfigurationInternal) uploadArchives.getConfiguration();
            Module module = configuration.getModule();
            for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
                MavenPom pom = resolver.getPom();
                ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
                        pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
                        pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
                        pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
                );
                publicationRegistry.registerPublication(project.getPath(), new DefaultProjectPublication(publicationId));
            }
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:MavenPlugin.java

示例2: resolve

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
public ModuleVersionIdentifier resolve(ProjectDependency dependency) {
    Project dependencyProject = dependency.getDependencyProject();
    ((ProjectInternal) dependencyProject).evaluate();

    PublishingExtension publishing = dependencyProject.getExtensions().findByType(PublishingExtension.class);

    if (publishing == null || publishing.getPublications().withType(PublicationInternal.class).isEmpty()) {
        // Project does not apply publishing (or has no publications): simply use the project name in place of the dependency name
        return new DefaultModuleVersionIdentifier(dependency.getGroup(), dependencyProject.getName(), dependency.getVersion());
    }

    // See if all publications have the same identifier
    Set<? extends PublicationInternal> publications = publishing.getPublications().withType(PublicationInternal.class);
    Iterator<? extends PublicationInternal> iterator = publications.iterator();
    ModuleVersionIdentifier candidate = iterator.next().getCoordinates();
    while (iterator.hasNext()) {
        ModuleVersionIdentifier alternative = iterator.next().getCoordinates();
        if (!candidate.equals(alternative)) {
            throw new UnsupportedOperationException("Publishing is not yet able to resolve a dependency on a project with multiple different publications.");
        }
    }
    return candidate;

}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:ProjectDependencyPublicationResolver.java

示例3: collectArtifacts

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
private void collectArtifacts(Configuration configuration,
                              Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts) {

    Set<ResolvedArtifact> allArtifacts;
    if (!extraModelInfo.getMode().equals(STANDARD)) {
        allArtifacts = configuration.getResolvedConfiguration().getLenientConfiguration().getArtifacts(
            Specs.satisfyAll());
    } else {
        allArtifacts = configuration.getResolvedConfiguration().getResolvedArtifacts();
    }

    for (ResolvedArtifact artifact : allArtifacts) {
        ModuleVersionIdentifier id = artifact.getModuleVersion().getId();
        List<ResolvedArtifact> moduleArtifacts = artifacts.get(id);

        if (moduleArtifacts == null) {
            moduleArtifacts = Lists.newArrayList();
            artifacts.put(id, moduleArtifacts);
        }

        if (!moduleArtifacts.contains(artifact)) {
            moduleArtifacts.add(artifact);
        }
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:26,代码来源:AtlasDepTreeParser.java

示例4: computeArtifactPath

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
@NonNull
private String computeArtifactPath(
        @NonNull ModuleVersionIdentifier moduleVersion,
        @NonNull ResolvedArtifact artifact) {
    StringBuilder pathBuilder = new StringBuilder(
            moduleVersion.getGroup().length()
                    + moduleVersion.getName().length()
                    + moduleVersion.getVersion().length()
                    + 10); // in case of classifier which is rare.

    pathBuilder.append(normalize(logger, moduleVersion, moduleVersion.getGroup()))
            .append(File.separatorChar)
            .append(normalize(logger, moduleVersion, moduleVersion.getName()))
            .append(File.separatorChar)
            .append(normalize(logger, moduleVersion,
                    moduleVersion.getVersion()));

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        pathBuilder.append(File.separatorChar).append(normalize(logger, moduleVersion,
                artifact.getClassifier()));
    }

    return pathBuilder.toString();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:25,代码来源:DependencyManager.java

示例5: computeArtifactName

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
@NonNull
private static String computeArtifactName(
        @NonNull ModuleVersionIdentifier moduleVersion,
        @NonNull ResolvedArtifact artifact) {
    StringBuilder nameBuilder = new StringBuilder(
            moduleVersion.getGroup().length()
                    + moduleVersion.getName().length()
                    + moduleVersion.getVersion().length()
                    + 10); // in case of classifier which is rare.

    nameBuilder.append(moduleVersion.getGroup())
            .append(':')
            .append(moduleVersion.getName())
            .append(':')
            .append(moduleVersion.getVersion());

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        nameBuilder.append(':').append(artifact.getClassifier());
    }

    return nameBuilder.toString();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:23,代码来源:DependencyManager.java

示例6: getIdeRepoFileDependencies

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
/**
 * Gets IDE repository file dependencies.
 *
 * @param configuration Configuration
 * @return IDE repository file dependencies
 */
public List<IdeExtendedRepoFileDependency> getIdeRepoFileDependencies(Configuration configuration) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    final Set<ResolvedComponentResult> resolvedRepoFileComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {
        @Override
        public boolean isSatisfiedBy(ResolvedComponentResult element) {
            return element.getId() instanceof ModuleComponentIdentifier;
        }
    });
    Set<ModuleVersionIdentifier> mappedResolvedDependencies = mapResolvedDependencies(resolvedRepoFileComponents);
    Set<ResolvedArtifact> artifacts = getExternalArtifacts(configuration);
    List<IdeExtendedRepoFileDependency> externalDependencies = new ArrayList<IdeExtendedRepoFileDependency>();
    for (ResolvedArtifact artifact : artifacts) {
        if (mappedResolvedDependencies.contains(artifact.getModuleVersion().getId())) {
            IdeExtendedRepoFileDependency ideRepoFileDependency = new IdeExtendedRepoFileDependency(artifact.getFile());
            ideRepoFileDependency.setId(artifact.getModuleVersion().getId());
            externalDependencies.add(ideRepoFileDependency);
        }
    }

    return externalDependencies;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:28,代码来源:DefaultIdeDependencyResolver.java

示例7: computeArtifactPath

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
@NonNull
public static String computeArtifactPath(@NonNull ModuleVersionIdentifier moduleVersion,
                                         @NonNull ResolvedArtifact artifact) {
    StringBuilder pathBuilder = new StringBuilder();

    pathBuilder.append(normalize(moduleVersion, moduleVersion.getGroup()))
        .append("/")
        .append(normalize(moduleVersion, moduleVersion.getName()))
        .append("/")
        .append(normalize(moduleVersion, moduleVersion.getVersion()));

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        pathBuilder.append("/")
            .append(normalize(moduleVersion, artifact.getClassifier()));
    }

    return pathBuilder.toString();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:19,代码来源:AtlasDepHelper.java

示例8: computeArtifactName

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
@NonNull
public static String computeArtifactName(@NonNull ModuleVersionIdentifier moduleVersion,
                                          @NonNull ResolvedArtifact artifact) {
    StringBuilder nameBuilder = new StringBuilder();

    nameBuilder.append(moduleVersion.getGroup())
        .append(":")
        .append(moduleVersion.getName())
        .append(":")
        .append(moduleVersion.getVersion());

    if (artifact.getClassifier() != null && !artifact.getClassifier().isEmpty()) {
        nameBuilder.append(":").append(artifact.getClassifier());
    }

    return nameBuilder.toString();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:18,代码来源:AtlasDepHelper.java

示例9: addResolvedDependencyInfo

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
/**
 * A recursive approach to dependency resolution
 *
 * @param parentDependency
 * @param resolvedDependenciesMap
 */
private void addResolvedDependencyInfo(ResolvedDependencyInfo parentDependency,
                                       Multimap<ModuleVersionIdentifier, ResolvedDependencyInfo>
                                           resolvedDependenciesMap) {
    int indent = parentDependency.getIndent();
    ModuleVersionIdentifier identifier = parentDependency.getModuleVersionIdentifier();
    Collection<ResolvedDependencyInfo> childDependencies = resolvedDependenciesMap.get(identifier);

    //TODO here
    for (ResolvedDependencyInfo childDependency : childDependencies) {
        if (childDependency.getIndent() > indent) {
            //                System.out.println(parentDependency + " indent " + indent + "->" + childDependency
            // +  " indent " + childDependency.getIndent());
            parentDependency.getChildren().add(childDependency);
            if (childDependency.getIndent() <= 1) {
                addResolvedDependencyInfo(childDependency, resolvedDependenciesMap);
            }
        }
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:26,代码来源:DependencyResolver.java

示例10: isAwbDependency

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
public static boolean isAwbDependency(DependencyResult dependencyResult,
                                      Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts) {
    if (dependencyResult instanceof ResolvedDependencyResult) {
        ResolvedDependencyResult resolvedDependencyResult = (ResolvedDependencyResult)dependencyResult;
        ModuleVersionIdentifier moduleVersionIdentifier = resolvedDependencyResult.getSelected().getModuleVersion();
        List<ResolvedArtifact> resolvedArtifacts = artifacts.get(moduleVersionIdentifier);

        if (resolvedArtifacts.size() > 0) {
            ResolvedArtifact resolvedArtifact = resolvedArtifacts.get(0);
            return ("awb".equals(resolvedArtifact.getType()));
        }
    }
    return false;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:15,代码来源:DependencyConvertUtils.java

示例11: mustRefreshVersionList

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
public boolean mustRefreshVersionList(final ModuleIdentifier moduleIdentifier, Set<ModuleVersionIdentifier> matchingVersions, long ageMillis) {
    CachedDependencyResolutionControl dependencyResolutionControl = new CachedDependencyResolutionControl(moduleIdentifier, matchingVersions, ageMillis);

    for (Action<? super DependencyResolutionControl> rule : dependencyCacheRules) {
        rule.execute(dependencyResolutionControl);
        if (dependencyResolutionControl.ruleMatch()) {
            return dependencyResolutionControl.mustCheck();
        }
    }

    return false;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:DefaultCachePolicy.java

示例12: mustRefreshModule

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
private boolean mustRefreshModule(ModuleVersionIdentifier moduleVersionId, ResolvedModuleVersion version, long ageMillis, boolean changingModule) {
    CachedModuleResolutionControl moduleResolutionControl = new CachedModuleResolutionControl(moduleVersionId, version, changingModule, ageMillis);

    for (Action<? super ModuleResolutionControl> rule : moduleCacheRules) {
        rule.execute(moduleResolutionControl);
        if (moduleResolutionControl.ruleMatch()) {
            return moduleResolutionControl.mustCheck();
        }
    }

    return false;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:DefaultCachePolicy.java

示例13: mustRefreshModuleArtifacts

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
public boolean mustRefreshModuleArtifacts(ModuleVersionIdentifier moduleVersionId, Set<ArtifactIdentifier> artifacts,
                                          long ageMillis, boolean belongsToChangingModule, boolean moduleDescriptorInSync) {
    if (belongsToChangingModule && !moduleDescriptorInSync) {
        return true;
    }
    return mustRefreshModule(moduleVersionId, new DefaultResolvedModuleVersion(moduleVersionId), ageMillis, belongsToChangingModule);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultCachePolicy.java

示例14: getIdentifier

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
/**
 * dependent
 * @param identifier
 * @return
 */
private String getIdentifier(ModuleVersionIdentifier identifier) {
    StringBuilder sb = new StringBuilder();
    sb.append(identifier.getGroup()).append(":");
    sb.append(identifier.getName()).append(":");
    sb.append(identifier.getVersion());
    return sb.toString();
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:13,代码来源:CircleDependencyCheck.java

示例15: DefaultArtifactSet

import org.gradle.api.artifacts.ModuleVersionIdentifier; //导入依赖的package包/类
public DefaultArtifactSet(ModuleVersionIdentifier ownerId, ModuleSource moduleSource, ModuleExclusion exclusions, Set<? extends VariantMetadata> variants,
                          ArtifactResolver artifactResolver, Map<ComponentArtifactIdentifier, ResolvedArtifact> allResolvedArtifacts, long id) {
    this.moduleVersionIdentifier = ownerId;
    this.moduleSource = moduleSource;
    this.exclusions = exclusions;
    this.variants = variants;
    this.artifactResolver = artifactResolver;
    this.allResolvedArtifacts = allResolvedArtifacts;
    this.id = id;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:DefaultArtifactSet.java


注:本文中的org.gradle.api.artifacts.ModuleVersionIdentifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。