diff --git a/app/core/build.gradle b/app/core/build.gradle index c9905a308..409e1711d 100644 --- a/app/core/build.gradle +++ b/app/core/build.gradle @@ -114,11 +114,6 @@ sourceSets { } test { java { - if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false' || System.getenv('DISABLE_ADDITIONAL_FEATURES') == 'true' - || (project.hasProperty('DISABLE_ADDITIONAL_FEATURES') - && System.getProperty('DISABLE_ADDITIONAL_FEATURES') == 'true')) { - exclude 'stirling/software/proprietary/security/**' - } if (System.getenv('STIRLING_PDF_DESKTOP_UI') == 'false') { exclude 'stirling/software/SPDF/UI/impl/**' } diff --git a/build.gradle b/build.gradle index 1cd58b00e..4059d48fe 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,13 @@ ext { tempJrePath = null } +ext.isSecurityDisabled = { -> + System.getenv('DOCKER_ENABLE_SECURITY') == 'false' || + System.getenv('DISABLE_ADDITIONAL_FEATURES') == 'true' || + (project.hasProperty('DISABLE_ADDITIONAL_FEATURES') && + System.getProperty('DISABLE_ADDITIONAL_FEATURES') == 'true') +} + jar { enabled = false manifest { @@ -222,37 +229,6 @@ licenseReport { outputDir = project.layout.buildDirectory.dir("reports/dependency-license").get().asFile.path } -sourceSets { - main { - java { - if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false' || System.getenv('DISABLE_ADDITIONAL_FEATURES') == 'true' - || (project.hasProperty('DISABLE_ADDITIONAL_FEATURES') - && System.getProperty('DISABLE_ADDITIONAL_FEATURES') == 'true')) { - exclude 'stirling/software/proprietary/security/**' - } - - if (System.getenv('STIRLING_PDF_DESKTOP_UI') == 'false') { - exclude 'stirling/software/SPDF/UI/impl/**' - } - - } - } - - test { - java { - if (System.getenv('DOCKER_ENABLE_SECURITY') == 'false' || System.getenv('DISABLE_ADDITIONAL_FEATURES') == 'true' - || (project.hasProperty('DISABLE_ADDITIONAL_FEATURES') - && System.getProperty('DISABLE_ADDITIONAL_FEATURES') == 'true')) { - exclude 'stirling/software/proprietary/security/**' - } - - if (System.getenv('STIRLING_PDF_DESKTOP_UI') == 'false') { - exclude 'stirling/software/SPDF/UI/impl/**' - } - } - } -} - // Configure the forked spring boot run task to properly delegate to the stirling-pdf module tasks.named('forkedSpringBootRun') { dependsOn ':stirling-pdf:bootRun' @@ -575,9 +551,7 @@ swaggerhubUpload { dependencies { implementation project(':stirling-pdf') implementation project(':common') - if (System.getenv('DISABLE_ADDITIONAL_FEATURES') != 'true' - || (project.hasProperty('DISABLE_ADDITIONAL_FEATURES') - && System.getProperty('DISABLE_ADDITIONAL_FEATURES') != 'true')) { + if (rootProject.ext.isSecurityDisabled()) { implementation project(':proprietary') } @@ -592,7 +566,6 @@ tasks.named("test") { useJUnitPlatform() } - // Make sure all relevant processes depend on writeVersion processResources.dependsOn(writeVersion)