plugins {
    id 'java'
    id 'application'
    id 'com.github.johnrengelman.shadow' version '5.0.0'
    id 'com.palantir.git-version' version '0.11.0'
}

sourceCompatibility = 1.8

dependencies {
	implementation 'commons-cli:commons-cli:1.4'
	implementation 'com.moandjiezana.toml:toml4j:0.7.2'
    // TODO: Implement tests
    //testImplementation 'junit:junit:4.12'
    implementation 'com.google.code.gson:gson:2.8.1'
    implementation 'com.squareup.okio:okio:2.2.2'
}

repositories {
    jcenter()
}

mainClassName = 'link.infra.packwiz.installer.RequiresBootstrap'
version gitVersion()

jar {
    manifest {
        attributes(
            'Main-Class': 'link.infra.packwiz.installer.RequiresBootstrap',
            'Implementation-Version': project.version
        )
    }
}

// Commons CLI and Minimal JSON are already included in packwiz-installer-bootstrap
shadowJar {
   dependencies {
       exclude(dependency('commons-cli:commons-cli:1.4'))
       exclude(dependency('com.eclipsesource.minimal-json:minimal-json:0.9.5'))
   }
}

// Used for vscode launch.json
task copyJar(type: Copy) {
    from shadowJar
    rename "packwiz-installer-(.*)\\.jar", "packwiz-installer.jar"
    into "build/libs/"
}

build.dependsOn copyJar