]> source.dussan.org Git - sonarqube.git/commitdiff
Single Gradle build for SQ and core plugins
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Sun, 18 Mar 2018 21:13:43 +0000 (22:13 +0100)
committerSonarTech <sonartech@sonarsource.com>
Thu, 22 Mar 2018 11:37:47 +0000 (12:37 +0100)
.travis.yml
build.gradle
server/sonar-db-core/build.gradle
server/sonar-db-core/src/test/java/org/sonar/db/CoreTestDb.java
server/sonar-db-dao/build.gradle
server/sonar-db-migration/build.gradle
server/sonar-server/build.gradle
settings.gradle
travis.sh

index 1b1eb2378192d36684251f8c02fd8ca85ea36623..6886fd62b689400317e816b57e6e246dacfd51c3 100644 (file)
@@ -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
index 3057c4801980a5d016f448cd513f77776b314ace..1e4502d2448c2292409e6cddcec845fd86901235 100644 (file)
@@ -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}")
 }
index bfb6921b78b53e008237e19cd1f4ef2c108eb847..8a4ee3042d6df249cafca54867333c476ed3b376 100644 (file)
@@ -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
index bcbd1b42e03ad19308a83569181b94d34ebc2de1..6b963d27e319da0c01ed01e37644552e5ebcc690 100644 (file)
@@ -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);
     }
index 24a45f382e12af7e63a5f52e05d00b1f81b46c59..98149ad92e50a177038221f20d669da5e874dcb4 100644 (file)
@@ -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
index 2198734c3a1ba2704edef71aff6a28b06609e674..f26ceaf82556fb3800231fad66bf1b011024c5ca 100644 (file)
@@ -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')
 }
 
index 34995b84bf86d999246544273400a4e26151d9ff..251f852de2b68d9a74519e1fd85df2447035683d 100644 (file)
@@ -82,6 +82,14 @@ task testJar(type: Jar) {
   from sourceSets.test.output
 }
 
+configurations {
+  tests
+}
+
+artifacts {
+   tests testJar
+}
+
 artifactoryPublish.skip = false
 
 // Used by core plugins
index 0009ccb13662dd7b235b17c902722801b922b2f0..49f30309a16befb2575c961208ebc713ec9e2e64 100644 (file)
@@ -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
+}
index 5386944b1486dab9cfbfb538c1a8f2c34d51156a..6674f5f7b28d6c473f9cebf73edbd68054bc470c 100755 (executable)
--- 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 \