Skip to content

Commit a9826dd

Browse files
committed
gradle: Introduce submodules
1 parent 5360c49 commit a9826dd

File tree

202 files changed

+197
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+197
-141
lines changed

api/build.gradle

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
plugins {
2+
id 'alpha.java-library-conventions'
3+
}
4+
5+
dependencies {
6+
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
7+
implementation group: 'commons-cli', name: 'commons-cli', version: '1.3.1'
8+
implementation group: 'org.apache.poi', name: 'poi', version: '4.1.1'
9+
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.1'
10+
}
11+

build.gradle

+1-122
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,10 @@
11
plugins {
2-
id 'antlr'
3-
id 'application'
4-
id 'checkstyle'
5-
id 'java'
62
id 'jacoco'
73

84
id 'com.github.kt3k.coveralls' version '2.8.1'
95
}
106

11-
sourceCompatibility = 1.8
12-
targetCompatibility = 1.8
13-
14-
mainClassName = 'at.ac.tuwien.kr.alpha.Main'
15-
16-
def antlrVersion = '4.7'
17-
18-
repositories {
19-
mavenCentral()
20-
jcenter()
21-
}
22-
23-
/* The following configuration directive is a work-around for a fault in the Gradle
24-
* ANTLR plugin. It would require both antlr4 and antlr4-runtime at compile time and
25-
* at run time, which unnecessarily bloats our JARs. Only antlr4-runtime is needed.
26-
* We therefore remove this extension of antlr dependencies being compile dependencies
27-
* and reintroduce them on our own.
28-
*/
29-
configurations {
30-
implementation {
31-
extendsFrom = extendsFrom.findAll { it != configurations.antlr }
32-
}
33-
}
34-
35-
dependencies {
36-
// We need to give the ANTLR Plugin a hint.
37-
antlr group: 'org.antlr', name: 'antlr4', version: "${antlrVersion}"
38-
39-
// Re-introduce antlr4-runtime as compile dependency.
40-
implementation group: 'org.antlr', name: 'antlr4-runtime', version: "${antlrVersion}"
41-
42-
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
43-
implementation group: 'commons-cli', name: 'commons-cli', version: '1.3.1'
44-
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
45-
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
46-
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.8'
47-
implementation group: 'org.reflections', name: 'reflections', version: '0.9.11'
48-
implementation group: 'org.apache.poi', name: 'poi', version: '4.1.1'
49-
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.1'
50-
51-
testImplementation group: 'junit', name: 'junit', version: '4.12'
52-
}
53-
54-
tasks.withType(AntlrTask) {
55-
// See https://github.com/antlr/antlr4/blob/master/doc/tool-options.md
56-
arguments += [
57-
"-visitor",
58-
"-no-listener",
59-
"-long-messages",
60-
"-package", "at.ac.tuwien.kr.alpha.antlr",
61-
"-Werror",
62-
"-Xlog",
63-
"-lib", "src/main/antlr/at/ac/tuwien/kr/alpha/antlr"
64-
]
65-
}
66-
67-
compileJava {
68-
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
69-
}
70-
71-
compileTestJava {
72-
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
73-
}
74-
75-
// Fix checkstyle version.
76-
checkstyle {
77-
toolVersion = "7.6"
78-
}
79-
80-
81-
task bundledJar(type: Jar) {
82-
manifest {
83-
attributes 'Main-Class': mainClassName
84-
}
85-
86-
from {
87-
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
88-
}
89-
90-
archiveFileName = "${project.name}-bundled.jar"
91-
92-
/*
93-
* In order to make sure we don't overwrite NOTICE and LICENSE files coming from dependency
94-
* jars with each other, number them while copying
95-
*/
96-
int i = 1
97-
rename { name -> (name.equals("NOTICE.txt") || name.equals("NOTICE")) ? "NOTICE." + (i++) + ".txt" : null }
98-
99-
int j = 1
100-
rename { name -> (name.equals("LICENSE.txt") || name.equals("LICENSE")) ? "LICENSE." + (j++) + ".txt" : null }
101-
102-
with jar
103-
}
104-
105-
jacocoTestReport {
106-
reports {
107-
xml.enabled = true
108-
html.enabled = true
109-
}
110-
111-
// NOTE: Contents of the antlr subpackage are autogenerated (see configuration of
112-
// AntlrTasks above). It does not make sense to include them in our coverage
113-
// report.
114-
afterEvaluate {
115-
getClassDirectories().setFrom(files(classDirectories.files.collect {
116-
fileTree(dir: it, exclude: "at/ac/tuwien/kr/alpha/antlr/**")
117-
}))
118-
}
119-
}
120-
121-
test {
122-
testLogging {
123-
exceptionFormat = 'full'
124-
}
125-
126-
}
127-
1287
wrapper {
129-
gradleVersion = '6.0'
8+
gradleVersion = '6.7'
1309
distributionType = 'ALL'
13110
}

