Skip to content

Commit

Permalink
split core and integration test sources into separate sub-projects
Browse files Browse the repository at this point in the history
  • Loading branch information
gesellix committed Jan 2, 2017
1 parent b068449 commit 4c2a0db
Show file tree
Hide file tree
Showing 107 changed files with 198 additions and 172 deletions.
189 changes: 22 additions & 167 deletions build.gradle
Expand Up @@ -24,129 +24,28 @@ plugins {
id 'com.gradle.build-scan' version '1.0'
}

repositories {
mavenLocal()
jcenter()
mavenCentral()
}

apply plugin: "com.gradle.plugin-publish"

apply plugin: 'groovy'

apply plugin: 'idea'

apply plugin: 'net.saliman.cobertura'
apply plugin: 'com.github.kt3k.coveralls'

apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

apply plugin: 'com.github.ben-manes.versions'

group = 'de.gesellix'

task sourcesJar(type: Jar) {
dependsOn classes
classifier 'sources'
from sourceSets.main.allSource
}

idea {
module {
testSourceDirs += file('src/integrationTest/groovy')
testSourceDirs += file('src/integrationTest/resources')
}
}

sourceSets {
integrationTest {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
groovy {
srcDir 'src/integrationTest/groovy'
}
resources {
srcDir 'src/integrationTest/resources'
}
}
}

cobertura {
coverageSourceDirs = sourceSets.main.groovy.srcDirs
// TODO should be removed when this issue has been resolved:
// https://github.com/stevesaliman/gradle-cobertura-plugin/issues/81
coberturaVersion = '2.0.3'
}

ext {
artifactVersion = new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date())
bintrayDryRun = false
}

configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}

def versionOverrides = [
'com.squareup.okio:okio:1.10.0',
'junit:junit:4.11',
'org.codehaus.groovy:groovy-all:2.4.7',
'xerces:xercesImpl:2.6.2',
'xerces:xmlParserAPIs:2.6.2',
'xml-apis:xml-apis:1.0.b2'
]

dependencies {
compile gradleApi()
compile localGroovy()

compile 'de.gesellix:docker-client:2017-01-02T17-52-31'

testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'cglib:cglib-nodep:3.2.4'

// see https://docs.gradle.org/current/userguide/test_kit.html
// testCompile gradleTestKit()
}

configurations.all {
resolutionStrategy {
failOnVersionConflict()
force versionOverrides
}
}

task integrationTest(type: Test) {
group = 'verification'
description = 'Runs the integration tests.'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
integrationTest.mustRunAfter test
check.dependsOn integrationTest

task aggregateTestReports(type: TestReport) {
destinationDir = test.reports.html.destination
reportOn test, integrationTest
}
aggregateTestReports.mustRunAfter integrationTest
check.dependsOn aggregateTestReports

cobertura.coverageFormats = ['html', 'xml']

artifacts {
archives sourcesJar
}

publishing {
publications {
gradleDockerPlugin(MavenPublication) {
version artifactVersion
from components.java
artifact sourcesJar
subprojects {
ext {
artifactVersion = new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date())
bintrayDryRun = false
}

apply plugin: 'groovy'
apply plugin: 'com.github.ben-manes.versions'

def dependencyVersions = [
'com.squareup.okio:okio:1.10.0',
'junit:junit:4.11',
'org.codehaus.groovy:groovy-all:2.4.7',
'xerces:xercesImpl:2.6.2',
'xerces:xmlParserAPIs:2.6.2',
'xml-apis:xml-apis:1.0.b2'
]

configurations.all {
resolutionStrategy {
failOnVersionConflict()
force dependencyVersions
}
}
}
Expand All @@ -156,50 +55,6 @@ buildScan {
licenseAgree = 'yes'
}

bintray {
user = System.env.BINTRAY_USER ?: project["bintray.user"]
key = System.env.BINTRAY_API_KEY ?: project["bintray.key"]
publications = ['gradleDockerPlugin']
pkg {
repo = 'docker-utils'
name = 'gradle-docker-plugin'
desc = 'A Docker plugin for Gradle'
licenses = ['Apache-2.0']
labels = ['docker', 'gradle', 'remote api', 'plugin']
websiteUrl = 'https://github.com/gesellix/gradle-docker-plugin'
issueTrackerUrl = 'https://github.com/gesellix/gradle-docker-plugin/issues'
vcsUrl = 'https://github.com/gesellix/gradle-docker-plugin.git'
attributes = ['gradle-plugin': 'de.gesellix.docker:de.gesellix:gradle-docker-plugin']
version = [
name : artifactVersion,
attributes: ['gradle-plugin': 'de.gesellix.docker:de.gesellix:gradle-docker-plugin']
]
}
dryRun = bintrayDryRun
}
bintrayUpload.dependsOn build

pluginBundle {
website = 'https://github.com/gesellix/gradle-docker-plugin'
vcsUrl = 'https://github.com/gesellix/gradle-docker-plugin.git'
description = 'A Docker plugin for Gradle'
tags = ['docker', 'gradle', 'remote api', 'plugin']

plugins {
gradleDockerPlugin {
id = 'de.gesellix.docker'
displayName = 'Gradle Docker plugin'
version artifactVersion
}
}

mavenCoordinates {
groupId = "de.gesellix"
artifactId = "gradle-docker-plugin"
version = artifactVersion
}
}

task wrapper(type: Wrapper) {
gradleVersion = '3.2.1'
distributionType = Wrapper.DistributionType.ALL
Expand Down
28 changes: 28 additions & 0 deletions integration-test/build.gradle
@@ -0,0 +1,28 @@
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
}
}

repositories {
mavenLocal()
jcenter()
mavenCentral()
}

//apply plugin: 'maven'

group = 'de.gesellix'

dependencies {
compile project(':plugin')

testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'cglib:cglib-nodep:3.2.4'

// see https://docs.gradle.org/current/userguide/test_kit.html
// testCompile gradleTestKit()
}
@@ -1,5 +1,3 @@
FROM busybox:latest

FROM alpine:edge
ADD ./subdirectory/file-to-be-included.txt /file-to-be-included.txt

CMD ["true"]
File renamed without changes.
123 changes: 123 additions & 0 deletions plugin/build.gradle
@@ -0,0 +1,123 @@
import java.text.SimpleDateFormat

buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
}

dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.4.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.7.1'

// breaks `./gradlew pubPlug`?
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.5'
classpath 'com.gradle.publish:plugin-publish-plugin:0.9.4'
}
}

