-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
149 lines (124 loc) · 3.43 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a commented-out sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.4.1/userguide/tutorial_java_projects.html
*/
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'checkstyle'
sourceCompatibility = 1.8
test.testLogging.showStandardStreams = true
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'resources'
}
}
test {
java {
srcDir 'tests'
}
resources {
srcDir 'testRes'
}
}
}
checkstyle {
toolVersion '8.45.1'; // your choice here
}
checkstyleMain {
source ='src/'
}
checkstyleTest {
source ='tests/'
}
test {
useJUnitPlatform()
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use 'jcenter' for resolving your dependencies.
mavenCentral()
}
// In this section you declare the dependencies for your production and test code
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'lib')
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.0'
implementation 'info.picocli:picocli:4.7.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.7'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.7'
}
task testJar2(type: Jar, dependsOn: testClasses) {
archiveBaseName = "test2"
from sourceSets.test.output
manifest {
attributes "Main-Class": "test.TestRunner"
}
}
task fatJar(type: Jar) {
dependsOn tasks.getByPath("classes")
manifest {
attributes "Main-Class": "cli.Main"
}
archiveBaseName = 'JJBMC'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
doLast {
copy {
from 'build/libs/JJBMC.jar'
into '.'
}
}
}
task testJar(type: Jar) {
dependsOn tasks.getByPath("classes")
dependsOn tasks.getByPath("testClasses")
manifest {
attributes "Main-Class": "test.TestRunner"
}
archiveBaseName = 'JJBMC-test'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
sourceSets.main.output.each {
from it
}
sourceSets.test.output.each {
from it
}
from {
configurations.testRuntimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
doLast {
copy {
from 'build/libs/JJBMC-test.jar'
into '.'
}
}
}
task harshCheckstyle(type: Checkstyle) {
source = "src/"
configFile = file("${rootDir}/config/checkstyle/checkstyleHarsh.xml")
classpath = files()
}
task caseStudies(type: JavaExec) {
classpath sourceSets.test.runtimeClasspath
mainClass = "casestudy.CaseStudies"
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}