Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build scans to run on affected-paths runs with Gradle. #29

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Unreleased
- `affected-paths-core`: Add in flag for enabling build scans on affected-paths runs

## v0.1.3
- `affected-paths-core`: Fix custom Gradle flags not being properly set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,11 @@ internal class BaseConfigurationOptions {
)
var gradleInstallationPath: Path? = null
internal set

@Option(
names = ["--build-scan"],
description = ["Capture the Gradle build scan"]
)
var gradleBuildScan: Boolean = false
internal set
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ internal fun BaseConfigurationOptions.toCoreOptions(): CoreOptions {
autoInjectPlugin = autoInject,
changedFiles = changedFiles,
gradleInstallationPath = gradleInstallationPath,
useBuildScan = gradleBuildScan
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ public class CoreAnalyzer @JvmOverloads constructor(private val coreOptions: Cor
)
)
actionExecutor.withCancellationToken(cancellationTokenSource.token())
if (coreOptions.useBuildScan) {
actionExecutor.forTasks(emptyList())
}
actionExecutor.addArguments(coreOptions.gradleArgs)
actionExecutor.addJvmArguments(coreOptions.jvmArgs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ public data class CoreOptions @JvmOverloads constructor(

/** Pass in a custom Gradle installation, instead of using the build distribution */
val gradleInstallationPath: Path? = null,

/**
* Add the build scan flag to the tooling.
*
* **Note**: This will cause the default tasks of a build to run.
*/

val useBuildScan: Boolean = false,
) {

init {
Expand Down Expand Up @@ -123,5 +131,8 @@ public data class CoreOptions @JvmOverloads constructor(
}.absolutePath
)
}
if (useBuildScan) {
add("--scan")
}
}
}
Loading