Skip to content

Commit

Permalink
Add ability to exclude source sets
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerbwong committed Jun 14, 2024
1 parent ff2bb88 commit c1a9726
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plugin/api/0.3.6-SNAPSHOT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ package me.tylerbwong.gradle.metalava.extension {
method public final org.gradle.api.provider.Property<java.lang.String> getApiType();
method public final org.gradle.api.provider.SetProperty<java.lang.String> getArguments();
method public final org.gradle.api.provider.Property<java.lang.Boolean> getEnforceCheck();
method public final org.gradle.api.file.ConfigurableFileCollection getExcludedSourceSets();
method public final org.gradle.api.provider.Property<java.lang.String> getFilename();
method public final org.gradle.api.provider.Property<me.tylerbwong.gradle.metalava.Format> getFormat();
method public final org.gradle.api.provider.SetProperty<java.lang.String> getHiddenAnnotations();
Expand All @@ -49,6 +50,7 @@ package me.tylerbwong.gradle.metalava.extension {
property public final org.gradle.api.provider.Property<java.lang.String> apiType;
property public final org.gradle.api.provider.SetProperty<java.lang.String> arguments;
property public final org.gradle.api.provider.Property<java.lang.Boolean> enforceCheck;
property public final org.gradle.api.file.ConfigurableFileCollection excludedSourceSets;
property public final org.gradle.api.provider.Property<java.lang.String> filename;
property public final org.gradle.api.provider.Property<me.tylerbwong.gradle.metalava.Format> format;
property public final org.gradle.api.provider.SetProperty<java.lang.String> hiddenAnnotations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ open class MetalavaExtension @Inject constructor(
*/
val additionalSourceSets: ConfigurableFileCollection = objectFactory.fileCollection()

/**
* Source directories to exclude.
*/
val excludedSourceSets: ConfigurableFileCollection = objectFactory.fileCollection()

/**
* If the tasks should run as part of Gradle's `check` task. The default is true.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ internal abstract class MetalavaCheckCompatibilityTask @Inject constructor(
return project.tasks.register<MetalavaCheckCompatibilityTask>(taskName) {
this.metalavaClasspath.from(metalavaClasspath)
tempFilename.set(tempFilenameProvider)
sourceSets.setFrom(module.sourceSets(project, variantName) + extension.additionalSourceSets)
sourceSets.setFrom(
module.sourceSets(
project,
variantName,
) + extension.additionalSourceSets - extension.excludedSourceSets,
)
filename.set(extension.filename)
shouldRunGenerateSignature.set(false)
bootClasspath.from(bootClasspathProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ internal abstract class MetalavaGenerateSignatureTask @Inject constructor(
val bootClasspathProvider = project.provider { module.bootClasspath }
return project.tasks.register<MetalavaGenerateSignatureTask>(taskName) {
this.metalavaClasspath.from(metalavaClasspath)
sourceSets.from(module.sourceSets(project, variantName) + extension.additionalSourceSets)
sourceSets.from(
module.sourceSets(
project,
variantName,
) + extension.additionalSourceSets - extension.excludedSourceSets,
)
filename.set(extension.filename)
shouldRunGenerateSignature.set(true)
bootClasspath.from(bootClasspathProvider)
Expand Down

0 comments on commit c1a9726

Please sign in to comment.