| apply plugin: 'kotlin' | |
| apply plugin: 'java-library' | |
| apply plugin: 'jacoco' | |
| apply plugin: 'org.jetbrains.dokka' | |
| apply plugin: 'org.jlleitschuh.gradle.ktlint' | |
| apply plugin: 'io.gitlab.arturbosch.detekt' | |
| apply plugin: 'maven-publish' | |
| apply plugin: 'signing' | |
| dependencies { | |
| // Transitively supply all kotlin APIs to our users | |
| api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | |
| testImplementation 'junit:junit:4.12' | |
| testImplementation 'org.mockito:mockito-core:2.15.0' | |
| } | |
| tasks.withType(JavaCompile) { | |
| options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" | |
| } | |
| compileKotlin.kotlinOptions { | |
| allWarningsAsErrors = true | |
| jvmTarget = "1.8" | |
| } | |
| compileTestKotlin.kotlinOptions { | |
| allWarningsAsErrors = true | |
| jvmTarget = "1.8" | |
| } | |
| // This hack puts testing resource files where we can get to them | |
| task copyTestResources(type: Copy) { | |
| from "${projectDir}/src/test/resources/printer" | |
| into "${buildDir}/classes/test/printer" | |
| } | |
| processTestResources.dependsOn copyTestResources | |
| task cleanTestResources(type: Delete) { | |
| delete fileTree("${buildDir}/classes/test/printer") { | |
| include '**/*.bin' | |
| } | |
| } | |
| test.finalizedBy cleanTestResources | |
| test { | |
| testLogging { | |
| events "failed" | |
| showExceptions = true | |
| exceptionFormat = "full" | |
| } | |
| } | |
| test { | |
| finalizedBy jacocoTestReport | |
| } | |
| jacoco { | |
| toolVersion = "0.8.9" | |
| } | |
| jacocoTestReport { | |
| reports { | |
| xml.required = true // coveralls plugin depends on xml format report | |
| html.outputLocation = layout.buildDirectory.dir('reports/jacocoHtml') | |
| } | |
| afterEvaluate { | |
| getClassDirectories().setFrom(files(classDirectories.files.collect { | |
| fileTree(dir: it, exclude: ['**/model/**']) | |
| })) | |
| } | |
| } | |
| detekt { | |
| input = files("$projectDir/src/main") | |
| baseline = file("$projectDir/src/config/baseline.xml") | |
| } | |
| // Graph dependencies | |
| task graphDeps(type: Exec, dependsOn: classes) { | |
| commandLine 'bin/graphDeps' | |
| } | |
| configure(graphDeps) { | |
| group = "Verification" | |
| description = "Create a dependency graph" | |
| } | |
| ktlint { | |
| version = "$ktlint_version" | |
| } | |
| afterEvaluate { | |
| check.dependsOn ktlintCheck | |
| } | |
| java { | |
| withJavadocJar() | |
| withSourcesJar() | |
| } | |
| publishing { | |
| publications { | |
| mavenJava(MavenPublication) { | |
| from components.java | |
| artifactId = project.name | |
| pom { | |
| name = project.name | |
| description = 'IPP packet builder/parser' | |
| url = 'https://github.com/hpinc/jipp' | |
| organization { | |
| name = 'HP Development Company, L.P.' | |
| url = 'https://github.com/HPInc' | |
| } | |
| issueManagement { | |
| system = 'GitHub' | |
| url = 'https://github.com/HPInc/jipp/issues' | |
| } | |
| licenses { | |
| license { | |
| name ='MIT' | |
| url ='https://github.com/HPInc/jipp/blob/master/LICENSE.md' | |
| distribution ='repo' | |
| } | |
| } | |
| scm { | |
| url = 'https://github.com/HPInc/jipp' | |
| connection = 'scm:git:git://github.com/HPInc/jipp.git' | |
| developerConnection = 'scm:git:ssh://git@github.com:HPInc/jipp.git' | |
| } | |
| developers { | |
| developer { | |
| name = 'Glade Diviney' | |
| email = 'glade.diviney@hp.com' | |
| } | |
| } | |
| } | |
| } | |
| } | |
| repositories { | |
| maven { | |
| url = "https://oss.sonatype.org/service/local/staging/deploy/maven2" | |
| credentials { | |
| username = project.ext.properties.sonatypeUsername | |
| password = project.ext.properties.sonatypePassword | |
| } | |
| } | |
| } | |
| } | |
| signing { | |
| sign publishing.publications.mavenJava | |
| } |