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