Skip to content

Commit

Permalink
Upgrade metalava to version 1.0.0-alpha10 (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlonzo authored Jun 13, 2024
1 parent a97c620 commit 6db4d2c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 34 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ plugins {
...

metalava {
documentation.set(Documentation.PUBLIC)
outputKotlinNulls.set(false)
includeSignatureVersion.set(false)
...
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package me.tylerbwong.gradle.metalava
/**
* Flags to determine documented API by visibility modifier.
*/
@Deprecated("This has been removed and is not currently used.")
enum class Documentation(private val flagValue: String) {
/**
* Only include elements that are public.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ open class MetalavaExtension @Inject constructor(
/**
* The version of Metalava to use.
*/
val version: Property<String> = objectFactory.property { set("1.0.0-alpha08") }
val version: Property<String> = objectFactory.property { set("1.0.0-alpha10") }

/**
* A custom Metalava JAR location path to use instead of the embedded dependency.
Expand Down Expand Up @@ -48,6 +48,7 @@ open class MetalavaExtension @Inject constructor(
/**
* @see Documentation
*/
@Deprecated("This has been removed and is not currently used.")
val documentation: Property<Documentation> = objectFactory.property {
set(Documentation.PROTECTED)
}
Expand All @@ -61,17 +62,20 @@ open class MetalavaExtension @Inject constructor(
* Controls whether nullness annotations should be formatted as in Kotlin (with "?" for nullable
* types, "" for non-nullable types, and "!" for unknown. The default is true.
*/
@Deprecated("This has been removed and is not currently used.")
val outputKotlinNulls: Property<Boolean> = objectFactory.property { set(true) }

/**
* Controls whether default values should be included in signature files. The default is true.
*/
@Deprecated("This has been removed and is not currently used.")
val outputDefaultValues: Property<Boolean> = objectFactory.property { set(true) }

/**
* Whether the signature files should include a comment listing the format version of the
* signature file. The default is true.
*/
@Deprecated("This has been removed and is not currently used.")
val includeSignatureVersion: Property<Boolean> = objectFactory.property { set(true) }

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ internal abstract class MetalavaCheckCompatibilityTask @Inject constructor(
val hideAnnotations = hiddenAnnotations.get().flatMap { listOf("--hide-annotation", it) }

val args: List<String> = listOf(
"--no-banner",
"--format=${format.get()}",
"--source-files", tempFilename.get(),
"--check-compatibility:${apiType.get()}:released", filename.get(),
"--input-kotlin-nulls=${inputKotlinNulls.get().flagValue}"
) + reportWarningsAsErrors.get().flag("--warnings-as-errors") + reportLintsAsErrors.get()
.flag("--lints-as-errors") + hidePackages + hideAnnotations
executeMetalavaWork(args)
Expand Down Expand Up @@ -87,13 +85,9 @@ internal abstract class MetalavaCheckCompatibilityTask @Inject constructor(
shouldRunGenerateSignature.set(false)
bootClasspath.from(bootClasspathProvider)
compileClasspath.from(module.compileClasspath(variantName))
documentation.set(extension.documentation)
format.set(extension.format)
signature.set(extension.signature)
javaSourceLevel.set(extension.javaSourceLevel)
outputKotlinNulls.set(extension.outputKotlinNulls)
outputDefaultValues.set(extension.outputDefaultValues)
includeSignatureVersion.set(extension.includeSignatureVersion)
hiddenPackages.set(extension.hiddenPackages)
hiddenAnnotations.set(extension.hiddenAnnotations)
apiType.set(extension.apiType)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.tylerbwong.gradle.metalava.task

import me.tylerbwong.gradle.metalava.Documentation
import me.tylerbwong.gradle.metalava.Module
import me.tylerbwong.gradle.metalava.Signature
import me.tylerbwong.gradle.metalava.extension.MetalavaExtension
Expand Down Expand Up @@ -44,24 +43,12 @@ internal abstract class MetalavaGenerateSignatureTask @Inject constructor(
@get:InputFiles
abstract val sourcePaths: ConfigurableFileCollection

@get:Input
abstract val documentation: Property<Documentation>

@get:Input
abstract val signature: Property<Signature>

@get:Input
abstract val javaSourceLevel: Property<JavaVersion>

@get:Input
abstract val outputKotlinNulls: Property<Boolean>

@get:Input
abstract val outputDefaultValues: Property<Boolean>

@get:Input
abstract val includeSignatureVersion: Property<Boolean>

@get:Input
abstract val shouldRunGenerateSignature: Property<Boolean>

Expand Down Expand Up @@ -92,15 +79,10 @@ internal abstract class MetalavaGenerateSignatureTask @Inject constructor(
}

val args: List<String> = listOf(
"${documentation.get()}",
"--no-banner",
"--format=${format.get()}",
"${signature.get()}", filenameOverride ?: filename.get(),
"--java-source", "${javaSourceLevel.get()}",
"--classpath", fullClasspath,
"--output-kotlin-nulls=${outputKotlinNulls.get().flagValue}",
"--output-default-values=${outputDefaultValues.get().flagValue}",
"--include-signature-version=${includeSignatureVersion.get().flagValue}",
"--source-path", sourcePaths,
) + hidePackages + hideAnnotations + keepFileFlags
executeMetalavaWork(args, awaitWork)
Expand Down Expand Up @@ -131,13 +113,9 @@ internal abstract class MetalavaGenerateSignatureTask @Inject constructor(
shouldRunGenerateSignature.set(true)
bootClasspath.from(bootClasspathProvider)
compileClasspath.from(module.compileClasspath(variantName))
documentation.set(extension.documentation)
format.set(extension.format)
signature.set(extension.signature)
javaSourceLevel.set(extension.javaSourceLevel)
outputKotlinNulls.set(extension.outputKotlinNulls)
outputDefaultValues.set(extension.outputDefaultValues)
includeSignatureVersion.set(extension.includeSignatureVersion)
hiddenPackages.set(extension.hiddenPackages)
hiddenAnnotations.set(extension.hiddenAnnotations)
keepFilename.set(extension.keepFilename)
Expand Down
2 changes: 0 additions & 2 deletions samples/groovy-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ java {

metalava {
filename = "api/$name-api.txt"
outputKotlinNulls = false
includeSignatureVersion = false
}

0 comments on commit 6db4d2c

Please sign in to comment.