org.apache.ivy.core.module.descriptor.Configuration.Visibility Java Examples

The following examples show how to use org.apache.ivy.core.module.descriptor.Configuration.Visibility. 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: IvyTranslations.java    From jeka with Apache License 2.0 5 votes vote down vote up
private static Configuration toConfiguration(JkScope jkScope) {
    final List<String> extendedScopes = new LinkedList<>();
    for (final JkScope parent : jkScope.getExtendedScopes()) {
        extendedScopes.add(parent.getName());
    }
    final Visibility visibility = Visibility.PUBLIC;
    return new Configuration(jkScope.getName(), visibility, jkScope.getDescription(),
            extendedScopes.toArray(new String[0]), jkScope.isTransitive(), null);
}
 
Example #2
Source File: AbstractModuleDescriptorParserTester.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
protected void assertConf(ModuleDescriptor md, String name, String desc, Visibility visibility,
        String[] exts) {
    Configuration conf = md.getConfiguration(name);
    assertNotNull("configuration not found: " + name, conf);
    assertEquals(name, conf.getName());
    assertEquals(desc, conf.getDescription());
    assertEquals(visibility, conf.getVisibility());
    assertEquals(Arrays.asList(exts), Arrays.asList(conf.getExtends()));
}
 
Example #3
Source File: GradlePomModuleDescriptorParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void doParsePom(DescriptorParseContext parserSettings, GradlePomModuleDescriptorBuilder mdBuilder, PomReader pomReader) throws IOException, SAXException {
    if (pomReader.hasParent()) {
        //Is there any other parent properties?

        ModuleVersionIdentifier parentId = DefaultModuleVersionIdentifier.newId(
                pomReader.getParentGroupId(),
                pomReader.getParentArtifactId(),
                pomReader.getParentVersion());
        PomReader parentPomReader = parseOtherPom(parserSettings, parentId);
        pomReader.setPomParent(parentPomReader);
    }
    pomReader.resolveGAV();

    String groupId = pomReader.getGroupId();
    String artifactId = pomReader.getArtifactId();
    String version = pomReader.getVersion();
    mdBuilder.setModuleRevId(groupId, artifactId, version);

    mdBuilder.setHomePage(pomReader.getHomePage());
    mdBuilder.setDescription(pomReader.getDescription());
    mdBuilder.setLicenses(pomReader.getLicenses());

    ModuleRevisionId relocation = pomReader.getRelocation();

    if (relocation != null) {
        if (groupId != null && artifactId != null
                && artifactId.equals(relocation.getName())
                && groupId.equals(relocation.getOrganisation())) {
            LOGGER.error("POM relocation to an other version number is not fully supported in Gradle : {} relocated to {}.",
                    mdBuilder.getModuleDescriptor().getModuleRevisionId(), relocation);
            LOGGER.warn("Please update your dependency to directly use the correct version '{}'.", relocation);
            LOGGER.warn("Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.");
            PomReader relocatedModule = parseOtherPom(parserSettings, DefaultModuleVersionIdentifier.newId(relocation));

            Collection<PomDependencyData> pomDependencyDataList = relocatedModule.getDependencies().values();
            for(PomDependencyData pomDependencyData : pomDependencyDataList) {
                mdBuilder.addDependency(pomDependencyData);
            }

        } else {
            LOGGER.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
                    + " is relocated to " + relocation
                    + ". Please update your dependencies.");
            LOGGER.debug("Relocated module will be considered as a dependency");
            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mdBuilder.getModuleDescriptor(), relocation, true, false, true);
            /* Map all public dependencies */
            Configuration[] m2Confs = GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS;
            for (Configuration m2Conf : m2Confs) {
                if (Visibility.PUBLIC.equals(m2Conf.getVisibility())) {
                    dd.addDependencyConfiguration(m2Conf.getName(), m2Conf.getName());
                }
            }
            mdBuilder.addDependency(dd);
        }
    } else {
        overrideDependencyMgtsWithImported(parserSettings, pomReader);

        for (PomDependencyData dependency : pomReader.getDependencies().values()) {
            mdBuilder.addDependency(dependency);
        }
    }
}
 
Example #4
Source File: GradlePomModuleDescriptorParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void doParsePom(DescriptorParseContext parserSettings, GradlePomModuleDescriptorBuilder mdBuilder, PomReader pomReader) throws IOException, SAXException {
    if (pomReader.hasParent()) {
        //Is there any other parent properties?

        ModuleVersionIdentifier parentId = DefaultModuleVersionIdentifier.newId(
                pomReader.getParentGroupId(),
                pomReader.getParentArtifactId(),
                pomReader.getParentVersion());
        PomReader parentPomReader = parseOtherPom(parserSettings, parentId);
        pomReader.setPomParent(parentPomReader);
    }
    pomReader.resolveGAV();

    String groupId = pomReader.getGroupId();
    String artifactId = pomReader.getArtifactId();
    String version = pomReader.getVersion();
    mdBuilder.setModuleRevId(groupId, artifactId, version);

    mdBuilder.setHomePage(pomReader.getHomePage());
    mdBuilder.setDescription(pomReader.getDescription());
    mdBuilder.setLicenses(pomReader.getLicenses());

    ModuleRevisionId relocation = pomReader.getRelocation();

    if (relocation != null) {
        if (groupId != null && artifactId != null
                && artifactId.equals(relocation.getName())
                && groupId.equals(relocation.getOrganisation())) {
            LOGGER.error("POM relocation to an other version number is not fully supported in Gradle : {} relocated to {}.",
                    mdBuilder.getModuleDescriptor().getModuleRevisionId(), relocation);
            LOGGER.warn("Please update your dependency to directly use the correct version '{}'.", relocation);
            LOGGER.warn("Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.");
            PomReader relocatedModule = parseOtherPom(parserSettings, DefaultModuleVersionIdentifier.newId(relocation));

            Collection<PomDependencyData> pomDependencyDataList = relocatedModule.getDependencies().values();
            for(PomDependencyData pomDependencyData : pomDependencyDataList) {
                mdBuilder.addDependency(pomDependencyData);
            }

        } else {
            LOGGER.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
                    + " is relocated to " + relocation
                    + ". Please update your dependencies.");
            LOGGER.debug("Relocated module will be considered as a dependency");
            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mdBuilder.getModuleDescriptor(), relocation, true, false, true);
            /* Map all public dependencies */
            Configuration[] m2Confs = GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS;
            for (Configuration m2Conf : m2Confs) {
                if (Visibility.PUBLIC.equals(m2Conf.getVisibility())) {
                    dd.addDependencyConfiguration(m2Conf.getName(), m2Conf.getName());
                }
            }
            mdBuilder.addDependency(dd);
        }
    } else {
        overrideDependencyMgtsWithImported(parserSettings, pomReader);

        for (PomDependencyData dependency : pomReader.getDependencies().values()) {
            mdBuilder.addDependency(dependency);
        }
    }
}
 
Example #5
Source File: GradlePomModuleDescriptorParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void doParsePom(DescriptorParseContext parserSettings, GradlePomModuleDescriptorBuilder mdBuilder, PomReader pomReader) throws IOException, SAXException {
    if (pomReader.hasParent()) {
        //Is there any other parent properties?

        ModuleVersionIdentifier parentId = DefaultModuleVersionIdentifier.newId(
                pomReader.getParentGroupId(),
                pomReader.getParentArtifactId(),
                pomReader.getParentVersion());
        PomReader parentPomReader = parseOtherPom(parserSettings, parentId);
        pomReader.setPomParent(parentPomReader);
    }
    pomReader.resolveGAV();

    String groupId = pomReader.getGroupId();
    String artifactId = pomReader.getArtifactId();
    String version = pomReader.getVersion();
    mdBuilder.setModuleRevId(groupId, artifactId, version);

    mdBuilder.setHomePage(pomReader.getHomePage());
    mdBuilder.setDescription(pomReader.getDescription());
    mdBuilder.setLicenses(pomReader.getLicenses());

    ModuleRevisionId relocation = pomReader.getRelocation();

    if (relocation != null) {
        if (groupId != null && artifactId != null
                && artifactId.equals(relocation.getName())
                && groupId.equals(relocation.getOrganisation())) {
            LOGGER.error("POM relocation to an other version number is not fully supported in Gradle : {} relocated to {}.",
                    mdBuilder.getModuleDescriptor().getModuleRevisionId(), relocation);
            LOGGER.warn("Please update your dependency to directly use the correct version '{}'.", relocation);
            LOGGER.warn("Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.");
            PomReader relocatedModule = parseOtherPom(parserSettings, DefaultModuleVersionIdentifier.newId(relocation));

            Collection<PomDependencyData> pomDependencyDataList = relocatedModule.getDependencies().values();
            for(PomDependencyData pomDependencyData : pomDependencyDataList) {
                mdBuilder.addDependency(pomDependencyData);
            }

        } else {
            LOGGER.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
                    + " is relocated to " + relocation
                    + ". Please update your dependencies.");
            LOGGER.debug("Relocated module will be considered as a dependency");
            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mdBuilder.getModuleDescriptor(), relocation, true, false, true);
            /* Map all public dependencies */
            Configuration[] m2Confs = GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS;
            for (Configuration m2Conf : m2Confs) {
                if (Visibility.PUBLIC.equals(m2Conf.getVisibility())) {
                    dd.addDependencyConfiguration(m2Conf.getName(), m2Conf.getName());
                }
            }
            mdBuilder.addDependency(dd);
        }
    } else {
        overrideDependencyMgtsWithImported(parserSettings, pomReader);

        for (PomDependencyData dependency : pomReader.getDependencies().values()) {
            mdBuilder.addDependency(dependency);
        }
    }
}
 
