Skip to content

Commit

Permalink
Try out junit5-rt as separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
mannodermaus committed Sep 9, 2017
1 parent 1d0ad0f commit 1c924b9
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 10 deletions.
110 changes: 110 additions & 0 deletions android-junit5-embedded-runtime/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
apply plugin: "java-library"
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "com.jfrog.bintray"

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

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

dependencies {
implementation files("libs/junit5-rt.jar")
}

// ------------------------------------------------------------------------------------------------
// Deployment Setup
//
// Releases are pushed to jcenter via Bintray, while snapshots are pushed to Sonatype OSS.
// 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
}

// Include javadoc.jar archive in each release
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}

project.ext.artifactId = "android-junit5-embedded-runtime"
version = VERSION_NAME

publishing {
publications {
library(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
groupId GROUP_ID
artifactId project.ext.artifactId
version VERSION_NAME
pom.withXml {
def root = asNode()
root.appendNode("description", DESCRIPTION)
root.appendNode("name", project.ext.artifactId)
root.appendNode("url", VCS_URL)
}
}
}
}

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

publish.dependsOn copyPom

project.configure(project) {
if (project.version.endsWith("-SNAPSHOT")) {
// Configure deployment of snapshot versions to Sonatype OSS
project.publishing {
repositories {
maven {
name "snapshot"
credentials {
username project.ext.sonatypeUser
password project.ext.sonatypePass
}
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
}

} else {
// Configure deployment of release versions to Bintray
project.bintray {
user = project.ext.bintrayUser
key = project.ext.bintrayKey
configurations = ["archives"]
dryRun = false
pkg {
repo = "maven"
name = project.ext.artifactId
userOrg = project.ext.bintrayUser
licenses = [LICENCE_NAME]
publish = true
publicDownloadNumbers = true
vcsUrl = VCS_URL
version {
name = VERSION_NAME
desc = DESCRIPTION
}
}
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ class AndroidJUnitPlatformPlugin implements Plugin<Project> {
project.dependencies.create("org.junit.platform:junit-platform-launcher:$platformVersion"),
project.dependencies.create("org.junit.platform:junit-platform-console:$platformVersion"),
project.dependencies.create("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"),
project.dependencies.create("org.junit.vintage:junit-vintage-engine:$vintageVersion"),

// IntelliJ JUnit 5 Runtime, bundled to compensate for outdated Android Studio builds
project.dependencies.create(project.files("libs/junit5-rt.jar"))
project.dependencies.create("org.junit.vintage:junit-vintage-engine:$vintageVersion")
]
}

Expand Down
11 changes: 6 additions & 5 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ buildscript {

dependencies {
//noinspection GradleDynamicVersion
classpath ("de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3-rev1-SNAPSHOT") {
changing = true
classpath ("de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3") {
// changing = true
}
classpath "com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}

configurations.classpath {
resolutionStrategy.cacheChangingModulesFor 5, "minutes"
// resolutionStrategy.cacheChangingModulesFor 0, "minutes"
}
}

Expand Down Expand Up @@ -57,8 +57,9 @@ android {
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

testImplementation junit5()
testImplementation junit5Params()
testImplementation junitJupiter()
testImplementation junitParams()
testCompileOnly project(":android-junit5-embedded-runtime")
}

// IJ doesn't recognize Kotlin test classes properly,
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rootProject.name = GROUP_ID

include ':android-junit5'
//include ':sample'
include ':sample'
include ':android-junit5-embedded-runtime'

0 comments on commit 1c924b9

Please sign in to comment.