Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/runConfigurations/Publish_Snapshot.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
language: android

env:
global:
- bintrayUser=aurae
- secure: VoY/zWE7itJmukAZt1Zw43jFzOk2ssWbpWhydYLiaRvplYVJvXTCSve4ZDpBhxPAlta2Kpfr9H8bwuaYCEtS+ovhi/q8Fo97YXiGdkHwEXJPal2n4O/XEj5hFr1BxIDTEwFBtGD/iQWZL/MVRaWFrfuMWajMZhDQkGz+DwRog4XCaw6UcEofW9kzfPG1T94C/bAIETrad4bfHKSbORVd2SbyPCFHkFH+YB/eWVqK2N5PuiPaet+EzcX/sxAFnwD6kF/uj3KxTlii/Yw8bM6LrPEWyyuMDglHN3LTevZ1CwT1oy8AUZaFzx246SL+Osn6t9WHoL1p3ltTS9O7sNL6WSyCP+JFYXF8iaF9USaINy/vcZFPsKdcCpgLPjSF/4mgXcjPc5KRao3tZOoamyvXuiGg7lfwUBl82t73ItlnSGgInAyUSesVrQ2gJNsVHdRqvOmVPBGXZ3lWb4GHksfQzLO210M7Tiu6leacWEbsYWmAsRER87qdUu7lY2b3wYJB7NhXX5AMZYINSzfCDVrThTWLXUU554D/3TmTKz/ROab2QxR/Qxh5i4ZJ/0MNdcM+qp8ORq6WlwGTUhCmD83XtiuBF3s/JW1WybsqC4Ppo23YuItqgfmMZWk75xLqpi48078vNgtEE/1YE2tvxd7ddfeT3eNLt7qrfj7Hu+r3L5A=

android:
components:
- tools
- platform-tools
- build-tools-26.0.0
- android-26

jdk:
- oraclejdk8

before_install:
- echo "sdk.dir=$ANDROID_HOME" > local.properties

script: ./gradlew clean check --info --stacktrace

after_success:
- ./scripts/deploy_snapshot.sh

deploy:
provider: script
script: ./scripts/deploy_release.sh
on:
tags: true
repo: aurae/android-junit5
146 changes: 94 additions & 52 deletions android-junit5/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: "groovy"
apply plugin: "idea"
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "com.jfrog.bintray"
apply plugin: "com.jfrog.artifactory"

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

// ------------------------------------------------------------------------------------------------
// Test Setup
//
// We run our unit tests against multiple versions of the Android Gradle Plugin,
// in order to support logical & structural intricacies of both the 2.x & 3.x line of plugins.
// To achieve this, several new source sets & configurations for each branch are created here,
// which are derived from the common "test" scope.
// ------------------------------------------------------------------------------------------------

