-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
134 lines (115 loc) · 3.51 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
buildscript {
repositories {
jcenter()
}
}
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
id 'groovy'
id 'application'
id 'distribution'
id "io.gitlab.arturbosch.detekt" version "1.6.0"
}
apply plugin: com.github.dedx.DepInjectPlugin
version = file('version').readLines().get(0)
sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
configurations {
ktlint
}
dependencies {
compile files('lib/dx.jar')
compile group: 'org.ow2.asm', name: 'asm', version: '7.1'
compile group: 'org.ow2.asm', name: 'asm-util', version: '7.1'
compile group: 'org.ow2.asm', name: 'asm-analysis', version: '7.1'
compile group: 'org.ow2.asm', name: 'asm-commons', version: '7.1'
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
compile group: 'com.google.flogger', name: 'flogger', version: '0.4'
runtime group: 'com.google.flogger', name: 'flogger-system-backend', version: '0.4'
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile localGroovy()
ktlint "com.pinterest:ktlint:0.36.0"
}
compileJava {
options.encoding = "UTF-8"
}
jar {
manifest {
attributes('dedx-version': version)
}
exclude('com/dedx/test')
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileGroovy {
dependsOn tasks.getByPath('compileKotlin')
classpath += files(compileKotlin.destinationDir)
}
task runTest(type: JavaExec) {
description "Run Groovy Script"
main = 'com.dedx.test.ScriptMain'
classpath = sourceSets.main.runtimeClasspath
jvmArgs += "-noverify" // avoid: Expecting a stackmap frame
args "${project.rootDir}/resource"
}
application {
mainClassName = 'com.dedx.tools.MainKt'
}
def outputDir = "${project.buildDir}/reports/ktlint/"
def outputFile = "${outputDir}ktlint-checkstyle-report.xml"
task ktlint(type: JavaExec, group: "verification") {
group = "verification"
description = "Runs ktlint."
main = "com.pinterest.ktlint.Main"
classpath = project.configurations.ktlint
args = [
"--reporter=plain",
"--reporter=checkstyle,output=${outputFile}",
"src/main/**/*.kt"
]
}
check.dependsOn ktlint
task ktlineFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style deviations."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args = ["--reporter=plain",
"--reporter=checkstyle,output=${outputFile}",
"-F",
"src/main/**/*.kt"
]
}
detekt {
failFast = true // fail build on any finding
buildUponDefaultConfig = true // preconfigure defaults
config = files("$projectDir/config/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
reports {
xml {
enabled = true // Enable/Disable XML report (default: true)
destination = file("${project.buildDir}/reports/detekt.xml")
}
html {
enabled = true // Enable/Disable HTML report (default: true)
destination = file("${project.buildDir}/reports/detekt.html")
}
txt {
enabled = true
destination = file("${project.buildDir}/reports/detekt.txt")
}
}
}
tasks.detekt.jvmTarget = "1.8"