-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
146 lines (123 loc) · 4.17 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
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* User Manual available at https://docs.gradle.org/6.6/userguide/java_library_plugin.html
*/
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java'
id 'application'
id 'antlr'
id 'eclipse'
id 'com.diffplug.spotless' version '6.18.0'
id 'checkstyle'
}
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenCentral()
}
dependencies {
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:29.0-jre'
// Use JUnit test framework
testImplementation 'junit:junit:4.13'
antlr 'org.antlr:antlr4:4.11.1'
// Apache Commons CLI
implementation 'commons-cli:commons-cli:1.4'
implementation 'io.github.lisa-analyzer:lisa-program:0.1b8'
implementation 'io.github.lisa-analyzer:lisa-analyses:0.1b8'
implementation 'io.github.lisa-analyzer:lisa-sdk:0.1b8'
implementation 'io.github.lisa-analyzer:lisa-imp:0.1b8'
implementation group: 'commons-cli', name: 'commons-cli', version: '1.5.0'
implementation 'io.github.cdimascio:dotenv-java:3.0.0'
implementation 'org.json:json:20210307'
}
generateGrammarSource {
maxHeapSize = "64m"
arguments += ["-visitor", "-no-listener"]
doLast {
copy {
from 'build/generated-src/antlr/main/'
include '*.*'
into 'build/generated-src/antlr/main/it/unipr/evm/antlr'
}
project.delete fileTree('build/generated-src/antlr/main').include('*.*')
}
}
checkstyle {
configFile = file(new File(rootProject.projectDir, 'checkstyle-config.xml'))
sourceSets = []
showViolations = true
toolVersion '8.38'
}
checkstyleTest.enabled = false
checkstyleMain {
finalizedBy 'checkstyleErrorMessage'
reports {
xml.required = false
html.required = false
}
}
task checkstyleErrorMessage {
onlyIf {
checkstyleMain.state.failure != null
}
doLast {
logger.error('Checkstyle plugin thrown an error. This means that the javadoc is not correctly setup. Inspect console output to find problematic javadocs.')
logger.error('To reproduce locally, execute \'./gradlew checkstyleMain\'')
}
}
spotless {
enforceCheck = false
encoding 'UTF-8'
lineEndings 'UNIX'
java {
// tabs, no spaces
indentWithTabs()
// keep imports clean
importOrder()
removeUnusedImports()
// use the eclipse formatting with the one provided with the project
eclipse().configFile(new File(rootProject.projectDir, 'spotless-formatting.xml'))
target 'src/**/*.java'
// ignore generated code
targetExclude '**/build/generated/**/*.java'
targetExclude '**/build/generated-src/**/*.java'
targetExclude '**/target/generated-sources/**/*.java'
}
antlr4 {
target 'src/*/antlr/**/*.g4'
antlr4Formatter()
}
}
spotlessJava {
// declaring explicit dependencies
dependsOn 'compileJava', 'compileTestJava', 'processTestResources', 'spotlessAntlr4'
}
spotlessJavaCheck {
finalizedBy 'spotlessErrorMessage'
}
spotlessAntlr4Check {
finalizedBy 'spotlessErrorMessage'
}
task spotlessErrorMessage {
onlyIf {
spotlessJavaCheck.state.failure != null || spotlessAntlr4Check.state.failure != null
}
doLast {
logger.error('Spotless plugin thrown an error. This means that the code is not correctly formatted.')
logger.error('To reproduce locally, execute \'./gradlew spotlessCheck\'')
logger.error('To automatically fix all the problems, execute \'./gradlew spotlessApply\'')
}
}
// class containing main method
mainClassName = 'it.unipr.EVMLiSA'
tasks.register('checkCodeStyle') {
group = 'verification'
description = 'Execute spotless and checkstyle to ensure code and javadoc formatting'
dependsOn 'spotlessCheck', 'checkstyleMain', 'checkstyleTest'
}