🔀 Merge bugfix/too-long-urls
[Sone.git] / build.gradle
1 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2
3 plugins {
4     id 'org.jetbrains.kotlin.jvm' version '1.7.10'
5     id 'org.jetbrains.kotlin.plugin.noarg' version '1.7.10'
6     id 'info.solidsoft.pitest' version '1.7.4'
7     id 'jacoco'
8 }
9
10 group = 'net.pterodactylus'
11 version = '82'
12
13 repositories {
14      mavenCentral()
15      maven { url "https://maven.pterodactylus.net/" }
16 }
17
18 apply plugin: 'java'
19
20 sourceCompatibility = 1.8
21 targetCompatibility = 1.8
22
23 tasks.withType(JavaCompile) {
24         options.encoding = 'UTF-8'
25 }
26
27 tasks.withType(KotlinCompile) {
28     kotlinOptions {
29         jvmTarget = "1.8"
30         freeCompilerArgs += '-Xjvm-default=enable'
31     }
32 }
33
34 configurations {
35     provided {
36         dependencies.all { dep ->
37             configurations.default.exclude group: dep.group, module: dep.name
38         }
39     }
40     implementation.extendsFrom provided
41 }
42
43 dependencies {
44     provided group: 'org.freenetproject', name: 'fred', version: '0.7.5.1475'
45     provided group: 'org.freenetproject', name: 'freenet-ext', version: '29'
46     provided group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.54'
47
48     implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8'
49     implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.3.0-RC'
50
51     implementation group: 'net.pterodactylus', name: 'utils', version: '0.13.1'
52     implementation group: 'com.google.inject', name: 'guice', version: '4.2.2'
53     implementation group: 'com.google.guava', name: 'guava', version: '27.0.1-jre'
54     implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.1'
55     implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.9.1'
56     implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
57     implementation group: 'org.jsoup', name: 'jsoup', version: '1.10.2'
58     implementation group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.1.0'
59     implementation group: 'javax.activation', name: 'javax.activation-api', version: '1.2.0'
60
61     testImplementation group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit'
62     testImplementation group: 'junit', name: 'junit', version: '4.11'
63     testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4'
64     testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
65 }
66
67 apply from: 'version.gradle'
68
69 task parallelTest(type: Test) {
70     maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
71     useJUnit {
72         excludeCategories 'net.pterodactylus.sone.test.NotParallel'
73     }
74 }
75
76 task notParallelTest(type: Test) {
77     maxParallelForks = 1
78     useJUnit {
79         includeCategories 'net.pterodactylus.sone.test.NotParallel'
80     }
81     dependsOn parallelTest
82 }
83
84 test {
85     exclude '**'
86     dependsOn parallelTest, notParallelTest
87 }
88
89 task fatJar(type: Jar) {
90     archiveFileName = project.name.toLowerCase() + '-jar-with-dependencies.jar'
91     from { (configurations.runtimeClasspath - configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } }
92     setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
93     manifest {
94         attributes('Plugin-Main-Class': 'net.pterodactylus.sone.main.SonePlugin')
95     }
96     with jar
97 }
98
99 javadoc {
100     options {
101         quiet()
102         showFromPrivate()
103         footer('© 2010–2013 David â€˜Bombe’ Roden')
104         links('http://docs.oracle.com/javase/7/docs/api/')
105     }
106     failOnError = false
107 }
108
109 jacoco {
110     toolVersion = '0.8.8'
111 }
112
113 jacocoTestReport {
114     executionData(layout.buildDirectory.getAsFileTree().matching {
115         include "jacoco/*.exec"
116     })
117     dependsOn test
118 }
119
120 pitest {
121     pitestVersion = '1.7.4'
122     outputFormats = ['HTML', 'XML']
123     timestampedReports = false
124     timeoutFactor = 3.0
125 }
126
127 apply plugin: 'idea'
128
129 task countLinesMain(type: Exec) {
130     executable = 'cloc'
131     args = ['--by-file', '--xml', '--report-file=build/reports/cloc/main.xml', 'src/main']
132     standardOutput = new ByteArrayOutputStream()
133 }
134
135 task countLinesTest(type: Exec) {
136     executable = 'cloc'
137     args = ['--by-file', '--xml', '--report-file=build/reports/cloc/test.xml', 'src/test']
138     standardOutput = new ByteArrayOutputStream()
139 }
140
141 task countLines {
142     new File(buildDir, "reports/cloc").mkdirs()
143     dependsOn tasks.countLinesMain
144     dependsOn tasks.countLinesTest
145 }
146
147 noArg {
148     annotation('net.pterodactylus.sone.main.NoArg')
149 }