repositories {
mavenLocal()
jcenter()
mavenCentral()
}

apply plugin: "com.gradle.plugin-publish"

apply plugin: 'net.saliman.cobertura'
apply plugin: 'com.github.kt3k.coveralls'

apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'

group = 'de.gesellix'

cobertura {
coverageSourceDirs = sourceSets.main.groovy.srcDirs
// TODO should be removed when this issue has been resolved:
// https://github.com/stevesaliman/gradle-cobertura-plugin/issues/81
coberturaVersion = '2.0.3'
}

dependencies {
compile gradleApi()
compile localGroovy()

compile 'de.gesellix:docker-client:2017-01-02T17-52-31'

testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'cglib:cglib-nodep:3.2.4'

// see https://docs.gradle.org/current/userguide/test_kit.html
// testCompile gradleTestKit()
}

cobertura.coverageFormats = ['html', 'xml']

task sourcesJar(type: Jar) {
dependsOn classes
classifier 'sources'
from sourceSets.main.allSource
}

artifacts {
archives sourcesJar
}

publishing {
publications {
gradleDockerPlugin(MavenPublication) {
version artifactVersion
from components.java
artifact sourcesJar
}
}
}

bintray {
user = System.env.BINTRAY_USER ?: project["bintray.user"]
key = System.env.BINTRAY_API_KEY ?: project["bintray.key"]
publications = ['gradleDockerPlugin']
pkg {
repo = 'docker-utils'
name = 'gradle-docker-plugin'
desc = 'A Docker plugin for Gradle'
licenses = ['Apache-2.0']
labels = ['docker', 'gradle', 'remote api', 'plugin']
websiteUrl = 'https://github.com/gesellix/gradle-docker-plugin'
issueTrackerUrl = 'https://github.com/gesellix/gradle-docker-plugin/issues'
vcsUrl = 'https://github.com/gesellix/gradle-docker-plugin.git'
attributes = ['gradle-plugin': 'de.gesellix.docker:de.gesellix:gradle-docker-plugin']
version = [
name : artifactVersion,
attributes: ['gradle-plugin': 'de.gesellix.docker:de.gesellix:gradle-docker-plugin']
]
}
dryRun = bintrayDryRun
}
bintrayUpload.dependsOn build

pluginBundle {
website = 'https://github.com/gesellix/gradle-docker-plugin'
vcsUrl = 'https://github.com/gesellix/gradle-docker-plugin.git'
description = 'A Docker plugin for Gradle'
tags = ['docker', 'gradle', 'remote api', 'plugin']

plugins {
gradleDockerPlugin {
id = 'de.gesellix.docker'
displayName = 'Gradle Docker plugin'
version artifactVersion
}
}

mavenCoordinates {
groupId = "de.gesellix"
artifactId = "gradle-docker-plugin"
version = artifactVersion
}
}
Expand Up @@ -66,7 +66,7 @@ class DockerTask extends DefaultTask {
/**
* Sets a proxy other than the one in the {@code docker} project extension.
*
* @param proxy A proxy object as understood by {@link de.gesellix.docker.client.DockerClientImpl}.
* @param proxy A proxy object as understood by {@link DockerClientImpl}.
*/
void setProxy(def proxy) {
this.proxy = proxy
Expand Down
@@ -1,6 +1,5 @@
package de.gesellix.gradle.docker.tasks

import groovy.json.JsonBuilder
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction

Expand Down
3 changes: 3 additions & 0 deletions plugin/src/test/resources/docker/Dockerfile
@@ -0,0 +1,3 @@
FROM alpine:edge
ADD ./subdirectory/file-to-be-included.txt /file-to-be-included.txt
CMD ["true"]
@@ -0,0 +1 @@
hello world

0 comments on commit 4c2a0db

Please sign in to comment.