Skip to content

Commit

Permalink
Got all tests for vertx-2.0.0-SNAPSHOT running
Browse files Browse the repository at this point in the history
Still uses the work-queue, so need to look into multithreaded worker mods
  • Loading branch information
timyates committed Apr 5, 2013
1 parent 23fa579 commit 9319f93
Show file tree
Hide file tree
Showing 12 changed files with 370 additions and 273 deletions.
194 changes: 69 additions & 125 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,155 +1,99 @@
import org.vertx.java.platform.PlatformLocator
import org.vertx.java.core.Handler
apply from: "gradle/setup.gradle"
apply from: "gradle/vertx.gradle"

/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* 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.
*/
Usage:
apply from: "gradle/maven.gradle"
./gradlew task_name
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
(or gradlew.bat task_name if you have the misfortune to have to use Windows)
group = groupname
archivesBaseName = artifact
If no task name is specified then the default task 'assemble' is run
defaultTasks = ['assemble']
Task names are:
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
idea - generate a skeleton IntelliJ IDEA project
// We don't produce a jar
jar.enabled = false
assert configurations.archives.artifacts.removeAll { it.file == jar.archivePath }
eclipse - generate a skeleton Eclipse IDE project
configurations {
provided
testCompile.extendsFrom provided
}
assemble - builds the outputs, by default this is the module zip file. It can also include a jar file if produceJar
in gradle.properties is set to true. Outputs are created in build/libs.
if pullInDeps in gradle.properties is set to 'true' then the modules dependencies will be
automatically pulled into a nested mods directory inside the module during the build
repositories {
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
}
copyMod - builds and copies the module to the local 'mods' directory so you can execute vertx runmod (etc)
directly from the command line
dependencies {
provided "io.vertx:vertx-core:$vertxVersion"
provided "io.vertx:vertx-platform:$vertxVersion"
compile "c3p0:c3p0:$c3p0Version"
compile "commons-dbutils:commons-dbutils:$dbutilsVersion"
testCompile "org.hsqldb:hsqldb:$hsqldbVersion"
testCompile "junit:junit:$junitVersion"
testCompile( "io.vertx:testtools:$toolsVersion" ) {
transitive = false
}
}

// This sets up the classpath for
buildscript {
modZip - creates the module zip into build/libs
repositories {
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
}
clean - cleans everything up
dependencies {
classpath "io.vertx:vertx-core:$vertxVersion"
classpath "io.vertx:vertx-platform:$vertxVersion"
}
}
test - runs the tests. An nice html test report is created in build/reports/tests (index.html)
sourceSets {
main {
compileClasspath = compileClasspath + configurations.provided
}
}
runMod - runs the module. This is similar to executing vertx runmod from the command line except that it does
not use the version of Vert.x installed and on the PATH to run it. Instead it uses the version of Vert.x
that the module was compiled and tested against.
task copyMod( type:Copy, dependsOn: 'classes', description: 'Assemble the module into the local mods directory' ) {
into "mods/maven:$groupname:$artifact:$version"
from compileJava
from 'src/main/resources'
into( 'lib' ) {
from configurations.compile
}
}
pullInDeps - pulls in all dependencies of the module into a nested module directory
task modZip( type: Zip, dependsOn: 'pullInDeps', description: 'Package the module .zip file') {
group = 'vert.x'
description = "Assembles a vert.x module"
destinationDir = project.file('build/libs')
archiveName = "${artifact}-${version}" + ".zip"
from copyMod
}
uploadArchives - upload the module zip file (and jar if one has been created) to Nexus. You will need to
configure sonatypeUsername and sonatypePassword in ~/.gradle/gradle.properties.
artifacts {
archives modZip
}
install - install any jars produced to the local Maven repository (.m2)
task cleanModsDir(type: Delete) {
delete 'mods'
}
*/

