
////////////////////////////////////////////////////////////////////////////////////////////
// This file is generated by Speakeasy and any edits will be lost in generation updates.
//
// If you wish to customize this file then place those customizations in `build-extras.gradle` which 
// is not touched by generation updates.
//
// Additions to the plugins block can be made by setting the `additionalPlugins` property (an array 
// of string where each string value is an additional line in the block) in gen.yaml.
////////////////////////////////////////////////////////////////////////////////////////////

plugins {
    // Apply the java-library plugin for API and implementation separation.
    id 'java-library'
    id 'maven-publish'
    id 'signing'
    id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3'
}

compileJava.options.encoding = "UTF-8"
compileJava.options.compilerArgs += '-Xlint:unchecked'
compileTestJava.options.encoding = "UTF-8"

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
    withSourcesJar()
    withJavadocJar()
}

model {
    tasks.generatePomFileForMavenPublication {
        destination = file("$buildDir/pom.xml")
    }
}

jar {
    dependsOn(":generatePomFileForMavenPublication")
    archiveBaseName = "plexapi"

    into("META-INF/maven/dev.plexapi/plexapi") {
        from("$buildDir/pom.xml")
    }
}

javadoc {
    options.encoding = "UTF-8"

    if(JavaVersion.current().isJava9Compatible()) {
        options.addBooleanOption('html5', true)
    }
    options.addStringOption('Xdoclint:none', '-quiet')
}

tasks.withType(Javadoc) {
  failOnError false
  options.addStringOption('Xdoclint:none', '-quiet')
}

group = "dev.plexapi"
version = "0.3.2"

sourcesJar {
    archiveBaseName = "plexapi"
}

javadocJar {
    archiveBaseName = "plexapi"
}
sonatypeCentralUpload {
    // This is your Sonatype generated username
    username = System.getenv("SONATYPE_USERNAME")
    // This is your sonatype generated password
    password = System.getenv("SONATYPE_PASSWORD")

    // This is a list of files to upload. Ideally you would point to your jar file, source and javadoc jar (required by central)
    archives = files(
      "$buildDir/libs/plexapi-${version}.jar",
      "$buildDir/libs/plexapi-${version}-sources.jar",
      "$buildDir/libs/plexapi-${version}-javadoc.jar"
    )

    // This is the pom file to upload. This is required by central
    pom = file("$buildDir/pom.xml")

    // This is your PGP private key. This is required to sign your files
    signingKey = System.getenv("SONATYPE_SIGNING_KEY")
    // This is your PGP private key passphrase to decrypt your private key
    signingKeyPassphrase = System.getenv("SIGNING_KEY_PASSPHRASE")
}


publishing {

    publications {
        maven(MavenPublication) {
            groupId = 'dev.plexapi'
            artifactId = 'plexapi'
            version = '0.3.2'

            from components.java

            pom {
                name = 'plexapi Java SDK'
                description = 'SDK enabling Java developers to easily integrate with the plexapi API.'
                url = 'https://github.com/LukeHagar/plexjava'
                scm {
                    url = 'github.com/LukeHagar/plexjava'
                    connection = 'scm:git:ssh://git@github.com/LukeHagar/plexjava.git'
                }
                licenses {
                    license {
                        name = 'The MIT License (MIT)'
                        url = 'https://mit-license.org/'
                    }
                }
                developers {
                    developer {
                        name = 'plexapi'
                        organization = 'plexapi'
                        email = 'lukeslakemail@gmail.com'
                    }
                }
                organization {
                    name = 'plexapi'
                    url = 'plexapi.dev'
                }
            }
        }
    }
}

if (!project.hasProperty('skip.signing')) {
    signing {
        def signingKey = findProperty("signingKey")
        def signingPassphrase = findProperty("signingPassphrase")
        useInMemoryPgpKeys(signingKey, signingPassphrase)
        sign publishing.publications.maven
    }
}

dependencies {
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.2'
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2'
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2'
    implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
    implementation 'org.apache.httpcomponents:httpclient:4.5.14'
    implementation 'org.apache.httpcomponents:httpmime:4.5.14'
    implementation 'commons-io:commons-io:2.15.1'
}



apply from: 'build-extras.gradle'
