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

Fixed #1799 by creating a separate intellijPlatformComposedJarApi (extends api & compileOnlyApi) configuration with JAVA_API usage attribute value. Also replaced java plugin by java-library plugin, because it is a more proper plugin for IntelliJ plugin projects (they are libraries). #1800

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

AlexanderBartash
Copy link
Contributor

@AlexanderBartash AlexanderBartash commented Oct 16, 2024

Pull Request Details

Fixed #1799 by creating a separate intellijPlatformComposedJarApi (extends api & compileOnlyApi) configuration with JAVA_API usage attribute value. Also replaced java plugin by java-library plugin, because it is a more proper plugin for IntelliJ plugin projects (they are libraries).

This PR includes #1792, because it is not merged yet, which I need to fix tests, since master is broken right now
The actual fix for this issue can be seen in d1c8ef8

Description

☝️ + see #1799

These changes create a new outgoing variant:

--------------------------------------------------
Variant intellijPlatformComposedJar
--------------------------------------------------
IntelliJ Platform final composed Jar archive

Capabilities
    - 123:subpr:unspecified (default capability)
Attributes
    - org.gradle.category                = library
    - org.gradle.dependency.bundling     = external
    - org.gradle.jvm.environment         = standard-jvm
    - org.gradle.jvm.version             = 22
    - org.gradle.libraryelements         = composed-jar
    - org.gradle.usage                   = java-runtime
    - org.jetbrains.kotlin.platform.type = jvm
Artifacts
    - build/libs/subpr.jar (artifactType = jar)

--------------------------------------------------
Variant intellijPlatformComposedJarApi
--------------------------------------------------
IntelliJ Platform final composed Jar archive Api

Capabilities
    - 123:subpr:unspecified (default capability)
Attributes
    - org.gradle.category                = library
    - org.gradle.dependency.bundling     = external
    - org.gradle.jvm.environment         = standard-jvm
    - org.gradle.jvm.version             = 22
    - org.gradle.libraryelements         = composed-jar
    - org.gradle.usage                   = java-api
    - org.jetbrains.kotlin.platform.type = jvm
Artifacts
    - build/libs/subpr.jar (artifactType = jar)

Here is proof that it works (notice the fake build number, it is from my local maven, also kotlin plugin is commented out):
image

Now org.jetbrains:annotations:26.0.1 is available and org.apache.commons:commons-lang3:3.5 is not, like it should be.

Related Issue

#1799

Motivation and Context

It was broken.

How Has This Been Tested

So far only manually.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • [ x] I have read the CONTRIBUTING document.
  • [x ] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [ x] I have included my change in the CHANGELOG.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@@ -59,8 +101,13 @@ abstract class IntelliJPlatformModulePlugin : Plugin<Project> {
isCanBeConsumed = true
isCanBeResolved = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to make it only consumable, but the tests then fail, because there is code which tries to resolve it. It should not be true + true, such config is deprecated.

// you should always determine the right values for those flags, or you might accidentally introduce
// resolution errors.
isCanBeConsumed = true
isCanBeResolved = false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it consumable instead of true + true like INTELLIJ_PLATFORM_COMPOSED_JAR below.

@AlexanderBartash
Copy link
Contributor Author

Tests failed because master is broken.

@@ -64,7 +71,8 @@ abstract class ComposedJarTask : Jar() {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
JarCompanion.applyPluginManifest(this)

project.artifacts.add(intellijPlatformComposedJarConfiguration.name, this)
intellijPlatformComposedJarConfiguration.outgoing.artifact(this)
intellijPlatformComposedJarApiConfiguration.outgoing.artifact(this)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that

creates jar for searchable options in runtime elements. I am not sure if that is how it should be, since we have these custom configurations and all of a sudden that thing is in the default one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May be related #1802

Choose a reason for hiding this comment

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

probably related, yes.

@AlexanderBartash
Copy link
Contributor Author

Tests failed due to Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

…arApi (extends api & compileOnlyApi) configuration with JAVA_API usage attribute value. Also replaced java plugin by java-library plugin, because it is a more proper plugin for IntelliJ plugin projects (they are libraries).
@hsz hsz merged commit 94fcaa1 into JetBrains:main Oct 22, 2024
2 checks passed
@hsz hsz added this to the next milestone Oct 22, 2024
@AlexanderBartash AlexanderBartash deleted the bug-1799-java-library branch October 23, 2024 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants