Skip to content
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

Created a metadata rule to replace composed-jar attribute by jar. #802

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ buildscript {
ext.ideaVersion = ideaVersion
ext.kotlinVersion = kotlinVersion
ext.java_version = "17"

// Should be in buildSrc ideally
//dependencies {
// classpath(gradleApi()) {
// because("Creates a dependency on the API of the current version of Gradle, so that we can create Gradle plugins.")
// }
//}
}

plugins {
Expand Down Expand Up @@ -33,7 +40,34 @@ tasks.withType(Test) {
environment 'GRADLE_RELEASE_REPOSITORY','https://services.gradle.org/distributions'
}

// Should be in buildSrc ideally
//@CacheableRule
//abstract class ComposedJarRule implements ComponentMetadataRule {
// @Inject abstract ObjectFactory getObjects()
//
// void execute(ComponentMetadataContext context) {
// context.details.withVariant("intellijPlatformComposedJar") {
// attributes {
// attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
// }
// }
// }
//}
Copy link
Author

Choose a reason for hiding this comment

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

I created two versions, feel free to use whatever you like.


dependencies {
//components {
// withModule("com.redhat.devtools.intellij:intellij-common", ComposedJarRule)
//}
components {
withModule("com.redhat.devtools.intellij:intellij-common") {
withVariant("intellijPlatformComposedJar") {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
}
}
}
}

implementation(
"com.redhat.devtools.intellij:intellij-common:${intellijCommonVersion}",
Copy link
Author

Choose a reason for hiding this comment

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

I just noticed another api which might work you can try:

implementation("com.redhat.devtools.intellij:intellij-common:${intellijCommonVersion}") {
        attributes {
            attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named("composed-jar"))
        }
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

tested it in a different PR where I needed this: df398b4 Works super nicely. I'll add you as co-author to my PR. Thanks!

"io.fabric8:kubernetes-client:${kubernetesClientVersion}",
Expand Down
Loading