Commit 508d0ae3 authored by Eric Bruneton's avatar Eric Bruneton

Merge branch 'add-tasks-to-check-and-format-code'

parents 7cda1f30 f535b646
......@@ -6,7 +6,7 @@ build:
test:
script:
gradle test
gradle test jacocoTestCoverageVerification
upload:
script:
......
......@@ -28,7 +28,6 @@
package org.objectweb.asm;
import java.util.Collection;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
import org.objectweb.asm.test.AsmTest;
......
......@@ -34,7 +34,6 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Test;
/**
......
......@@ -28,7 +28,6 @@
package org.objectweb.asm;
import java.util.Collection;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
import org.objectweb.asm.test.AsmTest;
......
......@@ -40,7 +40,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import org.junit.Before;
import org.junit.Test;
......
......@@ -30,9 +30,8 @@ package org.objectweb.asm;
import static org.junit.Assert.assertTrue;
import java.util.Collection;
import java.util.Random;
import java.util.HashSet;
import java.util.Random;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
import org.objectweb.asm.test.AsmTest;
......
......@@ -27,12 +27,6 @@
// THE POSSIBILITY OF SUCH DAMAGE.
package org.objectweb.asm;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.ByteVector;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
/**
* A non standard code attribute used for testing purposes.
*
......
......@@ -27,12 +27,6 @@
// THE POSSIBILITY OF SUCH DAMAGE.
package org.objectweb.asm;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.ByteVector;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
/**
* A non standard attribute used for testing purposes.
*
......
......@@ -32,7 +32,6 @@ import static org.junit.Assert.assertTrue;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.junit.Test;
/**
......
......@@ -28,11 +28,10 @@
package org.objectweb.asm.signature;
import java.util.Collection;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.test.AsmTest;
......
......@@ -30,11 +30,10 @@ package org.objectweb.asm.signature;
import static org.junit.Assert.assertEquals;
import java.util.Collection;
import org.junit.Test;
import org.junit.runners.Parameterized.Parameters;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.test.AsmTest;
......
......@@ -27,6 +27,7 @@
// THE POSSIBILITY OF SUCH DAMAGE.
plugins { id 'biz.aQute.bnd.builder' version '3.3.0' apply false }
plugins { id 'com.github.sherter.google-java-format' version '0.6' apply false }
description = 'ASM, a very small and fast Java bytecode manipulation framework'
......@@ -39,6 +40,7 @@ subprojects {
ext.requires = [] // The required Gradle projects, e.g. [':asm-test']
ext.depends = [] // The external dependencies, e.g. ['junit:junit:4.12']
ext.runWith = [] // The command line to run this project, if applicable.
ext.coverage = 0.9 // The minimum code fraction that must be covered by tests.
}
// -----------------------------------------------------------------------------
......@@ -61,6 +63,7 @@ project(':asm-commons') {
provides = ['org.objectweb.asm.commons']
requires = [':asm', ':asm-tree', ':asm-analysis']
dependencies { testCompile project(':asm-util') }
coverage = 0.5 // TODO: improve the code coverage of this project.
}
project(':asm-test') {
......@@ -86,6 +89,7 @@ project(':asm-xml') {
description = "XML API of ${parent.description}"
provides = ['org.objectweb.asm.xml']
requires = [':asm', ':asm-util']
coverage = 0.8
}
project(':benchmarks') {
......@@ -207,6 +211,8 @@ project(':tools:retrofitter') {
// All projects use Java 1.5 and are tested with :asm-test and JUnit.
subprojects {
apply plugin: 'com.github.sherter.google-java-format'
googleJavaFormat.toolVersion = '1.4'
sourceCompatibility = '1.5'
targetCompatibility = '1.5'
javadoc { failOnError = false } // TODO fix the Javadoc and remove this!
......@@ -234,6 +240,20 @@ configure(subprojects.findAll { it.runWith }) {
configure(subprojects.findAll { it.provides }) {
// Code coverage configuration.
apply plugin: 'jacoco'
jacocoTestCoverageVerification {
// Exclude everything not in org/objectweb/asm/** from coverage checks.
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, include: 'org/objectweb/asm/**')
})
}
violationRules.rule {
limit {
counter = 'INSTRUCTION'
minimum = coverage
}
}
}
// Retrofit the code to Java 1.5, in-place, in compileJava.doLast.
task retrofit(type: JavaExec) {
......@@ -245,7 +265,7 @@ configure(subprojects.findAll { it.provides }) {
compileJava.doLast { tasks.retrofit.execute() }
// Create one backward compatibility checking task for each 'sigtest-*' file
// in test/resources, and make the 'test' task depend on all these tasks.
// in test/resources, and make the 'check' task depend on all these tasks.
if (file('src/test/resources/').exists()) {
configurations { sigtest }
dependencies { sigtest 'org.netbeans.tools:sigtest-maven-plugin:1.0' }
......@@ -268,7 +288,7 @@ configure(subprojects.findAll { it.provides }) {
}
}
}
test.dependsOn f.name
check.dependsOn f.name
}
}
......@@ -289,7 +309,7 @@ configure(subprojects.findAll { it.provides }) {
'Bundle-DocURL': 'http://asm.ow2.org',
'Bundle-RequiredExecutionEnvironment': 'J2SE-1.5',
'Bundle-SymbolicName': provides[0],
'Export-Package': provides.collect{"${it};version=6.1"}.join(','),
'Export-Package': provides.collect{"${it};version=${version}"}.join(','),
'Implementation-Title': project.description,
'Module-Requires':
requires
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment