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

plugins {
  id 'org.sonarqube' version '1.2'
  id 'net.saliman.cobertura' version '2.3.0'
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'checkstyle'

group = 'com.intel.jndn.management'
version = '1.1.0'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
compileJava.options.encoding = 'UTF-8'

repositories {
  mavenLocal()
  jcenter()
  mavenCentral()
  maven {
    url "https://oss.sonatype.org/content/repositories/snapshots/"
  }
}

sourceSets {
  test {
    java {
      exclude '**/*IT.java'
    }
  }
  integrationTest {
    java {
      compileClasspath += main.output + test.output
      runtimeClasspath += main.output + test.output
      srcDir file('src/test/java')
      include '**/*IT.java'
    }
  }
}

configurations {
  checkstyleConfig
  integrationTestCompile.extendsFrom testCompile
  integrationTestRuntime.extendsFrom testRuntime
}

dependencies {
  compile 'net.named-data:jndn:0.10'

  testCompile 'junit:junit:4.12'
  testCompile 'com.intel.jndn.mock:jndn-mock:1.0.1'
  testRuntime 'org.slf4j:slf4j-api:1.7.16'

  checkstyleConfig "com.puppycrawl.tools:checkstyle:6.15"
}

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

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

task integrationTest(type: Test) {
  description 'Compile and run integration tests'
  testClassesDir = sourceSets.integrationTest.output.classesDir
  classpath = sourceSets.integrationTest.runtimeClasspath
}

tasks.withType(Test) {
  reports.html.destination = file("${reporting.baseDir}/${name}")
  testLogging {
    events "passed", "skipped", "failed"
    showStandardStreams = true
    exceptionFormat = "full"
  }
//  outputs.upToDateWhen { false }
}

tasks.withType(Checkstyle) {
  checkstyleClasspath = project.configurations.checkstyleConfig
  checkstyleMain {
    exclude 'com/intel/jndn/management/enums/NfdTlv.java'
  }
  checkstyleTest {
    configFile file('config/checkstyle/checkstyle-test.xml')
  }
  checkstyleIntegrationTest {
    configFile file('config/checkstyle/checkstyle-test.xml')
  }
}

if (JavaVersion.current().isJava8Compatible()) {
  allprojects {
    tasks.withType(Javadoc) {
      options.addStringOption('Xdoclint:none', '-quiet')
    }
  }
}

artifacts {
  archives javadocJar, sourcesJar
}

publishing {
  publications {
    mavenJava(MavenPublication) {
      artifact javadocJar
      artifact sourcesJar
    }
  }
}

signing {
  required { gradle.taskGraph.hasTask("uploadArchives") }
  sign configurations.archives
}

uploadArchives {
  repositories {
    mavenDeployer {
      beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

      repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
        try {
          authentication(userName: ossrhUsername, password: ossrhPassword)
        }
        catch (Exception e) {
        }
      }

      snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
        try {
          authentication(userName: ossrhUsername, password: ossrhPassword)
        }
        catch (Exception e) {
        }
      }

      pom.project {
        name 'jndn-management'
        packaging 'jar'
        description 'Tools for managing an NDN forwarding daemon'
        url 'https://github.com/01org/jndn-management'

        scm {
          connection 'scm:git:https://github.com/cawka/jndn-management'
          developerConnection 'scm:git:https://github.com/01org/jndn-management'
          url 'https://github.com/01org/jndn-management'
        }

        licenses {
          license {
            name 'GNU Lesser General Public License, Version 3.0+'
            url 'http://www.gnu.org/licenses/lgpl.html'
          }
        }

        developers {
          developer {
            id 'andrewbrown'
            name 'Andrew Brown'
            url 'https://github.com/andrewsbrown'
          }
          developer {
            id 'cawka'
            name 'Alexander Afanasyev'
            email 'aa@cs.ucla.edu'
          }
        }
      }
    }
  }
}

cobertura {
  coverageFormats = ['html', 'xml']
}
