org.gradle.api.XmlProvider Java Examples

The following examples show how to use org.gradle.api.XmlProvider. 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: EclipseConfigurator.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a library to the eclipse classpath. This method simply adds the library to the general
 * context main and test.
 *
 * @param libraryPath The path to the library that will be added
 * @param provider The provider of the classpath file
 */
private void addNewLibToClasspath(String libraryPath, XmlProvider provider) {
  provider
      .asNode()
      .appendNode(
          "classpathentry",
          new HashMap<String, String>() {
            {
              put("kind", "lib");
              put("path", libraryPath);
            }
          })
      .appendNode(
          "attribute",
          new HashMap<String, String>() {
            {
              put("name", "gradle_used_by_scope");
              put("value", "main,test");
            }
          });
}
 
Example #2
Source File: EclipseConfigurator.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
/**
 * We relocate (change the package naming) the picocontainer library in order to avoid issues with
 * the picocontainer version shipped with Intellij.
 */
public void usePatchedPicocontainer() {
  getEclipseXmlContentMerger()
      .withXml(
          (XmlProvider xmlProvider) -> {
            // Add new classpath entry to include the relocated picocontainer
            String relocatedPicoContainerJarPath = getRelocatedPicoContainerJarPath();
            addNewLibToClasspath(relocatedPicoContainerJarPath, xmlProvider);
          });
}
 
Example #3
Source File: CuriostackRootPlugin.java    From curiostack with MIT License 5 votes vote down vote up
private static void setupWorkspaceXml(Project project, XmlProvider xml) {
  Node properties = findOrCreateChild(xml.asNode(), "component", "PropertiesComponent");
  setProperty(properties, "js.linters.configure.manually.selectedeslint", "true");
  setProperty(
      properties, "node.js.path.for.package.eslint", NodeUtil.getNodeExe(project).toString());
  setProperty(properties, "node.js.detected.package.eslint", "true");
  setProperty(properties, "node.js.selected.package.eslint", "$PROJECT_DIR$/node_modules/eslint");
  setProperty(
      properties, "settings.editor.selected.configurable", "settings.javascript.linters.eslint");
}
 
Example #4
Source File: PomCustomizer.java    From shipkit with MIT License 5 votes vote down vote up
/**
 * Customizes the pom. The method requires following properties on root project to function correctly:
 */
public static void customizePom(final Project project, final ShipkitConfiguration conf, final MavenPublication publication) {
    publication.getPom().withXml(new Action<XmlProvider>() {
        public void execute(XmlProvider xml) {
            String archivesBaseName = (String) project.getProperties().get("archivesBaseName");
            File contributorsFile = contributorsFile(project);
            LOG.info("  Read project contributors from file: " + contributorsFile.getAbsolutePath());

            // It can happens that contributorsFile doesn't exist e.g. when shipkit.team.contributors is NOT empty
            ProjectContributorsSet contributorsFromGitHub = new ProjectContributorsSerializer()
                    .deserialize(IOUtil.readFullyOrDefault(contributorsFile, "[]"));
            LOG.info("  Customizing pom for publication " + publication.getName() + " in " + project.toString() +
                    "\n   - Module name (project.archivesBaseName): " + archivesBaseName +
                    "\n   - Description (project.description): " + project.getDescription() +
                    "\n   - GitHub repository (project.rootProject.shipkit.gitHub.repository): "
                            + conf.getGitHub().getRepository() +
                    "\n   - Developers (project.rootProject.shipkit.team.developers): "
                            + StringUtil.join(conf.getTeam().getDevelopers(), ", ") +
                    "\n   - Contributors (project.rootProject.shipkit.team.contributors): "
                            + StringUtil.join(conf.getTeam().getContributors(), ", ") +
                    "\n   - Contributors read from GitHub: "
                            + StringUtil.join(contributorsFromGitHub.toConfigNotation(), ", "));

            final boolean isAndroidLibrary = project.getPlugins().hasPlugin("com.android.library");
            customizePom(xml.asNode(), conf, archivesBaseName, project.getDescription(), contributorsFromGitHub, isAndroidLibrary);
        }
    });
}
 
