
apply plugin: 'base'

task nettyTcNativeBoringSslStaticLinuxX8664(type: Jar) {
    archiveBaseName.set('netty-tcnative-boringssl-static')
    archiveClassifier.set('linux-x86_64')
    version rootProject.version
    from (project.layout.projectDirectory.dir('src/main/resources')) {
        include 'META-INF/native/libnetty_tcnative_linux_x86_64.so'
    }
}
assemble.dependsOn(nettyTcNativeBoringSslStaticLinuxX8664)

task nettyTcNativeBoringSslStaticLinuxAarch64(type: Jar) {
    archiveBaseName.set('netty-tcnative-boringssl-static')
    archiveClassifier.set('linux-aarch_64')
    version rootProject.version
    from (project.layout.projectDirectory.dir('src/main/resources')) {
        include 'META-INF/native/libnetty_tcnative_linux_aarch_64.so'
    }
}
assemble.dependsOn(nettyTcNativeBoringSslStaticLinuxAarch64)

task nettyTcNativeBoringSslStaticOsxX8664(type: Jar) {
    archiveBaseName.set('netty-tcnative-boringssl-static')
    archiveClassifier.set('osx-x86_64')
    version rootProject.version
    from (project.layout.projectDirectory.dir('src/main/resources')) {
        include 'META-INF/native/libnetty_tcnative_osx_x86_64.jnilib'
    }
}
assemble.dependsOn(nettyTcNativeBoringSslStaticOsxX8664)

task nettyTcNativeBoringSslStaticOsxAarch64(type: Jar) {
    archiveBaseName.set('netty-tcnative-boringssl-static')
    archiveClassifier.set('osx-aarch_64')
    version rootProject.version
    from (project.layout.projectDirectory.dir('src/main/resources')) {
        include 'META-INF/native/libnetty_tcnative_osx_aarch_64.jnilib'
    }
}
assemble.dependsOn(nettyTcNativeBoringSslStaticOsxAarch64)

task nettyTcNativeBoringSslStaticWindowsX8664(type: Jar) {
    archiveBaseName.set('netty-tcnative-boringssl-static')
    archiveClassifier.set('windows-x86_64')
    version rootProject.version
    from (project.layout.projectDirectory.dir('src/main/resources')) {
        include 'META-INF/native/netty_tcnative_windows_x86_64.dll'
    }
}
assemble.dependsOn(nettyTcNativeBoringSslStaticWindowsX8664)

configurations {
    'linux-x86_64' {
        canBeConsumed = true
        canBeResolved = true
    }
    'linux-aarch64' {
        canBeConsumed = true
        canBeResolved = true
    }
    'osx-x86_64' {
        canBeConsumed = true
        canBeResolved = true
    }
    'osx-aarch64' {
        canBeConsumed = true
        canBeResolved = true
    }
    'windows-x86_64' {
        canBeConsumed = true
        canBeResolved = true
    }
}

artifacts {
    'linux-x86_64'(nettyTcNativeBoringSslStaticLinuxX8664)
    'linux-aarch64'(nettyTcNativeBoringSslStaticLinuxAarch64)
    'osx-x86_64'(nettyTcNativeBoringSslStaticOsxX8664)
    'osx-aarch64'(nettyTcNativeBoringSslStaticOsxAarch64)
    'windows-x86_64'(nettyTcNativeBoringSslStaticWindowsX8664)
}

publishing {
    publications {
        publishNettyTcNaticeBoringSslStaticLinuxX8664(MavenPublication) {
            groupId rootProject.group
            artifactId project.name
            version rootProject.version
            artifact nettyTcNativeBoringSslStaticLinuxX8664
        }
        publishNettyTcNativeBoringSslStaticLinuxAarch64(MavenPublication) {
            groupId rootProject.group
            artifactId project.name
            version rootProject.version
            artifact nettyTcNativeBoringSslStaticLinuxAarch64
        }
        publishNettyTcNaticeBoringSslStaticOsxX8664(MavenPublication) {
            groupId rootProject.group
            artifactId project.name
            version rootProject.version
            artifact nettyTcNativeBoringSslStaticOsxX8664
        }
        publishNettyTcNativeBoringSslStaticOsxAarch64(MavenPublication) {
            groupId rootProject.group
            artifactId project.name
            version rootProject.version
            artifact nettyTcNativeBoringSslStaticOsxAarch64
        }
        publishNettyTcNaticeBoringSslStaticWindowsX8664(MavenPublication) {
            groupId rootProject.group
            artifactId project.name
            version rootProject.version
            artifact nettyTcNativeBoringSslStaticWindowsX8664
        }
    }
}
