diff --git a/build.gradle.kts b/build.gradle.kts index 1759fe55bc..8b5299ca06 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,8 @@ -import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform +import com.github.psxpaul.task.JavaExecFork +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.liferay.gradle.plugins.node.tasks.ExecutePackageManagerTask import com.palantir.gradle.gitversion.VersionDetails +import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform import groovy.lang.Closure plugins { @@ -32,7 +35,6 @@ repositories { mavenCentral() } -// Use either "getByName" or "create" configurations { create("systemtestImplementation").extendsFrom(getByName("testImplementation")) create("systemtestRuntime").extendsFrom(getByName("testRuntimeClasspath")) @@ -60,12 +62,12 @@ sourceSets { } } -val installFrontend = tasks.register("installFrontend") { +val installFrontend = tasks.register("installFrontend") { setWorkingDir("frontend/") setArgs(listOf("ci")) } -val buildFrontend = tasks.register("buildFrontend") { +val buildFrontend = tasks.register("buildFrontend") { dependsOn(installFrontend) setWorkingDir("frontend/") setArgs(listOf("run", "devbuild")) @@ -100,8 +102,8 @@ tasks.named("processSystemtestResources") { // removed the .configure from tasks.getByName("run").dependsOn(zipReport); tasks.named("run") { - //the second arguments indicates the default value associated with the property. - tasks.getByName("compileJava").mustRunAfter(zipReport) + // The second arguments indicates the default value associated with the property. + compileJava.mustRunAfter(zipReport) args = System.getProperty("args", "").split(" ") systemProperty("version", getRepoSenseVersion()) } @@ -138,11 +140,13 @@ tasks.named("test") { } } +val processResources = tasks.getByName("processResources") + tasks.getByName("shadowJar").dependsOn(zipReport); -tasks.named("shadowJar") { - tasks.getByName("compileJava").mustRunAfter(zipReport) - tasks.getByName("processResources").mustRunAfter(zipReport) +tasks.named("shadowJar") { + compileJava.mustRunAfter(zipReport) + processResources.mustRunAfter(zipReport) archiveFileName.set("RepoSense.jar") destinationDirectory.set(file("${buildDir}/jar/")) @@ -151,7 +155,7 @@ tasks.named("shadowJ } } -tasks.register("lintFrontend") { +tasks.register("lintFrontend") { dependsOn(installFrontend) setWorkingDir("frontend/") setArgs(listOf("run", "lint")) @@ -163,8 +167,8 @@ val checkstyleSystemtest = tasks.getByName("checkstyleSystemtest") tasks.register("checkstyleAll") { dependsOn(checkstyleMain, checkstyleTest, checkstyleSystemtest) - tasks.getByName("checkstyleTest").mustRunAfter("checkstyleMain") - tasks.getByName("checkstyleSystemtest").mustRunAfter("checkstyleTest") + checkstyleTest.mustRunAfter("checkstyleMain") + checkstyleSystemtest.mustRunAfter("checkstyleTest") } tasks.register("environmentalChecks") { @@ -200,9 +204,7 @@ val systemtest = tasks.register("systemtest") { finalizedBy(tasks.getByName("jacocoTestReport")) } -val processResources = tasks.getByName("processResources") - -val serveTestReportInBackground = tasks.register("serveTestReportInBackground") { +val serveTestReportInBackground = tasks.register("serveTestReportInBackground") { description = "Creates a background server process for the test report that is to be used by Cypress" dependsOn(zipReport, compileJava, processResources, copyCypressConfig, copyMainClasses) compileJava.mustRunAfter(zipReport) @@ -219,12 +221,12 @@ val serveTestReportInBackground = tasks.register("installCypress") { +val installCypress = tasks.register("installCypress") { setWorkingDir("frontend/cypress/") setArgs(listOf("ci")) } -tasks.register("cypress") { +tasks.register("cypress") { dependsOn(installCypress, serveTestReportInBackground) tasks.getByName("serveTestReportInBackground").mustRunAfter(installCypress) @@ -232,7 +234,7 @@ tasks.register( setArgs(listOf("run-script", "debug")) } -val frontendTest = tasks.register("frontendTest") { +val frontendTest = tasks.register("frontendTest") { dependsOn(installCypress, serveTestReportInBackground) tasks.getByName("serveTestReportInBackground").mustRunAfter(installCypress) @@ -274,7 +276,6 @@ tasks.register("coverage") tasks.getByName("coverage") { sourceDirectories.from(files(sourceSets.getByName("main").allSource.srcDirs)) classDirectories.from(files(sourceSets.getByName("main").output)) -// executionData.from(files(tasks.getByName("jacocoTestReport").outputs.files)) executionData(fileTree("${buildDir}/jacoco").include("*.exec")) afterEvaluate {