From 1bf494523b4e152bb14deb18ccbc0976b9242a8b Mon Sep 17 00:00:00 2001 From: Roberto Perez Alcolea Date: Fri, 17 Nov 2023 16:26:31 -0800 Subject: [PATCH] Remove plugins that can't be config cache compliant and are IVy based --- build.gradle | 16 - gradle.lockfile | 2 +- .../ivy/IvyCompileOnlyPlugin.groovy | 98 ----- .../publishing/ivy/IvyPublishPlugin.groovy | 2 - ...IvyRemovePlatformDependenciesPlugin.groovy | 93 ----- .../ivy/PlatformDependencyVerifier.groovy | 71 ---- ...IvyCompileOnlyPluginIntegrationSpec.groovy | 104 ----- ...emovePlatformDependenciesPluginSpec.groovy | 364 ------------------ ...shVerificationPluginIntegrationSpec.groovy | 1 - 9 files changed, 1 insertion(+), 750 deletions(-) delete mode 100644 src/main/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPlugin.groovy delete mode 100644 src/main/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPlugin.groovy delete mode 100644 src/main/groovy/nebula/plugin/publishing/ivy/PlatformDependencyVerifier.groovy delete mode 100644 src/test/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPluginIntegrationSpec.groovy delete mode 100644 src/test/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPluginSpec.groovy diff --git a/build.gradle b/build.gradle index 385ae976..8f17a3fa 100644 --- a/build.gradle +++ b/build.gradle @@ -167,14 +167,6 @@ gradlePlugin { tags.set(['nebula', 'publish', 'ivy']) } - ivyCompileOnly { - id = 'com.netflix.nebula.ivy-compile-only' - displayName = 'com.netflix.nebula.ivy-compile-only' - description = 'Plugins to ease maven-publish and ivy-publish configuration' - implementationClass = 'nebula.plugin.publishing.ivy.IvyCompileOnlyPlugin' - tags.set(['nebula', 'publish', 'ivy']) - } - ivyManifest { id = 'com.netflix.nebula.ivy-manifest' displayName = 'com.netflix.nebula.ivy-manifest' @@ -223,14 +215,6 @@ gradlePlugin { tags.set(['nebula', 'publish', 'ivy']) } - ivyRemovePlatformDependencies { - id = 'com.netflix.nebula.ivy-remove-platform-dependencies' - displayName = 'com.netflix.nebula.ivy-remove-platform-dependencies' - description = 'Plugins to ease maven-publish and ivy-publish configuration' - implementationClass = 'nebula.plugin.publishing.ivy.IvyRemovePlatformDependenciesPlugin' - tags.set(['nebula', 'publish', 'ivy']) - } - publishVerification { id = 'com.netflix.nebula.publish-verification' displayName = 'com.netflix.nebula.publish-verification' diff --git a/gradle.lockfile b/gradle.lockfile index e1266304..b0164b49 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -24,7 +24,7 @@ com.jcraft:jzlib:1.1.2=integTestRuntimeClasspath,runtimeClasspath,testRuntimeCla com.netflix.nebula:gradle-contacts-plugin:7.0.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.netflix.nebula:gradle-dependency-lock-plugin:13.2.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath com.netflix.nebula:gradle-info-plugin:12.1.4=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -com.netflix.nebula:gradle-resolution-rules-plugin:10.2.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.netflix.nebula:gradle-resolution-rules-plugin:11.2.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath com.netflix.nebula:gradle-scm-plugin:7.0.0=integTestRuntimeClasspath,testRuntimeClasspath com.netflix.nebula:nebula-dependencies-comparison:0.2.1=integTestRuntimeClasspath,testRuntimeClasspath com.netflix.nebula:nebula-dependency-recommender:12.2.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/src/main/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPlugin.groovy b/src/main/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPlugin.groovy deleted file mode 100644 index e05ce359..00000000 --- a/src/main/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPlugin.groovy +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2017-2020 Netflix, Inc. - * - * 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 nebula.plugin.publishing.ivy - -import groovy.transform.Canonical -import groovy.transform.CompileDynamic -import org.gradle.api.Action -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.XmlProvider -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.publish.PublicationContainer -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.ivy.IvyModuleDescriptorSpec -import org.gradle.api.publish.ivy.IvyPublication - -@CompileDynamic -class IvyCompileOnlyPlugin implements Plugin { - - static enum DependenciesContent { - dependency, - exclude, - override, - conflict - } - - void apply(Project project) { - project.plugins.apply IvyBasePublishPlugin - - PublishingExtension publishing = project.extensions.getByType(PublishingExtension) - project.plugins.withType(JavaPlugin) { JavaPlugin javaBasePlugin -> - project.afterEvaluate(new Action() { - @Override - void execute(Project p) { - def compileOnlyDependencies = project.configurations.compileOnly.incoming.dependencies.collect { - new Dependency(it.group, it.name, it.version) - } - - publishing.publications(new Action() { - @Override - void execute(PublicationContainer publications) { - publications.withType(IvyPublication) { IvyPublication publication -> - publication.descriptor(new Action() { - @Override - void execute(IvyModuleDescriptorSpec ivyModuleDescriptorSpec) { - ivyModuleDescriptorSpec.withXml(new Action() { - @Override - void execute(XmlProvider xml) { - def root = xml.asNode() - def dependencies = compileOnlyDependencies - if (dependencies.size() > 0) { - def confs = root.configurations ? root.configurations[0] : root.appendNode('configurations') - confs.appendNode('conf', [name: 'provided', visibility: 'public']) - def deps = root.dependencies ? root.dependencies[0] : root.appendNode('dependencies') - dependencies.each { dep -> - def newDep = deps.appendNode('dependency') - newDep.@org = dep.organisation - newDep.@name = dep.module - newDep.@rev = dep.version - newDep.@conf = 'provided' - } - deps.children().sort(true, { - DependenciesContent.valueOf(it.name()).ordinal() - }) - } - } - }) - } - }) - } - } - }) - } - }) - - } - } - - @Canonical - private static class Dependency { - String organisation - String module - String version - } -} diff --git a/src/main/groovy/nebula/plugin/publishing/ivy/IvyPublishPlugin.groovy b/src/main/groovy/nebula/plugin/publishing/ivy/IvyPublishPlugin.groovy index fbd5dd0d..b8dc1e72 100644 --- a/src/main/groovy/nebula/plugin/publishing/ivy/IvyPublishPlugin.groovy +++ b/src/main/groovy/nebula/plugin/publishing/ivy/IvyPublishPlugin.groovy @@ -26,9 +26,7 @@ class IvyPublishPlugin implements Plugin { project.plugins.apply IvyNebulaPublishPlugin project.plugins.apply IvyBasePublishPlugin project.plugins.apply IvyResolvedDependenciesPlugin - project.plugins.apply IvyCompileOnlyPlugin project.plugins.apply IvyManifestPlugin - project.plugins.apply IvyRemovePlatformDependenciesPlugin project.plugins.apply IvyRemoveInvalidDependenciesPlugin project.plugins.apply IvyShadowPublishPlugin project.plugins.apply SpringBootJarPlugin diff --git a/src/main/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPlugin.groovy b/src/main/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPlugin.groovy deleted file mode 100644 index 4262537b..00000000 --- a/src/main/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPlugin.groovy +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2019-2020 Netflix, Inc. - * - * 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 nebula.plugin.publishing.ivy - -import groovy.transform.CompileDynamic -import org.gradle.api.Action -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.XmlProvider -import org.gradle.api.plugins.JavaPlugin -import org.gradle.api.publish.PublicationContainer -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.ivy.IvyModuleDescriptorSpec -import org.gradle.api.publish.ivy.IvyPublication - - -/** - * Removes from descriptor dependencies that have category status of platform or enhanced-platform - */ -@CompileDynamic -class IvyRemovePlatformDependenciesPlugin implements Plugin { - @Override - void apply(Project project) { - PublishingExtension publishing = project.extensions.getByType(PublishingExtension) - project.afterEvaluate(new Action() { - @Override - void execute(Project p) { - p.plugins.withType(JavaPlugin) { - def platformDependencies = PlatformDependencyVerifier.findPlatformDependencies(p) - publishing.publications(new Action() { - @Override - void execute(PublicationContainer publications) { - publications.withType(IvyPublication) { IvyPublication publication -> - publication.descriptor(new Action() { - @Override - void execute(IvyModuleDescriptorSpec ivyModuleDescriptorSpec) { - ivyModuleDescriptorSpec.withXml(new Action() { - @Override - void execute(XmlProvider xml) { - xml.asNode().dependencies.dependency.findAll() { Node dep -> - String scope = dep.@conf - String group = dep.@org - String name = dep.@name - - if (scope == 'compile->default') { - scope = 'compile' - } - - if (scope == 'provided->default' || scope == 'runtime->default') { - scope = 'runtime' - } - - if (scope == 'test->default') { - scope = 'test' - } - - if (scope.contains('->')) { - scope = scope.split('->')[0] - } - - boolean isPlatformDependency = PlatformDependencyVerifier.isPlatformDependency(platformDependencies, scope, group, name) - - if(isPlatformDependency) { - dep.parent().remove(dep) - } - } - } - }) - } - }) - } - } - }) - } - - } - }) - } -} diff --git a/src/main/groovy/nebula/plugin/publishing/ivy/PlatformDependencyVerifier.groovy b/src/main/groovy/nebula/plugin/publishing/ivy/PlatformDependencyVerifier.groovy deleted file mode 100644 index a82fe0a4..00000000 --- a/src/main/groovy/nebula/plugin/publishing/ivy/PlatformDependencyVerifier.groovy +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2019-2020 Netflix, Inc. - * - * 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 nebula.plugin.publishing.ivy - -import groovy.transform.CompileDynamic -import groovy.transform.Memoized -import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration -import org.gradle.api.artifacts.ConfigurationContainer -import org.gradle.api.artifacts.component.ComponentSelector -import org.gradle.api.artifacts.component.ModuleComponentSelector -import org.gradle.api.artifacts.component.ProjectComponentSelector - -/** - * Verifies if a dependency has platform or enhanced-platform category attribute - */ -@CompileDynamic -class PlatformDependencyVerifier { - - private static final String CATEGORY_ATTRIBUTE = "org.gradle.category" - private static final String REGULAR_PLATFORM = "platform" - private static final String ENFORCED_PLATFORM = "enforced-platform" - - static boolean isPlatformDependency(def platformDependencies, String scope, String group, String name) { - Boolean result = checkIfPlatformDependency(platformDependencies, scope, group, name) - Map scoping = [compile: 'runtime', provided: 'compileOnly'] - if (!result && scoping[scope]) { - result = checkIfPlatformDependency(platformDependencies, scoping[scope], group, name) - } - result - } - - private static boolean checkIfPlatformDependency(def platformDependencies, String scope, String group, String name) { - return platformDependencies.values().flatten().find { ComponentSelector componentSelector -> - if(componentSelector instanceof ModuleComponentSelector) { - return componentSelector.moduleIdentifier.group == group && componentSelector.moduleIdentifier.name == name - } else if(componentSelector instanceof ProjectComponentSelector) { - return componentSelector.projectName == name - } - } - } - - static Map> findPlatformDependencies(Project project) { - ConfigurationContainer configurations = project.configurations - Map> dependencyMap = [:] - dependencyMap['runtime'] = platformDependencies(configurations.runtimeClasspath) - dependencyMap['compile'] = platformDependencies(configurations.compileClasspath) - dependencyMap['test'] = platformDependencies(configurations.testRuntimeClasspath) - dependencyMap - } - - static Set platformDependencies(Configuration configuration) { - return configuration.incoming.resolutionResult.allDependencies.requested.findAll { - it.attributes.keySet().name.contains(CATEGORY_ATTRIBUTE) && it.attributes.findEntry(CATEGORY_ATTRIBUTE).get() in [REGULAR_PLATFORM, ENFORCED_PLATFORM] - } - } -} diff --git a/src/test/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPluginIntegrationSpec.groovy b/src/test/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPluginIntegrationSpec.groovy deleted file mode 100644 index fdc8908c..00000000 --- a/src/test/groovy/nebula/plugin/publishing/ivy/IvyCompileOnlyPluginIntegrationSpec.groovy +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2017-2020 Netflix, Inc. - * - * 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 nebula.plugin.publishing.ivy - -import nebula.plugin.publishing.BaseIntegrationTestKitSpec -import nebula.test.dependencies.DependencyGraphBuilder -import nebula.test.dependencies.GradleDependencyGenerator -import spock.lang.Subject - -@Subject(IvyCompileOnlyPlugin) -class IvyCompileOnlyPluginIntegrationSpec extends BaseIntegrationTestKitSpec { - File publishDir - - def setup() { - buildFile << """\ - plugins { - id 'com.netflix.nebula.ivy-nebula-publish' - id 'com.netflix.nebula.ivy-compile-only' - } - - version = '0.1.0' - group = 'test.nebula' - - repositories { - mavenCentral() - } - - publishing { - repositories { - ivy { - name = 'testLocal' - url = 'testrepo' - } - } - } - """.stripIndent() - - settingsFile << '''\ - rootProject.name = 'ivytest' - '''.stripIndent() - - publishDir = new File(projectDir, 'testrepo/test.nebula/ivytest/0.1.0') - } - - def 'verify ivy contains compileOnly dependencies'() { - keepFiles = true - buildFile << """\ - apply plugin: 'java' - dependencies { - compileOnly 'com.google.guava:guava:19.0' - } - """.stripIndent() - - when: - runTasks('publishNebulaIvyPublicationToTestLocalRepository') - - then: - def root = new XmlSlurper().parseText(new File(publishDir, 'ivy-0.1.0.xml').text) - def dependency = root.dependencies.dependency[0] - dependency.@org == 'com.google.guava' - dependency.@name == 'guava' - dependency.@rev == '19.0' - dependency.@conf == 'provided' - } - - def 'verify ivy contains compileOnly dependencies together with global excludes'() { - keepFiles = true - - buildFile << """\ - apply plugin: 'java' - configurations.all { - exclude group: 'org.slf4j', module: 'slf4j-api' - } - - dependencies { - compileOnly 'com.google.guava:guava:19.0' - } - """.stripIndent() - - when: - runTasks('publishNebulaIvyPublicationToTestLocalRepository') - - then: - def root = new XmlSlurper().parseText(new File(publishDir, 'ivy-0.1.0.xml').text) - def dependency = root.dependencies.dependency[0] - dependency.@org == 'com.google.guava' - dependency.@name == 'guava' - dependency.@rev == '19.0' - dependency.@conf == 'provided' - } -} diff --git a/src/test/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPluginSpec.groovy b/src/test/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPluginSpec.groovy deleted file mode 100644 index fe106270..00000000 --- a/src/test/groovy/nebula/plugin/publishing/ivy/IvyRemovePlatformDependenciesPluginSpec.groovy +++ /dev/null @@ -1,364 +0,0 @@ -package nebula.plugin.publishing.ivy - -import nebula.plugin.publishing.BaseIntegrationTestKitSpec -import nebula.test.dependencies.DependencyGraphBuilder -import nebula.test.dependencies.GradleDependencyGenerator -import spock.lang.Ignore -import spock.lang.Subject - -@Subject(IvyRemovePlatformDependenciesPlugin) -class IvyRemovePlatformDependenciesPluginSpec extends BaseIntegrationTestKitSpec { - File publishDir - - def setup() { - settingsFile << '''\ - rootProject.name = 'removedplatformivytest' - '''.stripIndent() - - publishDir = new File(projectDir, 'testrepo/test.nebula/removedplatformivytest/0.1.0') - } - - def 'publishes ivy descriptor without platform dependency'() { - buildFile << """\ - plugins { - id 'com.netflix.nebula.ivy-publish' - id 'com.netflix.nebula.ivy-resolved-dependencies' - id 'com.netflix.nebula.ivy-remove-platform-dependencies' - } - - version = '0.1.0' - group = 'test.nebula' - - publishing { - repositories { - ivy { - name = 'testLocal' - url = 'testrepo' - } - } - } - """.stripIndent() - - - def graph = new DependencyGraphBuilder().addModule('test.resolved:a:1.0.0') - .addModule('test.resolved:a:1.1.0') - .addModule('test.resolved:b:1.1.0').build() - def generator = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen") - - generator.generateTestIvyRepo() - - buildFile << """\ - apply plugin: 'java' - - repositories { - mavenCentral() - ${generator.ivyRepositoryBlock} - maven { - url = 'https://repo.jenkins-ci.org/releases/' - } - } - - dependencies { - implementation platform('org.jenkins-ci.main:jenkins-bom:latest.release') - implementation 'test.resolved:a:1.+' - } - """.stripIndent() - - when: - runTasks('publishNebulaIvyPublicationToTestLocalRepository') - - then: - def a = findDependency('a') - a.@rev == '1.1.0' - - def bom = findDependency('jenkins-bom') - !bom - } - - def 'publishes ivy descriptor without platform dependency - platform is a subproject'() { - buildFile << """\ - plugins { - id 'com.netflix.nebula.ivy-publish' - id 'com.netflix.nebula.ivy-resolved-dependencies' - id 'com.netflix.nebula.ivy-remove-platform-dependencies' - } - allprojects { - apply plugin: 'com.netflix.nebula.ivy-publish' - apply plugin: 'com.netflix.nebula.ivy-resolved-dependencies' - apply plugin: 'com.netflix.nebula.ivy-remove-platform-dependencies' - - version = '0.1.0' - group = 'test.nebula' - - repositories { - mavenCentral() - maven { - url = 'https://repo.jenkins-ci.org/releases/' - } - } - publishing { - repositories { - ivy { - name = 'testLocal' - url = 'testrepo' - } - } - } - } - """.stripIndent() - - - addSubproject('platform', """ -plugins { - id 'java-platform' -} - -dependencies { - constraints { - api 'commons-httpclient:commons-httpclient:3.1' - runtime 'org.postgresql:postgresql:42.2.5' - } -} - -publishing { - publications { - myPlatform(IvyPublication) { - from components.javaPlatform - } - } -} - """) - - - def graph = new DependencyGraphBuilder().addModule('test.resolved:a:1.0.0') - .addModule('test.resolved:a:1.1.0') - .addModule('test.resolved:b:1.1.0').build() - def generator = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen") - - generator.generateTestIvyRepo() - - - addSubproject('clienta', """ -plugins { - id 'java' -} - -repositories { - ${generator.ivyRepositoryBlock} - mavenCentral() -} - -dependencies { - implementation platform('org.jenkins-ci.main:jenkins-bom:latest.release') - implementation platform(project(":platform")) - implementation 'test.resolved:a:1.+' -} - """) - - when: - def x = runTasks(':clienta:publishNebulaIvyPublicationToTestLocalRepository') - - then: - File ivyDescriptor = new File(buildFile.parentFile, 'clienta/build/publications/nebulaIvy/ivy.xml') - def a = findDependency('a', ivyDescriptor) - a.@rev == '1.1.0' - - def jenkinsBom = findDependency('jenkins-bom', ivyDescriptor) - !jenkinsBom - - def projectPlatform = findDependency('platform', ivyDescriptor) - !projectPlatform - } - - @Ignore - def 'publishes ivy descriptor without enforced-platform dependency'() { - buildFile << """\ - plugins { - id 'com.netflix.nebula.ivy-publish' - id 'com.netflix.nebula.ivy-resolved-dependencies' - id 'com.netflix.nebula.ivy-remove-platform-dependencies' - } - version = '0.1.0' - group = 'test.nebula' - - publishing { - repositories { - ivy { - name = 'testLocal' - url = 'testrepo' - } - } - } - """.stripIndent() - - - def graph = new DependencyGraphBuilder().addModule('test.resolved:a:1.0.0') - .addModule('test.resolved:a:1.1.0') - .addModule('test.resolved:b:1.1.0').build() - def generator = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen") - - generator.generateTestIvyRepo() - - buildFile << """\ - apply plugin: 'java' - repositories { - ${generator.ivyRepositoryBlock} - mavenCentral() - maven { - url = 'https://repo.jenkins-ci.org/releases/' - } - } - - dependencies { - implementation enforcedPlatform('org.jenkins-ci.main:jenkins-bom:latest.release') - implementation 'test.resolved:a:1.+' - } - - tasks.withType(GenerateModuleMetadata).configureEach { - suppressedValidationErrors.add('enforced-platform') - } - """.stripIndent() - - when: - runTasks('publishNebulaIvyPublicationToTestLocalRepository') - - then: - def a = findDependency('a') - a.@rev == '1.1.0' - - def bom = findDependency('jenkins-bom') - !bom - } - - @Ignore - def 'publishes ivy descriptor with platform dependency if plugin is not applied'() { - buildFile << """\ - plugins { - id 'com.netflix.nebula.ivy-publish' - id 'com.netflix.nebula.ivy-resolved-dependencies' - } - - version = '0.1.0' - group = 'test.nebula' - - publishing { - repositories { - ivy { - name = 'testLocal' - url = 'testrepo' - } - } - } - """.stripIndent() - - - def graph = new DependencyGraphBuilder().addModule('test.resolved:a:1.0.0') - .addModule('test.resolved:a:1.1.0') - .addModule('test.resolved:b:1.1.0').build() - def generator = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen") - - generator.generateTestIvyRepo() - - buildFile << """\ - apply plugin: 'java' - - repositories { - ${generator.ivyRepositoryBlock} - mavenCentral() - maven { - url = 'https://repo.jenkins-ci.org/releases/' - } - } - - dependencies { - implementation enforcedPlatform('org.jenkins-ci.main:jenkins-bom:latest.release') - implementation 'test.resolved:a:1.+' - } - - tasks.withType(GenerateModuleMetadata).configureEach { - suppressedValidationErrors.add('enforced-platform') - } - """.stripIndent() - - when: - runTasks('publishNebulaIvyPublicationToTestLocalRepository') - - then: - def a = findDependency('a') - a.@rev == '1.1.0' - - def bom = findDependency('jenkins-bom') - bom != null - } - - @Ignore - def 'publishes ivy descriptor with enforced-platform dependency if plugin is not applied'() { - buildFile << """\ - plugins { - id 'com.netflix.nebula.ivy-publish' - id 'com.netflix.nebula.ivy-resolved-dependencies' - } - - version = '0.1.0' - group = 'test.nebula' - - publishing { - repositories { - ivy { - name = 'testLocal' - url = 'testrepo' - } - } - } - """.stripIndent() - - - def graph = new DependencyGraphBuilder().addModule('test.resolved:a:1.0.0') - .addModule('test.resolved:a:1.1.0') - .addModule('test.resolved:b:1.1.0').build() - def generator = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen") - - generator.generateTestIvyRepo() - - buildFile << """\ - apply plugin: 'java' - - repositories { - ${generator.ivyRepositoryBlock} - mavenCentral() - maven { - url = 'https://repo.jenkins-ci.org/releases/' - } - } - - dependencies { - implementation enforcedPlatform('org.jenkins-ci.main:jenkins-bom:latest.release') - implementation 'test.resolved:a:1.+' - } - - tasks.withType(GenerateModuleMetadata).configureEach { - suppressedValidationErrors.add('enforced-platform') - } - """.stripIndent() - - when: - runTasks('publishNebulaIvyPublicationToTestLocalRepository') - - then: - def a = findDependency('a') - a.@rev == '1.1.0' - - def bom = findDependency('jenkins-bom') - bom != null - } - - - def findDependency(String module, File ivyDescriptor = new File(publishDir, 'ivy-0.1.0.xml')) { - def root = new XmlSlurper().parseText(ivyDescriptor.text) - def d = root.dependencies.dependency.find { - it.@name == module - } - return d - } - -} \ No newline at end of file diff --git a/src/test/groovy/nebula/plugin/publishing/verification/PublishVerificationPluginIntegrationSpec.groovy b/src/test/groovy/nebula/plugin/publishing/verification/PublishVerificationPluginIntegrationSpec.groovy index e2968320..94835314 100644 --- a/src/test/groovy/nebula/plugin/publishing/verification/PublishVerificationPluginIntegrationSpec.groovy +++ b/src/test/groovy/nebula/plugin/publishing/verification/PublishVerificationPluginIntegrationSpec.groovy @@ -16,7 +16,6 @@ import netflix.nebula.dependency.recommender.DependencyRecommendationsPlugin import spock.lang.Ignore import spock.lang.IgnoreIf -@Ignore class PublishVerificationPluginIntegrationSpec extends IntegrationSpec { def setup() {