-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maven Shade support #5967
base: main
Are you sure you want to change the base?
Maven Shade support #5967
Changes from 1 commit
eb7053f
c10b15f
52fe6f7
6b6bc1f
7229db2
d6663f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,3 +485,54 @@ class MavenRepoJar extends File { | |
else getVersion().matches(pom.getVersionString() + "%") | ||
} | ||
} | ||
|
||
class MavenPlugin extends ProtoPom { | ||
MavenPlugin() { this.hasName("plugin") } | ||
} | ||
|
||
class MavenShadePlugin extends MavenPlugin { | ||
MavenShadePlugin() { | ||
this.getGroup().getValue() = "org.apache.maven.plugins" and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, done |
||
this.getArtifact().getValue() = "maven-shade-plugin" | ||
} | ||
|
||
MavenShadeRelocation getARelocation() { result.getPlugin() = this } | ||
} | ||
|
||
class MavenShadeRelocation extends XMLElement { | ||
MavenShadePlugin plugin; | ||
|
||
MavenShadeRelocation() { | ||
this.getParent().(XMLElement).getParent().(XMLElement).getParent() = plugin and | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be good to add a comment explaining the hierarchy here, i.e. It is also possible to specify the configuration per execution, as it was done in the example of the Maven Shade Plugin, see also the POM Reference. |
||
this.hasName("relocation") | ||
} | ||
|
||
MavenShadePlugin getPlugin() { result = plugin } | ||
|
||
string getPattern() { | ||
exists(XMLElement el | el.getName() = "pattern" and el.getParent() = this | | ||
result = el.getTextValue() | ||
) | ||
} | ||
|
||
string getShadedPattern() { | ||
exists(XMLElement el | el.getName() = "shadedPattern" and el.getParent() = this | | ||
result = el.getTextValue() | ||
) | ||
} | ||
|
||
predicate relocates(string fromPackage, string toPackage) { | ||
this.getPattern() = fromPackage and this.getShadedPattern() = toPackage | ||
} | ||
} | ||
|
||
bindingset[package] | ||
string getAShadedPackage(string package) { | ||
result = package | ||
or | ||
exists(string originalPackage, string shadedPackage, MavenShadeRelocation relocDirective | | ||
relocDirective.relocates(originalPackage, shadedPackage) | ||
| | ||
result = package.regexpReplaceAll("^" + originalPackage, shadedPackage) | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this changed on purpose, shouldn't it be the following? (might require formatting)