clean {
dependsOn cleanModsDir
dependencies {
compile "c3p0:c3p0:$c3p0Version"
compile "commons-dbutils:commons-dbutils:$dbutilsVersion"
testCompile "org.hsqldb:hsqldb:$hsqldbVersion"
testCompile "junit:junit:$junitVersion"
testCompile( "io.vertx:testtools:$toolsVersion" ) {
transitive = false
}
}

test {
dependsOn copyMod
// Remove any classpath entries for the module classes and resources- these must be picked up using the module classloader from
// inside the module, not from the system classpath
classpath -= sourceSets.main.output
classpath -= configurations.compile
/* Configure which tests are included
include 'org/foo/**'
exclude 'org/boo/**'
*/

// classpath.each {
// File file ->
// println file.absolutePath
// }

// Make sure tests are always run!
outputs.upToDateWhen { false }

systemProperty 'vertx.test.timeout', 15
systemProperty 'vertx.version', "$project.version"
systemProperty 'vertx.modulename', "maven:$groupname:$artifact:$version"
}

// Show output
testLogging.showStandardStreams = true
/*
If you're uploading stuff to Maven, Gradle needs to generate a POM.
Please edit the details below.
*/
def configurePom(def pom) {
pom.project {
description 'MongoDB Persistor Module for Vert.x'
inceptionYear '2012'
packaging 'zip'
url 'https://github.com/vert-x/mod-mongo-persistor'

developers {
developer {
id 'purplefox'
name 'Tim Fox'
// email 'developer email'
}
}

testLogging { exceptionFormat "full" }
}
scm {
url 'https://github.com/vert-x/mod-mongo-persistor'
}

task runMod(dependsOn: copyMod, description: 'Run the module using all the build dependencies (not using installed vertx') << {
def pm = PlatformLocator.factory.createPlatformManager()
pm.deployModule("maven:$groupname:$artifact:$version", null, 1, new Handler<String>() {
public void handle(String deploymentID) {
System.out.println("CTRL-C to stop server")
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
});
Thread.sleep(Long.MAX_VALUE);
}

task pullInDeps(dependsOn: copyMod, description: 'Pull in all the module dependencies for the module into the nested mods directory') << {
if (pullInDeps == 'true') {
def pm = PlatformLocator.factory.createPlatformManager()
def modName = "maven:$groupname:$artifact:$version"
System.out.println("Pulling in dependencies for module " + modName + " Please wait")
pm.pullInDependencies(modName)
System.out.println("Dependencies pulled into mods directory of module")
properties {
setProperty('project.build.sourceEncoding', 'UTF8')
}
}
}
12 changes: 4 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
groupname=com.bloidonia
artifact=mod-jdbc-persistor
version=2.0.0-SNAPSHOT

# Set to true if you want module dependencies to be pulled in and nested inside the module itself
pullInDeps=false

gradleVersion=1.4
# Set to true if you want the build to output a jar as well as a module zip file
produceJar=false

gradleVersion=1.5
vertxVersion=2.0.0-SNAPSHOT
toolsVersion=1.0.0-SNAPSHOT
junitVersion=4.10

c3p0Version=0.9.1.2
dbutilsVersion=1.5
hsqldbVersion=2.2.9
34 changes: 1 addition & 33 deletions gradle/maven.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ uploadArchives {

repositories {
mavenDeployer {
setUniqueVersion(false)
// setUniqueVersion(false)

configuration = configurations.archives

Expand All @@ -64,36 +64,4 @@ uploadArchives {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// configuration methods

def configurePom(def pom) {
pom.project {
description 'Vert.x module that provides JavaScript support using Rhino'
inceptionYear '2013'
packaging 'jar'
url 'http://vertx.io'

developers {
developer {
id 'purplefox'
name 'Tim Fox'
// email '[email protected]'
}
}

scm {
url 'https://github.com/vert-x/mod-lang-rhino'
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}

properties {
setProperty('project.build.sourceEncoding', 'UTF8')
}
}
}

Loading

0 comments on commit 9319f93

Please sign in to comment.