Skip to content

Instantly share code, notes, and snippets.

@daschl
Created August 4, 2014 13:59
Show Gist options
  • Save daschl/8dabae7e2e04d74ccd88 to your computer and use it in GitHub Desktop.
Save daschl/8dabae7e2e04d74ccd88 to your computer and use it in GitHub Desktop.

Revisions

  1. daschl created this gist Aug 4, 2014.
    210 changes: 210 additions & 0 deletions build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,210 @@
    /**
    * Copyright (C) 2014 Couchbase, Inc.
    *
    * 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 DEALING
    * IN THE SOFTWARE.
    */

    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'idea'
    apply plugin: 'maven-publish'
    apply plugin: 'checkstyle'
    apply plugin: 'com.github.johnrengelman.shadow'

    apply plugin: 'propdeps'
    apply plugin: 'propdeps-maven'
    apply plugin: 'propdeps-idea'
    apply plugin: 'propdeps-eclipse'

    group = 'com.couchbase.client'
    description = 'Official Couchbase JVM Core Library'

    sourceCompatibility = 1.6
    targetCompatibility = 1.6

    buildscript {
    repositories {
    maven { url 'http://repo.spring.io/plugins-release' }
    jcenter()
    }
    dependencies {
    classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.6'
    classpath 'com.github.jengelman.gradle.plugins:shadow:1.0.3'
    }
    }

    repositories {
    mavenCentral()
    jcenter()
    }

    sourceSets {
    integration
    }

    configurations {
    integrationCompile.extendsFrom compile, testCompile
    integrationRuntime.extendsFrom runtime, testRuntime

    markdownDoclet
    }

    dependencies {
    compile group: 'io.netty', name: 'netty-all', version: '4.0.21.Final'
    compile group: 'com.netflix.rxjava', name:'rxjava-core', version: '0.20.0-RC4'
    compile group: 'com.lmax', name: 'disruptor', version: '3.3.0'
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1.3'

    optional group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
    optional group: 'commons-logging', name: 'commons-logging', version: '1.1.3'
    optional group: 'log4j', name: 'log4j', version: '1.2.17'

    shadow group: 'com.netflix.rxjava', name:'rxjava-core', version: '0.20.0-RC4'

    testCompile group: 'junit', name: 'junit', version: '4.11'
    testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
    testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'

    integrationCompile sourceSets.main.output

    markdownDoclet 'ch.raffael.pegdown-doclet:pegdown-doclet:1.1.1'
    }

    idea {
    module {
    scopes.PROVIDED.minus += configurations.compile
    }
    }

    javadoc {
    doLast {
    copy {
    from "docs"
    into "$buildDir/docs/javadoc"
    }
    }
    }
    javadoc.options {
    docletpath = configurations.markdownDoclet.files.asType(List)
    doclet = "ch.raffael.doclets.pegdown.PegdownDoclet"
    addStringOption("parse-timeout", "10")
    }

    task integrationTest(type: Test) {
    testClassesDir = sourceSets.integration.output.classesDir
    classpath = sourceSets.integration.runtimeClasspath
    }

    task wrapper(type: Wrapper) {
    gradleVersion = '1.12'
    }

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

    task javadocJar(type: Jar) {
    classifier = 'javadoc'
    from javadoc
    }

    artifacts {
    archives sourcesJar
    archives javadocJar
    }

    checkstyle {
    configFile = new File(rootDir, "checkstyle.xml")
    }

    shadowJar {
    baseName = 'core-io'
    classifier = ''
    dependencies {
    exclude(dependency(group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'))
    exclude(dependency(group: 'commons-logging', name: 'commons-logging', version: '1.1.3'))
    exclude(dependency(group: 'log4j', name: 'log4j', version: '1.2.17'))
    exclude(dependency(group: 'com.netflix.rxjava', name:'rxjava-core', version: '0.20.0-RC4'))
    }

    relocate 'io.netty', 'com.couchbase.client.deps.io.netty'
    relocate 'com.lmax', 'com.couchbase.client.deps.com.lmax'
    relocate 'com.fasterxml', 'com.couchbase.client.deps.com.fasterxml'
    }

    /*def pomConfig = {
    name = rootProject.name
    description = rootProject.description
    url = 'http://couchbase.com'
    organization {
    name = 'Couchbase, Inc.'
    url = 'http://couchbase.com'
    }
    licenses {
    license {
    name 'The Apache Software License, Version 2.0'
    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    distribution 'repo'
    }
    }
    scm {
    url = 'https://github.com/couchbase/couchbase-jvm-core'
    connection = 'scm:git:git://github.com/couchbase/couchbase-jvm-core'
    developerConnection = 'scm:git:git://github.com/couchbase/couchbase-jvm-core'
    }
    developers {
    developer {
    id = 'daschl'
    name = 'Michael Nitschinger'
    email = '[email protected]'
    }
    }
    issueManagement {
    system = "Couchbase JIRA"
    url = "http://www.couchbase.com/issues/browse/JCBC"
    }
    }*/

    publishing {
    publications {
    shadow(MavenPublication) {
    from components.shadow
    artifactId = 'core-io'

    artifact(javadocJar) {
    classifier = 'javadoc'
    }
    artifact(sourcesJar) {
    classifier = 'sources'
    }

    /*pom.withXml {
    def root = asNode()
    root.children().last() + pomConfig
    }*/
    }
    }

    repositories {
    maven {
    url "$buildDir/repo"
    }
    }
    }