-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
156 lines (134 loc) · 5.78 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
150
151
152
153
154
155
156
plugins {
id 'java'
id "org.checkerframework" version "0.6.44"
id 'com.diffplug.spotless' version '6.25.0'
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
group = 'edu.njit.jerse'
version = '0.1-SNAPSHOT'
repositories {
mavenCentral()
}
ext.checkerFrameworkVersion = '3.47.0' // default value
dependencies {
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.15.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.15.2'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.15.2'
implementation 'com.github.javaparser:javaparser-core:3.26.2'
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.10.0'
implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.7.0.202309050840-r'
implementation group: 'com.google.guava', name: 'guava', version: '32.1.3-jre'
implementation 'org.plumelib:plume-util:1.9.0'
checkerFramework "org.checkerframework:checker:${checkerFrameworkVersion}"
}
test {
useJUnitPlatform()
}
apply plugin: 'org.checkerframework'
checkerFramework {
checkers = [
'org.checkerframework.checker.nullness.NullnessChecker',
'org.checkerframework.checker.optional.OptionalChecker',
'org.checkerframework.checker.resourceleak.ResourceLeakChecker',
]
}
/**
* The following code is for downloading and renaming the Checker Framework jars.
* This is necessary because the Checker Framework jars are named with the version number.
* If the jars are named with the version number, Checker Framework will not be able to find them.
* ASHE is dependent on the Checker Framework during compilation *and* runtime.
*/
configurations {
checkerFramework
}
tasks.register('resolveCheckerFrameworkVersion') {
doLast {
// Resolve the version from the resolved artifacts.
checkerFrameworkVersion = configurations.checkerFramework.resolvedConfiguration.resolvedArtifacts.find {
it.name == 'checker'
}?.moduleVersion?.id?.version ?: checkerFrameworkVersion
}
}
tasks.register('downloadCheckerFramework', Copy) {
from configurations.checkerFramework
into layout.buildDirectory.dir("libs/checkerframework")
}
tasks.named('downloadCheckerFramework').configure {
mustRunAfter 'resolveCheckerFrameworkVersion'
}
// Checker Framework is expecting the jars to be named without the version number.
// If the jars are named with the version number, Checker Framework will not be able to find them.
tasks.register('renameCheckerFrameworkJars') {
dependsOn 'downloadCheckerFramework', 'resolveCheckerFrameworkVersion'
doLast {
fileTree(layout.buildDirectory.dir("libs/checkerframework")).include('*.jar').each { File file ->
// Use the dynamically resolved version to replace in the file name.
// For exmaple: checker-3.38.0.jar -> checker.jar
if (file.name.endsWith('.jar') && file.name.contains(checkerFrameworkVersion)) {
String newName = file.name.replace("-${checkerFrameworkVersion}", "")
if (!file.renameTo(new File(file.parent, newName))) {
throw new GradleException("Could not rename ${file.name} to ${newName}")
}
}
}
}
}
assemble.dependsOn renameCheckerFrameworkJars
// TODO: task is deprecated. Use tasks.register instead.
/* Make Emacs TAGS table */
task tags(type: Exec) {
description "Run etags to create an Emacs TAGS table"
// TODO: buildDir is deprecated. Use layout.buildDirectory instead.
environment PATH: "$System.env.PATH:$buildDir/utils/plume-lib/bin"
commandLine "bash", "-c", "find src/ -name '*.java' | sort-directory-order | xargs etags"
}
// TODO: Create a task to run ASHE#main here
// Command to run AsheAutomation#main
// ./gradlew runAsheAutomation -PmodulePath="/path/to/module" -ProotProjectPath="/path/to/root/project" -Pllm="llm-model" -PpropsFilePath="/path/to/props/file"
tasks.register('runAsheAutomation', JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass.set('edu.njit.jerse.automation.AsheAutomation')
args = [
project.findProperty('modulePath'),
project.findProperty('rootProjectPath'),
project.findProperty('llm'),
project.findProperty('propsFilePath')
]
}
spotless {
// optional: limit format enforcement to just the files changed by this feature branch
ratchetFrom 'origin/main'
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
googleJavaFormat().reflowLongStrings()
formatAnnotations()
}
}
compileJava.dependsOn 'spotlessApply'
// Command to run RepositoryAutomationEngine#main
// ./gradlew runRepositoryAutomation -PrepositoriesCsvPath="/path/to/repositories.csv" -PcloneDirectory="/path/to/clone/directory" -Pllm="llm-model" -PpropsFilePath="/path/to/props/file"
tasks.register('runRepositoryAutomation', JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass.set('edu.njit.jerse.automation.RepositoryAutomationEngine')
args = [
project.findProperty('repositoriesCsvPath'),
project.findProperty('cloneDirectory'),
project.findProperty('llm'),
project.findProperty('propsFilePath')
]
}