Skip to content

Commit 07d7e01

Browse files
committed
Utilize a new Fat JAR module to embed the runtime using a new artifact
1 parent 1c924b9 commit 07d7e01

File tree

7 files changed

+48
-53
lines changed

7 files changed

+48
-53
lines changed

LICENSE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Open Source Licenses
22
====================
33

4-
This repository includes multiple licenses:
4+
The individual modules use different open source licenses:
55

6-
- The bundled `junit5-rt.jar` is taken from intellij-community & released under [Apache License v2.0](LICENSE-apache.md)
7-
- The remaining code mirrors JUnit 5's license & is released under [Eclipse Public License v2.0](LICENSE-epl2.md)
6+
- `android-junit5-embedded-runtime` uses [Apache License v2.0](android-junit5-embedded-runtime/LICENSE.md)
7+
- All other modules use [Eclipse Public License v2.0](android-junit5/LICENSE.md)
8+
9+
Please see the `LICENSE.md` files in the subfolders for details.

LICENSE-apache.md renamed to android-junit5-embedded-runtime/LICENSE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,5 @@
199199
distributed under the License is distributed on an "AS IS" BASIS,
200200
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201201
See the License for the specific language governing permissions and
202-
limitations under the License.
202+
limitations under the License.
203+
No newline at end of file

android-junit5-embedded-runtime/build.gradle

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,51 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
}
5+
dependencies {
6+
classpath "com.github.jengelman.gradle.plugins:shadow:$SHADOW_PLUGIN_VERSION"
7+
}
8+
}
9+
110
apply plugin: "java-library"
211
apply plugin: "maven"
312
apply plugin: "maven-publish"
13+
apply plugin: "com.github.johnrengelman.shadow"
414
apply plugin: "com.jfrog.bintray"
515

616
sourceCompatibility = JavaVersion.VERSION_1_6
717
targetCompatibility = JavaVersion.VERSION_1_6
818

919
// ------------------------------------------------------------------------------------------------
1020
// Dependency Definitions
21+
// This module exports a "fat JAR" with the embedded junit5-rt from IntelliJ IDEA,
22+
// using a shadowed JAR that overrides the default build artifact.
1123
// ------------------------------------------------------------------------------------------------
1224

1325
dependencies {
1426
implementation files("libs/junit5-rt.jar")
1527
}
1628

29+
shadowJar {
30+
// Remove '-all' suffix from the generated JAR
31+
classifier = null
32+
}
33+
34+
build.doLast { shadowJar.execute() }
35+
1736
// ------------------------------------------------------------------------------------------------
1837
// Deployment Setup
1938
//
2039
// Releases are pushed to jcenter via Bintray, while snapshots are pushed to Sonatype OSS.
2140
// This section defines the necessary tasks to push new releases and snapshots using Gradle tasks.
2241
// ------------------------------------------------------------------------------------------------
2342

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"
4243
version = VERSION_NAME
4344

4445
publishing {
4546
publications {
4647
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-
}
48+
project.shadow.component(it)
5949
}
6050
}
6151
}
@@ -94,15 +84,15 @@ project.configure(project) {
9484
dryRun = false
9585
pkg {
9686
repo = "maven"
97-
name = project.ext.artifactId
87+
name = RUNTIME_ARTIFACT_ID
9888
userOrg = project.ext.bintrayUser
99-
licenses = [LICENCE_NAME]
89+
licenses = [RUNTIME_LICENSE_NAME]
10090
publish = true
10191
publicDownloadNumbers = true
10292
vcsUrl = VCS_URL
10393
version {
10494
name = VERSION_NAME
105-
desc = DESCRIPTION
95+
desc = RUNTIME_DESCRIPTION
10696
}
10797
}
10898
}
File renamed without changes.

android-junit5/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ publishing {
117117
artifact sourcesJar
118118
artifact javadocJar
119119
groupId GROUP_ID
120-
artifactId ARTIFACT_ID
120+
artifactId PLUGIN_ARTIFACT_ID
121121
version VERSION_NAME
122122
pom.withXml {
123123
def root = asNode()
124-
root.appendNode("description", DESCRIPTION)
125-
root.appendNode("name", ARTIFACT_ID)
124+
root.appendNode("description", PLUGIN_DESCRIPTION)
125+
root.appendNode("name", PLUGIN_ARTIFACT_ID)
126126
root.appendNode("url", VCS_URL)
127127
}
128128
}
@@ -163,9 +163,9 @@ project.configure(project) {
163163
dryRun = false
164164
pkg {
165165
repo = "maven"
166-
name = ARTIFACT_ID
166+
name = PLUGIN_ARTIFACT_ID
167167
userOrg = project.ext.bintrayUser
168-
licenses = [LICENCE_NAME]
168+
licenses = [PLUGIN_LICENSE_NAME]
169169
publish = true
170170
publicDownloadNumbers = true
171171
vcsUrl = VCS_URL

gradle.properties

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@
33
# "AGP 3.x requires Studio 3.0 minimum" - workaround to use it inside IJ
44
android.injected.build.model.only.versioned = 3
55

6-
# Artifact configuration
6+
# Artifact configuration (common)
77
GROUP_ID = de.mannodermaus.gradle.plugins
8-
ARTIFACT_ID = android-junit5
98
VERSION_NAME = 1.0.0-RC3-rev1-SNAPSHOT
10-
LICENCE_NAME = EPL-1.0
11-
DESCRIPTION = Unit Testing with JUnit 5 for Android.
129
VCS_URL = https://github.com/aurae/android-junit5
1310

11+
# Artifact configuration (plugin)
12+
PLUGIN_ARTIFACT_ID = android-junit5
13+
PLUGIN_LICENSE_NAME = EPL-2.0
14+
PLUGIN_DESCRIPTION = Unit Testing with JUnit 5 for Android.
15+
16+
# Artifact configuration (embedded-runtime)
17+
RUNTIME_ARTIFACT_ID = android-junit5-embedded-runtime
18+
RUNTIME_LICENSE_NAME = Apache-2.0
19+
RUNTIME_DESCRIPTION = Mirror of IntelliJ IDEA's embedded JUnit 5 Runtime.
20+
1421
# Dependency versions (plugins)
1522
ANDROID_PLUGIN_2X_VERSION = 2.3.2
1623
ANDROID_PLUGIN_3X_VERSION = 3.0.0-beta5
1724
BINTRAY_PLUGIN_VERSION = 1.7.3
25+
SHADOW_PLUGIN_VERSION = 2.0.1
1826

1927
# Dependency versions
2028
JUNIT_PLATFORM_VERSION = 1.0.0-RC3

sample/build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@ buildscript {
99

1010
dependencies {
1111
//noinspection GradleDynamicVersion
12-
classpath ("de.mannodermaus.gradle.plugins:android-junit5:1.0.0-RC3") {
13-
// changing = true
14-
}
12+
classpath "de.mannodermaus.gradle.plugins:android-junit5:+"
1513
classpath "com.android.tools.build:gradle:$ANDROID_PLUGIN_3X_VERSION"
1614
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
1715
}
18-
19-
configurations.classpath {
20-
// resolutionStrategy.cacheChangingModulesFor 0, "minutes"
21-
}
2216
}
2317

2418
apply plugin: "com.android.application"

0 commit comments

Comments
 (0)