configurations {
testAgp2xCompile {
extendsFrom configurations.testCompile
Expand Down Expand Up @@ -40,6 +50,28 @@ idea {
}
}

// Run Unit Tests against Android Gradle Plugin version 2.x
task testAgp2x(type: Test) {
testClassesDirs = sourceSets.testAgp2x.output.classesDirs
classpath = sourceSets.main.runtimeClasspath + sourceSets.testAgp2x.runtimeClasspath
}

// Run Unit Tests against Android Gradle Plugin version 3.x
task testAgp3x(type: Test) {
testClassesDirs = sourceSets.testAgp3x.output.classesDirs
classpath = sourceSets.main.runtimeClasspath + sourceSets.testAgp3x.runtimeClasspath
}

// Combine all tests when executing the main JUnit task
tasks.getByName("test").dependsOn(
testAgp2x,
testAgp3x
)

// ------------------------------------------------------------------------------------------------
// Dependency Definitions
// ------------------------------------------------------------------------------------------------

dependencies {
compile gradleApi()
compile localGroovy()
Expand All @@ -55,46 +87,32 @@ dependencies {
testAgp3xCompile "com.android.tools.build:gradle:$ANDROID_PLUGIN_VERSION_3X"
}

// Run Unit Tests against Android Gradle Plugin version 2.x
task testAgp2x(type: Test) {
testClassesDirs = sourceSets.testAgp2x.output.classesDirs
classpath = sourceSets.main.runtimeClasspath + sourceSets.testAgp2x.runtimeClasspath
// ------------------------------------------------------------------------------------------------
// Deployment Setup
//
// Releases are pushed to jcenter via Bintray, and snapshots are pushed to OJO Artifactory.
// This section defines the necessary tasks to push new releases and snapshots using Gradle tasks.
// ------------------------------------------------------------------------------------------------

// Include sources.jar archive in each release
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}

// Run Unit Tests against Android Gradle Plugin version 3.x
task testAgp3x(type: Test) {
testClassesDirs = sourceSets.testAgp3x.output.classesDirs
classpath = sourceSets.main.runtimeClasspath + sourceSets.testAgp3x.runtimeClasspath
// Include javadoc.jar archive in each release
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}

// Combine all tests when executing the main JUnit task
tasks.getByName("test").dependsOn(
testAgp2x,
testAgp3x
)
artifacts {
archives sourcesJar
archives javadocJar
}

version = VERSION_NAME

bintray {
user = project.ext.bintrayUser
key = project.ext.bintrayApiKey
configurations = ['archives']
dryRun = false
pkg {
repo = 'maven'
name = ARTIFACT_ID
userOrg = properties.get("BINTRAY_USER")
licenses = ["EPL-1.0"]
publish = true
publicDownloadNumbers = true
vcsUrl = VCS_URL
version {
name = VERSION_NAME
desc = DESCRIPTION
}
}
}

publishing {
publications {
library(MavenPublication) {
Expand All @@ -114,25 +132,49 @@ publishing {
}
}

// Copy POM to location expected by Bintray
task copyPom(type: Copy) {
from 'build/publications/library'
into 'build/poms'
include 'pom-default.xml'
from "build/publications/library"
into "build/poms"
include "pom-default.xml"
}

publish.dependsOn copyPom

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
// Configure deployment of release versions to Bintray
bintray {
user = project.ext.bintrayUser
key = project.ext.bintrayKey
configurations = ["archives"]
dryRun = false
pkg {
repo = "maven"
name = ARTIFACT_ID
userOrg = project.ext.bintrayUser
licenses = ["EPL-1.0"]
publish = true
publicDownloadNumbers = true
vcsUrl = VCS_URL
version {
name = VERSION_NAME
desc = DESCRIPTION
}
}
}

artifacts {
archives sourcesJar
archives javadocJar
// Configure deployment of snapshots to Artifactory
artifactory {
contextUrl = "https://oss.jfrog.org/artifactory"
publish {
repository {
repoKey = VERSION_NAME.endsWith("SNAPSHOT") ? "oss-snapshot-local" : "oss-release-local"
username = project.ext.bintrayUser
password = project.ext.bintrayKey
maven = true
}
defaults {
publishArtifacts = true
publications("library")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import spock.lang.Specification
*/
abstract class AndroidJUnitPlatformSpec extends Specification {

protected static final COMPILE_SDK = 25
protected static final BUILD_TOOLS = "25.0.2"
protected static final MIN_SDK = 25
protected static final TARGET_SDK = 25
protected static final COMPILE_SDK = 26
protected static final BUILD_TOOLS = "26.0.0"
protected static final MIN_SDK = 26
protected static final TARGET_SDK = 26
protected static final VERSION_CODE = 1
protected static final VERSION_NAME = "1.0"
protected static final APPLICATION_ID = "org.junit.android.sample"
Expand Down
25 changes: 21 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,35 @@ buildscript {
}
dependencies {
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$BINTRAY_PLUGIN_VERSION"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$JFROG_PLUGIN_VERSION"
}
}

Properties properties = new Properties()
properties.load(new FileInputStream(new File(rootProject.projectDir, "local.properties")))
// Populate deployment credentials:
// * Local development - stored in properties file
// * CI Server - stored in environment variables
def deploymentUser = ""
def deploymentPass = ""

def credentialsFile = new File(project.rootDir, "local.properties")
if (credentialsFile.exists()) {
Properties properties = new Properties()
credentialsFile.withReader { properties.load(it) }
deploymentUser = properties.get("BINTRAY_USER")
deploymentPass = properties.get("BINTRAY_API_KEY")

} else {
deploymentUser = System.getenv("bintrayUser")
deploymentPass = System.getenv("bintrayKey")
}

allprojects {
repositories {
google()
jcenter()
}
ext {
bintrayUser = properties.get('BINTRAY_USER')
bintrayApiKey = properties.get('BINTRAY_API_KEY')
bintrayUser = deploymentUser
bintrayKey = deploymentPass
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
# Artifact configuration
GROUP_ID = de.mannodermaus.gradle.plugins
ARTIFACT_ID = android-junit5
VERSION_NAME = 1.0.0-M4-rev3
VERSION_NAME = 1.0.0-M5-SNAPSHOT
DESCRIPTION = Unit Testing with JUnit 5 for Android.
VCS_URL = https://github.com/aurae/android-junit5

# Dependency versions (plugins)
ANDROID_PLUGIN_VERSION_2X = 2.3.2
ANDROID_PLUGIN_VERSION_3X = 3.0.0-alpha5
BINTRAY_PLUGIN_VERSION = 1.3.1
JFROG_PLUGIN_VERSION = 4.1.1

# Dependency versions
SEMVER_VERSION = 0.9.0
Expand Down
3 changes: 3 additions & 0 deletions scripts/deploy_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

../gradlew clean build generatePomFileForLibraryPublication publish bintrayUpload -PbintrayUser=$bintrayUser -PbintrayKey=$bintrayKey -PdryRun=false
26 changes: 26 additions & 0 deletions scripts/deploy_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo.
#
# Adapted from https://coderwall.com/p/9b_lfq and
# http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/

SLUG="aurae/android-junit5"
JDK="oraclejdk8"
BRANCH="master"

set -e

if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then
echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'."
elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then
echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'."
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo "Skipping snapshot deployment: was pull request."
elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
else
echo "Deploying snapshot..."
../gradlew artifactoryPublish
echo "Snapshot deployed!"
fi