Skip to content

Commit

Permalink
Merge pull request #185 from paketo-buildpacks/include-exclude
Browse files Browse the repository at this point in the history
Add instruction for including/excluding additional files with a Java app
  • Loading branch information
pivotal-david-osullivan authored Oct 5, 2022
2 parents 26f6288 + 4ea3bf0 commit 57ec09b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The buildpack will do the following:
* If `<APPLICATION_ROOT>/sbt` does not exist
* Contributes SBT to a layer with all commands on `$PATH`
* Runs `<SBT_ROOT>/bin/sbt package` to build the application
* Removes the source code in `<APPLICATION_ROOT>`
* Removes the source code in `<APPLICATION_ROOT>`, following include/exclude rules
* If `$BP_SBT_BUILT_ARTIFACT` matched a single file
* Restores `$BP_SBT_BUILT_ARTIFACT` from the layer, expands the single file to `<APPLICATION_ROOT>`
* If `$BP_SBT_BUILT_ARTIFACT` matched a directory or multiple files
Expand All @@ -31,6 +31,9 @@ The buildpack will do the following:
| `$BP_SBT_BUILT_MODULE` | Configure the module to find application artifact in. Defaults to the root module (empty). |
| `$BP_SBT_BUILT_ARTIFACT` | Configure the built application artifact explicitly. Supersedes `$BP_SBT_BUILT_MODULE`. Defaults to `target/universal/*.zip`. Can match a single file, multiple files or a directory. Can be one or more space separated patterns. |
| `$BP_SBT_REPOSITORIES_FILE` | Specifies a custom location to SBT's `repositories` file. |
| `$BP_INCLUDE_FILES` | Colon separated list of glob patterns to match source files. Any matched file will be retained in the final image. Defaults to `` (i.e. nothing). |
| `$BP_EXCLUDE_FILES` | Colon separated list of glob patterns to match source files. Any matched file will be specifically removed from the final image. If include patterns are also specified, then they are applied first and exclude patterns can be used to further reduce the fileset. |

## Bindings

The buildpack optionally accepts the following bindings:
Expand Down
12 changes: 12 additions & 0 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ api = "0.7"
description = "the path to the SBT repositories file"
name = "BP_SBT_REPOSITORIES_FILE"

[[metadata.configurations]]
build = true
default = ""
description = "colon separated list of glob patterns, matched source files are included"
name = "BP_INCLUDE_FILES"

[[metadata.configurations]]
build = true
default = ""
description = "colon separated list of glob patterns, matched source files are removed"
name = "BP_EXCLUDE_FILES"

[[metadata.dependencies]]
cpes = ["cpe:2.3:a:lightbend:sbt:1.7.2:*:*:*:*:*:*:*"]
id = "sbt"
Expand Down

0 comments on commit 57ec09b

Please sign in to comment.