• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ErroringAction类的典型用法和代码示例

java 1次浏览

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

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

示例1: readPrefixes

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
private static Trie readPrefixes(RuntimeShadedJarType type) {
    final Trie.Builder builder = new Trie.Builder();
    IoActions.withResource(ImplementationDependencyRelocator.class.getResourceAsStream(type.getIdentifier() + "-relocated.txt"), new ErroringAction<InputStream>() {
        @Override
        protected void doExecute(InputStream thing) throws Exception {
            BufferedReader reader = new BufferedReader(new InputStreamReader(thing, Charset.forName("UTF-8")));
            String line;
            while ((line = reader.readLine()) != null) {
                line = line.trim();
                if (line.length() > 0) {
                    builder.addWord(line);
                }
            }
        }
    });
    return builder.build();
}
 

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

示例2: generate

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
@TaskAction
public void generate() {
    IoActions.writeTextFile(getOutputFile(), new ErroringAction<BufferedWriter>() {
        @Override
        public void doExecute(final BufferedWriter bufferedWriter) throws Exception {
            Trie packages = collectPackages();
            packages.dump(false, new ErroringAction<String>() {
                @Override
                public void doExecute(String s) throws Exception {
                    bufferedWriter.write(s);
                    bufferedWriter.newLine();
                }
            });
        }
    });
}
 

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

示例3: parseMavenMetadataInto

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
private void parseMavenMetadataInto(ExternalResource metadataResource, final MavenMetadata mavenMetadata) {
    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);
        }
    });
}
 

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

示例4: write

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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);
        }
    });
}
 

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

示例5: registerTabs

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
@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);
        }
    });
}
 

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

示例6: doCreate

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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()
    );
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:17,
代码来源:DefaultCollectionBuilder.java

示例7: parseMavenMetadataInto

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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);
        }
    });
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:23,
代码来源:MavenMetadataLoader.java

示例8: write

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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);
        }
    });
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:21,
代码来源:JavadocOptionFileWriter.java

示例9: build

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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");
    }
  });
}
 

开发者ID:JakeWharton,
项目名称:paraphrase,
代码行数:25,
代码来源:ClasspathAddingInitScriptBuilder.java

示例10: build

点赞 3

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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");
        }
    });
}
 

开发者ID:werval,
项目名称:werval,
代码行数:24,
代码来源:ClasspathAddingInitScriptBuilder.java

示例11: writeProbe

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
private static void writeProbe(File workingDir) {
    File probeFile = new File(workingDir, JavaProbe.CLASSNAME + ".class");
    try {
        IoActions.withResource(new FileOutputStream(probeFile), new ErroringAction<FileOutputStream>() {
            @Override
            protected void doExecute(FileOutputStream thing) throws Exception {
                thing.write(JavaProbe.dump());
            }
        });
    } catch (FileNotFoundException e) {
        throw new GradleException("Unable to write Java probe file", e);
    }
}
 

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

示例12: writeNonEffectivePom

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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 {
                new MavenXpp3Writer().write(writer, getModel());
            }
        });
    } finally {
        pomWriter.close();
    }
}
 

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

示例13: createFatJar

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
private void createFatJar(final File outputJar, final Iterable<? extends File> files, final ProgressLogger progressLogger) {
    final File tmpFile = tempFileFor(outputJar);

    IoActions.withResource(openJarOutputStream(tmpFile), new ErroringAction<ZipOutputStream>() {
        @Override
        protected void doExecute(ZipOutputStream jarOutputStream) throws Exception {
            processFiles(jarOutputStream, files, new byte[BUFFER_SIZE], new HashSet<String>(), new LinkedHashMap<String, List<String>>(), progressLogger);
            jarOutputStream.finish();
        }
    });

    GFileUtils.moveFile(tmpFile, outputJar);
}
 

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

示例14: processJarFile

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
private void processJarFile(final ZipOutputStream outputStream, File file, final byte[] buffer, final Set<String> seenPaths, final Map<String, List<String>> services) throws IOException {
    IoActions.withResource(openJarFile(file), new ErroringAction<ZipInputStream>() {
        @Override
        protected void doExecute(ZipInputStream inputStream) throws Exception {
            ZipEntry zipEntry = inputStream.getNextEntry();
            while (zipEntry != null) {
                processEntry(outputStream, inputStream, zipEntry, buffer, seenPaths, services);
                zipEntry = inputStream.getNextEntry();
            }
        }
    });
}
 

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

