plugins {
  id 'java-library'
  id("biz.aQute.bnd.builder") version "6.4.0"
}

sourceSets {
  main {
    java {
      exclude 'module-info.java'
    }
  }
  module_info {
    java {
      srcDirs ('src/main')
    }
  }
}

task compileJava9(type: JavaCompile) {
  source = sourceSets.module_info.java
  destinationDirectory = sourceSets.main.output.classesDirs[0]
  classpath = configurations.allProjects
  options.release = 9
}

compileJava {
  dependsOn compileJava9
}

javadoc {
  modularity.inferModulePath = false
}

jar {
  manifest {
    attributes('Export-Package': '*')
  }
}

apply from: rootProject.file('gradle-mvn-push.gradle')

/** Adds information to the publication for uploading to Maven repositories. */
final checkerQualPom(publication) {
  sharedPublicationConfiguration(publication)
  publication.from components.java
  publication.pom {
    name = 'Checker Qual'
    description = String.join(System.lineSeparator(),
        'checker-qual contains annotations (type qualifiers) that a programmer' +
        'writes to specify Java code for type-checking by the Checker Framework.')
    licenses {
      license {
        name = 'The MIT License'
        url = 'http://opensource.org/licenses/MIT'
        distribution = 'repo'
      }
    }
  }
}

publishing {
  publications {
    checkerQual(MavenPublication) {
      checkerQualPom it
    }
  }
}

signing {
  sign publishing.publications.checkerQual
}
