This repository has been archived by the owner on Dec 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
133 lines (110 loc) · 3.05 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
import edu.wpi.first.gradlerio.GradleRIOPlugin
import edu.wpi.first.gradlerio.frc.FRCJavaArtifact
import edu.wpi.first.gradlerio.frc.RoboRIO
import java.text.SimpleDateFormat
plugins {
id "java"
id "idea"
id "org.jetbrains.kotlin.jvm" version "1.2.50"
id "edu.wpi.first.GradleRIO" version "2018.06.21"
}
ext.kotlinVersion = "1.2.50"
ext.sertainVersion = "1.2.1"
ext.ktlintVersion = "0.19.0"
ext.gsonVersion = "2.8.5"
check.dependsOn "ktlint"
compileKotlin.dependsOn "versionTxt"
tasks.whenTaskAdded { task ->
if (task.name == "deploy" || task.name == "deployMain") task.dependsOn "assemble"
}
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
configurations {
ktlint
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compile "org.sert2521.sertain:core:$sertainVersion"
compile "com.google.code.gson:gson:$gsonVersion"
compile wpilib()
compile navx()
compile ctre()
compile pathfinder()
compile openrio.powerup.matchData()
ktlint "com.github.shyiko:ktlint:$ktlintVersion"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
deploy {
targets {
target("roborio", RoboRIO) {
team = getTeamOrDefault(2521)
}
}
artifacts {
artifact("main", FRCJavaArtifact) {
targets << "roborio"
debug = getDebugOrDefault(false)
}
}
}
wpi {
wpilibVersion = "2018.4.1"
ntcoreVersion = "4.1.0"
opencvVersion = "3.2.0"
cscoreVersion = "1.3.0"
wpiutilVersion = "3.2.0"
ctreVersion = "5.5.1.0"
navxVersion = "3.0.348"
shuffleboardVersion = "1.3.1"
}
jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
manifest GradleRIOPlugin.javaManifest("org.sert2521.powerup.Poe")
}
task ktlint(type: JavaExec) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
}
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "HEAD"
standardOutput = stdout
}
return stdout.toString().trim()
}
def getGitBranch = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
standardOutput = stdout
}
return stdout.toString().trim()
}
def getGitFilesChanged = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine "git", "diff", "--name-only", "HEAD"
standardOutput = stdout
}
return stdout.toString().trim().replace("\n", ", ")
}
task versionTxt() {
doLast {
String resourcesDir = "$projectDir/src/main/resources"
new File("$resourcesDir/branch.txt").text = getGitBranch()
new File("$resourcesDir/commit.txt").text = getGitHash()
new File("$resourcesDir/changes.txt").text = getGitFilesChanged()
new File("$resourcesDir/buildtime.txt").text =
new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date())
}
}
wrapper {
gradleVersion = "4.9"
}