JaCoCo initial drop.
diff --git a/org.jacoco.agent/.classpath b/org.jacoco.agent/.classpath
new file mode 100644
index 0000000..2d1a430
--- /dev/null
+++ b/org.jacoco.agent/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.jacoco.agent/.project b/org.jacoco.agent/.project
new file mode 100644
index 0000000..e8aebbd
--- /dev/null
+++ b/org.jacoco.agent/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jacoco.agent</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.jacoco.agent/.settings/org.eclipse.jdt.core.prefs b/org.jacoco.agent/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..6b1e66d
--- /dev/null
+++ b/org.jacoco.agent/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+#Mon May 18 09:43:33 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/org.jacoco.agent/.settings/org.eclipse.jdt.ui.prefs b/org.jacoco.agent/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..de9ff9b
--- /dev/null
+++ b/org.jacoco.agent/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,56 @@
+#Mon May 18 07:50:42 CEST 2009
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EclEmma
+formatter_settings_version=11
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.jacoco.agent/META-INF/MANIFEST.MF b/org.jacoco.agent/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8ec04a6
--- /dev/null
+++ b/org.jacoco.agent/META-INF/MANIFEST.MF
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JaCoCo Agent
+Bundle-SymbolicName: org.jacoco.agent
+Bundle-Version: 0.1.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.jacoco.core.data,
+ org.jacoco.core.instr,
+ org.jacoco.core.runtime,
+ org.objectweb.asm;version="3.1.0"
diff --git a/org.jacoco.agent/about.html b/org.jacoco.agent/about.html
new file mode 100644
index 0000000..f5d8b33
--- /dev/null
+++ b/org.jacoco.agent/about.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>
+ JaCoCo is a free Java code coverage library implemented by Marc R. Hoffmann.
+ Check <a href="http://www.eclemma.org/devdoc/jacoco.html">http://www.eclemma.org/devdoc/jacoco.html</a>
+ for updates, documentation and support.
+</p>
+
+<h3>License</h3>
+
+<p>
+ The Content in this plug-in is made available by Mountainminds GmbH & Co. KG,
+ Munich. Except indicated below, the Content is provided to you under the terms
+ and conditions of the Eclipse Public License Version 1.0 ("EPL").
+ A copy of the EPL is available at
+ <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+</p>
+
+<h3>Third-party Licenses</h3>
+
+<p>
+ This bundle is based on the <a href="http://asm.objectweb.org/">ASM</a>
+ library which is distributed under the following license.
+</p>
+
+<pre>
+Copyright (c) 2000-2005 INRIA, France Telecom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+</pre>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/org.jacoco.agent/build.properties b/org.jacoco.agent/build.properties
new file mode 100644
index 0000000..a657887
--- /dev/null
+++ b/org.jacoco.agent/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
diff --git a/org.jacoco.agent/buildhook.xml b/org.jacoco.agent/buildhook.xml
new file mode 100644
index 0000000..6dce926
--- /dev/null
+++ b/org.jacoco.agent/buildhook.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="org.jacoco.agent.buildhook">
+
+ <path id="dependencies">
+ <path refid="bundle-org.jacoco.core"/>
+ <path refid="bundle-org.objectweb.asm"/>
+ </path>
+
+ <property name="do.compile" value="true"/>
+ <property name="do.custompackage" value="true"/>
+ <property name="do.doc" value="true"/>
+
+ <target name="custompackage">
+ <jar destfile="${result.dist.lib.dir}/jacocoagent.jar">
+ <manifest>
+ <attribute name="Premain-Class" value="org.jacoco.agent.JacocoAgent"/>
+ <attribute name="Implementation-Title" value="JaCoCo Java Agent"/>
+ <attribute name="Implementation-Vendor" value="Mountainminds GmbH & Co. KG"/>
+ <attribute name="Implementation-Version" value="${qualified.bundle.version}"/>
+ </manifest>
+ <fileset dir="${result.tmp.bundle.classes.dir}"/>
+ <fileset dir="${toString:bundle-org.jacoco.core}"/>
+ <zipfileset includes="**/*.class">
+ <fileset file="${toString:bundle-org.objectweb.asm}"/>
+ </zipfileset>
+ </jar>
+ </target>
+
+</project>
\ No newline at end of file
diff --git a/org.jacoco.agent/src/org/jacoco/agent/CoverageTransformer.java b/org.jacoco.agent/src/org/jacoco/agent/CoverageTransformer.java
new file mode 100644
index 0000000..e418f77
--- /dev/null
+++ b/org.jacoco.agent/src/org/jacoco/agent/CoverageTransformer.java
@@ -0,0 +1,40 @@
+package org.jacoco.agent;
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.security.ProtectionDomain;
+
+import org.jacoco.core.instr.Instrumenter;
+import org.jacoco.core.runtime.IRuntime;
+
+public class CoverageTransformer implements ClassFileTransformer {
+
+ private final Instrumenter instrumenter;
+
+ public CoverageTransformer(IRuntime runtime) {
+ this.instrumenter = new Instrumenter(runtime);
+ }
+
+ public byte[] transform(ClassLoader loader, String classname,
+ Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
+ byte[] classfileBuffer) throws IllegalClassFormatException {
+
+ if (loader == null) {
+ // don't instrument classes of the bootstrap loader
+ return null;
+ }
+
+ if (loader.getClass().getName().equals(
+ "sun.reflect.DelegatingClassLoader")) {
+ // don't instrument classes generated for reflection
+ return null;
+ }
+
+ try {
+ return instrumenter.instrument(classfileBuffer);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ return null;
+ }
+ }
+}
diff --git a/org.jacoco.agent/src/org/jacoco/agent/JacocoAgent.java b/org.jacoco.agent/src/org/jacoco/agent/JacocoAgent.java
new file mode 100644
index 0000000..238fae6
--- /dev/null
+++ b/org.jacoco.agent/src/org/jacoco/agent/JacocoAgent.java
@@ -0,0 +1,26 @@
+package org.jacoco.agent;
+
+import java.lang.instrument.Instrumentation;
+
+import org.jacoco.core.data.ExecutionDataDumper;
+import org.jacoco.core.runtime.IRuntime;
+import org.jacoco.core.runtime.SystemPropertiesRuntime;
+
+public class JacocoAgent {
+
+ public static void premain(String agentArgs, final Instrumentation inst) {
+ final IRuntime runtime = new SystemPropertiesRuntime();
+ runtime.startup();
+
+ inst.addTransformer(new CoverageTransformer(runtime));
+
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+
+ @Override
+ public void run() {
+ runtime.collect(new ExecutionDataDumper(System.out), false);
+ }
+
+ });
+ }
+}
diff --git a/org.jacoco.agent/src/overview.html b/org.jacoco.agent/src/overview.html
new file mode 100644
index 0000000..464759e
--- /dev/null
+++ b/org.jacoco.agent/src/overview.html
@@ -0,0 +1,9 @@
+<html>
+<body>
+
+<p>
+ The JaCoCo agent bundle provides a Java agent for runtime instrumentation.
+</p>
+
+</body>
+</html>
\ No newline at end of file