Skip to content

Commit

Permalink
Merge branch 'plugins-kotlin-1.6.10-release' into plugins-release
Browse files Browse the repository at this point in the history
  • Loading branch information
ShreckYe committed Jul 28, 2022
2 parents b113303 + 898b511 commit 8591dba
Show file tree
Hide file tree
Showing 22 changed files with 292 additions and 80 deletions.
6 changes: 3 additions & 3 deletions architecture-common-gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ dependencies {
//api(project(":common-gradle-dependencies"))
implementation(project(":common-gradle-dependencies"))

implementation("org.jetbrains.compose:compose-gradle-plugin:1.2.0-alpha01-dev686")
implementation("org.jetbrains.compose:compose-gradle-plugin:1.1.1")
}

gradlePlugin {
plugins {
val `package` = group as String
fun scriptConventionsPlugin(shortName: String, displayNameAndDescription: String) =
scriptPlugin(`package`, shortName, displayNameAndDescription)
fun scriptConventionsPlugin(shortName: String, displayName: String, description: String = displayName) =
scriptPlugin(`package`, shortName, displayName, description)

scriptConventionsPlugin(
"kotlin-jvm-common-app-conventions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@ class GenerateKotlinJsBrowserWebrootForVertxWebPlugin : Plugin<Project> {
/*val jsBrowserDistributionTask by lazy {
tasks.getByPath(extension.webFrontendProjectPath.get() + ":jsBrowserDistribution") as KotlinWebpack
}*/
val jsBrowserProductionWebpack by lazy {
tasks.getByPath(extension.webFrontendProjectPath.get() + ":jsBrowserProductionWebpack") as KotlinWebpack
val jsBrowserWebpack by lazy {
tasks.getByPath(
extension.webFrontendProjectPath.get() +
if (extension.production.get()) ":jsBrowserProductionWebpack" else ":jsBrowserDevelopmentWebpack"
) as KotlinWebpack
}
val copyJsBrowserDistributionToResourcesWebroot = "copyJsBrowserDistributionToResourcesWebroot"
val browserDistributionResourcesDirectory = buildDir.resolve("browserDistributionResources")

tasks.register<Copy>(copyJsBrowserDistributionToResourcesWebroot) {
dependsOn(jsBrowserProductionWebpack)
from(jsBrowserProductionWebpack.destinationDirectory)
include("*.html", "*.css", "*.js")
dependsOn(jsBrowserWebpack)
from(jsBrowserWebpack.destinationDirectory)
if (extension.production.get())
include("*.html", "*.css", "*.js")
into(browserDistributionResourcesDirectory.resolve("webroot"))
}

Expand All @@ -41,5 +45,6 @@ class GenerateKotlinJsBrowserWebrootForVertxWebPlugin : Plugin<Project> {

interface Extension {
val webFrontendProjectPath: Property<String>
val production: Property<Boolean>
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.huanshankeji

internal val commonVersions = CommonVersions()
internal val commonDependencies = CommonDependencies(commonVersions)
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ dependencies {
implementation(platform(kotlin("bom")))

testImplementation(kotlin("test"))
testImplementation("org.junit.jupiter:junit-jupiter-api:${DefaultVersions.junitJupiter}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${commonVersions.junitJupiter}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")

implementation(CommonDependencies.Kotlinx.Coroutines.core())
testImplementation(CommonDependencies.Kotlinx.Coroutines.test())
implementation(commonDependencies.kotlinx.coroutines.core())
testImplementation(commonDependencies.kotlinx.coroutines.test())
}

tasks.test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ kotlin {
val commonMain by getting {
dependencies {
//implementation(platform(kotlin("bom", kotlinVersion)))
implementation(CommonDependencies.Kotlinx.Coroutines.core())
implementation(commonDependencies.kotlinx.coroutines.core())
}
}

val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(CommonDependencies.Kotlinx.Coroutines.test())
implementation(commonDependencies.kotlinx.coroutines.test())
}
}

Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/ScriptPlugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import org.gradle.api.NamedDomainObjectContainer
import org.gradle.plugin.devel.PluginDeclaration

fun NamedDomainObjectContainer<PluginDeclaration>.scriptPlugin(
`package`: String, shortName: String, displayNameAndDescription: String
`package`: String, shortName: String, displayName: String, description: String = displayName
) =
getByName("$`package`.$shortName") {
displayName = displayNameAndDescription
description = displayNameAndDescription
this.displayName = displayName
this.description = description
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ group = "com.huanshankeji"
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

withSourcesJar()
withJavadocJar()
}
8 changes: 4 additions & 4 deletions buildSrc/src/main/kotlin/plugin-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ plugins {

dependencies {
// Not specifying version can cause build issues when added to a project's buildscript dependencies.
implementation(kotlin("gradle-plugin", "1.6.21"))
implementation(kotlin("gradle-plugin", "1.6.10"))
}

version = "0.1.1"
version = "0.1.8-kotlin-1.6.10"

pluginBundle {
website = "https://github.com/huanshankeji/gradle-plugin"
vcsUrl = "https://github.com/huanshankeji/gradle-plugin.git"
website = "https://github.com/huanshankeji/gradle-common"
vcsUrl = "$website.git"
tags = listOf("kotlin", "multiplatform")
}
4 changes: 3 additions & 1 deletion common-gradle-dependencies/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ plugins {
id("build-dependency-library-conventions")
}

version = "0.1.0-20220520-dev"
// "x.y.z" indicates the version of the way of organizing the code,
// and the date indicates the version when the dependency versions are updated.
version = "0.2.0-20220714-kotlin-1.6.10"
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.huanshankeji

import org.gradle.api.artifacts.dsl.DependencyHandler

// some but not all default dependencies
object CommonDependencies {
object KotlinCommon {
val defaultVersion = DefaultVersions.kotlinCommon
class CommonDependencies(val versions: CommonVersions = CommonVersions()) {
inner class KotlinCommon internal constructor() {
val defaultVersion = versions.kotlinCommon
fun module(module: String, version: String = defaultVersion) =
"com.huanshankeji:kotlin-common-$module:$version"

Expand All @@ -14,88 +16,120 @@ object CommonDependencies {
fun coroutines(version: String = defaultVersion) = module("coroutines", version)
fun exposed(version: String = defaultVersion) = module("exposed", version)

object Ktor {
inner class Ktor internal constructor() {
fun module(module: String, version: String = defaultVersion) =
KotlinCommon.module("ktor-$module", version)
this@KotlinCommon.module("ktor-$module", version)

fun client(version: String = defaultVersion) = module("client", version)
}

val ktor = Ktor()

fun serialization(version: String = defaultVersion) = module("serialization", version)
fun vertx(version: String = defaultVersion) = module("vertx", version)
}

object Kotlinx {
object Coroutines {
val defaultVersion = DefaultVersions.kotlinxCoroutines
val kotlinCommon = KotlinCommon()

inner class Kotlinx internal constructor() {
inner class Coroutines internal constructor() {
val defaultVersion = versions.kotlinxCoroutines
fun module(module: String, version: String = defaultVersion) =
kotlinx("coroutines-$module", version)

fun core(version: String = defaultVersion) = module("core", version)
fun test(version: String = defaultVersion) = module("test", version)
}

object Html {
val defaultVersion = DefaultVersions.kotlinxHtml
val coroutines = Coroutines()

inner class Html internal constructor() {
val defaultVersion = versions.kotlinxHtml
fun module(module: String, version: String = defaultVersion) =
"org.jetbrains.kotlinx:kotlinx-html-$module:$version"
}

object Serialization {
val defaultVersion = DefaultVersions.kotlinxSerialization
val html = Html()

inner class Serialization internal constructor() {
val defaultVersion = versions.kotlinxSerialization
fun module(module: String, version: String = defaultVersion) =
kotlinx("serialization-$module", version)

fun core(version: String = defaultVersion) = module("core", version)
fun protobuf(version: String = defaultVersion) = module("protobuf", version)
fun json(version: String = defaultVersion) = module("json", version)
}

val serialization = Serialization()

fun datetime(version: String = versions.kotlinxDatetime) =
kotlinx("datetime", version)
}

val kotlinx = Kotlinx()


// official libraries from JetBrains

object Exposed {
val defaultVersion = DefaultVersions.exposed
inner class Exposed internal constructor() {
val defaultVersion = versions.exposed
fun module(module: String, version: String = defaultVersion) =
"org.jetbrains.exposed:exposed-$module:$version"

fun core(version: String = defaultVersion) =
module("core", version)
}

object Ktor {
val defaultVersion = DefaultVersions.ktor
val exposed = Exposed()

inner class Ktor internal constructor() {
val defaultVersion = versions.ktor
fun module(module: String, version: String = defaultVersion) =
"io.ktor:ktor-$module:$version"

object Client {
inner class Client internal constructor() {
fun module(module: String, version: String = defaultVersion) =
Ktor.module("client-$module", version)
this@Ktor.module("client-$module", version)

fun core(version: String = defaultVersion) =
module("core", version)
}

val client = Client()
}

val ktor = Ktor()


// others

object Vertx {
val defaultVersion = DefaultVersions.vertx
fun stackDepchain(version: String = defaultVersion) =
"io.vertx:vertx-stack-depchain:$version"
inner class Vertx internal constructor() {
val defaultVersion = versions.vertx

private fun stackDepchain(version: String = defaultVersion) =
moduleWithVersion("stack-depchain", version)

fun module(module: String) =
fun DependencyHandler.platformStackDepchain(version: String = defaultVersion) =
platform(stackDepchain(version))

fun moduleWithoutVersion(module: String) =
"io.vertx:vertx-$module"

fun moduleWithVersion(module: String, version: String = defaultVersion) =
"${moduleWithoutVersion(module)}:$version"
}

object Arrow {
val defaultVersion = DefaultVersions.arrow
val vertx = Vertx()

inner class Arrow internal constructor() {
val defaultVersion = versions.arrow
fun module(module: String, version: String = defaultVersion) =
"io.arrow-kt:arrow-$module:$version"

fun core(version: String = defaultVersion) =
module("core", version)
}

val arrow = Arrow()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.huanshankeji

class CommonVersions(
val kotlin: String = "1.6.10",

val kotlinCommon: String = "0.1.1-kotlin-1.6.10",

val exposed: String = "0.38.2",
val kotlinxCoroutines: String = "1.6.1",
val kotlinxHtml: String = "0.7.5",
val kotlinxSerialization: String = "1.3.2",
val kotlinxDatetime: String = "0.4.0",
val ktor: String = "1.6.8",

val arrow: String = "1.0.1",
val junitJupiter: String = "5.8.2",
val kotest: String = "5.2.3",
val postgreSql: String = "42.3.5",
val slf4j: String = "1.7.36",
val vertx: String = "4.2.7", // TODO: 4.3.0
)

This file was deleted.

24 changes: 22 additions & 2 deletions kotlin-common-gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ plugins {

dependencies {
//api(project(":common-gradle-dependencies"))
//implementation("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0")
}

gradlePlugin {
plugins {
val `package` = group as String
fun scriptConventionsPlugin(shortName: String, displayNameAndDescription: String) =
scriptPlugin(`package`, shortName, displayNameAndDescription)
fun scriptConventionsPlugin(shortName: String, displayName: String, description: String = displayName) =
scriptPlugin(`package`, shortName, displayName, description)

scriptConventionsPlugin(
"kotlin-jvm-common-conventions",
Expand Down Expand Up @@ -38,5 +39,24 @@ gradlePlugin {
"kotlin-multiplatform-jvm-and-js-browser-default-maven-publish-conventions",
"Kotlin Multiplatform conventions with the JVM target and the JS browser target, and with default Maven publish"
)
scriptConventionsPlugin(
"kotlin-jvm-library-sonatype-ossrh-publish-conventions",
"Kotlin/JVM library conventions with Sonatype OSSRH Maven Central publish"
)
scriptConventionsPlugin(
"kotlin-multiplatform-jvm-and-js-browser-sonatype-ossrh-publish-conventions",
"Kotlin Multiplatform conventions with the JVM target and the JS browser target, and with Sonatype OSSRH Maven Central publish"
)

scriptConventionsPlugin(
"jvm-integration-test",
"JVM integration test",
"Adds a JVM integration test source set."
)
scriptConventionsPlugin(
"jvm-test-common-feature-variant",
"JVM test common feature variant",
"Adds a JVM test common feature variant with a source set that depends on `main`."
)
}
}
Loading

0 comments on commit 8591dba

Please sign in to comment.