Skip to content

Commit 1c924b9

Browse files
committed
Try out junit5-rt as separate module
1 parent 1d0ad0f commit 1c924b9

File tree

5 files changed

+119
-10
lines changed

5 files changed

+119
-10
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
apply plugin: "java-library"
2+
apply plugin: "maven"
3+
apply plugin: "maven-publish"
4+
apply plugin: "com.jfrog.bintray"
5+
6+
sourceCompatibility = JavaVersion.VERSION_1_6
7+
targetCompatibility = JavaVersion.VERSION_1_6
8+
9+
// ------------------------------------------------------------------------------------------------
10+
// Dependency Definitions
11+
// ------------------------------------------------------------------------------------------------
12+
13+
dependencies {
14+
implementation files("libs/junit5-rt.jar")
15+
}
16+
17+
// ------------------------------------------------------------------------------------------------
18+
// Deployment Setup
19+
//
20+
// Releases are pushed to jcenter via Bintray, while snapshots are pushed to Sonatype OSS.
21+
// This section defines the necessary tasks to push new releases and snapshots using Gradle tasks.
22+
// ------------------------------------------------------------------------------------------------
23+
24+
// Include sources.jar archive in each release
25+
task sourcesJar(type: Jar, dependsOn: classes) {
26+
classifier = "sources"
27+
from sourceSets.main.allSource
28+
}
29+
30+
// Include javadoc.jar archive in each release
31+
task javadocJar(type: Jar, dependsOn: javadoc) {
32+
classifier = "javadoc"
33+
from javadoc.destinationDir
34+
}
35+
36+
artifacts {
37+
archives sourcesJar
38+
archives javadocJar
39+
}
40+
41+
project.ext.artifactId = "android-junit5-embedded-runtime"
42+
version = VERSION_NAME
43+
44+
publishing {
45+
publications {
46+
library(MavenPublication) {
47+
from components.java
48+
artifact sourcesJar
49+
artifact javadocJar
50+
groupId GROUP_ID
51+
artifactId project.ext.artifactId
52+
version VERSION_NAME
53+
pom.withXml {
54+
def root = asNode()
55+
root.appendNode("description", DESCRIPTION)
56+
root.appendNode("name", project.ext.artifactId)
57+
root.appendNode("url", VCS_URL)
58+
}
59+
}
60+
}
61+
}
62+
63+
// Copy POM to location expected by Bintray
64+
task copyPom(type: Copy) {
65+
from "build/publications/library"
66+
into "build/poms"
67+
include "pom-default.xml"
68+
}
69+
70+
publish.dependsOn copyPom
71+
72+
project.configure(project) {
73+
if (project.version.endsWith("-SNAPSHOT")) {
74+
// Configure deployment of snapshot versions to Sonatype OSS
75+
project.publishing {
76+
repositories {
77+
maven {
78+
name "snapshot"
79+
credentials {
80+
username project.ext.sonatypeUser
81+
password project.ext.sonatypePass
82+
}
83+
url "https://oss.sonatype.org/content/repositories/snapshots"
84+
}
85+
}
86+
}
87+
88+
} else {
89+
// Configure deployment of release versions to Bintray
90+
project.bintray {
91+
user = project.ext.bintrayUser
92+
key = project.ext.bintrayKey
93+
configurations = ["archives"]
94+
dryRun = false
95+
pkg {
96+
repo = "maven"
97+
name = project.ext.artifactId
98+
userOrg = project.ext.bintrayUser
99+
licenses = [LICENCE_NAME]
100+
publish = true
101+
publicDownloadNumbers = true
102+
vcsUrl = VCS_URL
103+
version {
104+
name = VERSION_NAME
105+
desc = DESCRIPTION
106+
}
107+
}
108+
}
109+
}
110+
}
File renamed without changes.

android-junit5/src/main/groovy/de/mannodermaus/gradle/plugins/android_junit5/AndroidJUnitPlatformPlugin.groovy

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ class AndroidJUnitPlatformPlugin implements Plugin<Project> {
9494
project.dependencies.create("org.junit.platform:junit-platform-launcher:$platformVersion"),
9595
project.dependencies.create("org.junit.platform:junit-platform-console:$platformVersion"),
9696
project.dependencies.create("org.junit.jupiter:junit-jupiter-engine:$jupiterVersion"),
97-
project.dependencies.create("org.junit.vintage:junit-vintage-engine:$vintageVersion"),
98-
99-
// IntelliJ JUnit 5 Runtime, bundled to compensate for outdated Android Studio builds
100-
project.dependencies.create(project.files("libs/junit5-rt.jar"))
97+
project.dependencies.create("org.junit.vintage:junit-vintage-engine:$vintageVersion")
10198
]
10299
}
103100

sample/build.gradle

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ buildscript {
99

1010
dependencies {
1111
//noinspection GradleDynamicVersion
12-
classpath ("de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3-rev1-SNAPSHOT") {
13-
changing = true
12+
classpath ("de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3") {
13+
// changing = true
1414
}
1515
classpath "com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION"
1616
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1717
}
1818

1919
configurations.classpath {
20-
resolutionStrategy.cacheChangingModulesFor 5, "minutes"
20+
// resolutionStrategy.cacheChangingModulesFor 0, "minutes"
2121
}
2222
}
2323

@@ -57,8 +57,9 @@ android {
5757
dependencies {
5858
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
5959

60-
testImplementation junit5()
61-
testImplementation junit5Params()
60+
testImplementation junitJupiter()
61+
testImplementation junitParams()
62+
testCompileOnly project(":android-junit5-embedded-runtime")
6263
}
6364

6465
// IJ doesn't recognize Kotlin test classes properly,

settings.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
rootProject.name = GROUP_ID
22

33
include ':android-junit5'
4-
//include ':sample'
4+
include ':sample'
5+
include ':android-junit5-embedded-runtime'

0 commit comments

Comments
 (0)