-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
121 lines (99 loc) · 3.34 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
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'java'
id 'distribution'
id 'com.github.johnrengelman.shadow' version '7.1.0'
id 'com.apollographql.apollo' version '2.5.11'
id 'org.barfuin.gradle.taskinfo' version '1.3.1' // For the `tiTree <task>` task
// The Snyk plugin defines two tasks: snyk-test, snyk-monitor
// https://snyk.io/blog/gradle-plugin-by-snyk-gradle-dependencies-scanning/
id 'io.snyk.gradle.plugin.snykplugin' version '0.4'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.apollographql.apollo:apollo-runtime:2.5.11'
compileOnly 'org.jetbrains:annotations:23.0.0'
testImplementation 'org.assertj:assertj-core:3.21.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
testImplementation 'org.mockito:mockito-junit-jupiter:4.2.0'
testImplementation 'org.mockito:mockito-inline:4.2.0'
}
def appVersion = 'dev' // Must be either "dev" or major.minor.patch
// Use Java 17 for all compilation, test and javadoc tasks,
// even if version 18+ is installed and the default
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
// Enable some javac diagnostics
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
// Configure/tweak tasks
distTar.enabled(false)
distributions {
main {
distributionBaseName = "$project.name-$appVersion"
contents {
from shadowJar.archiveFile
from 'config'
from 'README.md'
}
}
}
installDist {
// Install on the dev machine the build is running on (macOS is assumed)
destinationDir = new File("${System.getenv("HOME")}/Applications/Mixcaster")
def settingsFile = new File(destinationDir.getPath() + '/mixcaster-settings.properties')
def existingSettings = settingsFile.exists() ? settingsFile.text : null
def watchFile = new File(destinationDir.getPath() + '/mixcaster-watches.conf')
def existingWatches = watchFile.exists() ? watchFile.text : null
doLast {
// Restore existing configuration (the config files were just overwritten)
if (existingSettings != null ) {
settingsFile.text = existingSettings
}
if (existingWatches != null) {
watchFile.text = existingWatches
}
exec {
// If our launchd agent already exists, it's removed before installing the new one
commandLine "${destinationDir}/mixcaster", "-install"
}
}
}
jar {
manifest {
attributes (
'Main-Class': 'jakshin.mixcaster.Main',
'Implementation-Version': appVersion
)
}
}
shadowJar {
archiveFileName = "${project.name.toLowerCase()}.jar"
minimize()
}
snyk {
// Also need to set the $SNYK_TOKEN environment variable
severity = 'low'
autoDownload = true
autoUpdate = true
}
test {
useJUnitPlatform()
// Avoid a warning message printed by Java every time tests are run, since adding our
// mockito-inline dependency ("Sharing is only supported for boot loader classes...")
jvmArgs '-Xshare:off'
}
// Use "shadowJar" in place of "jar"
assemble.dependsOn(shadowJar)
distTar.dependsOn(shadowJar)
distZip.dependsOn(shadowJar)
installDist.dependsOn(shadowJar)
jar.enabled(false)