1
1
package co.anitrend.arch.buildSrc.plugin.components
2
2
3
3
import org.gradle.api.Project
4
- import org.gradle.api.tasks.bundling.Jar
5
- import org.gradle.kotlin.dsl.get
6
4
import org.jetbrains.dokka.gradle.DokkaTask
7
5
import co.anitrend.arch.buildSrc.module.Modules
8
6
import co.anitrend.arch.buildSrc.plugin.extensions.*
9
- import org.gradle.api.publish.maven.MavenPublication
10
- import org.gradle.kotlin.dsl.getValue
11
7
import org.gradle.kotlin.dsl.invoke
12
8
import org.gradle.kotlin.dsl.named
13
- import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
14
9
import java.net.URL
15
10
16
11
private fun Project.dependenciesOfProject (): List <Modules .Module > {
@@ -59,49 +54,11 @@ private fun Project.dependenciesOfProject(): List<Modules.Module> {
59
54
}
60
55
}
61
56
62
- private fun Project.createMavenPublicationUsing (sources : Jar ) {
63
- publishingExtension().publications {
64
- val component = components.findByName(" android" )
65
-
66
- val projectName = this @createMavenPublicationUsing.name
67
-
68
- logger.lifecycle(" Configuring maven publication options for ${path} :maven with component -> ${component?.name} " )
69
- create(" maven" , MavenPublication ::class .java) {
70
- groupId = " co.anitrend.arch"
71
- artifactId = projectName
72
- version = props[PropertyTypes .VERSION ]
73
-
74
- artifact(sources)
75
- artifact(" ${layout.buildDirectory.get()} /outputs/aar/${projectName} -release.aar" )
76
- from(component)
77
-
78
- pom {
79
- name.set(" support-arch" )
80
- description.set(" A multi-module template library that attempts to make clean arch apps easier to build" )
81
- url.set(" https://github.com/anitrend/support-arch" )
82
- licenses {
83
- license {
84
- name.set(" Apache License, Version 2.0" )
85
- url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
86
- }
87
- }
88
- developers {
89
- developer {
90
- id.set(" wax911" )
91
- name.set(" Maxwell Mapako" )
92
- organizationUrl.set(" https://github.com/anitrend" )
93
- }
94
- }
95
- }
96
- }
97
- }
98
- }
99
-
100
- private fun Project.createDokkaTaskProvider () = tasks.named<DokkaTask >(" dokkaHtml" ) {
57
+ internal fun Project.configureDokka () = tasks.named<DokkaTask >(" dokkaHtml" ) {
101
58
outputDirectory.set(layout.buildDirectory.dir(" docs/dokka" ))
102
59
103
60
// Set module name displayed in the final output
104
- moduleName.set(this @createDokkaTaskProvider .name)
61
+ moduleName.set(project .name)
105
62
106
63
// Use default or set to custom path to cache directory
107
64
// to enable package-list caching
@@ -207,35 +164,4 @@ private fun Project.createDokkaTaskProvider() = tasks.named<DokkaTask>("dokkaHtm
207
164
}
208
165
}
209
166
}
210
- }
211
-
212
- internal fun Project.configureOptions () {
213
- if (containsBasePlugin()) {
214
- logger.lifecycle(" Applying extension options for ${project.path} " )
215
-
216
- val mainSourceSets = when {
217
- ! isKotlinLibraryGroup() -> baseExtension().sourceSets[" main" ].java.srcDirs
218
- else -> kotlinJvmProjectExtension().sourceSets[" main" ].kotlin.srcDirs()
219
- }
220
-
221
- logger.lifecycle(" Applying additional tasks options for dokka and javadoc on ${project.path} " )
222
-
223
- createDokkaTaskProvider()
224
-
225
- val sourcesJar by tasks.register(" sourcesJar" , Jar ::class .java) {
226
- archiveClassifier.set(" sources" )
227
- from(mainSourceSets)
228
- }
229
-
230
- val classesJar by tasks.register(" classesJar" , Jar ::class .java) {
231
- from(" ${project.layout.buildDirectory.get()} /intermediates/classes/release" )
232
- }
233
-
234
- artifacts {
235
- add(" archives" , classesJar)
236
- add(" archives" , sourcesJar)
237
- }
238
-
239
- createMavenPublicationUsing(sourcesJar)
240
- }
241
167
}
0 commit comments