Skip to content

Conversation

@zygiert1990
Copy link
Contributor

Motivation:
With our project we are using PackPlugin and it works really well. However, we have some specific configuration so we are using dependencies from some child modules in scope "test->compile":

.dependsOn( common % "test->compile" )

Currently allowed mapping is hardcoded here:

def isCompileConfig(cp: ClasspathDep[ProjectRef]) = cp.configuration.forall(_.contains("compile->"))

In scope of this PR I just added possibility to override allowed mappings.

@github-actions github-actions bot added the doc label Aug 21, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @zygiert1990, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new configuration option, includedDependencyMappings, to the PackPlugin. This enhancement allows users to specify which dependency mappings (e.g., "test->compile") should be considered when copying dependencies, providing greater flexibility beyond the default "compile->" mapping. This change addresses the need to include dependencies from child modules with specific configurations that were previously hardcoded.

Highlights

  • New Configuration Setting: Introduced includedDependencyMappings in PackPlugin.scala to control which dependency configurations are included during packaging.
  • Flexible Dependency Inclusion: Modified the core logic to use the new includedDependencyMappings setting, enabling the inclusion of dependencies with non-default mappings like "test->compile".
  • Documentation Update: Updated README.md to explain the purpose and usage of the new includedDependencyMappings setting.
  • Test Case Addition: Added a new test case in sbt-test to validate that dependencies with custom mappings are correctly included when includedDependencyMappings is configured.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a valuable feature by allowing customization of dependency mappings through the includedDependencyMappings setting. The implementation is well-done, including updates to documentation and tests. I've identified one medium-severity issue regarding the behavior when includedDependencyMappings is an empty sequence, which could lead to unexpected results. A code suggestion is provided to address this. Overall, this is a great enhancement to the plugin.

zygiert1990 and others added 4 commits August 21, 2025 14:32
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Follow pack* naming convention for consistency with other settings
- Use "project scopes" instead of "dependency mappings" to avoid
  confusion with JAR dependency mapping
- Update documentation with clearer description and example

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@xerial
Copy link
Owner

xerial commented Jan 2, 2026

Summary of Changes

This PR adds a new setting packIncludedProjectScopes to control which project dependency scopes (e.g., compile->, test->compile) are included when packaging.

Problem

Previously, sbt-pack hardcoded filtering to only include compile-> mappings, which didn't work for projects using other scopes like test->compile.

Solution

  • Added packIncludedProjectScopes setting (default: Seq("compile->"))
  • Follows the pack* naming convention for consistency
  • Maintains backward compatibility (default behavior unchanged)

Usage Example

// Include both compile and test dependency scopes
packIncludedProjectScopes := Seq("compile->", "test->")

Files Changed

  • PackPlugin.scala - Added new setting and updated dependency traversal logic
  • README.md - Added documentation
  • copy-dependencies/test - Added test cases

@xerial xerial changed the title add include dependency mappings key Add packIncludedProjectScopes setting for filtering project dependency scopes Jan 2, 2026
@xerial
Copy link
Owner

xerial commented Jan 2, 2026

@zygiert1990 Sorry for the long wait. I've just noticed a message from @tanishiking yesterday. I've fixed the setting name to be consistent with the other settings. I'll release a new version with this feature.

@xerial xerial merged commit 8b031bd into xerial:main Jan 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants