fix(build): make frontend resources optional in test runs
- Gradle packaging: - stop treating the default frontend dist path as a required input during `processResources` - include frontend assets only when the resolved dist directory actually exists - keep support for the explicit `-PfrontendDistDir=...` path used by the Docker build - CI stability: - restore backend-only Gradle runs in the reusable test workflow without requiring an Angular build first - prevent `processResources` from failing before backend tests execute when `booklore-ui/dist/...` is absent - Validation: - run `processResources` successfully with no frontend dist present - run `processResources` with a temporary `frontendDistDir` and confirm `static/index.html` is packaged - pass `git diff --check`
This commit is contained in:
@@ -10,8 +10,9 @@ plugins {
|
|||||||
group = 'org.booklore'
|
group = 'org.booklore'
|
||||||
version = '0.0.1-SNAPSHOT'
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
def frontendDistDir = providers.gradleProperty('frontendDistDir')
|
def defaultFrontendDistDir = file("${rootDir}/../booklore-ui/dist/booklore/browser")
|
||||||
.orElse("${rootDir}/../booklore-ui/dist/booklore/browser")
|
def configuredFrontendDistDir = providers.gradleProperty('frontendDistDir')
|
||||||
|
.map { file(it) }
|
||||||
|
|
||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
@@ -145,14 +146,19 @@ jacocoTestReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('processResources') {
|
tasks.named('processResources') {
|
||||||
def frontendResourcesDir = providers.provider { file(frontendDistDir.get()) }
|
def frontendResourcesDir = configuredFrontendDistDir
|
||||||
inputs.dir(frontendResourcesDir)
|
.orElse(providers.provider { defaultFrontendDistDir })
|
||||||
.withPropertyName('frontendDistDir')
|
.get()
|
||||||
.optional()
|
|
||||||
|
inputs.property('frontendDistDir', frontendResourcesDir.absolutePath)
|
||||||
|
inputs.property('hasFrontendResources', frontendResourcesDir.exists())
|
||||||
|
|
||||||
|
if (frontendResourcesDir.exists()) {
|
||||||
from(frontendResourcesDir) {
|
from(frontendResourcesDir) {
|
||||||
into 'static'
|
into 'static'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bootRun {
|
bootRun {
|
||||||
def debug = System.getenv('REMOTE_DEBUG_ENABLED')
|
def debug = System.getenv('REMOTE_DEBUG_ENABLED')
|
||||||
|
|||||||
Reference in New Issue
Block a user