diff options
-rw-r--r-- | build.gradle | 46 | ||||
-rw-r--r-- | buildSrc/src/main/groovy/org.sonar.build/BlackBoxTest.groovy | 25 |
2 files changed, 66 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle index f9d738d5f87..74e1af5bf86 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ import groovy.json.JsonOutput +import org.sonar.build.BlackBoxTest import static org.gradle.api.JavaVersion.VERSION_17 @@ -211,6 +212,15 @@ subprojects { srcDirs += ['src/it/java'] } } + + bbt { + resources { + srcDirs = ['src/bbt/resources'] + } + java { + srcDirs += ['src/bbt/java'] + } + } } // Central place for definition dependency versions and exclusions. @@ -407,10 +417,16 @@ subprojects { } } - // global exclusions - configurations.all { - // do not conflict with com.sun.mail:javax.mail - exclude group: 'javax.mail', module: 'mail' + configurations { + bbtCompile.extendsFrom testCompile + bbtRuntime.extendsFrom testRuntime + bbtImplementation.extendsFrom testImplementation + + // global exclusions + all { + // do not conflict with com.sun.mail:javax.mail + exclude group: 'javax.mail', module: 'mail' + } } tasks.withType(Javadoc) { @@ -586,7 +602,6 @@ subprojects { tasks.withType(Test) { - configurations { utMonitoring } @@ -598,6 +613,27 @@ subprojects { } } + tasks.withType(BlackBoxTest) { + jacoco.enabled = false + testClassesDirs = sourceSets.bbt.output.classesDirs + classpath = sourceSets.bbt.runtimeClasspath + + configurations { + includeInTestResources + } + + dependencies { + bbtRuntimeOnly 'com.microsoft.sqlserver:mssql-jdbc' + bbtRuntimeOnly 'com.oracle.database.jdbc:ojdbc11' + bbtRuntimeOnly 'org.postgresql:postgresql' + bbtRuntimeOnly project(':plugins:sonar-xoo-plugin') + + bbtImplementation 'org.sonarsource.orchestrator:sonar-orchestrator' + bbtImplementation project(":sonar-testing-harness") + bbtImplementation project(":private:it-common") + } + } + if (isNightlyBuild) { tasks.withType(Test) { doFirst { diff --git a/buildSrc/src/main/groovy/org.sonar.build/BlackBoxTest.groovy b/buildSrc/src/main/groovy/org.sonar.build/BlackBoxTest.groovy new file mode 100644 index 00000000000..e80468a1dc5 --- /dev/null +++ b/buildSrc/src/main/groovy/org.sonar.build/BlackBoxTest.groovy @@ -0,0 +1,25 @@ +package org.sonar.build + +import org.gradle.api.tasks.testing.Test + +class BlackBoxTest extends Test { + BlackBoxTest() { + def branch = System.getenv('GITHUB_BRANCH') + if (branch != null && Set.of("branch-nightly-build", "master").contains(branch)) { + jvmArgs("-javaagent:" + System.getenv('ASPECTJ_WEAVER_PATH')) + } + + systemProperty 'java.awt.headless', 'true' + systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') + + if (!project.version.endsWith("-SNAPSHOT")) { + systemProperty 'sonar.runtimeVersion', project.version + } + + testLogging { + events "skipped", "failed" + showStandardStreams = true + exceptionFormat 'full' + } + } +} |