/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright 2020-2021 The JReleaser authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
plugins {
    id 'application'
    id 'org.jreleaser.jdks'
}

application {
    mainClass = 'org.jreleaser.cli.Main'
}

jar {
    manifest {
        attributes('Main-Class': 'org.jreleaser.cli.Main')
    }
}

config {
    info {
        specification { enabled = true }
    }
}

dependencies {
    api project(':jreleaser-workflow')
    //config
    api project(':jreleaser-config-yaml')
    api project(':jreleaser-config-toml')
    api project(':jreleaser-config-json')

    annotationProcessor "info.picocli:picocli-codegen:$picocliVersion"
    api "info.picocli:picocli:$picocliVersion"
    api "org.slf4j:slf4j-api:$slf4jVersion"
    runtimeOnly "org.slf4j:slf4j-simple:$slf4jVersion"
}

processResources {
    inputs.property('version', project.version)
    filesMatching(['**/*.properties']) {
        expand(
            'version': project.version,
            'id': 'jreleaser',
            'name': 'jreleaser'
        )
    }
}

distributions {
    main {
        contents {
            from('../..') {
                include 'VERSION'
            }
        }
    }
}

jdks {
    zulu11Linux {
        platform = 'linux'
        url = 'https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_x64.zip'
        checksum = '9d1718ef74c29a8148b67ddd90bc9267fc1614e0a1eb0f4ea16e234e86419a60'
    }
    zulu11LinuxMusl {
        platform = 'linux_musl'
        url = 'https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-linux_musl_x64.tar.gz'
        checksum = '406b76e53e8be7e19436dee6954ee903f50c0a2ed3ed86456de4c7b5072aa544'
    }
    zulu11Windows {
        platform = 'windows'
        url = 'https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-win_x64.zip'
        checksum = '7bcbaedecca73811f70a5ee89e9258afff9bc009286449d97d9b3105f52a1a3a'
    }
    zulu11Osx {
        platform = 'osx'
        url = 'https://cdn.azul.com/zulu/bin/zulu11.48.21-ca-jdk11.0.11-macosx_x64.zip'
        checksum = 'abc3a9696fb6c10efcf3c5878cdb049244b0ba5dcc7141c6f0f88b99df626d2a'
    }
}

copyDependencies {
    dependsOn classes
    inputs.files(configurations.runtimeClasspath)
    configuration = 'runtimeClasspath'
}

assemble.dependsOn copyDependencies