buildSrc/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
id 'groovy-gradle-plugin'
3+
}
4+
5+
repositories {
6+
gradlePluginPortal()
7+
}
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plugins {
2+
id 'alpha.java-common-conventions'
3+
id 'application'
4+
}
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
plugins {
2+
id 'java'
3+
id 'jacoco'
4+
id 'checkstyle'
5+
}
6+
7+
repositories {
8+
mavenCentral()
9+
jcenter()
10+
}
11+
12+
sourceCompatibility = 1.8
13+
targetCompatibility = 1.8
14+
15+
dependencies {
16+
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
17+
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3'
18+
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.8'
19+
implementation group: 'org.reflections', name: 'reflections', version: '0.9.11'
20+
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.20'
21+
22+
testImplementation group: 'junit', name: 'junit', version: '4.12'
23+
24+
// JUnit 5
25+
// testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
26+
// testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
27+
}
28+
29+
/* JUnit 5
30+
tasks.named('test') {
31+
useJUnitPlatform()
32+
}
33+
*/
34+
35+
test {
36+
testLogging {
37+
exceptionFormat = 'full'
38+
}
39+
40+
}
41+
42+
// Fix checkstyle version.
43+
checkstyle {
44+
toolVersion = "7.6"
45+
}
46+
47+
compileJava {
48+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
49+
}
50+
51+
compileTestJava {
52+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
53+
}
54+
55+
jacocoTestReport {
56+
reports {
57+
xml.enabled = true
58+
}
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plugins {
2+
id 'alpha.java-common-conventions'
3+
id 'java-library'
4+
}
5+

cli/build.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
plugins {
2+
id 'alpha.java-application-conventions'
3+
}
4+
5+
dependencies {
6+
implementation project(':core')
7+
implementation project(':api')
8+
}
9+
10+
def mainClassName = 'at.ac.tuwien.kr.alpha.Main'
11+
12+
application {
13+
mainClass = mainClassName
14+
}
15+
16+
task bundledJar(type: Jar) {
17+
manifest {
18+
attributes 'Main-Class': mainClassName
19+
}
20+
21+
from {
22+
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
23+
}
24+
25+
archiveFileName = "${project.name}-bundled.jar"
26+
27+
/*
28+
* In order to make sure we don't overwrite NOTICE and LICENSE files coming from dependency
29+
* jars with each other, number them while copying
30+
*/
31+
int i = 1
32+
rename { name -> (name.equals("NOTICE.txt") || name.equals("NOTICE")) ? "NOTICE." + (i++) + ".txt" : null }
33+
34+
int j = 1
35+
rename { name -> (name.equals("LICENSE.txt") || name.equals("LICENSE")) ? "LICENSE." + (j++) + ".txt" : null }
36+
37+
with jar
38+
}

core/build.gradle

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
plugins {
2+
id 'antlr'
3+
id 'alpha.java-library-conventions'
4+
}
5+
6+
7+
def antlrVersion = '4.7'
8+
9+
/* The following configuration directive is a work-around for a fault in the Gradle
10+
* ANTLR plugin. It would require both antlr4 and antlr4-runtime at compile time and
11+
* at run time, which unnecessarily bloats our JARs. Only antlr4-runtime is needed.
12+
* We therefore remove this extension of antlr dependencies being compile dependencies
13+
* and reintroduce them on our own.
14+
*/
15+
configurations {
16+
implementation {
17+
extendsFrom = extendsFrom.findAll { it != configurations.antlr }
18+
}
19+
}
20+
21+
dependencies {
22+
api project(':api')
23+
24+
// We need to give the ANTLR Plugin a hint.
25+
antlr group: 'org.antlr', name: 'antlr4', version: "${antlrVersion}"
26+
27+
// Re-introduce antlr4-runtime as compile dependency.
28+
implementation group: 'org.antlr', name: 'antlr4-runtime', version: "${antlrVersion}"
29+
}
30+
31+
tasks.withType(AntlrTask) {
32+
// See https://github.com/antlr/antlr4/blob/master/doc/tool-options.md
33+
arguments += [
34+
"-visitor",
35+
"-no-listener",
36+
"-long-messages",
37+
"-package", "at.ac.tuwien.kr.alpha.antlr",
38+
"-Werror",
39+
"-Xlog",
40+
"-lib", "src/main/antlr/at/ac/tuwien/kr/alpha/antlr"
41+
]
42+
}
43+
44+
jacocoTestReport {
45+
reports {
46+
xml.enabled = true
47+
}
48+
49+
// NOTE: Contents of the antlr subpackage are autogenerated (see configuration of
50+
// AntlrTasks above). It does not make sense to include them in our coverage
51+
// report.
52+
afterEvaluate {
53+
getClassDirectories().setFrom(files(classDirectories.files.collect {
54+
fileTree(dir: it, exclude: "at/ac/tuwien/kr/alpha/antlr/**")
55+
}))
56+
}
57+
}
58+

gradle/wrapper/gradle-wrapper.jar

501 Bytes
Binary file not shown.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

0 commit comments

Comments
 (0)