-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
76 lines (59 loc) · 1.48 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
plugins {
java
kotlin("jvm") version "1.6.10"
}
repositories {
mavenCentral()
google()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks {
val a1 = create("temp-file") {
description = "This task will crete temp file."
group = "otus"
doLast {
File("temp-file.txt").also {
it.createNewFile()
it.writeText("This is temp file!")
}
println("File is created!")
}
}
withType()
test {
useJUnitPlatform()
}
// named<Test>("test") {
//
// }
val customTask = create<CustomTask>("custom-task")
val jar = withType<org.gradle.jvm.tasks.Jar>()
register<Jar>("fat-jar") {
dependsOn(jar)
manifest {
attributes(
"Main-Class" to "org.sample.MyMain"
)
}
from(
configurations.compileClasspath.get().map {
if (it.isDirectory) it else zipTree(it)
}
)
}
}
val gsonVersion: String by project
val myCustomVersion = property("my_custom_version1", "-1")
println(myCustomVersion)
dependencies {
implementation("com.google.code.gson:gson:$gsonVersion")
testImplementation(kotlin("test-junit"))
}
group = "org.example"
version = "0.1-SNAPSHOT"
fun property(key: String, default: String): String {
return project.properties.getOrDefault(key, default).toString()
}