Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
241 lines (212 sloc) 7.24 KB
apply plugin: 'java'
apply plugin: 'signing'
apply plugin: 'maven'
group 'org.libtorrent4j'
archivesBaseName = 'libtorrent4j'
version '1.2.1.0'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
if (!hasProperty('ossrhUsername')) {
ext.ossrhUsername = ''
}
if (!hasProperty('ossrhPassword')) {
ext.ossrhPassword = ''
}
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.12'
}
test {
testLogging {
events "passed", "skipped", "failed"
}
environment "LD_LIBRARY_PATH": new File('.').absolutePath
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadoc2(type: Javadoc) {
source = sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc2) {
classifier = 'javadoc'
from javadoc2.destinationDir
}
task nativeMacOSXJar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-macosx'
extension 'jar'
from fileTree(dir: 'swig/bin/release/macosx', excludes: ['**/ed25519', '**/src'], include: '**/*libtorrent4j.dylib')
into 'lib/'
rename(".dylib", "-${version}.dylib")
}
task nativeWindowsJar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-windows'
extension 'jar'
from fileTree(dir: 'swig/bin/release/windows', excludes: ['**/ed25519', '**/src'], include: '**/*libtorrent4j.dll')
into 'lib/'
rename(".dll", "-${version}.dll")
}
task nativeLinuxJar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-linux'
extension 'jar'
from fileTree(dir: 'swig/bin/release/linux', excludes: ['**/ed25519', '**/src'], include: '**/*libtorrent4j.so')
into 'lib/'
rename(".so", "-${version}.so")
}
task nativeAndroidArmJar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-android-arm'
extension 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'armeabi-v7a/libtorrent4j.so')
into 'lib/'
rename(".so", "-${version}.so")
}
task nativeAndroidX86Jar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-android-x86'
extension 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'x86/libtorrent4j.so')
into 'lib/'
rename(".so", "-${version}.so")
}
task nativeAndroidArm64Jar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-android-arm64'
extension 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'arm64-v8a/libtorrent4j.so')
into 'lib/'
rename(".so", "-${version}.so")
}
task nativeAndroidX64Jar(type: Zip) {
destinationDir file("$buildDir/libs")
baseName 'libtorrent4j-android-x86_64'
extension 'jar'
from fileTree(dir: 'swig/bin/release/android', include: 'x86_64/libtorrent4j.so')
into 'lib/'
rename(".so", "-${version}.so")
}
artifacts {
archives sourcesJar
archives javadocJar
archives nativeMacOSXJar
archives nativeWindowsJar
archives nativeLinuxJar
archives nativeAndroidArmJar
archives nativeAndroidX86Jar
archives nativeAndroidArm64Jar
archives nativeAndroidX64Jar
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
addFilter('libtorrent4j') { artifact, file ->
artifact.name == 'libtorrent4j'
}
addFilter('libtorrent4j-macosx') { artifact, file ->
artifact.name == 'libtorrent4j-macosx'
}
addFilter('libtorrent4j-windows') { artifact, file ->
artifact.name == 'libtorrent4j-windows'
}
addFilter('libtorrent4j-linux') { artifact, file ->
artifact.name == 'libtorrent4j-linux'
}
addFilter('libtorrent4j-android-arm') { artifact, file ->
artifact.name == 'libtorrent4j-android-arm'
}
addFilter('libtorrent4j-android-x86') { artifact, file ->
artifact.name == 'libtorrent4j-android-x86'
}
addFilter('libtorrent4j-android-arm64') { artifact, file ->
artifact.name == 'libtorrent4j-android-arm64'
}
addFilter('libtorrent4j-android-x86_64') { artifact, file ->
artifact.name == 'libtorrent4j-android-x86_64'
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom('libtorrent4j').withXml {
asNode().children().last() + pomData()
}
pom('libtorrent4j-macosx').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
pom('libtorrent4j-windows').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
pom('libtorrent4j-linux').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
pom('libtorrent4j-android-arm').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
pom('libtorrent4j-android-x86').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
pom('libtorrent4j-android-arm64').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
pom('libtorrent4j-android-x86_64').withXml {
asNode().children().last() + pomData()
addDependency(asNode())
}
}
}
}
def pomData() {
return {
resolveStrategy = Closure.DELEGATE_FIRST
name 'libtorrent4j'
description 'A swig Java interface for libtorrent.'
url 'https://github.com/aldenml/libtorrent4j'
scm {
connection 'scm:git:git://github.com/aldenml/libtorrent4j.git'
developerConnection 'scm:git:ssh:git@github.com/aldenml/libtorrent4j.git'
url 'https://github.com/aldenml/libtorrent4j'
}
licenses {
license {
name 'The MIT License'
url 'https://github.com/aldenml/libtorrent4j/blob/master/LICENSE.md'
}
}
developers {
developer {
id 'aldenml'
name 'Alden Torres'
email 'aldenml@gmail.com'
}
}
}
}
def addDependency(root) {
def dependenciesNode = root.dependencies[0]
if (!dependenciesNode) {
dependenciesNode = root.appendNode('dependencies')
}
def depNode = dependenciesNode.appendNode('dependency')
depNode.appendNode('groupId', group)
depNode.appendNode('artifactId', archivesBaseName)
depNode.appendNode('version', version)
}
You can’t perform that action at this time.