Skip to content

Commit

Permalink
Fix a bug with interacting with nebula-publishing-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rspieldenner committed Oct 8, 2015
1 parent ff08619 commit 8f324f0
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 8 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
3.0.2 / 2015-10-08
==================

* Bug fix to not break interaction with nebula-publishing-plugin post 3.x

3.0.1 / 2015-09-15
==================

* Retry publishing

3.0.0 / 2015-09-15
==================

* Move to gradle 2.7, update build stuff

2.2.2 / 2015-5-18
===================

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ The following publishing plugins support the correct handling when generating th

To include, add the following to your build.gradle

plugins {
id 'nebula.optional-base' version '3.0.2' // if you want optional-base
id 'nebula.provided-base' version '3.0.2' // if you want provided-base
}

or

buildscript {
repositories { jcenter() }

dependencies {
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:2.2.+'
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.2'
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014 Netflix, Inc.
* Copyright 2014-2015 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,7 @@
* limitations under the License.
*/
package nebula.plugin.extraconfigurations.publication

import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.plugins.PublishingPlugin

abstract class AbstractPublishingConfigurer implements PublishingConfigurer {
Expand All @@ -31,8 +29,9 @@ abstract class AbstractPublishingConfigurer implements PublishingConfigurer {
Closure addArtifactClosure = {
// Wait for our plugin to be applied.
project.plugins.withType(PublishingPlugin) { PublishingPlugin publishingPlugin ->
PublishingExtension publishingExtension = project.extensions.getByType(PublishingExtension)
publishingExtension.publications.withType(publicationType, closure)
project.publishing {
publications.withType(publicationType, closure)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014 Netflix, Inc.
* Copyright 2014-2015 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,8 +14,8 @@
* limitations under the License.
*/
package nebula.plugin.extraconfigurations

import nebula.test.dependencies.DependencyGraph
import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator
import nebula.test.functional.ExecutionResult

Expand Down Expand Up @@ -225,4 +225,46 @@ publishing {
then:
assertOptionalDependencyInGeneratedIvy(repoUrl, 'org.apache.commons', 'commons-lang3', '3.3.2')
}

def 'still works if maven-publish publication is modified in after evaluate'() {
given:
def graph = new DependencyGraphBuilder().addModule('test.nebula:foo:1.0.0').build()
File mavenRepo = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen").generateTestMavenRepo()
File repoUrl = new File(projectDir, 'build/repo')

buildFile << """\
apply plugin: 'maven-publish'
group = '$GROUP_ID'
version = '$VERSION'
repositories { maven { url '${mavenRepo.absolutePath}' } }
dependencies {
compile 'test.nebula:foo:1.0.0', optional
}
afterEvaluate {
publishing {
repositories {
maven {
name 'testRepo'
url '${repoUrl.canonicalPath}'
}
}
publications {
testMaven(MavenPublication) {
from components.java
}
}
}
}
""".stripIndent()

when:
runTasksSuccessfully('publish')

then:
assertOptionalDependencyInGeneratedPom(repoUrl, 'test.nebula', 'foo', '1.0.0', 'runtime')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package nebula.plugin.extraconfigurations

import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator

class ProvidedBasePluginIntegrationTest extends AbstractIntegrationTest {
def setup() {
buildFile << """
Expand Down Expand Up @@ -343,4 +346,46 @@ task explodedWar(type: Copy) {
then:
!new File(projectDir, 'webapp-component/build/libs/exploded/WEB-INF/lib/commons-lang3-3.3.2.jar').exists()
}

def 'still works if maven-publish publication is modified in after evaluate'() {
given:
def graph = new DependencyGraphBuilder().addModule('test.nebula:foo:1.0.0').build()
File mavenRepo = new GradleDependencyGenerator(graph, "${projectDir}/testrepogen").generateTestMavenRepo()
File repoUrl = new File(projectDir, 'build/repo')

buildFile << """\
apply plugin: 'maven-publish'
group = '$GROUP_ID'
version = '$VERSION'
repositories { maven { url '${mavenRepo.absolutePath}' } }
dependencies {
provided 'test.nebula:foo:1.0.0'
}
afterEvaluate {
publishing {
repositories {
maven {
name 'testRepo'
url '${repoUrl.canonicalPath}'
}
}
publications {
testMaven(MavenPublication) {
from components.java
}
}
}
}
""".stripIndent()

when:
runTasksSuccessfully('publish')

then:
assertProvidedDependencyInGeneratedPom(repoUrl, 'test.nebula', 'foo', '1.0.0')
}
}

0 comments on commit 8f324f0

Please sign in to comment.