• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 6747 / 2
0%
main: 93%

Build:
Build:
LAST BUILD BRANCH: uv_lockfile
DEFAULT BRANCH: main
Ran 08 Sep 2015 10:16PM UTC
Files 386
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

08 Sep 2015 10:09PM UTC coverage: 71.141% (+0.01%) from 71.129%
CI_FLAGS="-fkmsrcn -u 0/2 'Unit tests for pants and pants-plugins - shard 1'"

push

travis-ci

gmalmquist
Made shading rules accessible and configurable for jvm_binary.

jvm_binary() targets may now specify a shading_rules argument,
which accepts a list of shading rules, which can be any of:

    shading_relocate()
    shading_exclude()
    shading_relocate_package()
    shading_exclude_package()

The order of rules in the list matters, as typical of shading
logic in general.

These rules are powerful enough to take advantage of jarjar's more
advanced syntax, like using wildcards in the middle of package
names. E.g., this syntax will now work:

    # Destination pattern will be inferred to be
    # `__shaded_by_pants__.com.@1.foo.bar.@2`
    shading_relocate('com.*.foo.bar.**')

Which can also be done by:

   shading_relocate_package('com.*.foo.bar')

I also added the ability to change the default
`__shaded_by_pants__` prefix.

    # `__my_prefix__.com.foo.bar.@1`
    shading_relocate_package('com.foo.bar', shade_prefix='__my_prefix__.')

The rules are implemented by `Shading.Relocate`, `Shading.Exclude`,
`Shading.RelocatePackage`, and `Shading.ExcludePackage`.

`Relocate` is the most generic, and acts as the base-class. It is
essentially a factory for the Rule nametuple that previously
existed in `Shader`.

Rather than build off of the pre-existing `shade_class`,
`shade_package`, `exclude_class`, and `exclude_package`, I made
`Relocate` and friends more powerful, extensible and (I hope)
intuitive concepts, and refactored the existing functions to use
the new classes instead.

They are wrapped in a Shading object rather than in the previous
Shader object to keep the objects that make it into BUILD file
aliases separate from those that do not. I also wistfully imagine
a day when we can register BUILD file aliases recursively,
which would let us use syntax like `Shading.Relocate` instead of
shading_relocate, which would both be more consistent with things
like `Duplicate` and `Skip` today, without polluting the global
namespace. Today this is not possible, because while you *can*
register `Shading`, and then access `Shading.*` in BUILD files,
they don't make it into the BUILD dictionary when we generate docs.

Testing Done:
Added tests to tests/python/pants_test/java/jar:shader and tests/python/pants_test/java/jar:shader-integration
Test project under testprojects/src/java/org/pantsbuild/testproject/shading and testprojects/src/java/org/pantsbuild/testproject/shadingdep.

CI went green: https://travis-ci.org/gmalmquist/pants/builds/78593423
CI went green: https://travis-ci.org/gmalmquist/pants/builds/78809269
CI went green: https://travis-ci.org/gmalmquist/pants/builds/79349294
CI went green: https://travis-ci.org/gmalmquist/pants/builds/79354035
CI went green: https://travis-ci.org/gmalmquist/pants/builds/79369976

Bugs closed: 2121

Reviewed at https://rbcommons.com/s/twitter/r/2754/

16462 of 23140 relevant lines covered (71.14%)

0.71 hits per line

Source Files on job 6747.2 (CI_FLAGS="-fkmsrcn -u 0/2 'Unit tests for pants and pants-plugins - shard 1'")
  • Tree
  • List 0
  • Changed 6
  • Source Changed 6
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 6747
  • Travis Job 6747.2
  • c40fd43b on github
  • Prev Job for CI_FLAGS="-fkmsrcn -u 0/2 'Unit tests for pants and pants-plugins - shard 1'" on master (#6745.2)
  • Next Job for CI_FLAGS="-fkmsrcn -u 0/2 'Unit tests for pants and pants-plugins - shard 1'" on master (#6750.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc