-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
129 lines (111 loc) · 3.28 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
plugins {
id 'java'
id 'application'
id 'maven-publish'
id 'net.researchgate.release' version '2.6.0'
}
repositories {
mavenLocal()
maven { url 'https://clyze.jfrog.io/artifactory/default-maven-local' }
// maven { url "http://centauri.di.uoa.gr:8081/artifactory/plast-public" }
mavenCentral()
}
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
dependencies {
implementation 'commons-cli:commons-cli:1.5.0'
implementation 'commons-io:commons-io:2.11.0'
implementation "org.antlr.grammars:grammarsv4:1.0-SNAPSHOT"
implementation 'org.clyze:metadata-model:2.4.1'
// Uncomment to support parsers with lowercase requirement (such as PHP).
// implementation "com.khubla.antlr:antlr4test-maven-plugin:1.17"
implementation 'org.zeroturnaround:zt-zip:1.14'
// Use JUnit test framework
testImplementation(platform('org.junit:junit-bom:5.7.1'))
testImplementation('org.junit.jupiter:junit-jupiter')
}
String mainClass = 'org.clyze.antlr2datalog.Main'
group = "org.clyze"
application {
// Define the main class for the application
mainClassName = mainClass
}
test {
useJUnitPlatform { }
}
wrapper {
gradleVersion = '7.3.3'
}
java {
withSourcesJar()
withJavadocJar()
}
javadoc.options.addBooleanOption('Xdoclint:all', true)
task bundleLogic(type: Zip) {
archiveFileName = 'logic.zip'
destinationDirectory = file('src/main/resources')
from file('logic')
}
task copyParsers(type: Copy) {
println "Copying parsers..."
String homeDir = System.getProperty("user.home")
from homeDir + "/.m2/repository/org/antlr/grammars/"
from 'extra-grammars'
into "src/main/resources/parsers"
['C', 'cobol85', 'CPP14', 'golang', 'javascript', 'kotlin-formal', 'Lua', 'php', 'python3', 'rust'].each { String lang ->
include "${lang}/**/*.jar"
}
include 'solidity/solidity.jar'
}
task cleanResources() {
println "Cleaning up resources..."
project.file("src/main/resources/parsers").deleteDir()
project.file("src/main/resources/logic").deleteDir()
project.file("src/main/resources/logic.zip").delete()
}
clean.dependsOn cleanResources
task fatJar(type: Jar) {
manifest {
attributes 'Main-Class': mainClass,
'Implementation-Version': archiveVersion.get()
}
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
from project.file('src/main/resources')
duplicatesStrategy = 'exclude'
with jar
}
processResources.dependsOn copyParsers, bundleLogic
fatJar.dependsOn processResources
artifacts {
fatJar
archives sourcesJar
archives javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact fatJar
}
}
}
if (project.hasProperty('artifactory_user')) {
publishing {
repositories {
maven {
credentials {
username artifactory_user
password artifactory_password
}
//Always publish to the public releases repo
url "${artifactory_contextUrl}/libs-public-release-local"
}
}
}
}
release {
failOnSnapshotDependencies = false
git {
requireBranch = 'main'
}
}
afterReleaseBuild.dependsOn publish