plugins {
    id 'groovy-gradle-plugin'
    id 'java-gradle-plugin'
}

repositories {
    mavenCentral()
    gradlePluginPortal()
}

ext {
    set("cycloneDxVersion", '2.4.1')
    set("graalvmToolsVersion", '0.11.1')
    set("springBootVersion", '3.5.6')
    set("dependencyManagementVersion", '1.1.7')
}

dependencies {
    implementation "org.cyclonedx:cyclonedx-gradle-plugin:${cycloneDxVersion}"
    implementation "io.spring.gradle:dependency-management-plugin:${dependencyManagementVersion}"
    implementation "org.graalvm.buildtools:native-gradle-plugin:${graalvmToolsVersion}"
    implementation "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}

configurations.configureEach {
    resolutionStrategy.dependencySubstitution {
        // Override transitive dependency from CycloneDX to fix CVE-2024-26308 and CVE-2024-25710
        substitute module('org.apache.commons:commons-compress') using module('org.apache.commons:commons-compress:1.28.0')
        // Override managed dependency in Spring Boot to fix CVE-2025-48924
        substitute module('org.apache.commons:commons-lang3') using module('org.apache.commons:commons-lang3:3.18.0')
    }
}

gradlePlugin {
    plugins {
        optionalDependenciesPlugin {
            id = "io.arconia.optional-dependencies"
            implementationClass = "io.arconia.build.OptionalDependenciesPlugin"
        }
    }
}
