-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathArtifactsExtension.kt
143 lines (126 loc) · 3.52 KB
/
ArtifactsExtension.kt
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
package guru.stefma.androidartifacts
import org.gradle.api.Project
import org.gradle.api.Action
import org.gradle.api.publish.maven.MavenPom
open class ArtifactsExtension {
/**
* The artifactId for the artifact.
*/
var artifactId: String? = null
/**
* Set to false when you don't want to publish
* the sources of your artifact.
*
* Default is true.
*/
var sources: Boolean = true
/**
* Set to false when you don't want to publish
* the javadoc/kdoc of your artifact.
*
* Default is true.
*/
var javadoc: Boolean = true
/**
* The human readable name of this artifact.
*
* This might differ from the [artifactId].
* ### Example:
* * name: Material Components for Android
* * artifactId: (com.android.support:design)
*
* Default is [Project.getName].
*/
var name: String? = null
/**
* The url of the project.
*
* This is a nice to have property and a nice gesture for projects users
* that they know where the project lives.
*
* Default is `null`.
*/
var url: String? = null
/**
* A short description about this artifact
*
* What is it good for, how does it differ from other artifacts in the same group?
* ### Example:
* * artifactId: org.reactivestreams:reactive-streams
* * description: A Protocol for Asynchronous Non-Blocking Data Sequence
*
* Default is [Project.getDescription].
*/
var description: String? = null
internal var licenseSpec: LicenseSpec? = null
/**
* Set a license to the POM file.
*
* Default is null. Means there will be no <license>-Tag
* inside the POM.
*/
@Deprecated(message = "Use pom(Action<MavenPom)")
fun license(action: Action<LicenseSpec>) {
licenseSpec = LicenseSpec()
action.execute(licenseSpec!!)
}
internal var customPomConfiguration: (Action<MavenPom>)? = null
/**
* Add additional field to the pom by using the [MavenPom] API
*
* ```
* javaArtifact {
* artifactId = '$artifactId'
* pom {
* name = "Awesome library"
* description = "Make your project great again"
* url = 'https://github.com/$user/$projectname'
* licenses {
* license {
* name = 'The Apache License, Version 2.0'
* url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
* }
* }
*
* developers {
* developer {
* id = '$user'
* name = '$fullname'
* email = '[email protected]'
* url = 'https://github.com/$user'
* }
* }
* }
* }
* ```
*/
fun pom(action: Action<MavenPom>) {
customPomConfiguration = action
}
}
class LicenseSpec {
/**
* The name of the license.
*/
var name: String? = null
/**
* The url of the license.
*/
var url: String? = null
/**
* The distribution type where your artifact
* will be mainly consumed.
*
* E.g. "repo" or "manually".
* See also [https://maven.apache.org/pom.html#Licenses][https://maven.apache.org/pom.html#Licenses]
*/
var distribution: String? = null
/**
* Some comments about why you have choosen this
* license.
*
* E.g.
* > A business-friendly OSS license
*/
var comments: String? = null
}