gradleup / gr8 Goto Github PK
View Code? Open in Web Editor NEWGr8 = Gradle + R8
Home Page: https://blog.mbonnin.net/use-kotlin-15-in-your-gradle-plugins
License: MIT License
Gr8 = Gradle + R8
Home Page: https://blog.mbonnin.net/use-kotlin-15-in-your-gradle-plugins
License: MIT License
It would be awesome if this:
https://docs.gradle.org/current/userguide/toolchains.html#sec:plugins
There's a comment in Gr8Task
as well that this could be helpful -
I'm trying to use this plugin for https://github.com/littlerobots/version-catalog-update-plugin. That project has a plugin module and a separate module containing some logic around the version catalogs.
Following the README I've setup the plugin like this:
def shadeConfiguration = configurations.create("shade")
gr8 {
def shadowedJar = create("gr8") {
proguardFile("rules.pro")
configuration("shade")
}
// Replace the regular jar with the shadowed one in the publication
replaceOutgoingJar(shadowedJar)
// Make the shadowed dependencies available during compilation/tests
configurations.named("compileOnly").configure {
extendsFrom(shadeConfiguration)
}
configurations.named("testImplementation").configure {
extendsFrom(shadeConfiguration)
}
}
repositories {
gradlePluginPortal()
}
dependencies {
shade project(":catalog")
compileOnly("dev.gradleplugins:gradle-api:7.3.2")
shade "org.jetbrains.kotlin:kotlin-stdlib:1.4"
shade "com.fasterxml.jackson.dataformat:jackson-dataformat-toml:2.13.0"
shade "com.squareup.moshi:moshi:1.12.0"
shade "com.squareup.moshi:moshi-kotlin:1.12.0"
testImplementation 'junit:junit:4.13.2'
testImplementation 'com.github.ben-manes:gradle-versions-plugin:0.40.0'
testImplementation(gradleTestKit())
compileOnly 'com.github.ben-manes:gradle-versions-plugin:0.40.0'
}
It seems that I have to add the catalog
module to the shade configuration too, otherwise none of the classes from that module appear to be added to the plugin jar. But this introduces an issue where I can no longer run my tests; classes from that project are not found in testKit tests, even when testImplementation
is extending the shade
config.
I'm also not sure if I really need to redeclare the dependencies that that module uses here in the shade
config. It also seems that not all of the kotlin classes are relocated in the gr8 jar so that also seems to point to more configuration / user errors ๐
Can you point me in the right direction?
I wanted to add all of compileOnly
to classpathConfiguration
to get rid of R8 warnings about missing classes. However that fails with:
Could not determine the dependencies of task ':plugin:gr8StripGradleApi'.
> Failed to query the value of task ':plugin:gr8StripGradleApi' property 'gradleApiJar$plugin_common'.
> Collection contains more than one matching element.
When I printed all files in the configurationthe configuration I found this:
.../.gradle/caches/modules-2/files-2.1/dev.gradleplugins/gradle-api/8.0.2/81ef2cba43a0896316935ece786174490ea30758/gradle-api-8.0.2.jar
.../.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle-api/7.4.2/5f81693f719b0472898c69dafb42befbb18de887/gradle-api-7.4.2.jar
Not sure if this is possible to avoid just based on the path. Maybe it could be possible to have more than one classpathConfiguration
and make it configurable which ones are stripped.
Hi,
I want to relocate AWS SDK for https://github.com/burrunan/gradle-s3-build-cache, and it looks like proguard is either "relocate+obfuscate" or "just keep old package names".
What I want is to just relocate packages under com.github.burrunan.s3cache.relocated
package, and I don't want all the classes to be renamed as a.class
so the stacktraces are understandable.
Do you know if there's a proguard configuration for that?
It looks like -keep
would keep the original names (which would defeat the purpose of shading as it would conflict with other dependencies), however, -flattenpackagehierarchy
and -repackageclasses
obfuscate the names.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.