From 715fdc681fe3fc9f411edceacef02911a4f711f6 Mon Sep 17 00:00:00 2001 From: Shreck Ye Date: Thu, 2 Jun 2022 14:36:07 +0800 Subject: [PATCH 1/3] Update `website` and `vcsUrl` in `pluginBundle` --- buildSrc/src/main/kotlin/plugin-conventions.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts b/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts index 0eee5c0..29da1ff 100644 --- a/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts @@ -11,7 +11,7 @@ dependencies { version = "0.1.5-kotlin-1.6.10-SNAPSHOT" 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") } From 0a1c2112bfb2992a1b9b6216f58a99cb2c23e517 Mon Sep 17 00:00:00 2001 From: Shreck Ye Date: Sat, 11 Jun 2022 21:48:11 +0800 Subject: [PATCH 2/3] Add a `production` property to `GenerateKotlinJsBrowserWebrootForVertxWebPlugin.Extension` and determine whether to filter resources with file extensions with it --- .../GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt | 4 +++- buildSrc/src/main/kotlin/plugin-conventions.gradle.kts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt b/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt index cf9499c..796af86 100644 --- a/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt +++ b/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt @@ -28,7 +28,8 @@ class GenerateKotlinJsBrowserWebrootForVertxWebPlugin : Plugin { tasks.register(copyJsBrowserDistributionToResourcesWebroot) { dependsOn(jsBrowserProductionWebpack) from(jsBrowserProductionWebpack.destinationDirectory) - include("*.html", "*.css", "*.js") + if (extension.production.get()) + include("*.html", "*.css", "*.js") into(browserDistributionResourcesDirectory.resolve("webroot")) } @@ -41,5 +42,6 @@ class GenerateKotlinJsBrowserWebrootForVertxWebPlugin : Plugin { interface Extension { val webFrontendProjectPath: Property + val production: Property } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts b/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts index 29da1ff..a1217ae 100644 --- a/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/plugin-conventions.gradle.kts @@ -8,7 +8,7 @@ dependencies { implementation(kotlin("gradle-plugin", "1.6.10")) } -version = "0.1.5-kotlin-1.6.10-SNAPSHOT" +version = "0.1.6-kotlin-1.6.10-SNAPSHOT" pluginBundle { website = "https://github.com/huanshankeji/gradle-common" From 907b0590d65fd0798ef5db1add1ea919453c9d2c Mon Sep 17 00:00:00 2001 From: Shreck Ye Date: Sat, 11 Jun 2022 22:14:01 +0800 Subject: [PATCH 3/3] Also make the `Copy` task depend on the "jsBrowserDevelopmentWebpack" task when not in production mode in `GenerateKotlinJsBrowserWebrootForVertxWebPlugin` --- ...GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt b/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt index 796af86..df918c7 100644 --- a/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt +++ b/architecture-common-gradle-plugins/src/main/kotlin/com/huanshankeji/GenerateKotlinJsBrowserWebrootForVertxWebPlugin.kt @@ -19,15 +19,18 @@ class GenerateKotlinJsBrowserWebrootForVertxWebPlugin : Plugin { /*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(copyJsBrowserDistributionToResourcesWebroot) { - dependsOn(jsBrowserProductionWebpack) - from(jsBrowserProductionWebpack.destinationDirectory) + dependsOn(jsBrowserWebpack) + from(jsBrowserWebpack.destinationDirectory) if (extension.production.get()) include("*.html", "*.css", "*.js") into(browserDistributionResourcesDirectory.resolve("webroot"))