Example #5
Source File: XmlTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Action<? super XmlProvider> provider) {
    actions.add(provider);
}
 
Example #6
Source File: DefaultMavenPom.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenPom withXml(final Action<XmlProvider> action) {
    withXmlActions.addAction(action);
    return this;
}
 
Example #7
Source File: XmlTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(Iterable<Action<? super XmlProvider>> actions) {
    for (Action<? super XmlProvider> action : actions) {
        action.execute(this);
    }
}
 
Example #8
Source File: IvyDescriptorFileGenerator.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public IvyDescriptorFileGenerator withXml(final Action<XmlProvider> action) {
    xmlTransformer.addAction(action);
    return this;
}
 
Example #9
Source File: XmlTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Action<? super XmlProvider> provider) {
    actions.add(provider);
}
 
Example #10
Source File: XmlTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Closure closure) {
    actions.add(new ClosureBackedAction<XmlProvider>(closure));
}
 
Example #11
Source File: XmlTransformer.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(Iterable<Action<? super XmlProvider>> actions) {
    for (Action<? super XmlProvider> action : actions) {
        action.execute(this);
    }
}
 
Example #12
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenPom withXml(final Action<XmlProvider> action) {
    withXmlActions.addAction(action);
    return this;
}
 
Example #13
Source File: MavenPomFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public MavenPomFileGenerator withXml(final Action<XmlProvider> action) {
    xmlTransformer.addAction(action);
    return this;
}
 
Example #14
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void withXml(Action<? super XmlProvider> action) {
    xmlAction.add(new UserCodeAction<XmlProvider>("Could not apply withXml() to generated POM", action));
}
 
Example #15
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Action<XmlProvider> getXmlAction() {
    return xmlAction;
}
 
Example #16
Source File: DefaultIvyModuleDescriptorSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void withXml(Action<? super XmlProvider> action) {
    xmlActions.add(new UserCodeAction<XmlProvider>("Could not apply withXml() to Ivy module descriptor", action));
}
 
Example #17
Source File: DefaultIvyModuleDescriptorSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Action<XmlProvider> getXmlAction() {
    return xmlActions;
}
 
Example #18
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Action<? super XmlProvider> provider) {
    actions.add(provider);
}
 
Example #19
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Closure closure) {
    actions.add(new ClosureBackedAction<XmlProvider>(closure));
}
 
Example #20
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(Iterable<Action<? super XmlProvider>> actions) {
    for (Action<? super XmlProvider> action : actions) {
        action.execute(this);
    }
}
 
Example #21
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenPom withXml(final Action<XmlProvider> action) {
    withXmlActions.addAction(action);
    return this;
}
 
Example #22
Source File: MavenPomFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public MavenPomFileGenerator withXml(final Action<XmlProvider> action) {
    xmlTransformer.addAction(action);
    return this;
}
 
Example #23
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void withXml(Action<? super XmlProvider> action) {
    xmlAction.add(new UserCodeAction<XmlProvider>("Could not apply withXml() to generated POM", action));
}
 
Example #24
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Action<XmlProvider> getXmlAction() {
    return xmlAction;
}
 
Example #25
Source File: DefaultIvyModuleDescriptor.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void withXml(Action<? super XmlProvider> action) {
    xmlActions.add(new UserCodeAction<XmlProvider>("Could not apply withXml() to Ivy module descriptor", action));
}
 
Example #26
Source File: DefaultIvyModuleDescriptor.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public Action<XmlProvider> getXmlAction() {
    return xmlActions;
}
 
Example #27
Source File: IvyDescriptorFileGenerator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public IvyDescriptorFileGenerator withXml(final Action<XmlProvider> action) {
    xmlTransformer.addAction(action);
    return this;
}
 
Example #28
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Action<? super XmlProvider> provider) {
    actions.add(provider);
}
 
Example #29
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void addAction(Closure closure) {
    actions.add(new ClosureBackedAction<XmlProvider>(closure));
}
 
Example #30
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(Iterable<Action<? super XmlProvider>> actions) {
    for (Action<? super XmlProvider> action : actions) {
        action.execute(this);
    }
}