diff --git a/.travis.yml b/.travis.yml index 0cbd4b8..8a66d34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: android +notifications: + email: false + android: components: - tools @@ -7,21 +10,23 @@ android: - build-tools-25.0.1 - android-25 -jdk: - - oraclejdk8 - branches: - except: - - gh-pages - -notifications: - email: false + only: + - master + - develop -sudo: false +script: + - if [ $TRAVIS_PULL_REQUEST != 'false' ]; + then ./gradlew sonarqube -Dsonar.analysis.mode=preview -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=lachlanmckee-github -Dsonar.login=$SONAR_TOKEN -Dsonar.github.pullRequest=$TRAVIS_PULL_REQUEST -Dsonar.github.repository=LachlanMcKee/timber-junit-rule -Dsonar.github.oauth=$GITHUB_TOKEN; + else ./gradlew sonarqube -Dsonar.analysis.mode=publish -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=lachlanmckee-github -Dsonar.login=$SONAR_TOKEN; + fi +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ cache: directories: - - $HOME/.m2 + - $HOME/.gradle/caches/ before_install: - chmod +x gradlew diff --git a/build.gradle b/build.gradle index c781554..be9b264 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,10 @@ buildscript { } } +plugins { + id "org.sonarqube" version "2.5" +} + allprojects { repositories { mavenCentral() @@ -21,4 +25,11 @@ ext { buildToolsVersion = '25.0.1' sourceCompatibilityVersion = JavaVersion.VERSION_1_7 targetCompatibilityVersion = JavaVersion.VERSION_1_7 +} + +sonarqube { + properties { + property "sonar.projectName", "Timber JUnit Rule" + property "sonar.projectKey", "timber-junit-rule" + } } \ No newline at end of file