-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
executable file
·125 lines (102 loc) · 3.19 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
buildscript {
dependencies {
}
repositories {
mavenCentral()
}
}
// Access Git info from build script
plugins {
id "org.ajoberstar.grgit" version "5.2.1"
id 'antlr'
id 'java-library'
id "com.diffplug.spotless" version "6.25.0"
id 'maven-publish'
}
// In this section you declare where to find the dependencies of your project
repositories {
mavenCentral()
mavenLocal()
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
dependencies {
antlr 'org.antlr:antlr4:4.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.11.1'
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.1'
}
test {
useJUnitPlatform()
// Always rerun when asked.
dependsOn 'cleanTest'
}
// Custom properties
ext {
// Get tag and commit info from Git to use for version numbering
def repo = grgit.open(currentDir: file('.'))
def head = repo.head()
def tags = repo.tag.list().find {
it.commit == head
}
if (tags) {
tagVersion = tags.getName()
project.version = tagVersion
}
revision = head.abbreviatedId
revisionFull = head.id
// println 'Configuring for ' + project.name + " " + tagVersion + " by " + vendor
}
group = "net.rptools.parser"
spotless {
java {
target project.fileTree(project.rootDir) {
include 'src/**/*.java'
exclude '**/generated-src/'
}
licenseHeaderFile 'spotless.license.java'
// Now using the Google Java style guide
//eclipse().configFile('build-resources/eclipse.prefs.formatter.xml')
googleJavaFormat()
// If you get exceptions thrown by spotlessApply, this might
// help. Enable it here if the problem is with a Java file, and
// below if it is not. Don't leave it enabled, as nothing will
// actually be updated if you do.
// https://github.com/diffplug/spotless/blob/master/PADDEDCELL.md
//paddedCell()
}
format 'misc', {
target '**/*.gradle', '**/.gitignore'
// spotless has built-in rules for most basic formatting tasks
trimTrailingWhitespace()
// or spaces. Takes an integer argument if you don't like 4
indentWithSpaces(4)
//paddedCell()
}
}
publishing {
publications {
maven(MavenPublication) {
groupId = 'com.github.RPTools'
artifactId = 'parser'
version = project.version
from components.java
}
}
}
jar {
manifest {
attributes 'Implementation-Title': 'parser',
'Implementation-Version': project.version
}
}
generateGrammarSource {
arguments += ["-package", "net.rptools.parser", "-visitor"]
// This makes IntelliJ happy since the files will be at the right place.
// But it's not required for a successful build.
outputDirectory = file("${layout.buildDirectory.get()}/generated-src/antlr/main/net/rptools/parser/")
}