aboutsummaryrefslogtreecommitdiff
path: root/gradle/publishing.gradle
blob: 716da43452833f547830f13fa406adb4a12198e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
apply plugin: 'maven-publish'

//bintray.bintrayUser = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
//bintray.bintrayKey = hasProperty('bintray_key') ? bintray_key : System.getenv('BINTRAY_KEY')
//bintray.repo = 'maven'
//bintray.org = hasProperty('bintray_username') ? bintray_username : System.getenv('BINTRAY_USER')
//bintray.packageName = 'Mockito-Kotlin'
//bintray.publication = 'mavenJava'
//
//bintray.licenses = ['MIT']
//bintray.ossrhUser = hasProperty('sonatype_username') ? sonatype_username : System.getenv('SONATYPE_USERNAME')
//bintray.ossrhPassword = hasProperty('sonatype_password') ? sonatype_password : System.getenv('SONATYPE_PASSWORD')
//bintray.overrideOnUpload = false
//bintray.gpgPassphrase = hasProperty('signing_password') ? signing_password : System.getenv('SIGNING_PASSWORD')

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from 'build/javadoc'
}

task sourceJar(type: Jar) {
    from sourceSets.main.allSource
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId 'mockito-kotlin'

            from components.java

            artifact sourceJar {
                classifier "sources"
            }

            artifact javadocJar

            pom.withXml {
                def root = asNode()
                root.appendNode('name', 'Mockito-Kotlin')
                root.appendNode('description', 'Using Mockito with Kotlin.')
                root.appendNode('url', 'https://github.com/mockito/mockito-kotlin')

                def scm = root.appendNode('scm')
                scm.appendNode('url', 'scm:git@github.com:mockito/mockito-kotlin.git')

                def licenses = root.appendNode('licenses')
                def mitLicense = licenses.appendNode('license')
                mitLicense.appendNode('name', 'MIT')

                def developers = root.appendNode('developers')
                def nhaarman = developers.appendNode('developer')
                nhaarman.appendNode('id', 'nhaarman')
                nhaarman.appendNode('name', 'Niek Haarman')
            }
        }
    }

    //useful for testing - running "publish" will create artifacts/pom in a local dir
    repositories { maven { url = "$rootProject.buildDir/repo" } }
}

// Avoid generation of the module metadata so that we don't have to publish an additional file
// and keep the build logic simple.
tasks.withType(GenerateModuleMetadata) {
    enabled = false
}