💚 Allow use of plugins block
[Sone.git] / build.gradle
1 buildscript {
2     ext.kotlinVersion = '1.3.50'
3     repositories {
4         mavenCentral()
5     }
6     dependencies {
7         classpath group: 'info.solidsoft.gradle.pitest', name: 'gradle-pitest-plugin', version: '1.4.0'
8         classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: kotlinVersion
9         classpath group: 'org.jetbrains.kotlin', name: 'kotlin-noarg', version: kotlinVersion
10     }
11 }
12
13 group = 'net.pterodactylus'
14 version = '80'
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: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.3.0-RC'
48
49     compile group: 'net.pterodactylus', name: 'utils', version: '0.12.4'
50     compile group: 'com.google.inject', name: 'guice', version: '4.2.2'
51     compile group: 'com.google.guava', name: 'guava', version: '27.0.1-android'
52     compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.1'
53     compile group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.9.1'
54     compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
55     compile group: 'org.jsoup', name: 'jsoup', version: '1.10.2'
56     compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '4.1.0'
57     compile group: 'javax.activation', name: 'javax.activation-api', version: '1.2.0'
58
59     testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit'
60     testCompile group: 'junit', name: 'junit', version: '4.11'
61     testCompile group: 'org.mockito', name: 'mockito-core', version: '2.28.2'
62     testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
63 }
64
65 apply from: 'version.gradle'
66
67 test {
68     maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
69 }
70
71 task fatJar(type: Jar) {
72     archiveName = project.name.toLowerCase() + '-jar-with-dependencies.jar'
73     from { (configurations.runtime - configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } }
74     manifest {
75         attributes('Plugin-Main-Class': 'net.pterodactylus.sone.main.SonePlugin')
76     }
77     with jar
78 }
79
80 javadoc {
81     options {
82         quiet()
83         showFromPrivate()
84         footer('© 2010–2013 David â€˜Bombe’ Roden')
85         links('http://docs.oracle.com/javase/7/docs/api/')
86     }
87     failOnError = false
88 }
89
90 apply plugin: 'jacoco'
91
92 jacoco {
93     toolVersion = '0.8.4'
94 }
95
96 jacocoTestReport.dependsOn test
97
98 apply plugin: 'info.solidsoft.pitest'
99
100 pitest {
101     outputFormats = ['HTML', 'XML']
102     timestampedReports = false
103     timeoutFactor = 3.0
104 }
105
106 apply plugin: 'findbugs'
107
108 findbugs {
109     ignoreFailures = true
110 }
111
112 apply plugin: 'idea'
113
114 task countLinesMain(type: Exec) {
115     executable = 'cloc'
116     args = ['--by-file', '--xml', '--report-file=build/reports/cloc/main.xml', 'src/main']
117     standardOutput = new ByteArrayOutputStream()
118 }
119
120 task countLinesTest(type: Exec) {
121     executable = 'cloc'
122     args = ['--by-file', '--xml', '--report-file=build/reports/cloc/test.xml', 'src/test']
123     standardOutput = new ByteArrayOutputStream()
124 }
125
126 task countLines {
127     new File(buildDir, "reports/cloc").mkdirs()
128     dependsOn tasks.countLinesMain
129     dependsOn tasks.countLinesTest
130 }
131
132 apply plugin: 'kotlin-noarg'
133
134 noArg {
135     annotation('net.pterodactylus.sone.main.NoArg')
136 }