forked from JetBrains-Research/astminer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
134 lines (108 loc) · 3.24 KB
/
build.gradle.kts
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
import tanvd.kosogor.proxy.publishJar
import tanvd.kosogor.proxy.shadowJar
group = "io.github.vovak.astminer"
version = "0.5"
plugins {
id("java")
kotlin("jvm") version "1.3.61" apply true
id("antlr")
id("idea")
id("application")
id("tanvd.kosogor") version "1.0.6"
id("org.jetbrains.dokka") version "0.9.18"
}
application {
mainClassName = "astminer.MainKt"
}
defaultTasks("run")
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
val generatedSourcesPath = "src/main/generated"
dependencies {
antlr("org.antlr:antlr4:4.7.1")
implementation(kotlin("stdlib"))
// https://mvnrepository.com/artifact/com.github.gumtreediff
api("com.github.gumtreediff", "core", "2.1.0")
api("com.github.gumtreediff", "client", "2.1.0")
api("com.github.gumtreediff", "gen.jdt", "2.1.0")
// https://mvnrepository.com/artifact/io.shiftleft/fuzzyc2cpg
api("io.shiftleft", "fuzzyc2cpg_2.12", "0.1.74") {
exclude("org.slf4j", "slf4j-simple")
}
testImplementation("junit:junit:4.11")
testImplementation(kotlin("test-junit"))
}
val shadowJar = shadowJar {
jar {
archiveName = "lib-$version.jar"
mainClass = "astminer.MainKt"
}
}.apply {
task.archiveClassifier.set("")
task.dependencies {
exclude(dependency("org.jetbrains.kotlin:.*"))
}
}
task<JavaExec>("performanceTest") {
main = "astminer.performance.PerformanceTest"
classpath = sourceSets["main"].runtimeClasspath
}
task<JavaExec>("processPyExample") {
main = "astminer.examples.pyExample.PyExample"
classpath = sourceSets["main"].runtimeClasspath
}
tasks.generateGrammarSource {
maxHeapSize = "64m"
arguments = arguments + listOf("-package", "me.vovak.antlr.parser")
// Keep a copy of generated sources
doLast {
println("Copying generated grammar lexer/parser files to main directory.")
copy {
from("$buildDir/generated-src/antlr/main")
into("$generatedSourcesPath/me/vovak/antlr/parser")
}
file("$buildDir/generated-src/antlr").deleteRecursively()
}
// Run when source dir has changed or was removed
outputs.dir(generatedSourcesPath)
}
tasks.clean {
doLast {
file(generatedSourcesPath).deleteRecursively()
}
}
tasks.compileKotlin {
dependsOn(tasks.generateGrammarSource)
}
tasks.compileJava {
dependsOn(tasks.generateGrammarSource)
}
sourceSets["main"].java.srcDir(file(generatedSourcesPath))
idea {
module {
generatedSourceDirs.add(file(generatedSourcesPath))
}
}
publishJar {
publication {
artifactId = "astminer"
}
bintray {
// If username and secretKey not set, will be taken from System environment param `bintray_user`, 'bintray_key'
repository = "astminer"
info {
githubRepo = "JetBrains-Research/astminer"
vcsUrl = "https://github.com/JetBrains-Research/astminer"
labels.addAll(listOf("mining", "ast", "ml4se", "code2vec", "path-based representations"))
license = "MIT"
description = "Extract AST, AST-related metrics, and path-based representations from source code"
}
}
}
tasks.dokka {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
}