Skip to content

Commit

Permalink
feat: ACI-3054 Save artifact transforms and remove config cache (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsolt-marta-bitrise authored Nov 4, 2024
1 parent eb0c242 commit 36262e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ workflows:
is_skippable: false
inputs:
- verbose: "true"
- save_transforms: "true"
- script:
title: Delete local Gradle caches
inputs:
Expand Down
8 changes: 8 additions & 0 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ inputs:
title: Compression level
summary: Zstd compression level to control speed / archive size. Set to 1 for fastest option. Valid values are between 1 and 19. Defaults to 3.
is_required: false
- save_transforms: "false"
opts:
title: Save transforms
summary: Save transformed classes and resources under `$HOME/.gradle/caches/**/transforms`
is_required: true
value_options:
- "true"
- "false"
11 changes: 9 additions & 2 deletions step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ var paths = []string{
// Cache of downloaded Gradle binary
"~/.gradle/wrapper",

// Configuration cache in project-level folder
".gradle/configuration-cache",
// Configuration cache is saved by separate step: save-gradle-configuration-cache

// JDKs downloaded by the toolchain support
"~/.gradle/jdks",
Expand All @@ -55,6 +54,7 @@ var paths = []string{
type Input struct {
Verbose bool `env:"verbose,required"`
CompressionLevel int `env:"compression_level,range[1..19]"`
SaveTransforms bool `env:"save_transforms"`
}

type SaveCacheStep struct {
Expand Down Expand Up @@ -90,6 +90,13 @@ func (step SaveCacheStep) Run() error {
return fmt.Errorf("failed to parse inputs: %w", err)
}
stepconf.Print(input)

if input.SaveTransforms {
// Save artifact transforms
// The `**` segment matches the version-specific folder, such as `7.6`.
paths = append(paths, "~/.gradle/caches/**/transforms")
}

step.logger.Println()
step.logger.Printf("Cache key: %s", key)
step.logger.Printf("Cache paths:")
Expand Down

0 comments on commit 36262e2

Please sign in to comment.