Projects >> gradle >>a16336b9e1dca255e534f8ef0c0442c7164eef97

Chunk
Conflicting content
                }
                ArtifactId artifactId = rule.getId();
                ModuleId moduleId = artifactId.getModuleId();
<<<<<<< HEAD
                boolean wildcardOrganisation = MatcherHelper.matchesAnyExpression(moduleId.getOrganisation());
                boolean wildcardModule = MatcherHelper.matchesAnyExpression(moduleId.getName());
=======
                boolean wildcardOrganisation = isWildcard(moduleId.getOrganisation());
                boolean wildcardModule = isWildcard(moduleId.getName());
                boolean wildcardArtifact = isWildcard(artifactId.getName()) && isWildcard(artifactId.getType()) && isWildcard(artifactId.getExt());
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c

                if (wildcardOrganisation && wildcardModule) {
                    excludeSpecs.add(new ExcludeRuleSpec(rule));
Solution content
                }
                ArtifactId artifactId = rule.getId();
                ModuleId moduleId = artifactId.getModuleId();
                boolean wildcardOrganisation = isWildcard(moduleId.getOrganisation());
                boolean wildcardModule = isWildcard(moduleId.getName());
                boolean wildcardArtifact = isWildcard(artifactId.getName()) && isWildcard(artifactId.getType()) && isWildcard(artifactId.getExt());

                if (wildcardOrganisation && wildcardModule) {
                    excludeSpecs.add(new ExcludeRuleSpec(rule));
File
DefaultModuleResolutionFilter.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
                } else if (wildcardArtifact) {
                    excludeSpecs.add(new ModuleIdSpec(moduleId.getOrganisation(), moduleId.getName()));
                } else {
<<<<<<< HEAD
                    boolean wildcardName = MatcherHelper.matchesAnyExpression(artifactId.getName());
                    boolean wildcardType = MatcherHelper.matchesAnyExpression(artifactId.getType());
                    boolean wildcardExt = MatcherHelper.matchesAnyExpression(artifactId.getExt());

                    if(wildcardName && wildcardType && wildcardExt) {
                        excludeSpecs.add(new ModuleIdSpec(moduleId.getOrganisation(), moduleId.getName()));
                    } else {
                        excludeSpecs.add(new ExcludeRuleSpec(rule));
                    }
=======
                    excludeSpecs.add(new ExcludeRuleSpec(rule));
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
                }
            }
        }
Solution content
                } else if (wildcardArtifact) {
                    excludeSpecs.add(new ModuleIdSpec(moduleId.getOrganisation(), moduleId.getName()));
                } else {
                    excludeSpecs.add(new ExcludeRuleSpec(rule));
                }
            }
        }
File
DefaultModuleResolutionFilter.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
        }

        public boolean acceptModule(ModuleIdentifier module) {
<<<<<<< HEAD
            ArtifactId ruleArtifactId = rule.getId();
            ModuleIdentifier ruleModuleId = new DefaultModuleIdentifier(ruleArtifactId.getModuleId().getOrganisation(), ruleArtifactId.getModuleId().getName());
            boolean matchesRule = MatcherHelper.matches(rule.getMatcher(), ruleModuleId, module);
            return !(matchesRule
                    && MatcherHelper.matchesAnyExpression(ruleArtifactId.getName())
                    && MatcherHelper.matchesAnyExpression(ruleArtifactId.getType())
                    && MatcherHelper.matchesAnyExpression(ruleArtifactId.getExt()));
        }

        public boolean acceptArtifact(ModuleIdentifier module, IvyArtifactName artifact) {
            ArtifactId ruleArtifactId = rule.getId();
            ModuleIdentifier ruleModuleId = new DefaultModuleIdentifier(ruleArtifactId.getModuleId().getOrganisation(), ruleArtifactId.getModuleId().getName());
            IvyArtifactName ruleIvyArtifactName = new DefaultIvyArtifactName(ruleArtifactId.getName(), ruleArtifactId.getType(), ruleArtifactId.getExt());
            return !(MatcherHelper.matches(rule.getMatcher(), ruleModuleId, module)
                    && MatcherHelper.matches(rule.getMatcher(), ruleIvyArtifactName, artifact));
        }
    }

    private static class MatcherHelper {
        public static boolean matches(PatternMatcher m, String expression, String input) {
            return m.getMatcher(expression).matches(input);
        }

        public static boolean matches(PatternMatcher m, ModuleIdentifier exp, ModuleIdentifier mid) {
            return matches(m, exp.getGroup(), mid.getGroup())
                    && matches(m, exp.getName(), mid.getName());
        }

        public static boolean matches(PatternMatcher m, IvyArtifactName exp, IvyArtifactName aid) {
            return matches(m, exp.getName(), aid.getName())
                    && matches(m, exp.getExtension(), aid.getExtension())
                    && matches(m, exp.getType(), aid.getType());
        }

        public static boolean matchesAnyExpression(String attribute) {
            return PatternMatcher.ANY_EXPRESSION.equals(attribute);
=======
            return !(matches(moduleId.getGroup(), module.getGroup())
                    && matches(moduleId.getName(), module.getName())
                    && isWildcard(ivyArtifactName.getName())
                    && isWildcard(ivyArtifactName.getType())
                    && isWildcard(ivyArtifactName.getExtension()));
        }

        public boolean acceptArtifact(ModuleIdentifier module, IvyArtifactName artifact) {
            return !(matches(moduleId.getGroup(), module.getGroup())
                    && matches(moduleId.getName(), module.getName())
                    && matches(ivyArtifactName.getName(), artifact.getName())
                    && matches(ivyArtifactName.getExtension(), artifact.getExtension())
                    && matches(ivyArtifactName.getType(), artifact.getType()));
        }

        private boolean matches(String expression, String input) {
            return matcher.getMatcher(expression).matches(input);
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
        }
    }
}
Solution content
        }

        public boolean acceptModule(ModuleIdentifier module) {
            return !(matches(moduleId.getGroup(), module.getGroup())
                    && matches(moduleId.getName(), module.getName())
                    && isWildcard(ivyArtifactName.getName())
                    && isWildcard(ivyArtifactName.getType())
                    && isWildcard(ivyArtifactName.getExtension()));
        }

        public boolean acceptArtifact(ModuleIdentifier module, IvyArtifactName artifact) {
            return !(matches(moduleId.getGroup(), module.getGroup())
                    && matches(moduleId.getName(), module.getName())
                    && matches(ivyArtifactName.getName(), artifact.getName())
                    && matches(ivyArtifactName.getExtension(), artifact.getExtension())
                    && matches(ivyArtifactName.getType(), artifact.getType()));
        }

        private boolean matches(String expression, String input) {
            return matcher.getMatcher(expression).matches(input);
        }
    }
}
File
DefaultModuleResolutionFilter.java
Developer's decision
Version 2
Kind of conflict
Class signature
Method declaration
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
import org.gradle.model.collection.internal.PolymorphicDomainObjectContainerModelProjection;
import org.gradle.model.internal.core.ModelPath;
import org.gradle.model.internal.registry.ModelRegistry;
<<<<<<< HEAD
import org.gradle.model.internal.type.ModelType;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.PlatformContainer;
import org.gradle.platform.base.internal.BinarySpecInternal;
import org.gradle.platform.base.internal.ComponentSpecInternal;
import org.gradle.platform.base.internal.DefaultComponentSpecContainer;
import org.gradle.platform.base.internal.DefaultPlatformContainer;
=======
import org.gradle.platform.base.*;
import org.gradle.platform.base.internal.*;
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c

import javax.inject.Inject;
Solution content
import org.gradle.model.collection.internal.PolymorphicDomainObjectContainerModelProjection;
import org.gradle.model.internal.core.ModelPath;
import org.gradle.model.internal.registry.ModelRegistry;
import org.gradle.model.internal.type.ModelType;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.PlatformContainer;
import org.gradle.platform.base.internal.*;

import javax.inject.Inject;
File
ComponentModelBasePlugin.java
Developer's decision
Combination
Kind of conflict
Import
Chunk
Conflicting content
/**
 * Defines Platform specific operations for ComponentSpecs
 */
<<<<<<< HEAD
=======
@Incubating @HasInternalProtocol
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
public interface PlatformAwareComponentSpec extends ComponentSpec {
    /**
     * Specifies a platform that this component should be built be for.
Solution content
/**
 * Defines Platform specific operations for ComponentSpecs
 */
@Incubating @HasInternalProtocol
public interface PlatformAwareComponentSpec extends ComponentSpec {
    /**
     * Specifies a platform that this component should be built be for.
File
PlatformAwareComponentSpec.java
Developer's decision
Version 2
Kind of conflict
Annotation
Chunk
Conflicting content
 * A container of {@link Platform}s.
 */
@Incubating
<<<<<<< HEAD
public interface PlatformContainer extends ExtensiblePolymorphicDomainObjectContainer {
     List chooseFromTargets(Class type, List targets);
=======
public interface PlatformContainer extends PolymorphicDomainObjectContainer, ExtensiblePolymorphicDomainObjectContainer {
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
}
Solution content
 * A container of {@link Platform}s.
 */
@Incubating
public interface PlatformContainer extends ExtensiblePolymorphicDomainObjectContainer {
}
File
PlatformContainer.java
Developer's decision
Combination
Kind of conflict
Interface signature
Method interface
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    @ComponentBinaries
    public void createBinaries(CollectionBuilder binaries, final JvmLibrarySpec jvmLibrary,
                               PlatformContainer platforms, BinaryNamingSchemeBuilder namingSchemeBuilder, final JvmComponentExtension jvmComponentExtension,
                               @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
=======
        @ComponentBinaries
        public void createBinaries(CollectionBuilder binaries, final JvmLibrarySpec jvmLibrary,
                                   PlatformResolver platforms, BinaryNamingSchemeBuilder namingSchemeBuilder, final JvmComponentExtension jvmComponentExtension,
                                   @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c

        final File binariesDir = new File(buildDir, "jars");
        final File classesDir = new File(buildDir, "classes");
Solution content
        }
    }

    @ComponentBinaries
    public void createBinaries(CollectionBuilder binaries, final JvmLibrarySpec jvmLibrary,
                               PlatformResolver platforms, BinaryNamingSchemeBuilder namingSchemeBuilder, final JvmComponentExtension jvmComponentExtension,
                               @Path("buildDir") File buildDir, ServiceRegistry serviceRegistry, JavaToolChainRegistry toolChains) {

        final File binariesDir = new File(buildDir, "jars");
        final File classesDir = new File(buildDir, "classes");
File
JvmComponentPlugin.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method signature
Chunk
Conflicting content
        final File binariesDir = new File(buildDir, "jars");
        final File classesDir = new File(buildDir, "classes");

<<<<<<< HEAD
        List targetPlatforms = jvmLibrary.getTargetPlatforms();
        if (targetPlatforms.isEmpty()) {
            // TODO:DAZ Make it simpler to get the default java platform name, or use a spec here
            targetPlatforms = Collections.singletonList(new DefaultJavaPlatform(JavaVersion.current()).getName());
        }
        List selectedPlatforms = platforms.chooseFromTargets(JavaPlatform.class, targetPlatforms);
        for (final JavaPlatform platform : selectedPlatforms) {
            final JavaToolChainInternal toolChain = (JavaToolChainInternal) toolChains.getForPlatform(platform);
            final String binaryName = createBinaryName(jvmLibrary, namingSchemeBuilder, selectedPlatforms, platform);

            binaries.create(binaryName, new Action() {
                public void execute(JarBinarySpec jarBinary) {
                    JarBinarySpecInternal jarBinaryInternal = (JarBinarySpecInternal) jarBinary;
                    jarBinaryInternal.setBaseName(jvmLibrary.getName());
                    jarBinary.setToolChain(toolChain);
                    jarBinary.setTargetPlatform(platform);

                    File outputDir = new File(classesDir, jarBinary.getName());
                    jarBinary.setClassesDir(outputDir);
                    jarBinary.setResourcesDir(outputDir);
                    jarBinary.setJarFile(new File(binariesDir, String.format("%s/%s.jar", jarBinary.getName(), jarBinaryInternal.getBaseName())));

                    boolean canBuild = toolChain.select(jarBinary.getTargetPlatform()).isAvailable();
                    jarBinaryInternal.setBuildable(canBuild);

                    jvmComponentExtension.getAllBinariesAction().execute(jarBinary);
                }
            });
=======
            List selectedPlatforms = resolvePlatforms(jvmLibrary, platforms);
            for (final JavaPlatform platform : selectedPlatforms) {
                final JavaToolChainInternal toolChain = (JavaToolChainInternal) toolChains.getForPlatform(platform);
                final String binaryName = createBinaryName(jvmLibrary, namingSchemeBuilder, selectedPlatforms, platform);

                binaries.create(binaryName, new Action() {
                    public void execute(JarBinarySpec jarBinary) {
                        JarBinarySpecInternal jarBinaryInternal = (JarBinarySpecInternal) jarBinary;
                        jarBinaryInternal.setBaseName(jvmLibrary.getName());
                        jarBinary.setToolChain(toolChain);
                        jarBinary.setTargetPlatform(platform);

                        File outputDir = new File(classesDir, jarBinary.getName());
                        jarBinary.setClassesDir(outputDir);
                        jarBinary.setResourcesDir(outputDir);
                        jarBinary.setJarFile(new File(binariesDir, String.format("%s/%s.jar", jarBinary.getName(), jarBinaryInternal.getBaseName())));

                        boolean canBuild = toolChain.select(jarBinary.getTargetPlatform()).isAvailable();
                        jarBinaryInternal.setBuildable(canBuild);

                        jvmComponentExtension.getAllBinariesAction().execute(jarBinary);
                    }
                });
            }
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
        }
    }
Solution content
        final File binariesDir = new File(buildDir, "jars");
        final File classesDir = new File(buildDir, "classes");

        List selectedPlatforms = resolvePlatforms(jvmLibrary, platforms);
        for (final JavaPlatform platform : selectedPlatforms) {
            final JavaToolChainInternal toolChain = (JavaToolChainInternal) toolChains.getForPlatform(platform);
            final String binaryName = createBinaryName(jvmLibrary, namingSchemeBuilder, selectedPlatforms, platform);

            binaries.create(binaryName, new Action() {
                public void execute(JarBinarySpec jarBinary) {
                    JarBinarySpecInternal jarBinaryInternal = (JarBinarySpecInternal) jarBinary;
                    jarBinaryInternal.setBaseName(jvmLibrary.getName());
                    jarBinary.setToolChain(toolChain);
                    jarBinary.setTargetPlatform(platform);

                    File outputDir = new File(classesDir, jarBinary.getName());
                    jarBinary.setClassesDir(outputDir);
                    jarBinary.setResourcesDir(outputDir);
                    jarBinary.setJarFile(new File(binariesDir, String.format("%s/%s.jar", jarBinary.getName(), jarBinaryInternal.getBaseName())));

                    boolean canBuild = toolChain.select(jarBinary.getTargetPlatform()).isAvailable();
                    jarBinaryInternal.setBuildable(canBuild);

                    jvmComponentExtension.getAllBinariesAction().execute(jarBinary);
                }
            });
        }
    }
File
JvmComponentPlugin.java
Developer's decision
Combination
Kind of conflict
Cast expression
For statement
If statement
Method invocation
Variable
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    @Mutate
    public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
        for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
            Task jarTask = createJarTask(tasks, projectJarBinary);
            projectJarBinary.builtBy(jarTask);
            projectJarBinary.getTasks().add(jarTask);
=======
        private List resolvePlatforms(JvmLibrarySpec jvmLibrary, PlatformResolver platforms) {
            List targetPlatforms = ((JvmLibrarySpecInternal) jvmLibrary).getTargetPlatforms();
            if (targetPlatforms.isEmpty()) {
                // TODO:DAZ Make it simpler to get the default java platform name, or use a spec here
                String defaultJavaPlatformName = new DefaultJavaPlatform(JavaVersion.current()).getName();
                targetPlatforms = Collections.singletonList(DefaultPlatformRequirement.create(defaultJavaPlatformName));
            }
            return platforms.resolve(JavaPlatform.class, targetPlatforms);
        }

        @Mutate
        public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
            for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
                Task jarTask = createJarTask(tasks, projectJarBinary);
                projectJarBinary.builtBy(jarTask);
                projectJarBinary.getTasks().add(jarTask);
            }
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
        }
    }
Solution content
        }
    }

    private List resolvePlatforms(JvmLibrarySpec jvmLibrary, PlatformResolver platforms) {
        List targetPlatforms = ((JvmLibrarySpecInternal) jvmLibrary).getTargetPlatforms();
        if (targetPlatforms.isEmpty()) {
            // TODO:DAZ Make it simpler to get the default java platform name, or use a spec here
            String defaultJavaPlatformName = new DefaultJavaPlatform(JavaVersion.current()).getName();
            targetPlatforms = Collections.singletonList(DefaultPlatformRequirement.create(defaultJavaPlatformName));
        }
        return platforms.resolve(JavaPlatform.class, targetPlatforms);
    }

    @Mutate
    public void createTasks(TaskContainer tasks, BinaryContainer binaries) {
        for (JarBinarySpecInternal projectJarBinary : binaries.withType(JarBinarySpecInternal.class)) {
            Task jarTask = createJarTask(tasks, projectJarBinary);
            projectJarBinary.builtBy(jarTask);
            projectJarBinary.getTasks().add(jarTask);
        }
    }
File
JvmComponentPlugin.java
Developer's decision
Combination
Kind of conflict
Annotation
For statement
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
        // TODO:DAZ Migrate to @BinaryType and @ComponentBinaries
        @Mutate
        public void createNativeBinaries(BinaryContainer binaries, NamedDomainObjectSet nativeComponents,
<<<<<<< HEAD
                                         LanguageTransformContainer languageTransforms, NativeToolChainRegistryInternal toolChains,
                                         PlatformContainer platforms, BuildTypeContainer buildTypes, FlavorContainer flavors,
=======
                                         LanguageRegistry languages, NativeToolChainRegistryInternal toolChains,
                                         PlatformResolver platforms, BuildTypeContainer buildTypes, FlavorContainer flavors,
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
                                         ServiceRegistry serviceRegistry, @Path("buildDir") File buildDir) {
            Instantiator instantiator = serviceRegistry.get(Instantiator.class);
            NativeDependencyResolver resolver = serviceRegistry.get(NativeDependencyResolver.class);
Solution content
        // TODO:DAZ Migrate to @BinaryType and @ComponentBinaries
        @Mutate
        public void createNativeBinaries(BinaryContainer binaries, NamedDomainObjectSet nativeComponents,
                                         LanguageTransformContainer languageTransforms, NativeToolChainRegistryInternal toolChains,
                                         PlatformResolver platforms, BuildTypeContainer buildTypes, FlavorContainer flavors,
                                         ServiceRegistry serviceRegistry, @Path("buildDir") File buildDir) {
            Instantiator instantiator = serviceRegistry.get(Instantiator.class);
            NativeDependencyResolver resolver = serviceRegistry.get(NativeDependencyResolver.class);
File
NativeComponentModelPlugin.java
Developer's decision
Combination
Kind of conflict
Variable
Chunk
Conflicting content
    @ComponentBinaries
    void createBinaries(CollectionBuilder binaries, final PlayApplicationSpec componentSpec,
<<<<<<< HEAD
                        PlatformContainer platforms, final PlayToolChainInternal playToolChainInternal,
                        final ServiceRegistry serviceRegistry, @Path("buildDir") final File buildDir, final ProjectIdentifier projectIdentifier) {

        final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
        final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
        for (final PlayPlatform chosenPlatform : getChosenPlatforms(componentSpec, platforms)) {
=======
                        PlatformResolver platforms, final PlayToolChainInternal playToolChainInternal,
                        final FileResolver fileResolver, @Path("buildDir") final File buildDir, final ProjectIdentifier projectIdentifier) {
        for (final PlayPlatform chosenPlatform : resolveTargetPlatforms(componentSpec, platforms)) {
>>>>>>> 5723e23479c8615e5be85efd7cedc2761fab990c
            final String binaryName = String.format("%sBinary", componentSpec.getName());
            final File binaryBuildDir = new File(buildDir, binaryName);
            binaries.create(binaryName, new Action() {
Solution content
    @ComponentBinaries
    void createBinaries(CollectionBuilder binaries, final PlayApplicationSpec componentSpec,
                        PlatformResolver platforms, final PlayToolChainInternal playToolChainInternal,
                        final ServiceRegistry serviceRegistry, @Path("buildDir") final File buildDir, final ProjectIdentifier projectIdentifier) {

        final FileResolver fileResolver = serviceRegistry.get(FileResolver.class);
        final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
        for (final PlayPlatform chosenPlatform : resolveTargetPlatforms(componentSpec, platforms)) {
            final String binaryName = String.format("%sBinary", componentSpec.getName());
            final File binaryBuildDir = new File(buildDir, binaryName);
            binaries.create(binaryName, new Action() {
File
PlayApplicationPlugin.java
Developer's decision
Combination
Kind of conflict
For statement
Method invocation
Variable