Skip to content

Commit

Permalink
#55 add the generated resources of the node plugin to the output jar (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
klu2 authored Jul 5, 2022
1 parent 635253c commit a76e6ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.language.jvm.tasks.ProcessResources
import java.io.File

class NodeConfigurePlugin : Plugin<Project> {
Expand Down Expand Up @@ -112,6 +113,10 @@ class NodeConfigurePlugin : Plugin<Project> {
project.tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME).mustRunAfter(build)
project.tasks.getByName(JavaPlugin.JAR_TASK_NAME).dependsOn(build)

// add the output directory to the JAR
project.tasks.named(JavaPlugin.PROCESS_RESOURCES_TASK_NAME, ProcessResources::class.java).get()
.from(build.outputs)

if (NpmHelper.hasScript("test", project.file(NpmHelper.PACKAGE_JSON))) {
val npmTest = project.tasks.create("clfNpmTest", NpmTask::class.java) { t ->
t.group = AutoConfigureGradlePlugin.TASK_GROUP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package io.cloudflight.gradle.autoconfigure.skeleton

import io.cloudflight.gradle.autoconfigure.test.util.ProjectFixture
import io.cloudflight.gradle.autoconfigure.test.util.useFixture
import org.assertj.core.api.Assertions.assertThat
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.Arguments.arguments
import org.junit.jupiter.params.provider.MethodSource
import java.nio.file.Paths
import java.util.stream.Stream
import java.util.zip.ZipFile

data class TestOptions(
val fixtureName: String,
Expand All @@ -16,14 +19,19 @@ data class TestOptions(

class SwaggerConfigurePluginTest {


@ParameterizedTest
@MethodSource("skeletonArguments")
fun `the supplied options are used to configure the Swaggerplugin`(
fun `the skeleton application is build correctly`(
options: TestOptions
): Unit = swaggerFixture(options.fixtureName) {
val result = run("clean", "build")
run(LifecycleBasePlugin.CLEAN_TASK_NAME, LifecycleBasePlugin.BUILD_TASK_NAME)

val uiJar = this.fixtureDir.resolve("skeleton-ui/build/libs/skeleton-ui-1.0.0.jar")
assertThat(uiJar).exists()

val zipFile = ZipFile(uiJar.toFile())
assertThat(zipFile.getEntry("META-INF/MANIFEST.MF")).isNotNull
assertThat(zipFile.getEntry("static/index.html")).isNotNull
}

companion object {
Expand Down

0 comments on commit a76e6ca

Please sign in to comment.