plugins {
    id 'org.springframework.boot' version "$springBoot"
    id 'java'
    id 'application'
    id 'org.graalvm.buildtools.native' version "$graalvmBuildVersion"
}

java {
    sourceCompatibility = 21
    targetCompatibility = 21
}

repositories {
    mavenCentral()
}

dependencies {
    implementation "info.picocli:picocli:$picocliVersion"
    implementation project(':lib:ac-api')
    implementation "net.sf.applecommander:ShrinkItArchive:$shkVersion"
    implementation "net.sf.applecommander:applesingle-api:$asVersion"
    implementation "net.sf.applecommander:bastools-api:$btVersion"
    implementation "org.applecommander:acdasm:$acdasmVersion"
    implementation "com.google.code.gson:gson:$gsonVersion"

    annotationProcessor "info.picocli:picocli-codegen:$picocliVersion"

    testImplementation platform("org.junit:junit-bom:$junitVersion")
    testImplementation 'org.junit.jupiter:junit-jupiter'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

test {
    useJUnitPlatform()
}

application {
    mainClass = 'io.github.applecommander.acx.Main'
}

jar {
    manifest {
        attributes 'Implementation-Title': "AppleCommander 'acx'",
                'Implementation-Version': archiveVersion
    }
}

bootJar {
  archiveBaseName = 'AppleCommander'
  archiveAppendix = 'acx'
  manifest {
      attributes 'Implementation-Title': "AppleCommander 'acx'",
                  'Implementation-Version': archiveVersion
  }
  from('../../LICENSE')
}

graalvmNative {
    String osName = System.getProperty('os.name').toLowerCase().split()[0]
    String osArch = System.getProperty('os.arch').toLowerCase().split()[0]
    binaries {
        named("main") {
            imageName.set("acx-${osName}-${osArch}-${project.version}")
        }
    }
}