Example #6
Source File: GradlePomModuleDescriptorParser.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void doParsePom(DescriptorParseContext parserSettings, GradlePomModuleDescriptorBuilder mdBuilder, PomReader pomReader) throws IOException, SAXException {
    if (pomReader.hasParent()) {
        //Is there any other parent properties?

        ModuleVersionIdentifier parentId = DefaultModuleVersionIdentifier.newId(
                pomReader.getParentGroupId(),
                pomReader.getParentArtifactId(),
                pomReader.getParentVersion());
        PomReader parentPomReader = parseOtherPom(parserSettings, parentId);
        pomReader.setPomParent(parentPomReader);
    }
    pomReader.resolveGAV();

    String groupId = pomReader.getGroupId();
    String artifactId = pomReader.getArtifactId();
    String version = pomReader.getVersion();
    mdBuilder.setModuleRevId(groupId, artifactId, version);

    mdBuilder.setHomePage(pomReader.getHomePage());
    mdBuilder.setDescription(pomReader.getDescription());
    mdBuilder.setLicenses(pomReader.getLicenses());

    ModuleRevisionId relocation = pomReader.getRelocation();

    if (relocation != null) {
        if (groupId != null && artifactId != null
                && artifactId.equals(relocation.getName())
                && groupId.equals(relocation.getOrganisation())) {
            LOGGER.error("POM relocation to an other version number is not fully supported in Gradle : {} relocated to {}.",
                    mdBuilder.getModuleDescriptor().getModuleRevisionId(), relocation);
            LOGGER.warn("Please update your dependency to directly use the correct version '{}'.", relocation);
            LOGGER.warn("Resolution will only pick dependencies of the relocated element.  Artifacts and other metadata will be ignored.");
            PomReader relocatedModule = parseOtherPom(parserSettings, DefaultModuleVersionIdentifier.newId(relocation));

            Collection<PomDependencyData> pomDependencyDataList = relocatedModule.getDependencies().values();
            for(PomDependencyData pomDependencyData : pomDependencyDataList) {
                mdBuilder.addDependency(pomDependencyData);
            }

        } else {
            LOGGER.info(mdBuilder.getModuleDescriptor().getModuleRevisionId()
                    + " is relocated to " + relocation
                    + ". Please update your dependencies.");
            LOGGER.debug("Relocated module will be considered as a dependency");
            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(mdBuilder.getModuleDescriptor(), relocation, true, false, true);
            /* Map all public dependencies */
            Configuration[] m2Confs = GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS;
            for (Configuration m2Conf : m2Confs) {
                if (Visibility.PUBLIC.equals(m2Conf.getVisibility())) {
                    dd.addDependencyConfiguration(m2Conf.getName(), m2Conf.getName());
                }
            }
            mdBuilder.addDependency(dd);
        }
    } else {
        overrideDependencyMgtsWithImported(parserSettings, pomReader);

        for (PomDependencyData dependency : pomReader.getDependencies().values()) {
            mdBuilder.addDependency(dependency);
        }
    }
}