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

plugins {
  id 'java'
  id 'maven'
  id 'signing'
  id 'checkstyle'
  id 'org.sonarqube' version '2.8'
  id 'net.saliman.cobertura' version '3.0.0'
}

group = 'net.named-data.jndn-extra'
version = '1.2.2'

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

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

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.22'

  testCompile 'junit:junit:4.12'
  testCompile 'net.named-data.jndn-extra:jndn-mock:1.1.1'
  testRuntime 'org.slf4j:slf4j-api:1.7.28'

  checkstyleConfig 'com.puppycrawl.tools:checkstyle:8.23'
}

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'
  group = 'verification'

  testClassesDirs = sourceSets.integrationTest.output.classesDirs
  classpath = sourceSets.integrationTest.runtimeClasspath

  mustRunAfter test
}

tasks.withType(JavaCompile) {
  options.deprecation = true
}

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
}

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/named-data/jndn-management'

        scm {
          connection 'scm:git:https://github.com/named-data/jndn-management.git'
          developerConnection 'scm:git:ssh://git@github.com/named-data/jndn-management.git'
          url 'https://github.com/named-data/jndn-management'
        }

        licenses {
          license {
            name 'GNU Lesser General Public License, Version 3.0+'
            url 'https://www.gnu.org/licenses/lgpl-3.0.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']
}
