File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -14,23 +14,40 @@ subprojects { project ->
14
14
15
15
task sourcesJar(type : Jar , dependsOn :classes) {
16
16
from sourceSets. main. allSource
17
+ classifier ' sources'
18
+ extension ' jar'
17
19
}
18
20
19
21
task javadocJar(type : Jar , dependsOn :javadoc) {
20
22
from javadoc. destinationDir
23
+ classifier ' javadoc'
24
+ extension ' jar'
21
25
}
22
26
23
27
configurations. add(' sources' )
24
28
configurations. add(' javadoc' )
29
+ configurations. archives {
30
+ extendsFrom configurations. sources
31
+ extendsFrom configurations. javadoc
32
+ }
33
+
34
+ // When outputing to an Ivy repo, we want to use the proper type field
35
+ gradle. taskGraph. whenReady {
36
+ def isNotMaven = ! it. hasTask(project. uploadMavenCentral)
37
+ if (isNotMaven) {
38
+ def artifacts = project. configurations. sources. artifacts
39
+ def sourceArtifact = artifacts. iterator(). next()
40
+ sourceArtifact. type = ' sources'
41
+ }
42
+ }
25
43
26
44
artifacts {
27
45
sources(sourcesJar) {
28
- type ' source '
29
- classifier ' sources '
46
+ // Weird Gradle quirk where type will be used for the extension, but only for sources
47
+ type ' jar '
30
48
}
31
49
javadoc(javadocJar) {
32
50
type ' javadoc'
33
- classifier ' javadoc'
34
51
}
35
52
}
36
53
You can’t perform that action at this time.
0 commit comments