buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.owasp:dependency-check-gradle:10.0.3'
    }
}

plugins {
    id 'org.springframework.boot' version '3.5.3'
    id 'io.spring.dependency-management' version '1.1.7'
    id 'java-library'
    id 'war'
    id 'maven-publish'
}
apply plugin: 'org.owasp.dependencycheck'

import org.gradle.internal.jvm.Jvm

assert Jvm.current().javaVersion >= JavaVersion.VERSION_17: 'This project requires Java 17+'

group = 'net.arin'
description = 'RDAP Bootstrap Server'

version = '3.0.1-SNAPSHOT'
if (project.hasProperty('artifactVersion')) {
    version = "${project.properties.artifactVersion}"
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

repositories {
    maven { url 'https://repo.maven.apache.org/maven2' }
}

ext {
    logbackVersion = '1.5.6'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation group: 'com.googlecode.java-ipv6', name: 'java-ipv6', version: '0.17'
    implementation group: 'net.ripe.ipresource', name: 'ipresource', version: '1.52'
    implementation group: 'commons-io', name: 'commons-io', version: '2.19.0'

    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'

    testImplementation group: 'junit', name: 'junit', version: '4.13.2'
    testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.14.2'
}

springBoot {
    mainClass = 'net.arin.rdap_bootstrap.spring.RdapBootstrapApp'
}

bootRun {
    systemProperties System.properties
}

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = "https://maven.pkg.github.com/arineng/rdap_bootstrap_server"
            credentials {
                username = System.getenv("GITHUB_ACTOR")
                password = System.getenv("GITHUB_TOKEN")
            }
        }
    }
    publications {
        bootJava(MavenPublication) {
            artifact bootJar
        }
    }
}
