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