示例15: processJarFile

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
private void processJarFile(File file, final Trie.Builder builder) throws IOException {
    IoActions.withResource(openJarFile(file), new ErroringAction<ZipInputStream>() {
        @Override
        protected void doExecute(ZipInputStream inputStream) throws Exception {
            ZipEntry zipEntry = inputStream.getNextEntry();
            while (zipEntry != null) {
                processEntry(zipEntry, builder);
                zipEntry = inputStream.getNextEntry();
            }
        }
    });
}
 

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

示例16: sanitize

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
public void sanitize(final File in, File out) {
    IoActions.writeTextFile(out, new ErroringAction<BufferedWriter>() {
        @Override
        protected void doExecute(BufferedWriter writer) throws Exception {
            BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(in)));
            String line;
            StringBuilder sb = new StringBuilder();
            while ((line = reader.readLine()) != null) {
                if (sanitizeFunction.skipLine(line)) {
                    continue;
                }
                List<String> data = LINE_SPLITTER.splitToList(line);
                if (data.size() == 2) {
                    String stackTraces = data.get(0);
                    String suffix = data.get(1);
                    List<String> stackTraceElements = STACKTRACE_SPLITTER.splitToList(stackTraces);
                    List<String> remapped = new ArrayList<String>(stackTraceElements.size());
                    for (String stackTraceElement : stackTraceElements) {
                        String mapped = sanitizeFunction.map(stackTraceElement);
                        if (mapped != null) {
                            remapped.add(mapped);
                        }
                    }
                    if (!remapped.isEmpty()) {
                        sb.setLength(0);
                        STACKTRACE_JOINER.appendTo(sb, remapped);
                        sb.append(' ');
                        sb.append(suffix);
                        sb.append("\n");
                        writer.write(sb.toString());
                    }
                }
            }
        }
    });
}
 

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

示例17: getSuites

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
public List<File> getSuites(File testSuitesDir) {
    List<File> suites = new ArrayList<File>();

    suites.addAll(suiteXmlFiles);

    if (suiteXmlBuilder != null) {
        File buildSuiteXml = new File(testSuitesDir.getAbsolutePath(), "build-suite.xml");

        if (buildSuiteXml.exists()) {
            if (!buildSuiteXml.delete()) {
                throw new RuntimeException("failed to remove already existing build-suite.xml file");
            }

        }

        IoActions.writeTextFile(buildSuiteXml, new ErroringAction<BufferedWriter>() {
            @Override
            protected void doExecute(BufferedWriter writer) throws Exception {
                writer.write("<!DOCTYPE suite SYSTEM \"http://testng.org/testng-1.0.dtd\">");
                writer.newLine();
                writer.write(suiteXmlWriter.toString());
            }
        });

        suites.add(buildSuiteXml);
    }


    return suites;
}
 

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

示例18: registerTabs

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
@Override
protected void registerTabs() {
    addFailuresTab();
    addIgnoredTab();
    addTab("Classes", new ErroringAction<SimpleHtmlWriter>() {
        public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException {
            renderClasses(htmlWriter);
        }
    });
}
 

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

示例19: registerTabs

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
@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();
            }
        });
    }
}
 

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

示例20: addFailuresTab

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
protected void addFailuresTab() {
    if (!results.getFailures().isEmpty()) {
        addTab("Failed tests", new ErroringAction<SimpleHtmlWriter>() {
            public void doExecute(SimpleHtmlWriter element) throws IOException {
                renderFailures(element);
            }
        });
    }
}
 

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

示例21: addIgnoredTab

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
protected void addIgnoredTab() {
    if (!results.getIgnored().isEmpty()) {
        addTab("Ignored tests", new ErroringAction<SimpleHtmlWriter>() {
            public void doExecute(SimpleHtmlWriter htmlWriter) throws IOException {
                renderIgnoredTests(htmlWriter);
            }
        });
    }
}
 

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

示例22: renderHtmlPage

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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();
        }
    });
}
 

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

示例23: renderRawHtmlPage

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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));
        }
    });
}
 

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

示例24: writeTo

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
/**
 * 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);
        }
    });
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:12,
代码来源:TextReportRenderer.java

示例25: writeTo

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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;
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:10,
代码来源:DefaultManifest.java

示例26: writeNonEffectivePom

点赞 2

import org.gradle.internal.ErroringAction; //导入依赖的package包/类
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();
    }
}
 

开发者ID:Pushjet,
项目名称:Pushjet-Android,
代码行数:12,
代码来源:DefaultMavenPom.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)