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

Mark Missing Local Artifacts as optional #23245

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,66 @@
/*
* Copyright 2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gradle.integtests.resolve

import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import spock.lang.Issue

@Issue("https://github.com/gradle/gradle/pull/23245")
Copy link
Member

Choose a reason for hiding this comment

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

I think you meant to link to the issue here?

class ResolvePOMSpec extends AbstractIntegrationSpec {
def "resolving a @pom artifact from an included build replacing an external library doesn't fail the build"() {
given:
def mainProjectDir = file("main-project")
def includedLoggingProjectDir = file("included-logging")

mainProjectDir.file("settings.gradle.kts").text = """
rootProject.name = "main-project"
include("app")
includeBuild("../included-logging")
"""

mainProjectDir.file("app/build.gradle.kts").text = """
plugins {
application
}

dependencies {
implementation("org.gradle.repro:lib@pom")
}
"""

includedLoggingProjectDir.file("settings.gradle.kts").text = """
rootProject.name = "included-logging"
include("lib")
"""

includedLoggingProjectDir.file("lib/build.gradle.kts").text = """
plugins {
`java-library`
}
"""

includedLoggingProjectDir.file("gradle.properties").text = """
group=org.gradle.repro
version=0.1.0-SNAPSHOT
"""

executer.inDirectory(mainProjectDir)

expect:
succeeds "build"
}
}
Expand Up @@ -98,4 +98,9 @@ public boolean equals(Object obj) {
MissingLocalArtifactMetadata other = (MissingLocalArtifactMetadata) obj;
return other.componentIdentifier.equals(componentIdentifier) && other.name.equals(name);
}

@Override
public boolean isOptionalArtifact() {
return true;
Copy link
Member

@ljacomet ljacomet Dec 22, 2022

Choose a reason for hiding this comment

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

This is not a method I am super familiar with.
Can you explain why a blanket change like this to all instances of MissingLocalArtifactMetadata is not an issue?

And looks like we have tests that fail because of the change.

Copy link
Member Author

Choose a reason for hiding this comment

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

So my previous test run succeeded here, then my only change after was to add a new integration test. So that's a little strange.

I was looking for failing tests and when I didn't see any assumed we could mark missing but local metadata artifacts as optional so that we don't throw an exception when trying to get() them. I'll look a little deeper into these now failing tests, maybe they can throw some new light on this.

}
}