diff --git a/.gitignore b/.gitignore index 0d2cb03..be5e0ef 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,9 @@ /build /captures - -/gradle.properties +gradle.properties +lib/bintray.properties +reporter-pivotal/bintray.properties # Created by https://www.gitignore.io diff --git a/CHANGELOG.md b/CHANGELOG.md index 447d4da..a99b68c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +# v 0.6.5 +- Update kotlin 1.2.10 +- Add missing proguard setup. +- Update third party features versions. + # v 0.6.4 - Add proguard setup. - Update kotlin to 1.1.51. @@ -10,19 +15,16 @@ - Remove wrong stetho-okhttp dependency. # v 0.6.2 - - Remove extra resources on PivotalTracker reporter module. - Update dependencies. - Simplify the use of properties view. - Hide library resources to user. # v 0.6.1 (~~0.6~~ BROKEN) - - Update to Kotlin 1.1.1. - Add bug reporter with pivotal tracker, waiting others! # v 0.5.11 - - Update to Kotlin 1.0.6. - Allow to set initial state for switch's (true/false). - Show drawer on first launch now can be set from constructor. diff --git a/bintray.gradle b/bintray.gradle index def52b5..4f95a59 100644 --- a/bintray.gradle +++ b/bintray.gradle @@ -1,9 +1,6 @@ // // This script must be applied after android app/lib plugin. // -// Artifact id must be set in android.defaultConfig.archivesBaseName -// use -PsignPackage to allow package signing -// /* * Copyright 2013 Chris Banes @@ -28,22 +25,37 @@ apply plugin: 'com.jfrog.bintray' version = VERSION_NAME group = GROUP -def correctSetup() { - ["BINTRAY_USER", - "BINTRAY_USER_ORG", - "BINTRAY_PASSWORD", - "BINTRAY_API_KEY", - "BINTRAY_GPG_PASSPHRASE"].each { +def setup() { + println("Checking environment variables setup for ${project.name}...") + def resultOk = true + ["BINTRAY_USER", "BINTRAY_USER_ORG", "BINTRAY_PASSWORD", "BINTRAY_API_KEY", "DA_OSS_USERNAME", + "DA_OSS_PWD", "DA_SIGN_SECRET_RING_FILE"].each { if (!project.hasProperty(it)) { - println("-> bintray: $it property not found and is needed to deploy") - return false + println("-> Property '$it' not found.") + resultOk = false } } + + if (resultOk) { + println("Relax, it's fine.\n") + } else { + println("Opps, it's incomplete.\n") + } + + return resultOk +} + +def getVariableOrEmpty(String name) { + if (project.hasProperty(name)) { + return project.property(name) + } else { + return "" + } } -if (!correctSetup()) { - println("-> bintray: No bintray properties found") +if (!setup()) { + println("bintray.gradle script can't continue without all the needed variables.\n") return } @@ -52,23 +64,23 @@ def isReleaseBuild() { } def getReleaseRepositoryUrl() { - hasProperty('RELEASE_REPOSITORY_URL') ? getProperty("RELEASE_REPOSITORY_URL") : + hasProperty('RELEASE_REPOSITORY_URL') ? getVariableOrEmpty("RELEASE_REPOSITORY_URL") : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" } def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? getProperty("SNAPSHOT_REPOSITORY_URL") : + return hasProperty('SNAPSHOT_REPOSITORY_URL') ? getVariableOrEmpty("SNAPSHOT_REPOSITORY_URL") : "https://oss.sonatype.org/content/repositories/snapshots/" // "https://oss.jfrog.org/artifactory/oss-snapshot-local" // "https://oss.jfrog.org" } def getRepositoryUsername() { - return hasProperty('BINTRAY_USER') ? getProperty("BINTRAY_USER") : "" + return hasProperty('BINTRAY_USER') ? getVariableOrEmpty("BINTRAY_USER") : "" } def getRepositoryPassword() { - return hasProperty('BINTRAY_PASSWORD') ? getProperty("BINTRAY_PASSWORD") : "" + return hasProperty('BINTRAY_PASSWORD') ? getVariableOrEmpty("BINTRAY_PASSWORD") : "" } afterEvaluate { project -> @@ -192,8 +204,13 @@ afterEvaluate { project -> } bintray { - user = getProperty("BINTRAY_USER") - key = getProperty("BINTRAY_API_KEY") + if (!setup()) { + println("-> bintray: No bintray properties found") + return + } + + user = getVariableOrEmpty("BINTRAY_USER") + key = getVariableOrEmpty("BINTRAY_API_KEY") configurations = ['archives'] @@ -204,7 +221,7 @@ bintray { pkg { repo = "maven" name = POM_ARTIFACT_ID - userOrg = getProperty("BINTRAY_USER_ORG") + userOrg = getVariableOrEmpty("BINTRAY_USER_ORG") desc = POM_DESCRIPTION websiteUrl = POM_URL issueTrackerUrl = POM_URL + '/issues' @@ -218,6 +235,18 @@ bintray { version { desc = POM_DESCRIPTION name = VERSION_NAME + + gpg { + sign = false + } + + mavenCentralSync { + sync = true + user = getVariableOrEmpty("DA_OSS_USERNAME") + password = getVariableOrEmpty("DA_OSS_PWD") + close = '1' + //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually. + } } } } \ No newline at end of file diff --git a/build.gradle b/build.gradle index 286de47..1285f51 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:2.3.3' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0' classpath plugs.kotlin classpath plugs.gradleVersions } diff --git a/circle.yml b/circle.yml index db8952c..d5d6b10 100644 --- a/circle.yml +++ b/circle.yml @@ -12,20 +12,15 @@ machine: dependencies: cache_directories: - ~/.android - - ~/android - ~/.gradle - pre: - # Install dependencies + override: - wget "https://services.gradle.org/distributions/$GRADLE_VERSION-bin.zip"; unzip $GRADLE_VERSION-bin.zip - sh scripts/install-dependencies.sh - # Create config files based on all env variables - - PROPERTIES_FILE=lib/bintray.properties sh scripts/cp-env-to-properties.sh - - PROPERTIES_FILE=pivotaltracker-reporter/bintray.properties sh scripts/cp-env-to-properties.sh - - sh scripts/cp-env-to-properties.sh - test: override: + - bash scripts/cp-env-to-properties.sh + - ./gradlew assemble -PdisablePreDex --stacktrace --no-daemon - ./gradlew testDebugUnitTestCoverage -PdisablePreDex --stacktrace --no-daemon @@ -35,3 +30,10 @@ test: - cp -r lib/build/test-results $CIRCLE_TEST_REPORTS post: - bash <(curl -s https://codecov.io/bash) -f "$CIRCLE_TEST_REPORTS/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml" + +deployment: + production: + branch: master + commands: + - bash scripts/cp-env-to-properties.sh + - bash scripts/deploy.sh \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index d0712c0..47af61d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -16,5 +16,6 @@ ext { libraries = [appCompat : "com.android.support:appcompat-v7:${versions.supportLibrary}", supportDesign: "com.android.support:design:${versions.supportLibrary}", - kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}"] + kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}", + kotlinReflect: "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}"] } \ No newline at end of file diff --git a/gradle.properties.example b/gradle.properties.example index 8017cbb..888c799 100644 --- a/gradle.properties.example +++ b/gradle.properties.example @@ -3,13 +3,9 @@ BINTRAY_USER= BINTRAY_USER_ORG= BINTRAY_PASSWORD= BINTRAY_API_KEY= -BINTRAY_GPG_PASSPHRASE= - -# GPG signing data -signing.keyId= -signing.password= -signing.secretKeyRingFile= # ~/.gnupg/secring.gpg +DA_OSS_USERNAME= +DA_OSS_PWD= # Optional ARTIST_PIVOTAL_API_KEY= -ARTIST_PIVOTAL_PROJECT_ID= \ No newline at end of file +ARTIST_PIVOTAL_PROJECT_ID= diff --git a/lib/gradle.properties b/lib/gradle.properties index ff5b6c2..10be867 100644 --- a/lib/gradle.properties +++ b/lib/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=0.6.4 -VERSION_CODE=30 +VERSION_NAME=0.6.5 +VERSION_CODE=31 GROUP=com.baristav.debugartist POM_NAME=Debug Artist diff --git a/reporter-pivotal/build.gradle b/reporter-pivotal/build.gradle index 6cd7ae8..671a765 100644 --- a/reporter-pivotal/build.gradle +++ b/reporter-pivotal/build.gradle @@ -23,6 +23,7 @@ dependencies { compile libraries.appCompat compile libraries.supportDesign compile libraries.kotlinStdLib + compile libraries.kotlinReflect compile project(":lib") compile "io.reactivex:rxjava:${versions.rxJava}" diff --git a/reporter-pivotal/gradle.properties b/reporter-pivotal/gradle.properties index 177df1e..852bed7 100644 --- a/reporter-pivotal/gradle.properties +++ b/reporter-pivotal/gradle.properties @@ -1,5 +1,5 @@ -VERSION_NAME=0.6.4 -VERSION_CODE=5 +VERSION_NAME=0.6.5 +VERSION_CODE=6 GROUP=com.baristav.debugartist POM_NAME=Debug Artist - Pivotal Tracker reporter diff --git a/reporter-pivotal/rules.pro b/reporter-pivotal/rules.pro index 3a357c8..d521886 100644 --- a/reporter-pivotal/rules.pro +++ b/reporter-pivotal/rules.pro @@ -1,8 +1,11 @@ -dontobfuscate --keepattributes InnerClasses, EnclosingMethod +-keepattributes InnerClasses, EnclosingMethod, *Annotation* + -dontskipnonpubliclibraryclasses -keepclasseswithmembers class debug_artist.reporter_pivotaltracker.Story { *; } -keepclasseswithmembers class debug_artist.reporter_pivotaltracker.StoryRequestBody { *; } -keepclasseswithmembers class debug_artist.reporter_pivotaltracker.Comment { *; } --keepclasseswithmembers class debug_artist.reporter_pivotaltracker.Attachment { *; } \ No newline at end of file +-keepclasseswithmembers class debug_artist.reporter_pivotaltracker.Attachment { *; } + +-dontwarn kotlin.reflect.jvm.internal.** \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 1067b65..df00f85 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,5 +1,13 @@ apply plugin: 'com.android.application' +def getVariableOrEmpty(String name) { + if (project.hasProperty(name)) { + return project.property(name) + } else { + return "" + } +} + android { compileSdkVersion setup.compileSdk buildToolsVersion setup.buildTools @@ -21,8 +29,8 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'rules.pro' - buildConfigField "String", "PIVOTAL_API_KEY", "\"$ARTIST_PIVOTAL_API_KEY\"" - buildConfigField "String", "PIVOTAL_PROJECT_ID", "\"$ARTIST_PIVOTAL_PROJECT_ID\"" + buildConfigField "String", "PIVOTAL_API_KEY", "\"${getVariableOrEmpty("DA_PIVOTAL_API_KEY")}\"" + buildConfigField "String", "PIVOTAL_PROJECT_ID", "\"${getVariableOrEmpty("DA_PIVOTAL_PROJECT_ID")}\"" } release { minifyEnabled true @@ -31,7 +39,8 @@ android { } } - signingConfigs { // Added to be able to assemble release apks with shrink + signingConfigs { + // Added to be able to assemble release apks with shrink debug { keyAlias "sample" keyPassword "sample" diff --git a/scripts/cp-env-to-properties.sh b/scripts/cp-env-to-properties.sh index 405bbe0..6509c39 100755 --- a/scripts/cp-env-to-properties.sh +++ b/scripts/cp-env-to-properties.sh @@ -1,12 +1,29 @@ #!/usr/bin/env bash # -# Copy env variables to app module gradle properties file +# Prepare the project to be built from a server, creating the needed files from env variables. # +# - Copy env variables to app module gradle properties file. +# - Decode variable names with "_BARISTA_DOT_" as ".". +# - Decode from base64 the secring.gpg +# + +set +x // Hide all output + +ENV_VARIABLES=$(printenv | tr ' ' '\n') +IFS="" -: ${PROPERTIES_FILE:=gradle.properties} +# Decode base64 file +echo $DA_SIGN_SECRET_RING_FILE | base64 --decode --ignore-garbage >> secring.gpg +cp secring.gpg lib/secring.gpg +cp secring.gpg reporter-pivotal/secring.gpg -set +x // dont print the next lines on run script +for PROPERTIES_FILE in gradle.properties lib/bintray.properties reporter-pivotal/bintray.properties +do + # Decode variables named like 'sign_BARISTA_DOT_password=123' to 'sign.password=123'. + # Some ci servers like circle-ci don't support env variable names with a '.' + echo ${ENV_VARIABLES//_BARISTA_DOT_/.} > $PROPERTIES_FILE -printenv | tr ' ' '\n' > $PROPERTIES_FILE + echo signing.secretKeyRingFile=secring.gpg >> $PROPERTIES_FILE +done -set -x +set -x \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh old mode 100644 new mode 100755 diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 0b27c10..e1670f3 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -19,4 +19,5 @@ if [ ! -e $DEPS_FILE ]; then touch DEPS_FILE; - fi \ No newline at end of file +fi +