org.gradle.internal.ErroringAction Java Examples
The following examples show how to use
org.gradle.internal.ErroringAction.
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: DefaultCollectionBuilder.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private <S extends T> void doCreate(final String name, ModelType<S> type, Action<? super S> configAction, Factory<? extends S> factory) { ModelReference<S> modelReference = ModelReference.of(collectionPath.child(name), type); ModelRuleDescriptor descriptor = new NestedModelRuleDescriptor(sourceDescriptor, ActionModelRuleDescriptor.from(new ErroringAction<Appendable>() { @Override protected void doExecute(Appendable thing) throws Exception { thing.append("create(").append(name).append(")"); } })); ruleRegistrar.create( ModelCreators.of(modelReference, new CreateAndConfigureFactory<S>(factory, configAction)) .descriptor(descriptor) .inputs(implicitInputs.getReferences()) .build() ); }
Example #2
Source File: ClasspathAddingInitScriptBuilder.java From paraphrase with Apache License 2.0 | 6 votes |
public void build(File initScriptFile, final List<File> classpath) { IoActions.writeTextFile(initScriptFile, new ErroringAction<Writer>() { @Override protected void doExecute(Writer writer) throws Exception { writer.write("allprojects {\n"); writer.write(" buildscript {\n"); writer.write(" dependencies {\n"); writer.write(" classpath files(\n"); int i = 0; for (File file : classpath) { writer.write( String.format(" '%s'", TextUtil.escapeString(file.getAbsolutePath()))); if (++i != classpath.size()) { writer.write(",\n"); } } writer.write("\n"); writer.write(" )\n"); writer.write(" }\n"); writer.write(" }\n"); writer.write("}\n"); } }); }
Example #3
Source File: JavadocOptionFileWriter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
void write(File outputFile) throws IOException { IoActions.writeTextFile(outputFile, new ErroringAction<BufferedWriter>() { @Override protected void doExecute(BufferedWriter writer) throws Exception { final Map<String, JavadocOptionFileOption> options = new TreeMap<String, JavadocOptionFileOption>(optionFile.getOptions()); JavadocOptionFileWriterContext writerContext = new JavadocOptionFileWriterContext(writer); JavadocOptionFileOption localeOption = options.remove("locale"); if (localeOption != null) { localeOption.write(writerContext); } for (final String option : options.keySet()) { options.get(option).write(writerContext); } optionFile.getSourceNames().write(writerContext); } }); }
Example #4
Source File: OverviewPageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Override protected void registerTabs() { addFailuresTab(); addIgnoredTab(); if (!getResults().getPackages().isEmpty()) { addTab("Packages", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter writer) throws IOException { renderPackages(writer); } }); } addTab("Classes", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderClasses(htmlWriter); } }); }
Example #5
Source File: MavenMetadataLoader.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void parseMavenMetadataInto(ExternalResource metadataResource, final MavenMetadata mavenMetadata) throws IOException, SAXException, ParserConfigurationException { LOGGER.debug("parsing maven-metadata: {}", metadataResource); metadataResource.withContent(new ErroringAction<InputStream>() { public void doExecute(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { XMLHelper.parse(inputStream, null, new ContextualSAXHandler() { public void endElement(String uri, String localName, String qName) throws SAXException { if ("metadata/versioning/snapshot/timestamp".equals(getContext())) { mavenMetadata.timestamp = getText(); } if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) { mavenMetadata.buildNumber = getText(); } if ("metadata/versioning/versions/version".equals(getContext())) { mavenMetadata.versions.add(getText().trim()); } super.endElement(uri, localName, qName); } }, null); } }); }
Example #6
Source File: OverviewPageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Override protected void registerTabs() { addFailuresTab(); addIgnoredTab(); if (!getResults().getPackages().isEmpty()) { addTab("Packages", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter writer) throws IOException { renderPackages(writer); } }); } addTab("Classes", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderClasses(htmlWriter); } }); }
Example #7
Source File: JavadocOptionFileWriter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
void write(File outputFile) throws IOException { IoActions.writeTextFile(outputFile, new ErroringAction<BufferedWriter>() { @Override protected void doExecute(BufferedWriter writer) throws Exception { final Map<String, JavadocOptionFileOption<?>> options = new TreeMap<String, JavadocOptionFileOption<?>>(optionFile.getOptions()); JavadocOptionFileWriterContext writerContext = new JavadocOptionFileWriterContext(writer); JavadocOptionFileOption<?> localeOption = options.remove("locale"); if (localeOption != null) { localeOption.write(writerContext); } for (final String option : options.keySet()) { options.get(option).write(writerContext); } optionFile.getSourceNames().write(writerContext); } }); }
Example #8
Source File: MavenMetadataLoader.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private void parseMavenMetadataInto(ExternalResource metadataResource, final MavenMetadata mavenMetadata) throws IOException, SAXException, ParserConfigurationException { LOGGER.debug("parsing maven-metadata: {}", metadataResource); metadataResource.withContent(new ErroringAction<InputStream>() { public void doExecute(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { XMLHelper.parse(inputStream, null, new ContextualSAXHandler() { public void endElement(String uri, String localName, String qName) throws SAXException { if ("metadata/versioning/snapshot/timestamp".equals(getContext())) { mavenMetadata.timestamp = getText(); } if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) { mavenMetadata.buildNumber = getText(); } if ("metadata/versioning/versions/version".equals(getContext())) { mavenMetadata.versions.add(getText().trim()); } super.endElement(uri, localName, qName); } }, null); } }); }
Example #9
Source File: DefaultCollectionBuilder.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private <S extends T> void doCreate(final String name, ModelType<S> type, Action<? super S> configAction, Factory<? extends S> factory) { ModelReference<S> modelReference = ModelReference.of(collectionPath.child(name), type); ModelRuleDescriptor descriptor = new NestedModelRuleDescriptor(sourceDescriptor, ActionModelRuleDescriptor.from(new ErroringAction<Appendable>() { @Override protected void doExecute(Appendable thing) throws Exception { thing.append("create(").append(name).append(")"); } })); ruleRegistrar.create( ModelCreators.of(modelReference, new CreateAndConfigureFactory<S>(factory, configAction)) .descriptor(descriptor) .inputs(implicitInputs.getReferences()) .build() ); }
Example #10
Source File: JavadocOptionFileWriter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
void write(File outputFile) throws IOException { IoActions.writeTextFile(outputFile, new ErroringAction<BufferedWriter>() { @Override protected void doExecute(BufferedWriter writer) throws Exception { final Map<String, JavadocOptionFileOption> options = new TreeMap<String, JavadocOptionFileOption>(optionFile.getOptions()); JavadocOptionFileWriterContext writerContext = new JavadocOptionFileWriterContext(writer); JavadocOptionFileOption localeOption = options.remove("locale"); if (localeOption != null) { localeOption.write(writerContext); } for (final String option : options.keySet()) { options.get(option).write(writerContext); } optionFile.getSourceNames().write(writerContext); } }); }
Example #11
Source File: OverviewPageRenderer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override protected void registerTabs() { addFailuresTab(); addIgnoredTab(); if (!getResults().getPackages().isEmpty()) { addTab("Packages", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter writer) throws IOException { renderPackages(writer); } }); } addTab("Classes", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderClasses(htmlWriter); } }); }
Example #12
Source File: MavenMetadataLoader.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void parseMavenMetadataInto(ExternalResource metadataResource, final MavenMetadata mavenMetadata) throws IOException, SAXException, ParserConfigurationException { LOGGER.debug("parsing maven-metadata: {}", metadataResource); metadataResource.withContent(new ErroringAction<InputStream>() { public void doExecute(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { XMLHelper.parse(inputStream, null, new ContextualSAXHandler() { public void endElement(String uri, String localName, String qName) throws SAXException { if ("metadata/versioning/snapshot/timestamp".equals(getContext())) { mavenMetadata.timestamp = getText(); } if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) { mavenMetadata.buildNumber = getText(); } if ("metadata/versioning/versions/version".equals(getContext())) { mavenMetadata.versions.add(getText().trim()); } super.endElement(uri, localName, qName); } }, null); } }); }
Example #13
Source File: MavenMetadataLoader.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private void parseMavenMetadataInto(ExternalResource metadataResource, final MavenMetadata mavenMetadata) throws IOException, SAXException, ParserConfigurationException { LOGGER.debug("parsing maven-metadata: {}", metadataResource); metadataResource.withContent(new ErroringAction<InputStream>() { public void doExecute(InputStream inputStream) throws ParserConfigurationException, SAXException, IOException { XMLHelper.parse(inputStream, null, new ContextualSAXHandler() { public void endElement(String uri, String localName, String qName) throws SAXException { if ("metadata/versioning/snapshot/timestamp".equals(getContext())) { mavenMetadata.timestamp = getText(); } if ("metadata/versioning/snapshot/buildNumber".equals(getContext())) { mavenMetadata.buildNumber = getText(); } if ("metadata/versioning/versions/version".equals(getContext())) { mavenMetadata.versions.add(getText().trim()); } super.endElement(uri, localName, qName); } }, null); } }); }
Example #14
Source File: JavadocOptionFileWriter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
void write(File outputFile) throws IOException { IoActions.writeTextFile(outputFile, new ErroringAction<BufferedWriter>() { @Override protected void doExecute(BufferedWriter writer) throws Exception { final Map<String, JavadocOptionFileOption<?>> options = new TreeMap<String, JavadocOptionFileOption<?>>(optionFile.getOptions()); JavadocOptionFileWriterContext writerContext = new JavadocOptionFileWriterContext(writer); JavadocOptionFileOption<?> localeOption = options.remove("locale"); if (localeOption != null) { localeOption.write(writerContext); } for (final String option : options.keySet()) { options.get(option).write(writerContext); } optionFile.getSourceNames().write(writerContext); } }); }
Example #15
Source File: OverviewPageRenderer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override protected void registerTabs() { addFailuresTab(); addIgnoredTab(); if (!getResults().getPackages().isEmpty()) { addTab("Packages", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter writer) throws IOException { renderPackages(writer); } }); } addTab("Classes", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderClasses(htmlWriter); } }); }
Example #16
Source File: DefaultManifest.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public org.gradle.api.java.archives.Manifest writeTo(Object path) { IoActions.writeTextFile(fileResolver.resolve(path), new ErroringAction<Writer>() { @Override protected void doExecute(Writer writer) throws Exception { writeTo(writer); } }); return this; }
Example #17
Source File: ClassPageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void registerTabs() { addFailuresTab(); addTab("Tests", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter writer) throws IOException { renderTests(writer); } }); final long classId = getModel().getId(); if (resultsProvider.hasOutput(classId, TestOutputEvent.Destination.StdOut)) { addTab("Standard output", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { htmlWriter.startElement("span").attribute("class", "code") .startElement("pre") .characters(""); resultsProvider.writeAllOutput(classId, TestOutputEvent.Destination.StdOut, htmlWriter); htmlWriter.endElement() .endElement(); } }); } if (resultsProvider.hasOutput(classId, TestOutputEvent.Destination.StdErr)) { addTab("Standard error", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter element) throws Exception { element.startElement("span").attribute("class", "code") .startElement("pre") .characters(""); resultsProvider.writeAllOutput(classId, TestOutputEvent.Destination.StdErr, element); element.endElement() .endElement(); } }); } }
Example #18
Source File: HtmlReportRenderer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public <T> void renderHtmlPage(final String name, final T model, final ReportRenderer<T, HtmlPageBuilder<SimpleHtmlWriter>> renderer) { File outputFile = new File(outputDirectory, name); IoActions.writeTextFile(outputFile, "utf-8", new ErroringAction<Writer>() { @Override protected void doExecute(Writer writer) throws Exception { SimpleHtmlWriter htmlWriter = new SimpleHtmlWriter(writer, ""); htmlWriter.startElement("html"); renderer.render(model, new DefaultHtmlPageBuilder<SimpleHtmlWriter>(prefix(name), htmlWriter)); htmlWriter.endElement(); } }); }
Example #19
Source File: PageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void addFailuresTab() { if (!results.getFailures().isEmpty()) { addTab("Failed tests", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter element) throws IOException { renderFailures(element); } }); } }
Example #20
Source File: PageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void addIgnoredTab() { if (!results.getIgnored().isEmpty()) { addTab("Ignored tests", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderIgnoredTests(htmlWriter); } }); } }
Example #21
Source File: DefaultMavenPom.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void writeNonEffectivePom(final Writer pomWriter) throws IOException { try { withXmlActions.transform(pomWriter, POM_FILE_ENCODING, new ErroringAction<Writer>() { protected void doExecute(Writer writer) throws IOException { mavenProject.writeModel(writer); } }); } finally { pomWriter.close(); } }
Example #22
Source File: TextReportRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Renders the report for the given model to a file. */ public void writeTo(final T model, File file) { IoActions.writeTextFile(file, "utf-8", new ErroringAction<Writer>() { @Override protected void doExecute(Writer writer) throws Exception { writeTo(model, writer); } }); }
Example #23
Source File: HtmlReportRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public <T> void renderRawHtmlPage(final String name, final T model, final ReportRenderer<T, HtmlPageBuilder<Writer>> renderer) { File outputFile = new File(outputDirectory, name); IoActions.writeTextFile(outputFile, "utf-8", new ErroringAction<Writer>() { @Override protected void doExecute(Writer writer) throws Exception { renderer.render(model, new DefaultHtmlPageBuilder<Writer>(prefix(name), writer)); } }); }
Example #24
Source File: PackagePageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void registerTabs() { addFailuresTab(); addIgnoredTab(); addTab("Classes", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderClasses(htmlWriter); } }); }
Example #25
Source File: ClassPageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void registerTabs() { addFailuresTab(); addTab("Tests", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter writer) throws IOException { renderTests(writer); } }); if (resultsProvider.hasOutput(classId, TestOutputEvent.Destination.StdOut)) { addTab("Standard output", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { htmlWriter.startElement("span").attribute("class", "code") .startElement("pre") .characters(""); resultsProvider.writeAllOutput(classId, TestOutputEvent.Destination.StdOut, htmlWriter); htmlWriter.endElement() .endElement(); } }); } if (resultsProvider.hasOutput(classId, TestOutputEvent.Destination.StdErr)) { addTab("Standard error", new ErroringAction<SimpleHtmlWriter>() { @Override protected void doExecute(SimpleHtmlWriter element) throws Exception { element.startElement("span").attribute("class", "code") .startElement("pre") .characters(""); resultsProvider.writeAllOutput(classId, TestOutputEvent.Destination.StdErr, element); element.endElement() .endElement(); } }); } }
Example #26
Source File: PageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void addFailuresTab() { if (!results.getFailures().isEmpty()) { addTab("Failed tests", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter element) throws IOException { renderFailures(element); } }); } }
Example #27
Source File: PageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
protected void addIgnoredTab() { if (!results.getIgnored().isEmpty()) { addTab("Ignored tests", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderIgnoredTests(htmlWriter); } }); } }
Example #28
Source File: DefaultMavenPom.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void writeNonEffectivePom(final Writer pomWriter) throws IOException { try { withXmlActions.transform(pomWriter, POM_FILE_ENCODING, new ErroringAction<Writer>() { protected void doExecute(Writer writer) throws IOException { mavenProject.writeModel(writer); } }); } finally { pomWriter.close(); } }
Example #29
Source File: DefaultManifest.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public org.gradle.api.java.archives.Manifest writeTo(Object path) { IoActions.writeTextFile(fileResolver.resolve(path), new ErroringAction<Writer>() { @Override protected void doExecute(Writer writer) throws Exception { writeTo(writer); } }); return this; }
Example #30
Source File: PackagePageRenderer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override protected void registerTabs() { addFailuresTab(); addIgnoredTab(); addTab("Classes", new ErroringAction<SimpleHtmlWriter>() { public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException { renderClasses(htmlWriter); } }); }