{"id":16965019,"url":"https://github.com/propensive/umbrageous","last_synced_at":"2025-04-11T23:02:07.030Z","repository":{"id":195866322,"uuid":"607632328","full_name":"propensive/umbrageous","owner":"propensive","description":"Scala compiler plugin to shade packages at compiletime","archived":false,"fork":false,"pushed_at":"2025-01-23T19:43:12.000Z","size":2285,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T07:46:38.220Z","etag":null,"topics":["compiler-plugin","package-shading","scala","shading"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/propensive.png","metadata":{"files":{"readme":".github/readme.md","changelog":null,"contributing":".github/contributing.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-28T11:19:15.000Z","updated_at":"2025-01-23T19:43:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"9259415f-c5f4-4a7b-b333-e4c7bbaefefb","html_url":"https://github.com/propensive/umbrageous","commit_stats":null,"previous_names":["propensive/umbrageous"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fumbrageous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fumbrageous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fumbrageous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/propensive%2Fumbrageous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/propensive","download_url":"https://codeload.github.com/propensive/umbrageous/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492875,"owners_count":21113162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler-plugin","package-shading","scala","shading"],"created_at":"2024-10-13T23:44:50.323Z","updated_at":"2025-04-11T23:02:06.998Z","avatar_url":"https://github.com/propensive.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[\u003cimg alt=\"GitHub Workflow\" src=\"https://img.shields.io/github/actions/workflow/status/propensive/umbrageous/main.yml?style=for-the-badge\" height=\"24\"\u003e](https://github.com/propensive/umbrageous/actions)\n[\u003cimg src=\"https://img.shields.io/discord/633198088311537684?color=8899f7\u0026label=DISCORD\u0026style=for-the-badge\" height=\"24\"\u003e](https://discord.com/invite/MBUrkTgMnA)\n\u003cimg src=\"/doc/images/github.png\" valign=\"middle\"\u003e\n\n# Umbrageous\n\n____\n\nShading a package, effectively renaming it, is one way to avoid conflicts\nbetween packages with the same name. This is a scenario which frequently arises\nin complex builts which include transitive dependencies on different versions\nof the same library (often called the \"diamond dependency problem\").\n\nNormally shading is performed on a binary after compilation, but this is slow\nand can introduce new problems.  Umbrageous is a compiler plugin which makes it\ntrivial to compile a library into a package with a distinct prefix without\nmodifying its source code.\n\n## Features\n\n- rewrites package names at compiletime\n- adds no time to the build process\n- avoids the need to modify source code\n- avoids slow bytecode rewriting after compilation\n- customizable with compiler parameters; no configuration files required\n- automatically unshades shaded packages in downstream compilations\n\n\n## Availability\n\n\n\n\n\n\n\n## Getting Started\n\nTo use Umbrageous, `scalac` must be invoked with two additional parameters:\n```sh\nscalac -d bin -Xplugin:umbrageous.jar -P:umbrageous:com.example:shaded *.scala`\n```\n\nFirstly, `-Xplugin:umbrageous.jar` points the compiler to a JAR file containing\nthe packaged plugin.\n\nSecondly, `-P:umbrageous:com.example:shaded` tells the plugin to shade\neverything inside the `com.example` package behind the prefix `shaded`, i.e.\nrewriting `com.example` to `shaded.com.example`.\n\nThis `-P` parameter can be provided multiple times to shade different packages.\nIf more than one parameter matches a package name (e.g.\n`-P:umbrageous:com:shade1` and `-P:umbrageous:com.example:shade2`) then the\nprefix corresponding to the longest match will be applied to that package.\n\nA downstream project can include an additional wildcard import at the start to\ninclude everything from its shaded dependencies, for example,\n```scala\npackage myproject\nimport shade.*  // additional import\nimport com.example\n```\nwill allow the shaded `com.example` package (shaded by the `shade` prefix)\nresolve anywhere in the scope of the import (whether imported, or referred to\nby fully-qualified classname).\n\nIncluding the parameter, `-P:umbrageous:com.example:shade` will automatically\nunshade the `com.example` package from subsequent compilations without the need\nfor the import.\n\nNote that this parameter is the same whether applying or using shading.\nHowever, caution should be taken to avoid including nonexistant shaded\npackages: doing so will add the synthetic wildcard import, but it will not\nresolve, and a compile error will result.\n\n### Limitations\n\nUmbrageous does not currently match package names that are defined in multiple\n`package` declarations, such as `com.example` in:\n\n```scala\npackage com\npackage example\n\nobject Main // ...\n```\n\nAdditionally, code which references an absolute name, such as\n`_root_.com.example.Main` will not find the entity with its new, shaded name.\n\n\n\n\n\n## Status\n\nUmbrageous is classified as __fledgling__. For reference, Soundness projects are\ncategorized into one of the following five stability levels:\n\n- _embryonic_: for experimental or demonstrative purposes only, without any guarantees of longevity\n- _fledgling_: of proven utility, seeking contributions, but liable to significant redesigns\n- _maturescent_: major design decisions broady settled, seeking probatory adoption and refinement\n- _dependable_: production-ready, subject to controlled ongoing maintenance and enhancement; tagged as version `1.0.0` or later\n- _adamantine_: proven, reliable and production-ready, with no further breaking changes ever anticipated\n\nProjects at any stability level, even _embryonic_ projects, can still be used,\nas long as caution is taken to avoid a mismatch between the project's stability\nlevel and the required stability and maintainability of your own project.\n\nUmbrageous is designed to be _small_. Its entire source code currently consists\nof 57 lines of code.\n\n## Building\n\nUmbrageous will ultimately be built by Fury, when it is published. In the\nmeantime, two possibilities are offered, however they are acknowledged to be\nfragile, inadequately tested, and unsuitable for anything more than\nexperimentation. They are provided only for the necessity of providing _some_\nanswer to the question, \"how can I try Umbrageous?\".\n\n1. *Copy the sources into your own project*\n   \n   Read the `fury` file in the repository root to understand Umbrageous's build\n   structure, dependencies and source location; the file format should be short\n   and quite intuitive. Copy the sources into a source directory in your own\n   project, then repeat (recursively) for each of the dependencies.\n\n   The sources are compiled against the latest nightly release of Scala 3.\n   There should be no problem to compile the project together with all of its\n   dependencies in a single compilation.\n\n2. *Build with [Wrath](https://github.com/propensive/wrath/)*\n\n   Wrath is a bootstrapping script for building Umbrageous and other projects in\n   the absence of a fully-featured build tool. It is designed to read the `fury`\n   file in the project directory, and produce a collection of JAR files which can\n   be added to a classpath, by compiling the project and all of its dependencies,\n   including the Scala compiler itself.\n   \n   Download the latest version of\n   [`wrath`](https://github.com/propensive/wrath/releases/latest), make it\n   executable, and add it to your path, for example by copying it to\n   `/usr/local/bin/`.\n\n   Clone this repository inside an empty directory, so that the build can\n   safely make clones of repositories it depends on as _peers_ of `umbrageous`.\n   Run `wrath -F` in the repository root. This will download and compile the\n   latest version of Scala, as well as all of Umbrageous's dependencies.\n\n   If the build was successful, the compiled JAR files can be found in the\n   `.wrath/dist` directory.\n\n## Contributing\n\nContributors to Umbrageous are welcome and encouraged. New contributors may like\nto look for issues marked\n[beginner](https://github.com/propensive/umbrageous/labels/beginner).\n\nWe suggest that all contributors read the [Contributing\nGuide](/contributing.md) to make the process of contributing to Umbrageous\neasier.\n\nPlease __do not__ contact project maintainers privately with questions unless\nthere is a good reason to keep them private. While it can be tempting to\nrepsond to such questions, private answers cannot be shared with a wider\naudience, and it can result in duplication of effort.\n\n## Author\n\nUmbrageous was designed and developed by Jon Pretty, and commercial support and\ntraining on all aspects of Scala 3 is available from [Propensive\nO\u0026Uuml;](https://propensive.com/).\n\n\n\n## Name\n\nPlants which are umbrageous provide shade from light, and _Umbrageous_ shades Scala packages.\n\nIn general, Soundness project names are always chosen with some rationale,\nhowever it is usually frivolous. Each name is chosen for more for its\n_uniqueness_ and _intrigue_ than its concision or catchiness, and there is no\nbias towards names with positive or \"nice\" meanings—since many of the libraries\nperform some quite unpleasant tasks.\n\nNames should be English words, though many are obscure or archaic, and it\nshould be noted how willingly English adopts foreign words. Names are generally\nof Greek or Latin origin, and have often arrived in English via a romance\nlanguage.\n\n## Logo\n\nThe logo shows the shadowy side of a mountain range.\n\n## License\n\nUmbrageous is copyright \u0026copy; 2025 Jon Pretty \u0026 Propensive O\u0026Uuml;, and\nis made available under the [Apache 2.0 License](/license.md).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fumbrageous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpropensive%2Fumbrageous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpropensive%2Fumbrageous/lists"}