-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
118 lines (94 loc) · 2.91 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
buildscript {
ext {
kotlin_version = '1.6.+'
}
repositories {
mavenCentral()
// gradle plugin repository
maven {
url "https://plugins.gradle.org/m2/"
}
}
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
dependencies {
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: kotlin_version
classpath group: 'gradle.plugin.com.github.johnrengelman', name: 'shadow', version: '7.1.2'
}
}
dependencyLocking {
lockAllConfigurations()
}
apply plugin: 'kotlin'
// build fat jars
apply plugin: 'com.github.johnrengelman.shadow'
// change build output to avoid name clashes with shell script 'build'
buildDir('out')
group = 'edu.kit.compiler'
version = '1.0'
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
implementation 'com.github.ajalt.clikt:clikt:3.4.0'
implementation 'com.github.ajalt.mordant:mordant:2.0.0-beta3'
implementation 'com.github.Firmwehr:jFirm:5b0164832e'
implementation 'net.java.dev.jna:jna:4.5.2'
implementation "com.tylerthrailkill.helpers:pretty-print:2.0.2"
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit5"
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
// define JVM target version
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
jvmTarget = "17"
}
}
java {
targetCompatibility = JavaVersion.VERSION_17
}
jar {
archivesBaseName = "compiler"
manifest {
attributes 'Implementation-Title': 'MiniJavaCompiler',
'Implementation-Version': project.version,
'Main-Class': 'edu.kit.compiler.MainKt'
}
}
shadowJar {
archiveName("compiler-all.jar")
}
test {
useJUnitPlatform()
jvmArgs '-Xss3m'
}
test.dependsOn shadowJar
// ktlint (https://github.com/pinterest/ktlint)
configurations {
ktlint
}
dependencies {
ktlint('com.pinterest:ktlint:0.43.2') {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
}
}
}
task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml", "src/**/*.kt"
}
check.dependsOn ktlint
// does not work with java 16 yet (https://github.com/pinterest/ktlint/issues/1195), switch to java 11 for running this task
task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt"
}