Set `top` alignment in `MainView` to a fixed value for consistent rendering. Enabled source maps with embedded source content in the JS compiler for improved debugging. Adjusted build script directory paths and formatting for better clarity and maintainability.
183 lines
4.3 KiB
Kotlin
183 lines
4.3 KiB
Kotlin
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
|
|
import java.nio.file.Files
|
|
import java.nio.file.Paths
|
|
|
|
buildscript {
|
|
apply(from = "common.gradle.kts")
|
|
apply(from = "version.gradle.kts")
|
|
}
|
|
|
|
plugins {
|
|
kotlin("multiplatform")
|
|
id("maven-publish")
|
|
application
|
|
}
|
|
|
|
kotlin {
|
|
js {
|
|
compilerOptions {
|
|
target.set("es2015")
|
|
sourceMap.set(true)
|
|
sourceMapEmbedSources.set(JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS)
|
|
}
|
|
//useEsModules()
|
|
//useCommonJs()
|
|
|
|
binaries.executable()
|
|
browser {
|
|
commonWebpackConfig {
|
|
outputFileName = "vst-chip-worklet-ui.js"
|
|
sourceMaps = true
|
|
devtool = "inline-source-map"
|
|
}
|
|
|
|
distribution {
|
|
outputDirectory.set(File("$projectDir/web1"))
|
|
}
|
|
}
|
|
}
|
|
/*
|
|
@OptIn(ExperimentalWasmDsl::class)
|
|
wasmJs {
|
|
binaries.executable()
|
|
browser{
|
|
distribution {
|
|
outputDirectory.set(File("$projectDir/web/"))
|
|
}
|
|
}
|
|
|
|
mavenPublication {
|
|
groupId = group as String
|
|
pom { name = "${project.name}-wasm-js" }
|
|
}
|
|
}
|
|
*/
|
|
jvm {
|
|
withJava()
|
|
}
|
|
|
|
sourceSets {
|
|
val commonMain by getting {
|
|
dependencies {
|
|
api("nl.astraeus:vst-ui-base:2.2.3")
|
|
implementation("nl.astraeus:midi-arrays:0.3.6")
|
|
}
|
|
}
|
|
val jsMain by getting
|
|
val jsTest by getting {
|
|
dependencies {
|
|
implementation(kotlin("test-js"))
|
|
}
|
|
}
|
|
val jvmMain by getting
|
|
}
|
|
}
|
|
|
|
application {
|
|
mainClass.set("nl.astraeus.vst.chip.MainKt")
|
|
}
|
|
|
|
tasks.register<Copy>("buildJS") {
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
dependsOn("audio-worklet:jsBrowserDevelopmentExecutableDistribution")
|
|
dependsOn("jsBrowserDevelopmentExecutableDistribution")
|
|
|
|
from(layout.projectDirectory.dir("web1"))
|
|
into(layout.projectDirectory.dir("web"))
|
|
|
|
from(layout.projectDirectory.dir("web2"))
|
|
into(layout.projectDirectory.dir("web"))
|
|
}
|
|
tasks.register<Copy>("buildJSProd") {
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
|
dependsOn("audio-worklet:jsBrowserDistribution")
|
|
dependsOn("jsBrowserDistribution")
|
|
|
|
from(layout.projectDirectory.dir("web1"))
|
|
into(layout.projectDirectory.dir("web"))
|
|
|
|
from(layout.projectDirectory.dir("web2"))
|
|
into(layout.projectDirectory.dir("web"))
|
|
}
|
|
|
|
/* Hardcoded deploy configuration */
|
|
|
|
val deployDirectory = "vst-chip.midi-vst.com"
|
|
|
|
tasks.register<Copy>("unzipDistribution") {
|
|
mustRunAfter("removeSymbolicLink")
|
|
val zipDir = layout.projectDirectory.dir("build/distributions")
|
|
val zipFile = zipDir.file("${project.name}-${project.version}.zip")
|
|
|
|
val outputDir = file("/home/rnentjes/www/${deployDirectory}")
|
|
|
|
from(zipTree(zipFile))
|
|
into(outputDir)
|
|
}
|
|
|
|
tasks.register("createSymbolicLink") {
|
|
mustRunAfter("unzipDistribution")
|
|
doLast {
|
|
val targetDir =
|
|
Paths.get("/home/rnentjes/www/${deployDirectory}/${project.name}-${project.version}") // Directory to link to
|
|
val symlink =
|
|
Paths.get("/home/rnentjes/www/${deployDirectory}/${project.name}") // Path for the symbolic link
|
|
|
|
if (!Files.exists(targetDir)) {
|
|
throw IllegalArgumentException("Target directory does not exist: $targetDir")
|
|
}
|
|
|
|
if (Files.exists(symlink)) {
|
|
println("Symbolic link already exists: $symlink")
|
|
} else {
|
|
Files.createSymbolicLink(symlink, targetDir)
|
|
println("Symbolic link created: $symlink -> $targetDir")
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register<Copy>("copyWeb") {
|
|
val webDir = layout.projectDirectory.dir("web")
|
|
val outputDir = file("/home/rnentjes/www/${deployDirectory}/web")
|
|
|
|
from(webDir)
|
|
into(outputDir)
|
|
}
|
|
|
|
tasks.named<Task>("build") {
|
|
dependsOn("generateVersionProperties")
|
|
}
|
|
|
|
tasks.named("kotlinUpgradeYarnLock") {
|
|
mustRunAfter("clean")
|
|
}
|
|
|
|
tasks.named("build") {
|
|
mustRunAfter("kotlinUpgradeYarnLock")
|
|
}
|
|
|
|
tasks.named("build") {
|
|
mustRunAfter("kotlinUpgradeYarnLock")
|
|
}
|
|
|
|
tasks.named("copyWeb") {
|
|
mustRunAfter("build")
|
|
}
|
|
|
|
tasks.register("removeSymbolicLink") {
|
|
mustRunAfter("build")
|
|
doLast {
|
|
delete(layout.projectDirectory.file("/home/rnentjes/www/${deployDirectory}/${project.name}"))
|
|
}
|
|
}
|
|
|
|
tasks.register("deploy") {
|
|
dependsOn("clean")
|
|
dependsOn("kotlinUpgradeYarnLock")
|
|
dependsOn("build")
|
|
dependsOn("copyWeb")
|
|
dependsOn("removeSymbolicLink")
|
|
dependsOn("unzipDistribution")
|
|
dependsOn("createSymbolicLink")
|
|
}
|