plugins {
    id 'java'
    id "com.github.johnrengelman.shadow" version "7.1.0"
}

group project.asb_trigger_group
version project.asb_trigger_version

configurations {
    dist {
        transitive true
    }
}

repositories {
    mavenLocal()

    maven {
        url = 'https://maven.wso2.org/nexus/content/groups/wso2-public/'
    }

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

    maven {
        url = 'https://maven.pkg.github.com/ballerina-platform/ballerina-lang'
        credentials {
            username System.getenv("packageUser")
            password System.getenv("packagePAT")
        }
    }
}

dependencies {
    implementation group: 'com.azure', name: 'azure-messaging-servicebus', version: project.asb_sdk_version
    dist group: 'com.azure', name: 'azure-messaging-servicebus', version: project.asb_sdk_version
    implementation group: 'org.ballerinalang', name: 'ballerina-lang', version: project.ballerinaLangVersion
    implementation group: 'log4j', name: 'log4j', version: project.log4jVersion
    dist group: 'log4j', name: 'log4j', version: project.log4jVersion
    implementation(group: 'org.ballerinalang', name: 'ballerina-runtime', version: project.ballerinaLangVersion) {
        transitive = false
    }
}

jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    dependsOn configurations.dist
    from { configurations.dist.collect { it.isDirectory() ? it : zipTree(it) } } {
        exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA', 'io/netty/**', 'com/google/gson/**', 
        'org/slf4j/**', 'org/apache/commons/lang3/**', 'com/ctc/wstx/**', 'org/codehaus/**'
    }
}

build.dependsOn(shadowJar)
