Skip to content

Conversation

@iamdanfox
Copy link
Contributor

Before this PR

A number of our repos use the ./gradlew test -Drecreate=true pattern, but I recently found (on our circle-templates repo) that we've been doing it wrong the entire time. Specifically, the task short-circuits and doesn't run when there are no code changes, even though the behaviour should be different when -Drecreate=true is passed in.

After this PR

==COMMIT_MSG==
For repos that use snapshot-style testing, ./gradlew test -Drecreate=true will ensure the "recreate" system property is passed through to Java correctly.
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Feb 7, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

For repos that use snapshot-style testing, ./gradlew test -Drecreate=true will ensure the "recreate" system property is passed through to Java correctly.

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from ferozco February 7, 2020 14:05
// ./gradlew test -Drecreate=true
String shouldRecreate = System.getProperty("recreate", "false");
task.systemProperty("recreate", shouldRecreate);
task.getInputs().property("recreate", shouldRecreate);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be be defensive and disable caching when shouldRecreate=true?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to require/force boolean values here, possibly Boolean.getBoolean("recreate") and use the string value for the sysprop+input?

@ferozco
Copy link
Contributor

ferozco commented Feb 7, 2020

Its seems slightly out of scope for baseline to handle this convention and the upside for adding this is pretty low since in the worst case things will fail at CI time

@dansanduleac
Copy link
Contributor

The reason to put this in a common place is that we keep copy pasting a chunk of gradle to help us do this, and we'd rather do away with the duplication.

@iamdanfox
Copy link
Contributor Author

@ferozco I mean we have quite a diverse chunk of functionality in baseline already, stuff to give us reproducibility, compilation fixes, circleci.

While it's a bit weird, I think it's in line with the overall goal of trying to minimise floating blobs of identical gradle across projects (especially when you find a bug in one of them!).

@ferozco
Copy link
Contributor

ferozco commented Feb 10, 2020

👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants