X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=build.gradle;h=d0b159cfe38f852502034191934736fbbabfa8c3;hp=ba3a410f4491d3b937370b6c82703279ffda3b98;hb=refs%2Fheads%2Fnext;hpb=32f76712b3e2915081a7c626944b703e8922be7d diff --git a/build.gradle b/build.gradle index ba3a410..b23af3d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,59 +1,95 @@ -group = 'net.pterodactylus' -version = '0.9.5' +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.1.10' - } +plugins { + id 'org.jetbrains.kotlin.jvm' version '1.7.10' + id 'org.jetbrains.kotlin.plugin.noarg' version '1.7.10' + id 'info.solidsoft.pitest' version '1.7.4' + id 'jacoco' } +group = 'net.pterodactylus' +version = '82' + repositories { - maven { url "http://maven.pterodactylus.net/" } mavenCentral() + maven { url "https://maven.pterodactylus.net/" } } apply plugin: 'java' -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } +tasks.withType(KotlinCompile) { + kotlinOptions { + jvmTarget = "1.8" + freeCompilerArgs += '-Xjvm-default=enable' + } +} + configurations { provided { dependencies.all { dep -> configurations.default.exclude group: dep.group, module: dep.name } } - compile.extendsFrom provided + implementation.extendsFrom provided } - + dependencies { provided group: 'org.freenetproject', name: 'fred', version: '0.7.5.1475' provided group: 'org.freenetproject', name: 'freenet-ext', version: '29' provided group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.54' - compile group: 'net.pterodactylus', name: 'utils', version: '0.12.4' - compile group: 'com.google.inject', name: 'guice', version: '3.0' - compile group: 'com.google.guava', name: 'guava', version: '14.0.1' - compile group: 'commons-lang', name: 'commons-lang', version: '2.6' - compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.1.2' - compile group: 'com.google.code.findbugs', name: 'jsr305', version: '2.0.1' + implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8' + implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.3.0-RC' + + implementation group: 'net.pterodactylus', name: 'utils', version: '0.13.1' + implementation group: 'com.google.inject', name: 'guice', version: '4.2.2' + implementation group: 'com.google.guava', name: 'guava', version: '27.0.1-jre' + implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.1' + implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.9.1' + implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2' + implementation group: 'org.jsoup', name: 'jsoup', version: '1.10.2' + implementation group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.1.0' + implementation group: 'javax.activation', name: 'javax.activation-api', version: '1.2.0' + + testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit' + testImplementation group: 'junit', name: 'junit', version: '4.11' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' + testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' +} + +apply from: 'version.gradle' - testCompile group: 'junit', name: 'junit', version: '4.11' - testCompile group: 'org.mockito', name: 'mockito-core', version: '2.1.0' - testCompile group: 'org.jsoup', name: 'jsoup', version: '1.7.1' - testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3' +task parallelTest(type: Test) { + maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 + useJUnit { + excludeCategories 'net.pterodactylus.sone.test.NotParallel' + } +} + +task notParallelTest(type: Test) { + maxParallelForks = 1 + useJUnit { + includeCategories 'net.pterodactylus.sone.test.NotParallel' + } + dependsOn parallelTest +} + +test { + exclude '**' + dependsOn parallelTest, notParallelTest } task fatJar(type: Jar) { - archiveName = project.name + '-jar-with-dependencies.jar' - from { (configurations.runtime - configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } } + archiveFileName = project.name.toLowerCase() + '-jar-with-dependencies.jar' + from { (configurations.runtimeClasspath - configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } } + setDuplicatesStrategy(DuplicatesStrategy.INCLUDE) manifest { attributes('Plugin-Main-Class': 'net.pterodactylus.sone.main.SonePlugin') } @@ -70,26 +106,44 @@ javadoc { failOnError = false } -apply plugin: 'jacoco' - jacoco { - toolVersion = '0.7.7.201606060606' + toolVersion = '0.8.8' } -jacocoTestReport.dependsOn test - -apply plugin: 'info.solidsoft.pitest' +jacocoTestReport { + executionData(layout.buildDirectory.getAsFileTree().matching { + include "jacoco/*.exec" + }) + dependsOn test +} pitest { + pitestVersion = '1.7.4' outputFormats = ['HTML', 'XML'] timestampedReports = false timeoutFactor = 3.0 } -apply plugin: 'findbugs' +apply plugin: 'idea' -findbugs { - ignoreFailures = true +task countLinesMain(type: Exec) { + executable = 'cloc' + args = ['--by-file', '--xml', '--report-file=build/reports/cloc/main.xml', 'src/main'] + standardOutput = new ByteArrayOutputStream() } -apply plugin: 'idea' +task countLinesTest(type: Exec) { + executable = 'cloc' + args = ['--by-file', '--xml', '--report-file=build/reports/cloc/test.xml', 'src/test'] + standardOutput = new ByteArrayOutputStream() +} + +task countLines { + new File(buildDir, "reports/cloc").mkdirs() + dependsOn tasks.countLinesMain + dependsOn tasks.countLinesTest +} + +noArg { + annotation('net.pterodactylus.sone.main.NoArg') +}