Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
/*
The MIT License (MIT)
Copyright (c) 2017-2021 tools4j.org (Marco Terzer)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java-library'
id 'idea'
id 'io.freefair.javadoc-links' version '4.1.6' apply false
id 'biz.aQute.bnd.builder' version '5.0.0' apply false
id "com.github.hierynomus.license" version "0.15.0" apply false
}
defaultTasks 'clean', 'build'
def projGroup = 'org.tools4j'
def projVersion = file('version.txt').text.trim()
def junit4Version = '4.13.1'
def junit5Version = '5.7.0'
ext {
//gradle clean build publish -PossrhUsername=mterzer -PossrhPassword=xxx
isReleaseVersion = !projVersion.endsWith('-SNAPSHOT')
releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
println name + " version=" + projVersion + " release=" + isReleaseVersion
if (!project.hasProperty('ossrhUsername')) {
ossrhUsername = ''
}
if (!project.hasProperty('ossrhPassword')) {
ossrhPassword = ''
}
}
def projectPom = {
name = 'spockito'
packaging = 'pom'
// optionally artifactId can be defined here
description = 'Java JUnit runner for parameterized tests where the test cases are defined in a table-like manner.'
url = 'https://github.com/tools4j/spockito'
scm {
connection = 'scm:git:https://github.com/tools4j/spockito.git'
developerConnection = 'scm:git:https://github.com/tools4j/spockito.git'
url = 'https://github.com/tools4j/spockito.git'
}
licenses {
license {
name = 'The MIT License (MIT)'
url = 'https://opensource.org/licenses/MIT'
}
}
developers {
developer {
id = 'terzerm'
name = 'Marco Terzer'
email = 'terzerm@gmail.com'
url = 'https://github.com/terzerm'
}
}
}
jar.enabled = false
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'license'
//apply plugin: 'io.freefair.javadoc-links'
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-params:${junit5Version}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit5Version}"
}
group = projGroup
version = projVersion
test {
useJUnitPlatform()
}
tasks.withType(Sign) {
onlyIf {
isReleaseVersion && gradle.taskGraph.hasTask(tasks.publish)
}
}
tasks.withType(Jar) {
enabled = true
includeEmptyDirs = false
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.deprecation = true
}
tasks.withType(Test) {
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
}
reports.html.enabled = false // Disable individual test reports
}
license {
header rootProject.file('etc/LICENSE.template')
strictCheck true
include "**/*.java"
ext.year = LocalDate.now().getYear()
mapping {
java='SLASHSTAR_STYLE'
}
}
compileJava.dependsOn licenseFormat
javadoc {
title = '<h1>Spockito</h1>'
options.bottom = '<i>Copyright &#169; 2017-2021 tools4j.org (Marco Terzer). All Rights Reserved.</i>'
options.encoding = 'UTF-8'
options.docEncoding = 'UTF-8'
options.charSet = 'UTF-8'
if (JavaVersion.current().isJava10Compatible()) {
options.addBooleanOption 'html5', true
}
}
task testJar(type: Jar, dependsOn: testClasses) {
archiveClassifier.set "test-${project.archivesBaseName}"
from sourceSets.test.output
}
configurations {
tests
}
artifacts {
tests testJar
}
}
project(':spockito-table') {
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'io.freefair.javadoc-links'
jar {
bnd """
Automatic-Module-Name: org.tools4j.spockito-table
Bundle-Name: org.tools4j.spockito-table
Bundle-SymbolicName: org.tools4j.spockito-table
Implementation-Title: Spockito
Implementation-Vendor: tools4j.org
Implementation-Version: ${projVersion}
-exportcontents: org.tools4j.spockito, org.tools4j.spockito.*
# Suppress headers that reduce reproducibility.
-reproducible: true
-noextraheaders: true
"""
}
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
spockitoTable(MavenPublication) {
from components.java
pom(projectPom)
}
}
repositories {
maven {
url = !isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
signing {
sign publishing.publications.spockitoTable
}
}
project(':spockito-junit4') {
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'biz.aQute.bnd.builder'
dependencies {
api project(':spockito-table')
api "junit:junit:${junit4Version}"
}
jar {
bnd """
Automatic-Module-Name: org.tools4j.spockito-junit4
Bundle-Name: org.tools4j.spockito-junit4
Bundle-SymbolicName: org.tools4j.spockito-junit4
Implementation-Title: Spockito
Implementation-Vendor: tools4j.org
Implementation-Version: ${projVersion}
-exportcontents: org.tools4j.spockito, org.tools4j.spockito.*
# Suppress headers that reduce reproducibility.
-reproducible: true
-noextraheaders: true
"""
}
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
spockitoChronicle(MavenPublication) {
from components.java
pom(projectPom)
}
}
repositories {
maven {
url = !isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
signing {
sign publishing.publications.spockitoChronicle
}
}
project(':spockito-junit5') {
apply plugin: 'maven-publish'
apply plugin: 'signing'
dependencies {
api project(':spockito-table')
api "org.junit.jupiter:junit-jupiter-api:${junit5Version}"
api "org.junit.jupiter:junit-jupiter-params:${junit5Version}"
}
java {
withSourcesJar()
withJavadocJar()
}
publishing {
publications {
spockitoSamples(MavenPublication) {
from components.java
pom(projectPom)
}
}
repositories {
maven {
url = !isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
}
signing {
sign publishing.publications.spockitoSamples
}
}
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
// Include the results from the `test` task in all sub-projects
reportOn subprojects*.test
}
task copyCrashLogs(type: Copy) {
from '.'
include '**/hs_err*.log'
include 'LICENSE'
into 'build/crash_logs'
includeEmptyDirs = false
}
wrapper {
gradleVersion = '6.1.1'
distributionType = 'ALL'
}