Skip to content

Commit

Permalink
Fixed issues preventing buildSrc from running correctly and resolve…
Browse files Browse the repository at this point in the history
…d plugin version conflicts
  • Loading branch information
abouzerda committed Aug 14, 2024
1 parent 9f35222 commit 096d094
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 109 deletions.
93 changes: 1 addition & 92 deletions bgw-gui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,92 +1 @@
plugins {
val kotlinVersion = "2.0.0"
kotlin("multiplatform")
kotlin("plugin.serialization") version kotlinVersion
application
`maven-publish`
}

group = "tools.aqua"
version = "1.0-SNAPSHOT"

repositories {
jcenter()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}

kotlin {
jvmToolchain(11)
jvm {
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js(IR) {
binaries.executable()
browser {
commonWebpackConfig {
cssSupport {
enabled.set(true)
}
}
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-server-core:2.3.11")
implementation("io.ktor:ktor-server-netty:2.3.11")
implementation("io.ktor:ktor-server-websockets:2.3.11")
implementation("io.ktor:ktor-server-html-builder-jvm:2.3.11")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
implementation("me.friwi:jcefmaven:122.1.10")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.3.1-pre.758")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.3.1-pre.758")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.11.4-pre.758")
}
}
val jsTest by getting
}
}

application {
mainClass.set("tools.aqua.bgw.main.MainKt")
}

tasks.named<Copy>("jvmProcessResources") {
val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
from(jsBrowserDistribution)
}

tasks.named<JavaExec>("run") {
dependsOn(tasks.named<Jar>("jvmJar"))
classpath(tasks.named<Jar>("jvmJar"))
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "tools.aqua"
artifactId = "bgw-gui"
version = "1.0-SNAPSHOT"
from(components["kotlin"])
}
}
}
plugins { id("tools.aqua.bgw.multiplatform-conventions") }
11 changes: 7 additions & 4 deletions bgw-net/bgw-net-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

plugins { `kotlin-dsl`.version("3.1.0") }
plugins { `kotlin-dsl` }

repositories {
gradlePluginPortal()
Expand Down Expand Up @@ -44,6 +44,11 @@ dependencies {
implementation(libs.gradle.taskTree)
implementation(libs.gradle.vaadin)

implementation(
"org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:2.0.0")
implementation(
"org.jetbrains.kotlin.plugin.serialization:org.jetbrains.kotlin.plugin.serialization.gradle.plugin:2.0.0")

// black magic from https://github.com/gradle/gradle/issues/15383
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* Copyright 2024 The BoardGameWork Authors
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
application
`maven-publish`
id("io.gitlab.arturbosch.detekt")
}

group = "tools.aqua"

version = "1.0-SNAPSHOT"

repositories {
jcenter()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}

kotlin {
jvmToolchain(11)
jvm {
withJava()
testRuns["test"].executionTask.configure { useJUnitPlatform() }
}
js(IR) {
binaries.executable()
browser { commonWebpackConfig { cssSupport { enabled.set(true) } } }
}
sourceSets {
val commonMain by getting {
dependencies { implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0") }
}
val commonTest by getting { dependencies { implementation(kotlin("test")) } }
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-server-core:2.3.11")
implementation("io.ktor:ktor-server-netty:2.3.11")
implementation("io.ktor:ktor-server-websockets:2.3.11")
implementation("io.ktor:ktor-server-html-builder-jvm:2.3.11")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")
implementation("me.friwi:jcefmaven:122.1.10")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.3.1-pre.758")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.3.1-pre.758")
implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.11.4-pre.758")
}
}
val jsTest by getting
}
}

application { mainClass.set("tools.aqua.bgw.main.MainKt") }

tasks.named<Copy>("jvmProcessResources") {
val jsBrowserDistribution = tasks.named("jsBrowserDistribution")
from(jsBrowserDistribution)
}

tasks.named<JavaExec>("run") {
dependsOn(tasks.named<Jar>("jvmJar"))
classpath(tasks.named<Jar>("jvmJar"))
}

publishing {
publications {
create<MavenPublication>("maven") {
groupId = "tools.aqua"
artifactId = "bgw-gui"
version = "1.0-SNAPSHOT"
from(components["kotlin"])
}
}
}
18 changes: 9 additions & 9 deletions contrib/detekt-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ console-reports:
- 'FileBasedFindingsReport'

comments:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Mostly enabled. Rationale: maintenance issues
AbsentOrWrongFileLicense:
Expand All @@ -39,7 +39,7 @@ comments:
active: true

complexity:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Mostly disabled. Rationale: better suited for code review
ComplexCondition:
Expand Down Expand Up @@ -72,7 +72,7 @@ complexity:
active: false

coroutines:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Mostly enabled. Rationale: indicative of errors
GlobalCoroutineUsage:
Expand All @@ -88,7 +88,7 @@ coroutines:
active: true

empty-blocks:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Completely enabled. Rationale: indicative of errors
EmptyCatchBlock:
Expand Down Expand Up @@ -124,7 +124,7 @@ empty-blocks:
active: true

exceptions:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Mostly enabled. Rationale: indicative of errors
active: true
Expand Down Expand Up @@ -159,7 +159,7 @@ exceptions:
active: true

naming:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Mostly enabled. Rationale: principle of the least surprise
active: true
Expand Down Expand Up @@ -214,7 +214,7 @@ naming:
active: true

performance:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Completely enabled. Rationale: indicative of errors
active: true
Expand All @@ -228,7 +228,7 @@ performance:
active: true

potential-bugs:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Completely enabled. Rationale: indicative of errors
active: true
Expand Down Expand Up @@ -305,7 +305,7 @@ potential-bugs:
active: true

style:
excludes: ['**/bgw-docs-examples/**']
excludes: ['**/bgw-docs-examples/**', '**/bgw-net-server/**']

# Partially enabled to complement Spotless. Rationale: helps consistency
active: true
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Platforms

kotlin = "1.7.10"
kotlin = "1.9.10"
spring = "2.7.14"
vaadin = "23.1.6"

Expand Down Expand Up @@ -77,7 +77,7 @@ vaadin-bom = { group = "com.vaadin", name = "vaadin-bom", version.ref = "vaadin"
# Gradle Plugins

gradle-dokka = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "kotlin" }
gradle-kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version = "2.0.0" }
gradle-kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
gradle-kotlin-allopen = { group = "org.jetbrains.kotlin", name = "kotlin-allopen", version.ref = "kotlin" }
gradle-kotlin-noarg = { group = "org.jetbrains.kotlin", name = "kotlin-noarg", version.ref = "kotlin" }

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
rootProject.name = "bgw"

include(
"bgw-gui",
"bgw-docs",
"bgw-examples:bgw-docs-examples",
"bgw-examples:bgw-maumau-example",
"bgw-examples:bgw-sudoku-example",
"bgw-examples:bgw-tetris-example",
"bgw-gui",
"bgw-net:bgw-net-client",
"bgw-net:bgw-net-common",
"bgw-net:bgw-net-server",
Expand Down

0 comments on commit 096d094

Please sign in to comment.