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

binding extension properties to Gradle properties #851

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

RBusarow
Copy link
Collaborator

This change makes it so that all of Anvil's existing configuration options can be set via a gradle.properties or a -P_______ command line option.

For any setting, Anvil take the first non-null value out of:

  1. Settings in the Gradle DSL:
    anvil {
      generateDaggerFactories.set(true)
    }
  2. Properties set via the command line like:
    ./gradlew build -Pcom.squareup.anvil.generateDaggerFactories=true
  3. Properties specified in a project-level, root-project-level, or ~/.gradle/-level gradle.properties:
    com.squareup.anvil.generateDaggerFactories = true
  4. Hard-coded default values (never null)

Practically speaking, this makes it possible to locally feature-toggle things (like the upcoming incremental fix) without touching a project's build logic.

@RBusarow RBusarow force-pushed the rick/gradle-property-conventions branch 2 times, most recently from e0a2f3b to 7ee26c8 Compare January 14, 2024 21:06
This change makes it so that all of Anvil's existing configuration options can be set via a `gradle.properties` or a `-P_______` command line option.

For any setting, Anvil take the first non-null value out of:
1. Settings in the Gradle DSL:
   ```kotlin
   anvil {
     generateDaggerFactories.set(true)
   }
   ```
3. Properties set via the command line like:
   ```sh
   ./gradlew build -Pcom.squareup.anvil.generateDaggerFactories=true
   ```
4. Properties specified in a project-level, root-project-level, or `~/.gradle/`-level `gradle.properties`:
   ```properties
   com.squareup.anvil.generateDaggerFactories = true
   ```
5. Hard-coded default values (never null)

Practically speaking, this makes it possible to *locally* feature-toggle things (like the upcoming incremental fix) without touching a project's build logic.
@RBusarow RBusarow force-pushed the rick/gradle-property-conventions branch from 7ee26c8 to 980c538 Compare January 14, 2024 21:52
@RBusarow RBusarow marked this pull request as ready for review January 15, 2024 15:12
@RBusarow RBusarow force-pushed the rick/gradle-property-conventions branch from 6818af1 to e40306c Compare January 17, 2024 20:56
@RBusarow RBusarow merged commit ad1d379 into main Jan 17, 2024
18 checks passed
@RBusarow RBusarow deleted the rick/gradle-property-conventions branch January 17, 2024 23:59
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.

2 participants