From: Simon Brandhof Date: Sun, 18 Mar 2018 21:13:43 +0000 (+0100) Subject: Single Gradle build for SQ and core plugins X-Git-Tag: 7.5~1520 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0a9d9db7f85e7d45b4ffa319d262231f311641f9;p=sonarqube.git Single Gradle build for SQ and core plugins --- diff --git a/.travis.yml b/.travis.yml index 1b1eb237819..6886fd62b68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,5 +28,5 @@ before_cache: notifications: email: false webhooks: - - secure: "CrwnSt40WNegJOkgDOaCwUwP9fCgx68pYQWtcZnj4+bRF7kFuFI+EUFuf7G29oPOf9CjmFVvZ+mS/ZJ9AqtjfWh/Q9f4Zsv9BBfOmTgUcidYp8+hQljeesEXwi2Mqfa2JeRysje4xu2p8b52h+apbbQ2Y2FQsP4uwmj1LEpP32U=" + - secure: "j09yiJk87kDbkAFWR9s2hJrYfIuTMpbprrnLuEiiZRkkHMGWBXrvj0oRVv89CAhOR/JU6u0n134VKZjCXLCpHIh/XVh+IvAFTHj2dXVSJNbssc0qdGvZthSSvxL7xQcfRmA3f37ZYnSJ3Mr1vCDEtkVyVd87nPg0v2OMKE1Wk+jxmNXrkShsZ3mMGCjwwQwNdSCMVwBKToCbqLbJ4r5EOlyjDNaKbRARxEQ7zojHkVMWWeEhOACLqm2Qh8v5YvetWb9/6wKtnbchbMPzWlcxRwv88XhHRs4tIf3zHIdlG4e1AVqTWChkxXnLAB3a7oiNSBNytldHaf9iyyvtKkDSufo+8iNqShLwxO8aBYUPDu0nOCCl/8z586XdaP5oKz2QrdXzoe24E9uxlK9gkuCR7uUCmWUQDrmf6jHu5co6VXeYsq9sHA/KK+OusQuN9IYvuEyOeFufWUJF3n3Uz6K1VVwQjdfMtCqdwM0CeZL9nNOIHZVbR3WBp/pUQnnuvF8Zj+NllBl5N9ProdHZqCVietlBonqNI0pV1x7HriFV+tU1PoqYIa1Cz/tSUxn9mOYGf85Rmho0CP4ZtTS3UgyQerl4BYPWkFs8WfcqipjPSzwGbQLBlCANDbPPbeo/VnXz9ExSFjQcII916DEMR3kb6kY8cduKYqdbZ52483agblY=" on_start: always diff --git a/build.gradle b/build.gradle index 3057c480198..1e4502d2448 100644 --- a/build.gradle +++ b/build.gradle @@ -170,7 +170,7 @@ subprojects { exclude 'xerces:xmlParserAPIs' exclude 'xerces:xercesImpl' } - dependencySet(group: 'org.eclipse.jetty', version: '9.4.8.v20171121') { + dependencySet(group: 'org.eclipse.jetty', version: '9.3.6.v20151106') { entry 'jetty-proxy' entry 'jetty-server' entry 'jetty-servlet' @@ -224,10 +224,6 @@ subprojects { from sourceSets.main.allSource } - javadoc { - options.encoding = 'UTF-8' - } - task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir @@ -291,7 +287,7 @@ artifactory { } defaults { properties = [ - 'build.name': 'sonarqube', + 'build.name': 'sonar-enterprise', 'build.number': (System.getenv('BUILD_ID') ?: System.getenv('BUILD_NUMBER')), 'pr.branch.target': System.getenv('PULL_REQUEST_BRANCH_TARGET'), 'pr.number': System.getenv('PULL_REQUEST_NUMBER'), @@ -306,7 +302,7 @@ artifactory { } clientConfig.info.setBuildNumber(System.getenv('BUILD_NUMBER')) // Define the artifacts to be deployed to https://sonarsource.bintray.com on releases - clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH', "${project.group}:sonar-application:zip") + clientConfig.info.addEnvironmentProperty('ARTIFACTS_TO_PUBLISH', "${project.group}:sonar-application:zip,com.sonarsource.governance:sonar-governance-plugin:jar,com.sonarsource.developer:sonar-developer-plugin:jar,com.sonarsource.ha:sonar-ha-plugin:jar,com.sonarsource.branch:sonar-branch-plugin:jar") // The name of this variable is important because it's used by the delivery process when extracting version from Artifactory build info. clientConfig.info.addEnvironmentProperty('PROJECT_VERSION', "${version}") } diff --git a/server/sonar-db-core/build.gradle b/server/sonar-db-core/build.gradle index bfb6921b78b..8a4ee3042d6 100644 --- a/server/sonar-db-core/build.gradle +++ b/server/sonar-db-core/build.gradle @@ -24,7 +24,6 @@ dependencies { compileOnly 'com.google.code.findbugs:jsr305' testCompile 'com.google.code.findbugs:jsr305' - testCompile 'com.h2database:h2' testCompile 'com.microsoft.sqlserver:mssql-jdbc' testCompile 'com.oracle.jdbc:ojdbc8' testCompile 'junit:junit' @@ -35,13 +34,19 @@ dependencies { testCompile 'org.postgresql:postgresql' testCompile 'org.sonarsource.orchestrator:sonar-orchestrator' testCompile project(':sonar-testing-harness') + + testRuntime 'com.h2database:h2' + testRuntime 'com.microsoft.sqlserver:mssql-jdbc' + testRuntime 'com.oracle.jdbc:ojdbc8' + testRuntime 'mysql:mysql-connector-java' + testRuntime 'org.postgresql:postgresql' } task createDB(type:JavaExec) { main = 'org.sonar.db.CreateDb' classpath = sourceSets.test.runtimeClasspath systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') - systemProperty 'sonar.runtimeVersion', version + systemProperty 'sonar.runtimeVersion', System.getProperty('sonar.runtimeVersion') systemProperty 'orchestrator.artifactory.apiKey', System.getProperty('orchestrator.artifactory.apiKey') systemProperty 'orchestrator.artifactory.repositories', System.getProperty('orchestrator.artifactory.repositories') } @@ -56,6 +61,14 @@ task testJar(type: Jar) { from sourceSets.test.output } +configurations { + tests +} + +artifacts { + tests testJar +} + artifactoryPublish.skip = false // Used by core plugins diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/CoreTestDb.java b/server/sonar-db-core/src/test/java/org/sonar/db/CoreTestDb.java index bcbd1b42e03..6b963d27e31 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/CoreTestDb.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/CoreTestDb.java @@ -43,6 +43,7 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.db.dialect.H2; import org.sonar.process.logging.LogbackHelper; +import static org.apache.commons.lang.StringUtils.isNotEmpty; import static org.sonar.process.ProcessProperties.Property.JDBC_USERNAME; /** @@ -73,7 +74,7 @@ class CoreTestDb { CoreTestDb(@Nullable String schemaPath) { if (db == null) { Settings settings = new MapSettings().addProperties(System.getProperties()); - if (settings.hasKey("orchestrator.configUrl")) { + if (isNotEmpty(settings.getString("orchestrator.configUrl"))) { loadOrchestratorSettings(settings); } String login = settings.getString(JDBC_USERNAME.getKey()); @@ -176,7 +177,7 @@ class CoreTestDb { settings.setProperty(entry.getKey(), interpolatedValue); } } catch (Exception e) { - throw new IllegalStateException(e); + throw new IllegalStateException("Cannot load Orchestrator properties from:" + url, e); } finally { IOUtils.closeQuietly(input); } diff --git a/server/sonar-db-dao/build.gradle b/server/sonar-db-dao/build.gradle index 24a45f382e1..98149ad92e5 100644 --- a/server/sonar-db-dao/build.gradle +++ b/server/sonar-db-dao/build.gradle @@ -13,7 +13,6 @@ dependencies { compileOnly 'com.google.code.findbugs:jsr305' - testCompile 'com.h2database:h2' testCompile 'com.tngtech.java:junit-dataprovider' testCompile 'junit:junit' testCompile 'org.assertj:assertj-core' @@ -24,11 +23,16 @@ dependencies { testCompile project(':server:sonar-db-core').sourceSets.test.output testCompileOnly 'com.google.code.findbugs:jsr305' + + testRuntime 'com.h2database:h2' + testRuntime 'com.microsoft.sqlserver:mssql-jdbc' + testRuntime 'com.oracle.jdbc:ojdbc8' + testRuntime 'mysql:mysql-connector-java' + testRuntime 'org.postgresql:postgresql' } test { - if (System.hasProperty('orchestrator.configUrl')) - systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') + systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') } task testJar(type: Jar) { @@ -36,6 +40,14 @@ task testJar(type: Jar) { from sourceSets.test.output } +configurations { + tests +} + +artifacts { + tests testJar +} + artifactoryPublish.skip = false // Used by core plugins diff --git a/server/sonar-db-migration/build.gradle b/server/sonar-db-migration/build.gradle index 2198734c3a1..f26ceaf8255 100644 --- a/server/sonar-db-migration/build.gradle +++ b/server/sonar-db-migration/build.gradle @@ -13,7 +13,6 @@ dependencies { compileOnly 'com.google.code.findbugs:jsr305' testCompile 'com.google.code.findbugs:jsr305' - testCompile 'com.h2database:h2' testCompile 'com.tngtech.java:junit-dataprovider' testCompile 'junit:junit' testCompile 'org.assertj:assertj-core' @@ -21,10 +20,15 @@ dependencies { testCompile 'org.mockito:mockito-core' testCompile project(':sonar-testing-harness') testCompile project(':server:sonar-db-core').sourceSets.test.output + + testRuntime 'com.h2database:h2' + testRuntime 'com.microsoft.sqlserver:mssql-jdbc' + testRuntime 'com.oracle.jdbc:ojdbc8' + testRuntime 'mysql:mysql-connector-java' + testRuntime 'org.postgresql:postgresql' } test { - if (System.hasProperty('orchestrator.configUrl')) systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl') } diff --git a/server/sonar-server/build.gradle b/server/sonar-server/build.gradle index 34995b84bf8..251f852de2b 100644 --- a/server/sonar-server/build.gradle +++ b/server/sonar-server/build.gradle @@ -82,6 +82,14 @@ task testJar(type: Jar) { from sourceSets.test.output } +configurations { + tests +} + +artifacts { + tests testJar +} + artifactoryPublish.skip = false // Used by core plugins diff --git a/settings.gradle b/settings.gradle index 0009ccb1366..49f30309a16 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ -rootProject.name = 'sonarqube' +rootProject.name = 'sonar-enterprise' include 'plugins:sonar-xoo-plugin' @@ -59,3 +59,9 @@ include 'tests:plugins:ui-extensions-plugin' include 'tests:plugins:wait-at-platform-level4-plugin' include 'tests:plugins:ws-plugin' include 'tests' + +// use Settings.getRootDir() so that it doesn't matter which directory you are executing from +File extraSettings = new File(rootDir, 'private/settings.gradle') +if (extraSettings.exists()) { + apply from: extraSettings +} diff --git a/travis.sh b/travis.sh index 5386944b148..6674f5f7b28 100755 --- a/travis.sh +++ b/travis.sh @@ -78,9 +78,10 @@ BUILD) if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo 'Build and analyze master' + # FIXME analysis and deployment disabled for now ./gradlew --no-daemon --console plain \ -DbuildNumber=$BUILD_NUMBER \ - build sonarqube artifactoryPublish -PjacocoEnabled=true -Prelease=true \ + build -PjacocoEnabled=true -Prelease=true \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.projectVersion=$INITIAL_VERSION \ @@ -91,9 +92,10 @@ BUILD) elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo 'Build release branch' + # FIXME analysis and deployment disabled for now ./gradlew --no-daemon --console plain \ -DbuildNumber=$BUILD_NUMBER \ - build sonarqube artifactoryPublish -PjacocoEnabled=true -Prelease=true \ + build -PjacocoEnabled=true -Prelease=true \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.branch.name=$TRAVIS_BRANCH \ @@ -107,7 +109,7 @@ BUILD) echo 'Build and analyze internal pull request' ./gradlew --no-daemon --console plain \ -DbuildNumber=$BUILD_NUMBER \ - build sonarqube artifactoryPublish -PjacocoEnabled=true -Prelease=true \ + build artifactoryPublish -PjacocoEnabled=true -Prelease=true \ -Dsonar.host.url=$SONAR_HOST_URL \ -Dsonar.login=$SONAR_TOKEN \ -Dsonar.analysis.buildNumber=$BUILD_NUMBER \