File: build.gradle

package info (click to toggle)
lightvalue 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 268 kB
  • sloc: java: 1,415; sh: 12; makefile: 4
file content (120 lines) | stat: -rw-r--r-- 3,464 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import groovy.swing.SwingBuilder

gradle.taskGraph.whenReady { taskGraph ->
    if (!taskGraph.allTasks.findAll { it.name ==~ /.*Sonatype.*/ }.isEmpty()) {
        String password = null

        if (System.console() == null) {
            new SwingBuilder().edt {
                dialog(modal: true,
                        title: 'Enter password',
                        alwaysOnTop: true,
                        resizable: false,
                        locationRelativeTo: null,
                        pack: true,
                        show: true
                ) {
                    vbox {
                        label(text: "Please enter key passphrase:")
                        input = passwordField()
                        button(defaultButton: true, text: 'OK', actionPerformed: {
                            password = new String(input.password)
                            dispose();
                        })
                    }
                }
            }
        } else {
            def passwordRaw = System.console().readPassword("\nPlease enter password: ")
            password = new String(passwordRaw)
        }

        rootProject.subprojects { project ->
            signing {
                useGpgCmd()
            }

            project.publishing.repositories.each { repo ->
                repo.credentials.password = password
            }
        }
    }
}

subprojects { subproject ->
    apply plugin: 'java'
    apply plugin: 'maven-publish'
    apply plugin: 'signing'
    apply plugin: 'idea'

    group 'org.kravemir.lightvalue'
    version '0.8.1'

    sourceCompatibility = 1.8

    apply from: "${rootProject.projectDir}/gradle/publishing.gradle"

    ext {
        publishingEnabled = project.hasProperty("enablePublishing")
        sonatypeUsername = project.hasProperty('sonatypeUsername') ? project.getProperty('sonatypeUsername') : ''
    }

    repositories {
        mavenCentral()
    }

    task sourceJar(type: Jar, dependsOn: classes) {
        classifier 'sources'
        from sourceSets.main.allSource
    }

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

    tasks.withType(Jar) {
        from(rootProject.projectDir) {
            include 'LICENSE'
            into 'META-INF'
        }

        manifest {
            attributes(
                    'Created-By': System.getProperty('java.version') + ' (' + System.getProperty('java.vendor') + ')',
                    'Implementation-Title': subproject.artifactName,
                    'Implementation-Version': subproject.version
            )
        }
    }

    artifacts {
        archives jar
        archives sourceJar
        archives javadocJar
    }

    publishing {
        repositories {
            maven {
                name "sonatypeSnapshots"
                url 'https://oss.sonatype.org/content/repositories/snapshots/'
                credentials {
                    username project.sonatypeUsername
                    password "-- not specified --"
                }
            }
        }
    }

    afterEvaluate {
        if (publishingEnabled) {
            signing {
                publishing.publications.all { publication ->
                    sign publication
                    required { !gradle.taskGraph.allTasks.findAll { it.name ==~ /.*Sonatype.*/ }.isEmpty() }
                }
            }
        }
    }
}