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

Prep v0.1.4 release #33

Merged
merged 5 commits into from
Dec 12, 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Unreleased

## v0.1.4
- `affected-paths-core`: Add in flag for enabling build scans on affected-paths runs
- `affected-paths-core`: Allow better control of the Gradle daemon

## v0.1.3
- `affected-paths-core`: Fix custom Gradle flags not being properly set
- `tooling-support-android`: Evaluate projects with `com.android.test` plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,48 @@ 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

@Option(
names = ["--gradle-jvm-flags"],
description = ["List of JVM flags to pass to the Gradle daemon"],
split = " "
)
var gradleJvmFlags: List<String> = emptyList()
internal set

@Option(
names = ["--gradle-flags"],
description = ["Gradle flags to use on model queries and task runs"],
split = " "
)
var gradleFlags: List<String> = emptyList()
internal set

@Option(
names = ["--distribution-path"],
description = ["Gradle distribution path"]
)
var gradleDistributionPath: Path? = null
internal set

@Option(
names = ["--gradle-version"],
description = ["Gradle version to use"]
)
var gradleVersion: String? = null
internal set

@Option(
names = ["--gradle-user-home"],
description = ["Gradle user home path to use"]
)
var gradleUserHome: Path? = null
internal set
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ internal fun BaseConfigurationOptions.toCoreOptions(): CoreOptions {
allowGradleParallel = allowGradleParallel,
initialGradleMemory = initialGradleMemory,
maxGradleMemory = maxGradleMemory,
customJvmFlags = listOf("-XX:-MaxFDLimit"),
customGradleFlags = listOf("--stacktrace"),
customJvmFlags = gradleJvmFlags,
customGradleFlags = gradleFlags,
autoInjectPlugin = autoInject,
changedFiles = changedFiles,
gradleInstallationPath = gradleInstallationPath,
useBuildScan = gradleBuildScan,
gradleDistributionPath = gradleDistributionPath,
gradleVersion = gradleVersion,
gradleUserHome = gradleUserHome
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,21 @@ public class CoreAnalyzer @JvmOverloads constructor(private val coreOptions: Cor

val projectConnection = with(affectedPathsApplication.koin.get<GradleConnector>()) {
forProjectDirectory(rootDir.toFile())
if (coreOptions.gradleInstallationPath != null) {
useInstallation(coreOptions.gradleInstallationPath.toFile())
} else {
useBuildDistribution()
when {
coreOptions.gradleDistributionPath != null -> {
useDistribution(coreOptions.gradleDistributionPath.toUri())
}
coreOptions.gradleInstallationPath != null -> {
useInstallation(coreOptions.gradleInstallationPath.toFile())
}
coreOptions.gradleVersion != null -> {
useGradleVersion(coreOptions.gradleVersion)
}
else -> useBuildDistribution()
}

if (coreOptions.gradleUserHome != null) {
useGradleUserHomeDir(coreOptions.gradleUserHome.toFile())
}
return@with connect()
}
Expand All @@ -96,6 +107,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 @@ -70,8 +70,33 @@ public data class CoreOptions @JvmOverloads constructor(
/** Include any "includeBuild" builds from the current build */
val useIncludeBuild: Boolean = true,

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

/**
* Pass in a custom Gradle installation, instead of using the build distribution
*
* **NOTE**: This will override `gradleDistributionPath` if used.
*/
val gradleInstallationPath: Path? = null,

/**
* Gradle version to use for the current build
*
* **NOTE**: This will override `gradleInstallationPath` and `gradleDistributionPath` if used.
*/
val gradleVersion: String? = null,

/** Gradle user home directory to use */
val gradleUserHome: 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 @@ -108,7 +133,7 @@ public data class CoreOptions @JvmOverloads constructor(
mavenCentral()
}
dependencies {
classpath "com.squareup.affected.paths:tooling-support:0.1.3"
classpath "com.squareup.affected.paths:tooling-support:0.1.4"
}
}
}
Expand All @@ -123,5 +148,8 @@ public data class CoreOptions @JvmOverloads constructor(
}.absolutePath
)
}
if (useBuildScan) {
add("--scan")
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
kotlin.code.style=official

GROUP=com.squareup.affected.paths
VERSION_NAME=0.1.3
VERSION_NAME=0.1.4

POM_URL=https://github.com/squareup/affected-paths
POM_SCM_URL=https://github.com/squareup/affected-paths
Expand Down
Loading