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

Add step input for specifying additional gradle options #96

Merged
merged 5 commits into from
Jul 25, 2022

Conversation

godrei
Copy link
Contributor

@godrei godrei commented Jul 22, 2022

Checklist

  • I've read and followed the Contribution Guidelines
  • step.yml and README.md is updated with the changes (if needed)

Version

Requires a MINOR version update

Context

The Step is running gradlew dependencies command in order to list the given project's missing dependencies.

To make the Step more felxibale and align our Step development guideline (Provide input for additional command-line arguments) this PR introduces a new Step input for specifying additional options for the gradlew dependencies command.

With this change, users can overcome, for example, issues with the incubating Configuration cache feature while migrating the project by passing the --no-configuration-cache or --configuration-cache-problems=warn options.

Changes

  • New Step Input (gradlew_dependencies_options) was introduced for passing additional options to the gradlew dependencies command.

Investigation details

Gradle Configuration cache: https://docs.gradle.org/7.4.2/userguide/configuration_cache.html#config_cache:intro

Decisions

The change was manually tested only since the Step is not prepared for writing unit tests easily. I will create a follow-up ticket to make up for the missing test and to make the step testable.

With the manual test, I checked if the provided options are passed properly to the gradlew dependencies command:

  • Updated the sample workflow to pass an addition gradlew dependencies option to the step:
...
    - path::./:
        title: Execute step
        inputs:
        - gradlew_dependencies_options: --configuration-cache-problems=warn
...
  • Modified the step here to print the executed gradlew command:
func getDependenciesOutput(projectLocation string, options []string) (string, error) {
	args := []string{"dependencies", "--stacktrace"}
	args = append(args, options...)

	gradleCmd := command.New("./gradlew", args...)
	gradleCmd.SetStdin(strings.NewReader("y"))
	gradleCmd.SetDir(projectLocation)
	fmt.Println(gradleCmd.PrintableCommandArgs())
	return gradleCmd.RunAndReturnTrimmedCombinedOutput()
}

@godrei godrei marked this pull request as ready for review July 25, 2022 08:50
lpusok
lpusok previously approved these changes Jul 25, 2022
@godrei
Copy link
Contributor Author

godrei commented Jul 25, 2022

Sorry for dismissing the review, I spotted a glitch in the new Step Input description, fixed it, and now it looks like this:
Screenshot 2022-07-25 at 14 37 32

lpusok
lpusok previously approved these changes Jul 25, 2022
@godrei godrei merged commit b77cfa8 into master Jul 25, 2022
@godrei godrei deleted the gradlew-options branch July 25, 2022 13:49
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