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

Update dependency com.facebook:ktfmt to v0.52 #997

Merged
merged 1 commit into from
Aug 20, 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
2 changes: 1 addition & 1 deletion gradle/hubdle.libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cash-sqldelight = "2.0.0"
cash-turbine = "1.1.0"
diffplug-gradle-spotless = "7.0.0.BETA1"
eclipse-jgit = "6.10.0.202406032230-r"
facebook-ktfmt = "0.51"
facebook-ktfmt = "0.52"
github-gradle-nexus-publish-plugin = "2.0.0"
github-triplet-play = "3.10.1"
gitlab-arturbosch-detekt = "1.23.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ import org.gradle.api.Project
import org.gradle.api.provider.Property

@HubdleDslMarker
public open class HubdleExtension
@Inject
constructor(
project: Project,
) : HubdleEnableableExtension(project) {
public open class HubdleExtension @Inject constructor(project: Project) :
HubdleEnableableExtension(project) {

override val isEnabled: Property<Boolean> = property { true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class HubdleState(private val project: Project) {

internal inline fun <reified T : BaseHubdleExtension> createExtension(
vararg constructionArguments: Any,
block: T.() -> Unit = {}
block: T.() -> Unit = {},
): T {
val extensionName = "_Internal${T::class.simpleName}".substringBeforeLast("Extension")
val extension: T = project.extensions.create(extensionName, *constructionArguments)
Expand All @@ -54,11 +54,7 @@ internal class HubdleState(private val project: Project) {
val applicablePlugins: List<ApplicablePlugin>
get() = _applicablePlugins.toList()

fun applicablePlugin(
isEnabled: Provider<Boolean>,
scope: Scope,
pluginId: PluginId,
) {
fun applicablePlugin(isEnabled: Provider<Boolean>, scope: Scope, pluginId: PluginId) {
val applicablePlugin =
ApplicablePlugin(isEnabled = isEnabled, scope = scope, pluginId = pluginId)
_applicablePlugins.add(applicablePlugin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,12 @@ import org.gradle.api.provider.Provider

internal fun HubdleConfigurableExtension.configurableDependencies() {
lazyConfigurable {
project.forKotlinSetsDependencies(
TEST,
COMMON_TEST,
TEST_FUNCTIONAL,
TEST_INTEGRATION,
) {
project.forKotlinSetsDependencies(TEST, COMMON_TEST, TEST_FUNCTIONAL, TEST_INTEGRATION) {
implementation(library(jetbrains_kotlin_test))
implementation(library(jetbrains_kotlin_test_annotations_common))
}

project.forKotlinSetsDependencies(
TEST,
JVM_TEST,
TEST_FUNCTIONAL,
TEST_INTEGRATION,
) {
project.forKotlinSetsDependencies(TEST, JVM_TEST, TEST_FUNCTIONAL, TEST_INTEGRATION) {
if (hubdleTesting.isFullEnabled.get()) {
val testModuleFramework: Provider<MinimalExternalModuleDependency?> = provider {
when (hubdleTesting.options.get()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal fun Project.withId(id: PluginId, block: () -> Unit) {

internal inline fun <reified T : Any> Project.withId(
id: PluginId,
crossinline block: T.() -> Unit
crossinline block: T.() -> Unit,
) {
pluginManager.withPlugin("$id") { block(extensions.getByType()) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.javiersc.hubdle.project.extensions.apis

import org.gradle.api.Project

public abstract class HubdleConfigurableExtension(
project: Project,
) : HubdleEnableableExtension(project) {
public abstract class HubdleConfigurableExtension(project: Project) :
HubdleEnableableExtension(project) {

internal abstract fun Project.defaultConfiguration()
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ import org.gradle.api.tasks.TaskContainer
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.the

public abstract class HubdleEnableableExtension(
override val project: Project,
) : BaseHubdleEnableableExtension {
public abstract class HubdleEnableableExtension(override val project: Project) :
BaseHubdleEnableableExtension {

internal val tasks: TaskContainer
get() = project.tasks
Expand Down Expand Up @@ -69,10 +68,7 @@ public abstract class HubdleEnableableExtension(
hubdleState.applicablePlugin(isEnabled, scope, pluginId)
}

internal fun applicablePlugin(
scope: ApplicablePlugin.Scope,
pluginId: PluginId,
) {
internal fun applicablePlugin(scope: ApplicablePlugin.Scope, pluginId: PluginId) {
applicablePlugin(isFullEnabled, scope, pluginId)
}

Expand Down Expand Up @@ -127,7 +123,7 @@ internal fun <T : HubdleEnableableExtension> T.enableAndExecute(action: Action<T

internal fun <T : HubdleEnableableExtension> T.enableAndExecute(
enabled: Provider<Boolean> = provider { true },
action: Action<T>
action: Action<T>,
) {
enabled(enabled)
action.execute(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet

public abstract class HubdleMinimalSourceSetConfigurableExtension<T>(
project: Project,
) : HubdleConfigurableExtension(project) {
public abstract class HubdleMinimalSourceSetConfigurableExtension<T>(project: Project) :
HubdleConfigurableExtension(project) {

override val project: Project
get() = super.project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import org.gradle.api.NamedDomainObjectProvider
import org.gradle.api.Project
import org.gradle.api.provider.Property

public abstract class HubdleSourceSetConfigurableExtension<T>(
project: Project,
) : HubdleMinimalSourceSetConfigurableExtension<T>(project) {
public abstract class HubdleSourceSetConfigurableExtension<T>(project: Project) :
HubdleMinimalSourceSetConfigurableExtension<T>(project) {

override val project: Project
get() = super.project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,8 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension

@HubdleDslMarker
public open class HubdleConfigExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
public open class HubdleConfigExtension @Inject constructor(project: Project) :
HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { true }

Expand Down Expand Up @@ -136,7 +133,7 @@ constructor(
@HubdleDslMarker
public fun publishing(
enabled: Provider<Boolean> = provider { isTagPrefixProject },
action: Action<HubdleConfigPublishingExtension> = Action {}
action: Action<HubdleConfigPublishingExtension> = Action {},
) {
publishing.enableAndExecute(enabled, action)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ import org.gradle.api.Project
import org.gradle.api.provider.Property

@HubdleDslMarker
public open class HubdleConfigAnalysisExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
public open class HubdleConfigAnalysisExtension @Inject constructor(project: Project) :
HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import javax.inject.Inject
import org.gradle.api.Project
import org.gradle.api.provider.Property

public open class HubdleConfigAnalysisReportsExtension
@Inject
constructor(
project: Project,
) : HubdleEnableableExtension(project) {
public open class HubdleConfigAnalysisReportsExtension @Inject constructor(project: Project) :
HubdleEnableableExtension(project) {

override val isEnabled: Property<Boolean> = property { true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ import org.gradle.api.provider.SetProperty
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType

public open class HubdleConfigAnalysisDetektExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
public open class HubdleConfigAnalysisDetektExtension @Inject constructor(project: Project) :
HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { true }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ import org.gradle.kotlin.dsl.findByType
import org.sonarqube.gradle.SonarExtension
import org.sonarqube.gradle.SonarProperties

public open class HubdleConfigAnalysisSonarExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
public open class HubdleConfigAnalysisSonarExtension @Inject constructor(project: Project) :
HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { true }

Expand All @@ -54,7 +51,9 @@ constructor(

override fun Project.defaultConfiguration() {
applicablePlugin(
scope = ApplicablePlugin.Scope.CurrentProject, pluginId = PluginId.Sonarqube)
scope = ApplicablePlugin.Scope.CurrentProject,
pluginId = PluginId.Sonarqube,
)

lazyConfigurable { configureSonarqube(project) }
// TODO: Remove both when project isolation is fixed in Sonar Gradle plugin as hubdle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ import org.gradle.api.tasks.TaskProvider
@HubdleDslMarker
public open class HubdleConfigBinaryCompatibilityValidatorExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
constructor(project: Project) : HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { false }

Expand All @@ -38,7 +36,8 @@ constructor(
override fun Project.defaultConfiguration() {
applicablePlugin(
scope = Scope.CurrentProject,
pluginId = PluginId.JetbrainsKotlinxBinaryCompatibilityValidator)
pluginId = PluginId.JetbrainsKotlinxBinaryCompatibilityValidator,
)

lazyConfigurable {
// TODO: Change this configurable with 0.7.0 as it must be applied on each project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.the

@HubdleDslMarker
public open class HubdleConfigCoverageExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
public open class HubdleConfigCoverageExtension @Inject constructor(project: Project) :
HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import org.gradle.api.Project
import org.gradle.api.provider.Property

@HubdleDslMarker
public open class HubdleConfigDocumentationExtension
@Inject
constructor(
project: Project,
) : HubdleEnableableExtension(project) {
public open class HubdleConfigDocumentationExtension @Inject constructor(project: Project) :
HubdleEnableableExtension(project) {

override val isEnabled: Property<Boolean> = property { false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import org.gradle.kotlin.dsl.withType
import org.jetbrains.dokka.gradle.DokkaTaskPartial

@HubdleDslMarker
public open class HubdleConfigDocumentationApiExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
public open class HubdleConfigDocumentationApiExtension @Inject constructor(project: Project) :
HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { false }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option
import org.gradle.kotlin.dsl.property

public abstract class AddChangelogItemTask
@Inject
constructor(
objects: ObjectFactory,
) : DefaultTask() {
public abstract class AddChangelogItemTask @Inject constructor(objects: ObjectFactory) :
DefaultTask() {

@Input
@Option(option = "added", description = "Add an item to the `added` section")
Expand Down Expand Up @@ -59,10 +56,7 @@ constructor(
public val updated: Property<String?> = objects.property()

@Input
@Option(
option = "renovate",
description = "Extract dependencies from the table in the PR body",
)
@Option(option = "renovate", description = "Extract dependencies from the table in the PR body")
@Optional
public val renovate: Property<String?> = objects.property()

Expand Down Expand Up @@ -195,7 +189,7 @@ private fun String.addChanges(header: String, changes: List<String>): Changelog

private fun Project.dependenciesFromRenovatePullRequestBody(
body: String?,
path: String?
path: String?,
): List<String> {
val renovateLines: List<String> =
when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import org.gradle.api.tasks.TaskAction

public abstract class GenerateChangelogHtmlTask
@Inject
constructor(
objects: ObjectFactory,
layout: ProjectLayout,
) : DefaultTask() {
constructor(objects: ObjectFactory, layout: ProjectLayout) : DefaultTask() {

@get:Input public abstract val html: Property<String?>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import org.jetbrains.changelog.tasks.PatchChangelogTask
@HubdleDslMarker
public open class HubdleConfigDocumentationChangelogExtension
@Inject
constructor(
project: Project,
) : HubdleConfigurableExtension(project) {
constructor(project: Project) : HubdleConfigurableExtension(project) {

override val isEnabled: Property<Boolean> = property { false }

Expand All @@ -48,15 +46,7 @@ constructor(
lazyConfigurable {
configure<ChangelogPluginExtension> {
repositoryUrl.set(hubdlePublishingMavenPom.scmUrl)
groups.set(
listOf(
"Added",
"Changed",
"Deprecated",
"Fixed",
"Removed",
"Updated",
))
groups.set(listOf("Added", "Changed", "Deprecated", "Fixed", "Removed", "Updated"))
combinePreReleases.set(false)

versionPrefix.set(hubdleSemver.tagPrefix)
Expand Down Expand Up @@ -116,7 +106,8 @@ constructor(
configuration.attributes { attributes ->
attributes.attribute(
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
project.objects.named(GENERATED_CHANGELOG_HTML_ATTRIBUTE))
project.objects.named(GENERATED_CHANGELOG_HTML_ATTRIBUTE),
)
}
configuration.outgoing { publications ->
publications.artifact(generateChangelogHtmlTask)
Expand Down
Loading
Loading