Skip to content

feat: Expose useParenthesesForGroovy configuration for Groovy DSL syntax.#1648

Open
Freeezzzi wants to merge 1 commit intoautonomousapps:mainfrom
Freeezzzi:feat/expose-use-parentheses-for-groovy
Open

feat: Expose useParenthesesForGroovy configuration for Groovy DSL syntax.#1648
Freeezzzi wants to merge 1 commit intoautonomousapps:mainfrom
Freeezzzi:feat/expose-use-parentheses-for-groovy

Conversation

@Freeezzzi
Copy link

Problem

In #1522 useParenthesesForGroovy param was added to AdvicePrinter to support parentheses syntax in Groovy build scripts.
From 1522 PR description:

// Space syntax (default)
implementation projects.myModule   
api projects.common.viewmodels  

// Parentheses syntax (when useParenthesesForGroovy = true)
implementation(projects.myModule) 
api(projects.common.viewmodels) 

The parameter existed in the code but it was never exposed as a configurable option - it always defaulted to false.
For proof, here's a search in repository: https://github.com/search?q=repo%3Aautonomousapps%2Fdependency-analysis-gradle-plugin%20useParenthesesForGroovy&type=code

This meant that even if a project consistently used parentheses syntax in Groovy build scripts:

dependencies {
  implementation(libs.core)
  api(projects.myModule)
}

The plugin's advice output (projectHealth, buildHealth) and build script rewriting (fixDependencies) would always produce space:

implementation libs.core
api projects.myModule

How I propose to configure

useParenthesesForGroovy flag is now configurable via the structure {} DSL block.

Configure in settings.gradle[.kts] or root build.gradle[.kts]:

dependencyAnalysis {
  structure {
    useParenthesesForGroovy(true)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant