Skip to content

Commit

Permalink
Revert "Duplicate project name detection"
Browse files Browse the repository at this point in the history
This reverts commits 404c6cf to ffb51fb and
commit a0a662c.

Fixes #12315
  • Loading branch information
ljacomet committed Feb 21, 2020
1 parent 2109fa5 commit 3e60f25
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 1,078 deletions.
Expand Up @@ -606,6 +606,33 @@ afterEvaluate {
failure.assertHasCause("Module version 'org.test:b1:1.0' is not unique in composite: can be provided by [project :buildB:b1, project :buildC:b1].")
}

def "reports failure to resolve dependencies when substitution is ambiguous within single participant"() {
given:
buildB
def buildC = multiProjectBuild("buildC", ['c1', 'c2']);
buildC.settingsFile << """
include ':nested:c1'
"""
buildC.buildFile << """
allprojects {
apply plugin: 'java'
}
"""
includedBuilds << buildC

buildA.buildFile << """
dependencies {
implementation "org.test:c1:1.0"
}
"""

when:
checkDependenciesFails()

then:
failure.assertHasCause("Module version 'org.test:c1:1.0' is not unique in composite: can be provided by [project :buildC:c1, project :buildC:nested:c1].")
}

def "reports failure to resolve dependencies when transitive dependency substitution is ambiguous"() {
given:
transitiveDependencyIsAmbiguous("'org.test:b1:2.0'")
Expand Down Expand Up @@ -720,22 +747,22 @@ afterEvaluate {
maven { url '$mavenRepo.uri' }
}
configurations {
buildInputs
configurations {
buildInputs
create('default')
}
dependencies {
buildInputs "org.test:test:1.2"
}
task buildOutputs {
inputs.files configurations.buildInputs
doLast {
configurations.buildInputs.each { }
}
}
artifacts {
"default" file: file("out.jar"), builtBy: buildOutputs
}
Expand Down

This file was deleted.

@@ -1,5 +1,5 @@
/*
* Copyright 2020 the original author or authors.
* Copyright 2012 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.
Expand All @@ -13,13 +13,64 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gradle.api.internal.artifacts;

import org.gradle.api.Project;

import java.util.List;
public class ProjectBackedModule implements Module {

private final Project project;

public ProjectBackedModule(Project project) {
this.project = project;
}

@Override
public String getGroup() {
return project.getGroup().toString();
}

@Override
public String getName() {
return project.getName();
}

@Override
public String getVersion() {
return project.getVersion().toString();
}

@Override
public String getStatus() {
return project.getStatus().toString();
}

@Override
public String getProjectPath() {
return project.getPath();
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

ProjectBackedModule that = (ProjectBackedModule) o;

if (project != null ? !project.equals(that.project) : that.project != null) {
return false;
}

return true;
}

public interface ProjectBackedModule extends Module {
Project getProject();
List<Project> getProjectsWithSameCoordinates();
@Override
public int hashCode() {
return project != null ? project.hashCode() : 0;
}
}

This file was deleted.

Expand Up @@ -26,10 +26,8 @@
import org.gradle.api.internal.DocumentationRegistry;
import org.gradle.api.internal.StartParameterInternal;
import org.gradle.api.internal.artifacts.DefaultModule;
import org.gradle.api.internal.artifacts.DefaultProjectModuleFactory;
import org.gradle.api.internal.artifacts.DependencyManagementServices;
import org.gradle.api.internal.artifacts.Module;
import org.gradle.api.internal.artifacts.ProjectModuleFactory;
import org.gradle.api.internal.artifacts.configurations.DependencyMetaDataProvider;
import org.gradle.api.internal.classpath.ModuleRegistry;
import org.gradle.api.internal.classpath.PluginModuleRegistry;
Expand Down Expand Up @@ -587,8 +585,4 @@ protected BuildScanUserInputHandler createBuildScanUserInputHandler(UserInputHan
protected BuildInvocationDetails createBuildInvocationDetails(BuildStartedTime buildStartedTime) {
return new DefaultBuildInvocationDetails(buildStartedTime);
}

protected ProjectModuleFactory createProjectModuleIdentifierFactory(DefaultProjectRegistry<ProjectInternal> projectRegistry) {
return new DefaultProjectModuleFactory(projectRegistry);
}
}

0 comments on commit 3e60f25

Please sign in to comment.