diff --git a/src/main/kotlin/com/sliderzxc/gradle/publishing/config/DeveloperConfig.kt b/src/main/kotlin/com/sliderzxc/gradle/publishing/config/DeveloperConfig.kt index 36de107..4f4ef28 100644 --- a/src/main/kotlin/com/sliderzxc/gradle/publishing/config/DeveloperConfig.kt +++ b/src/main/kotlin/com/sliderzxc/gradle/publishing/config/DeveloperConfig.kt @@ -1,5 +1,14 @@ package com.sliderzxc.gradle.publishing.config +/** + * Data class representing the configuration for a developer. + * + * @property id The developer's ID. + * @property name The developer's name. + * @property email The developer's email. + * @property username The developer's username. + * @property password The developer's password. + */ data class DeveloperConfig( val id: String, val name: String, diff --git a/src/main/kotlin/com/sliderzxc/gradle/publishing/config/LibraryConfig.kt b/src/main/kotlin/com/sliderzxc/gradle/publishing/config/LibraryConfig.kt index b76a1d0..8f89324 100644 --- a/src/main/kotlin/com/sliderzxc/gradle/publishing/config/LibraryConfig.kt +++ b/src/main/kotlin/com/sliderzxc/gradle/publishing/config/LibraryConfig.kt @@ -1,5 +1,21 @@ package com.sliderzxc.gradle.publishing.config +/** + * Data class representing the configuration for a library to be published. + * + * @property group The group ID of the library. + * @property version The version of the library. + * @property name The name of the library. + * @property description The description of the library. + * @property url The URL of the library. + * @property scmUrl The SCM URL of the library. + * @property releaseRepository The repository for releasing stable versions. + * @property snapshotRepository The repository for releasing snapshot versions. + * @property licenseName The name of the license. + * @property licenseUrl The URL of the license. + * @property signingKey The signing key for artifacts. + * @property signingPassword The password for the signing key. + */ data class LibraryConfig( val group: String, val version: String, diff --git a/src/main/kotlin/com/sliderzxc/gradle/publishing/config/PublishingConfig.kt b/src/main/kotlin/com/sliderzxc/gradle/publishing/config/PublishingConfig.kt index 0b47936..8842e11 100644 --- a/src/main/kotlin/com/sliderzxc/gradle/publishing/config/PublishingConfig.kt +++ b/src/main/kotlin/com/sliderzxc/gradle/publishing/config/PublishingConfig.kt @@ -1,5 +1,11 @@ package com.sliderzxc.gradle.publishing.config +/** + * Data class representing the combined configuration for publishing a library. + * + * @property libraryConfig The configuration for the library. + * @property developerConfig The configuration for the developer. + */ data class PublishingConfig( val libraryConfig: LibraryConfig, val developerConfig: DeveloperConfig diff --git a/src/main/kotlin/com/sliderzxc/gradle/publishing/javadoc/JavaDoc.kt b/src/main/kotlin/com/sliderzxc/gradle/publishing/javadoc/JavaDoc.kt index e12e3b2..89d3baf 100644 --- a/src/main/kotlin/com/sliderzxc/gradle/publishing/javadoc/JavaDoc.kt +++ b/src/main/kotlin/com/sliderzxc/gradle/publishing/javadoc/JavaDoc.kt @@ -5,14 +5,28 @@ import org.gradle.api.Task import org.gradle.api.tasks.bundling.Jar import org.gradle.kotlin.dsl.create +/** + * Ensures the existence of the Javadoc JAR task in the project. If the task already exists, it is returned. + * Otherwise, a new Javadoc JAR task is created and returned. + * + * @return The Javadoc JAR task. + */ internal fun Project.ensureJavadocJarTask(): Task { return tasks.findByName(JAVADOC_JAR_TASK_NAME) ?: createJavadocJarTask() } +/** + * Creates a new Javadoc JAR task in the project. + * + * @return The newly created Javadoc JAR task. + */ private fun Project.createJavadocJarTask(): Task { return tasks.create(JAVADOC_JAR_TASK_NAME).apply { archiveClassifier.set("javadoc") } } +/** + * The name of the Javadoc JAR task. + */ private const val JAVADOC_JAR_TASK_NAME = "javadocJar" \ No newline at end of file diff --git a/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/SetupAndroidLibraryPublishing.kt b/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/SetupAndroidLibraryPublishing.kt index d2e9f7c..7f13a4f 100644 --- a/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/SetupAndroidLibraryPublishing.kt +++ b/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/SetupAndroidLibraryPublishing.kt @@ -13,6 +13,11 @@ import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.get import org.gradle.kotlin.dsl.register +/** + * Configures the publishing settings for an Android library using the Maven Publish plugin. + * + * @param config The publishing configuration. + */ internal fun Project.setupAndroidLibraryPublishing(config: PublishingConfig) { applyMavenPublishPlugin() applySigningPlugin() diff --git a/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/utils/Extensions.kt b/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/utils/Extensions.kt index d609dca..37206e7 100644 --- a/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/utils/Extensions.kt +++ b/src/main/kotlin/com/sliderzxc/gradle/publishing/platforms/android/utils/Extensions.kt @@ -4,6 +4,12 @@ import org.gradle.api.Project import org.gradle.kotlin.dsl.findByType import kotlin.reflect.KClass +/** + * Checks if the project has an extension of the specified type. + * + * @param clazz The class reference of the extension type. + * @return `true` if the project has an extension of the specified type, `false` otherwise. + */ internal inline fun Project.hasExtension(clazz: () -> KClass<*>): Boolean { return try { extensions.findByType(clazz()) != null