Skip to content

Instantly share code, notes, and snippets.

@darylteo
Last active December 13, 2015 21:39
Show Gist options
  • Select an option

  • Save darylteo/4978932 to your computer and use it in GitHub Desktop.

Select an option

Save darylteo/4978932 to your computer and use it in GitHub Desktop.
/*
* Copyright 2012 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.
*/
apply from: "gradle/maven.gradle"
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
group = groupname
archivesBaseName = artifact
defaultTasks = ['assemble']
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
// We don't produce a jar
jar.enabled = false
assert configurations.archives.artifacts.removeAll { it.file == jar.archivePath }
configurations {
provided
testCompile.extendsFrom provided
}
repositories {
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
}
dependencies {
provided "io.vertx:vertx-core:$vertxVersion"
provided "io.vertx:vertx-platform:$vertxVersion"
testCompile "junit:junit:$junitVersion"
testCompile( "io.vertx:testtools:$toolsVersion" ) {
transitive = false
}
}
buildscript {
repositories {
mavenLocal()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
mavenCentral()
}
dependencies {
//runtime "io.vertx:vertx-platform:$vertxVersion"
classpath "io.vertx:vertx-platform:$vertxVersion"
}
}
sourceSets {
main {
compileClasspath = compileClasspath + configurations.provided
}
}
task copyMod( type:Copy, dependsOn: 'classes' ) {
into "mods/maven:$groupname:$artifact:$version"
from compileJava
from 'src/main/resources'
into( 'lib' ) {
from configurations.compile
}
}
// Package into build/libs/mod.zip
task dist( type: Zip) {
group = 'vert.x'
description = "Assembles a vert.x module"
destinationDir = project.file('build/libs')
archiveName = "${artifact}-${version}" + ".zip"
from copyMod
}
artifacts {
archives dist
}
task cleanModsDir(type: Delete) {
delete 'mods'
}
clean {
dependsOn cleanModsDir
}
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
// classpath.each {
// File file ->
// println file.absolutePath
// }
outputs.upToDateWhen { false }
// Some vert.x properties
systemProperty 'vertx.test.timeout', 15
systemProperty 'vertx.version', "$project.version"
// Show output
testLogging.showStandardStreams = true
testLogging { exceptionFormat "full" }
}
task runMod(dependsOn: copyMod) << {
def pm = org.vertx.java.platform.PlatformLocator.factory.createPlatformManager()
pm.deployModule("maven:$groupname:$artifact:$version", null, 1, null)
}
//task collectDeps(type: Copy) {
// group = 'vert.x'
// description = 'conveniently collect dependencies for other IDEs'
// destinationDir = file("build/deps")
// into("compile") {
// from configurations.compile
// }
// into("test") {
// from configurations.testCompile
// }
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment