Skip to content

Commit

Permalink
Utilize a new Fat JAR module to embed the runtime using a new artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
mannodermaus committed Sep 9, 2017
1 parent 1c924b9 commit 07d7e01
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 53 deletions.
8 changes: 5 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Open Source Licenses
====================

This repository includes multiple licenses:
The individual modules use different open source licenses:

- The bundled `junit5-rt.jar` is taken from intellij-community & released under [Apache License v2.0](LICENSE-apache.md)
- The remaining code mirrors JUnit 5's license & is released under [Eclipse Public License v2.0](LICENSE-epl2.md)
- `android-junit5-embedded-runtime` uses [Apache License v2.0](android-junit5-embedded-runtime/LICENSE.md)
- All other modules use [Eclipse Public License v2.0](android-junit5/LICENSE.md)

Please see the `LICENSE.md` files in the subfolders for details.
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,5 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
No newline at end of file
56 changes: 23 additions & 33 deletions android-junit5-embedded-runtime/build.gradle
Original file line number Diff line number Diff line change
@@ -1,61 +1,51 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:$SHADOW_PLUGIN_VERSION"
}
}

apply plugin: "java-library"
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "com.github.johnrengelman.shadow"
apply plugin: "com.jfrog.bintray"

sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6

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

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

shadowJar {
// Remove '-all' suffix from the generated JAR
classifier = null
}

build.doLast { shadowJar.execute() }

// ------------------------------------------------------------------------------------------------
// 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)
}
project.shadow.component(it)
}
}
}
Expand Down Expand Up @@ -94,15 +84,15 @@ project.configure(project) {
dryRun = false
pkg {
repo = "maven"
name = project.ext.artifactId
name = RUNTIME_ARTIFACT_ID
userOrg = project.ext.bintrayUser
licenses = [LICENCE_NAME]
licenses = [RUNTIME_LICENSE_NAME]
publish = true
publicDownloadNumbers = true
vcsUrl = VCS_URL
version {
name = VERSION_NAME
desc = DESCRIPTION
desc = RUNTIME_DESCRIPTION
}
}
}
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions android-junit5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ publishing {
artifact sourcesJar
artifact javadocJar
groupId GROUP_ID
artifactId ARTIFACT_ID
artifactId PLUGIN_ARTIFACT_ID
version VERSION_NAME
pom.withXml {
def root = asNode()
root.appendNode("description", DESCRIPTION)
root.appendNode("name", ARTIFACT_ID)
root.appendNode("description", PLUGIN_DESCRIPTION)
root.appendNode("name", PLUGIN_ARTIFACT_ID)
root.appendNode("url", VCS_URL)
}
}
Expand Down Expand Up @@ -163,9 +163,9 @@ project.configure(project) {
dryRun = false
pkg {
repo = "maven"
name = ARTIFACT_ID
name = PLUGIN_ARTIFACT_ID
userOrg = project.ext.bintrayUser
licenses = [LICENCE_NAME]
licenses = [PLUGIN_LICENSE_NAME]
publish = true
publicDownloadNumbers = true
vcsUrl = VCS_URL
Expand Down
16 changes: 12 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,26 @@
# "AGP 3.x requires Studio 3.0 minimum" - workaround to use it inside IJ
android.injected.build.model.only.versioned = 3

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

# Artifact configuration (plugin)
PLUGIN_ARTIFACT_ID = android-junit5
PLUGIN_LICENSE_NAME = EPL-2.0
PLUGIN_DESCRIPTION = Unit Testing with JUnit 5 for Android.

# Artifact configuration (embedded-runtime)
RUNTIME_ARTIFACT_ID = android-junit5-embedded-runtime
RUNTIME_LICENSE_NAME = Apache-2.0
RUNTIME_DESCRIPTION = Mirror of IntelliJ IDEA's embedded JUnit 5 Runtime.

# Dependency versions (plugins)
ANDROID_PLUGIN_2X_VERSION = 2.3.2
ANDROID_PLUGIN_3X_VERSION = 3.0.0-beta5
BINTRAY_PLUGIN_VERSION = 1.7.3
SHADOW_PLUGIN_VERSION = 2.0.1

# Dependency versions
JUNIT_PLATFORM_VERSION = 1.0.0-RC3
Expand Down
8 changes: 1 addition & 7 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ buildscript {

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

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

apply plugin: "com.android.application"
Expand Down

0 comments on commit 07d7e01

Please sign in to comment.