-
Notifications
You must be signed in to change notification settings - Fork 143
/
Copy pathbuild.gradle
178 lines (160 loc) · 5.93 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
plugins {
id 'java'
id 'application'
id 'eclipse'
id 'maven-publish'
id 'signing'
id 'idea'
// id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
group = "com.github.tsantalis"
version = project.hasProperty('buildVersion') ?
project.buildVersion
: '3.0.10'
applicationName = rootProject.name
mainClassName = "org.refactoringminer.RefactoringMiner"
idea {
module {
excludeDirs.add(file("src-test/data/astDiff/"))
excludeDirs.add(file("tmp"))
}
}
//checkstyle {
// toolVersion = '8.36'
// configFile = rootProject.file('config/checkstyle/checkstyle.xml')
// configProperties = [suppressionFile: "${rootProject.file('config/checkstyle/checkstyle_supressions.xml')}"]
// ignoreFailures = false
// showViolations = true
//}
repositories {
mavenCentral()
}
test {
useJUnitPlatform()
afterTest { descriptor, result ->
if (result.resultType == TestResult.ResultType.FAILURE) {
println "\n$descriptor.className [$descriptor.classDisplayName] > $descriptor.name [$descriptor.displayName]: $result.resultType"
}
}
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
jvmArgs '-Xmx4096M', '-Xms1024M' /* In case of heap-space error*/
if (project.hasProperty('notoken')) {
exclude '**/GHRepositoryWrapperTest.*'
exclude '**/TestCommandLine.*'
print 'Skipping tests that require a GitHub token'
}
}
// Improve testResourceProcessing time by ~10 seconds
// Solution found in https://github.com/gradle/gradle/issues/1643#issuecomment-589864718
tasks.processTestResources {
// Solution to slow testResourceProcessing (optimization)
eachFile { details ->
def targetFile = new File(destinationDir, details.path)
if (details.file.lastModified() == targetFile.lastModified()
&& details.file.length() == targetFile.length()) {
exclude()
}
}
// Retain timestamps from source files
def copyDetails = []
eachFile { copyDetails << it } // Collect copy details
doLast {
copyDetails.forEach { details ->
def target = new File(destinationDir, details.path)
if (target.exists()) {
target.setLastModified(details.lastModified)
}
}
}
}
dependencies {
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.10.0.202406032230-r'
implementation 'org.slf4j:slf4j-api:2.0.16'
implementation 'org.slf4j:slf4j-simple:2.0.16'
implementation 'org.eclipse.jdt:org.eclipse.jdt.core:3.39.0'
implementation 'org.apache.commons:commons-text:1.12.0'
implementation 'org.kohsuke:github-api:1.135'
implementation 'io.github.java-diff-utils:java-diff-utils:4.15'
implementation 'com.github.gumtreediff:core:3.0.0'
implementation 'com.github.gumtreediff:gen.jdt:3.0.0'
implementation 'org.jcommander:jcommander:1.85'
implementation 'org.jsoup:jsoup:1.18.2'
implementation 'com.perforce:p4java:2024.1.2674354'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
testImplementation 'net.joshka:junit-json-params:5.9.2-r0'
testImplementation 'org.skyscreamer:jsonassert:1.5.1'
testImplementation 'org.glassfish:javax.json:1.1.4'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'it.unimi.dsi:fastutil:8.5.15'
implementation 'com.sparkjava:spark-core:2.9.4'
implementation('org.rendersnake:rendersnake:1.9.0') {
exclude group: 'javax.servlet', module: 'servlet-api'
}
}
java {
withJavadocJar()
withSourcesJar()
}
artifacts {
archives javadocJar, sourcesJar
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
publishing {
repositories {
maven {
def releaseRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
url = isReleaseVersion ? releaseRepo : snapshotRepo
credentials {
username = project.hasProperty('ossrhUsername') ? ossrhUsername : "Unknown user"
password = project.hasProperty('ossrhPassword') ? ossrhPassword : "Unknown password"
}
}
}
publications {
mavenJava(MavenPublication) {
artifactId = 'refactoring-miner'
from components.java
pom {
name = "Refactoring Miner"
description = 'RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.'
url = 'https://github.com/tsantalis/RefactoringMiner'
licenses {
license {
name = 'The MIT License (MIT)'
url = 'http://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'tsantalis'
name = 'Nikolaos Tsantalis'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:tsantalis/RefactoringMiner.git'
developerConnection = 'scm:git:[email protected]:tsantalis/RefactoringMiner.git'
url = 'https://github.com/tsantalis/RefactoringMiner/tree/master'
}
}
}
}
}
signing {
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
def jarName = project.hasProperty('jarName') ? project.jarName : 'RM-fat.jar'
shadowJar {
manifest {
attributes 'Main-Class': 'org.refactoringminer.RefactoringMiner'
}
archiveFileName = jarName
}