Gradle getting ready for multi project configuration
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 8 Jan 2017 23:22:07 +0000 (00:22 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 8 Jan 2017 23:22:07 +0000 (00:22 +0100)
SpringJava/Gradle/build-integTest.gradle [new file with mode: 0644]
SpringJava/Gradle/build-test.gradle [new file with mode: 0644]
SpringJava/Gradle/build.gradle [new file with mode: 0644]
SpringJava/Gradle/settings.gradle [new file with mode: 0644]
SpringJava/Gradle/spring-jpa-persistence/build-integTest.gradle [deleted file]
SpringJava/Gradle/spring-jpa-persistence/build-test.gradle [deleted file]
SpringJava/Gradle/spring-jpa-persistence/build.gradle
SpringJava/Gradle/spring-jpa-persistence/settings.gradle [deleted file]

diff --git a/SpringJava/Gradle/build-integTest.gradle b/SpringJava/Gradle/build-integTest.gradle
new file mode 100644 (file)
index 0000000..575fc86
--- /dev/null
@@ -0,0 +1,36 @@
+sourceSets {
+    integTest {
+        compileClasspath += main.output + test.output
+        runtimeClasspath += main.output + test.output
+    }
+}
+
+configurations {
+  integTestCompile.extendsFrom testCompile
+  integTestRuntime.extendsFrom testRuntime
+}
+
+
+task integTest(type: Test) {
+    // dependsOn startApp
+    // finalizedBy stopApp
+    description = 'Runs integration tests';
+    group = 'verification';
+
+    testClassesDir = sourceSets.integTest.output.classesDir
+    classpath = sourceSets.integTest.runtimeClasspath
+
+    testLogging {
+        events "PASSED", "FAILED", "SKIPPED"
+    }
+
+    jacoco {
+        append = false
+        destinationFile = file("$buildDir/jacoco/jacoco-it.exec")
+        classDumpFile = file("$buildDir/jacoco/classpathIntegdumps")
+    }
+
+    // mustRunAfter test
+}
+
+project.tasks.check.dependsOn(integTest)
diff --git a/SpringJava/Gradle/build-test.gradle b/SpringJava/Gradle/build-test.gradle
new file mode 100644 (file)
index 0000000..3cc22f6
--- /dev/null
@@ -0,0 +1,12 @@
+test {
+    testLogging {
+        events "PASSED", "FAILED", "SKIPPED"
+    }
+
+    jacoco {
+        append = false
+        destinationFile = file("$buildDir/jacoco/jacoco.exec")
+        classDumpFile = file("$buildDir/jacoco/classpathdumps")
+    }
+}
+
diff --git a/SpringJava/Gradle/build.gradle b/SpringJava/Gradle/build.gradle
new file mode 100644 (file)
index 0000000..c6f6aba
--- /dev/null
@@ -0,0 +1,52 @@
+subprojects {
+    apply plugin: 'java'
+    apply plugin: 'idea'
+    apply plugin: 'jacoco'
+    apply plugin: 'eclipse'
+    apply plugin: 'idea'
+
+    group 'de.spring.jpa'
+    version '1.0-SNAPSHOT'
+
+    targetCompatibility = 1.8
+    sourceCompatibility = 1.8
+
+
+    repositories {
+        mavenCentral()
+        maven { url 'https://dl.bintray.com/palantir/releases' }
+    }
+
+    buildscript {
+        repositories {
+            mavenCentral()
+            maven { url 'https://plugins.gradle.org/m2/' }
+        }
+    }
+
+    jar {
+        manifest {
+            attributes 'Implementation-Title': 'Spring JPA Persistence, gradle example', 'Implementation-Version': version
+        }
+    }
+
+    apply plugin: 'jacoco'
+
+    apply from: "$rootProject.projectDir/build-test.gradle"
+    apply from: "$rootProject.projectDir/build-integTest.gradle"
+
+    jacoco {
+        toolVersion = '0.7.6.201602180812'
+        reportsDir = file("$buildDir/reports/jacoco")
+    }
+
+    jacocoTestReport {
+        reports {
+            xml.enabled false
+            csv.enabled false
+            html.destination "${buildDir}/jacoco/"
+        }
+    }
+
+}
+
diff --git a/SpringJava/Gradle/settings.gradle b/SpringJava/Gradle/settings.gradle
new file mode 100644 (file)
index 0000000..89575c1
--- /dev/null
@@ -0,0 +1 @@
+include 'spring-jpa-persistence'
diff --git a/SpringJava/Gradle/spring-jpa-persistence/build-integTest.gradle b/SpringJava/Gradle/spring-jpa-persistence/build-integTest.gradle
deleted file mode 100644 (file)
index 78b70fd..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-sourceSets {
-    integTest {
-        compileClasspath += main.output + test.output
-        runtimeClasspath += main.output + test.output
-    }
-}
-
-configurations {
-  integTestCompile.extendsFrom testCompile
-  integTestRuntime.extendsFrom testRuntime
-}
-
-
-task integTest(type: Test) {
-    // dependsOn startApp
-    // finalizedBy stopApp
-    description = 'Runs integration tests';
-    group = 'verification';
-
-    testClassesDir = sourceSets.integTest.output.classesDir
-    classpath = sourceSets.integTest.runtimeClasspath
-
-    testLogging {
-        events "PASSED", "FAILED", "SKIPPED"
-    }
-
-    jacoco {
-        append = false
-        destinationFile = file("$buildDir/jacoco/jacoco-it.exec")
-        classDumpFile = file("$buildDir/jacoco/classpathIntegdumps")
-    }
-
-    // mustRunAfter test
-}
-
-integTest.doFirst {
-    // It is required in order to run data bases in random ports.
-    // We need it for running tests from IDE and from command console but
-    // also it will be required by systems like Travis where we do not control
-    // the available ports.
-    def mysqlInfo = dockerCompose.servicesInfos.mysql
-    systemProperty 'DATABASE_PORT', mysqlInfo.ports[3306]
-}
-
-dockerCompose.isRequiredBy(integTest)
-dockerCompose {
-    useComposeFiles = ['src/integTest/resources/docker/docker-compose.yml']
-    captureContainersOutput = false
-    stopContainers = true
-    removeContainers = true
-    buildBeforeUp = false
-}
-
-project.tasks.check.dependsOn(integTest)
diff --git a/SpringJava/Gradle/spring-jpa-persistence/build-test.gradle b/SpringJava/Gradle/spring-jpa-persistence/build-test.gradle
deleted file mode 100644 (file)
index 3cc22f6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-test {
-    testLogging {
-        events "PASSED", "FAILED", "SKIPPED"
-    }
-
-    jacoco {
-        append = false
-        destinationFile = file("$buildDir/jacoco/jacoco.exec")
-        classDumpFile = file("$buildDir/jacoco/classpathdumps")
-    }
-}
-
index d726f95..25b3053 100644 (file)
@@ -1,46 +1,14 @@
-group 'de.spring.jpa'
-version '1.0-SNAPSHOT'
-
-
 buildscript {
-    repositories {
-        mavenCentral()
-        maven { url 'https://plugins.gradle.org/m2/' }
-    }
+
     dependencies {
         classpath 'gradle.plugin.com.ewerk.gradle.plugins:querydsl-plugin:1.0.7'
         classpath 'com.avast.gradle:docker-compose-gradle-plugin:0.3.16'
     }
 }
 
-apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'idea'
-apply plugin: 'jacoco'
 apply plugin: 'com.ewerk.gradle.plugins.querydsl'
 apply plugin: 'docker-compose'
 
-apply from: 'build-test.gradle'
-apply from: 'build-integTest.gradle'
-
-
-targetCompatibility = 1.8
-sourceCompatibility = 1.8
-
-
-
-repositories {
-    mavenCentral()
-    maven { url 'https://dl.bintray.com/palantir/releases' }
-}
-
-eclipse {
-    classpath {
-        downloadJavadoc = true
-        downloadSources = true
-    }
-}
-
 dependencies {
     // 1/3 Required dependency for log4j 2 with slf4j: binding between log4j2 and slf4j
     compile('org.apache.logging.log4j:log4j-slf4j-impl:2.7')
@@ -140,22 +108,20 @@ querydsl {
   jpa = true
 }
 
-
-jar {
-    manifest {
-        attributes 'Implementation-Title': 'Spring JPA Persistence, gradle example', 'Implementation-Version': version
-    }
-}
-
-jacoco {
-    toolVersion = '0.7.6.201602180812'
-    reportsDir = file("$buildDir/reports/jacoco")
+integTest.doFirst {
+    // It is required in order to run data bases in random ports.
+    // We need it for running tests from IDE and from command console but
+    // also it will be required by systems like Travis where we do not control
+    // the available ports.
+    def mysqlInfo = dockerCompose.servicesInfos.mysql
+    systemProperty 'DATABASE_PORT', mysqlInfo.ports[3306]
 }
 
-jacocoTestReport {
-    reports {
-        xml.enabled false
-        csv.enabled false
-        html.destination "${buildDir}/jacoco/"
-    }
+dockerCompose.isRequiredBy(integTest)
+dockerCompose {
+    useComposeFiles = ['src/integTest/resources/docker/docker-compose.yml']
+    captureContainersOutput = false
+    stopContainers = true
+    removeContainers = true
+    buildBeforeUp = false
 }
diff --git a/SpringJava/Gradle/spring-jpa-persistence/settings.gradle b/SpringJava/Gradle/spring-jpa-persistence/settings.gradle
deleted file mode 100644 (file)
index a07f836..0000000
+++ /dev/null
@@ -1 +0,0 @@
-rootProject.name = 'gradle-spring-jpa-persistence'