-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
131 lines (110 loc) · 4.49 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
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
import org.gradle.crypto.checksum.Checksum
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion = "2.0.21"
kotlin("jvm") version kotlinVersion
kotlin("plugin.serialization") version kotlinVersion
kotlin("plugin.compose") version kotlinVersion
id("org.jetbrains.compose") version "1.8.0+check"
id("com.diffplug.spotless") version "6.25.0"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.gradle.crypto.checksum") version "1.4.0"
}
group = "com.example"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}
kotlin { jvmToolchain(21) }
dependencies {
val ktorVersion = "3.0.1"
val kotestVersion = "5.9.1"
val kotlinProcessVersion = "1.5"
val kotlinxSerializationVersion = "1.7.3"
val kamelVersion = "0.4.1"
implementation(compose.desktop.currentOs)
if (System.getenv("CI") == "true") {
implementation(compose.desktop.macos_x64)
implementation(compose.desktop.macos_arm64)
implementation(compose.desktop.windows_x64)
implementation(compose.desktop.linux_x64)
implementation(compose.desktop.linux_arm64)
}
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("com.github.pgreze:kotlin-process:$kotlinProcessVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationVersion")
implementation("com.alialbaali.kamel:kamel-image:$kamelVersion")
implementation("br.com.devsrsouza.compose.icons.jetbrains:feather:1.0.0")
implementation("io.github.oshai:kotlin-logging-jvm:7.0.0")
implementation("org.slf4j:slf4j-simple:2.0.16")
implementation("dev.dirs:directories:26")
implementation("io.github.vinceglb:filekit-compose:0.8.7")
testImplementation("org.junit.jupiter:junit-jupiter:5.11.3")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
}
tasks { test { useJUnitPlatform() } }
compose {
desktop {
application {
mainClass = "MainKt"
nativeDistributions {
packageName = "yt-dlp-compose"
packageVersion = "1.0.0"
targetFormats(
TargetFormat.Deb,
TargetFormat.Dmg,
TargetFormat.Exe,
TargetFormat.Msi,
)
// lwjgl3 needs sun.misc.Unsafe to be included in the bundled JRE
modules("jdk.unsupported")
}
}
}
}
spotless {
kotlin { ktfmt().kotlinlangStyle() }
kotlinGradle { ktfmt().kotlinlangStyle() }
}
tasks {
withType<JavaCompile> { targetCompatibility = JavaVersion.VERSION_17.toString() }
withType<KotlinCompile> { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } }
register("nativeDistribution") {
dependsOn("packageDistributionForCurrentOS", "createChecksumsForNativeDistributions")
}
register<Checksum>("createChecksumsForNativeDistributions") {
dependsOn("packageDistributionForCurrentOS")
inputFiles.setFrom(
layout.buildDirectory.dir("compose/binaries/main/deb"),
layout.buildDirectory.dir("compose/binaries/main/dmg"),
layout.buildDirectory.dir("compose/binaries/main/exe"),
layout.buildDirectory.dir("compose/binaries/main/msi"),
)
outputDirectory = layout.buildDirectory.dir("checksums")
checksumAlgorithm = Checksum.Algorithm.SHA256
appendFileNameToChecksum = true
}
jar { manifest { attributes("Main-Class" to "MainKt") } }
shadowJar {
destinationDirectory = layout.buildDirectory.dir("fatJar")
archiveFileName = "yt-dlp-compose.jar"
finalizedBy("createChecksumsForFatJar")
}
register<Checksum>("createChecksumsForFatJar") {
dependsOn("shadowJar")
inputFiles.setFrom(
layout.buildDirectory.dir("fatJar"),
)
outputDirectory = layout.buildDirectory.dir("checksums")
checksumAlgorithm = Checksum.Algorithm.SHA256
appendFileNameToChecksum = true
}
}