Package org.jacoco.core.instr

Examples of org.jacoco.core.instr.Instrumenter


    if (destdir == null) {
      throw new BuildException("Destination directory must be supplied",
          getLocation());
    }
    int total = 0;
    final Instrumenter instrumenter = new Instrumenter(
        new OfflineInstrumentationAccessGenerator());
    instrumenter.setRemoveSignatures(removesignatures);
    final Iterator<?> resourceIterator = files.iterator();
    while (resourceIterator.hasNext()) {
      final Resource resource = (Resource) resourceIterator.next();
      if (resource.isDirectory()) {
        continue;
View Full Code Here


   * @param logger
   *            logger for exceptions during instrumentation
   */
  public CoverageTransformer(final IRuntime runtime,
      final AgentOptions options, final IExceptionLogger logger) {
    this.instrumenter = new Instrumenter(runtime);
    this.logger = logger;
    // Class names will be reported in VM notation:
    includes = new WildcardMatcher(toVMName(options.getIncludes()));
    excludes = new WildcardMatcher(toVMName(options.getExcludes()));
    exclClassloader = new WildcardMatcher(options.getExclClassloader());
View Full Code Here

  private ExecutionDataStore execute(final ClassReader reader)
      throws Exception {
    RuntimeData data = new RuntimeData();
    IRuntime runtime = new SystemPropertiesRuntime();
    runtime.startup(data);
    final byte[] bytes = new Instrumenter(runtime).instrument(reader);
    run(loader.add(target, bytes));
    final ExecutionDataStore store = new ExecutionDataStore();
    data.collect(store, new SessionInfoStore(), false);
    runtime.shutdown();
    return store;
View Full Code Here

    // to collect execution data:
    final IRuntime runtime = new LoggerRuntime();

    // The Instrumenter creates a modified version of our test target class
    // that contains additional probes for execution data recording:
    final Instrumenter instr = new Instrumenter(runtime);
    final byte[] instrumented = instr.instrument(
        getTargetClass(targetName), targetName);

    // Now we're ready to run our instrumented class and need to startup the
    // runtime first:
    final RuntimeData data = new RuntimeData();
View Full Code Here

    } catch (final IOException e1) {
      throw new MojoExecutionException(
          "Unable to get list of files to instrument.", e1);
    }

    final Instrumenter instrumenter = new Instrumenter(
        new OfflineInstrumentationAccessGenerator());
    for (final String fileName : fileNames) {
      if (fileName.endsWith(".class")) {
        final File source = new File(classesDir, fileName);
        final File backup = new File(originalClassesDir, fileName);
        InputStream input = null;
        OutputStream output = null;
        try {
          FileUtils.copyFile(source, backup);
          input = new FileInputStream(backup);
          output = new FileOutputStream(source);
          instrumenter.instrument(input, output, source.getPath());
        } catch (final IOException e2) {
          throw new MojoExecutionException(
              "Unable to instrument file.", e2);
        } finally {
          IOUtil.close(input);
View Full Code Here

TOP

Related Classes of org.jacoco.core.instr.Instrumenter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.