POMs generated by publishing are now correct. (#1055)

* POMs generated by publishing are now correct. The publish extension now requires an explicit call to configure the publishing instead of waiting until after evaluation. This prevents evaluation order issues with the artifact renaming code that causes the POM to have the original, incorrect, artifact names.

* Fixed new test compile issues caused by removal of some dependencies in test utils that caused webserver code to be automatically included in any project also compiling test utils.
This commit is contained in:
Clinton 2017-07-18 12:34:56 +01:00 committed by GitHub
parent 561a329064
commit 0ccfae252f
26 changed files with 56 additions and 39 deletions

View File

@ -31,5 +31,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -62,5 +62,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -30,5 +30,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -92,5 +92,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -1,4 +1,4 @@
gradlePluginsVersion=0.13.2
gradlePluginsVersion=0.13.3
kotlinVersion=1.1.1
guavaVersion=21.0
bouncycastleVersion=1.57

View File

@ -17,3 +17,7 @@ dependencies {
// Bouncy Castle: for X.500 distinguished name manipulation
compile "org.bouncycastle:bcprov-jdk15on:$bouncycastle_version"
}
publish {
name project.name
}

View File

@ -98,5 +98,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -49,5 +49,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -61,3 +61,7 @@ jar {
rename { 'net/corda/plugins/runnodes.jar' }
}
}
publish {
name project.name
}

View File

@ -76,8 +76,8 @@ The project configuration block has the following structure:
.. code-block:: text
publish {
name = 'non-default-project-name'
disableDefaultJar = false // set to true to disable the default JAR being created (e.g. when creating a fat JAR)
name 'non-default-project-name' // Always put this last because it causes configuration to happen
}
**Artifacts**

View File

@ -1,14 +1,25 @@
package net.corda.plugins
class ProjectPublishExtension {
private PublishTasks task
void setPublishTask(PublishTasks task) {
this.task = task
}
/**
* Use a different name from the current project name for publishing
* Use a different name from the current project name for publishing.
* Set this after all other settings that need to be configured
*/
String name
void name(String name) {
task.setPublishName(name)
}
/**
* True when we do not want to publish default Java components
*/
Boolean disableDefaultJar = false
/**
* True if publishing a WAR instead of a JAR. Forces disableDefaultJAR to "true" when true
*/

View File

@ -23,24 +23,17 @@ class PublishTasks implements Plugin<Project> {
void apply(Project project) {
this.project = project
this.publishName = project.name
createTasks()
createExtensions()
createConfigurations()
project.afterEvaluate {
configurePublishingName()
checkAndConfigurePublishing()
}
}
void configurePublishingName() {
if(publishConfig.name != null) {
project.logger.info("Changing publishing name for ${project.name} to ${publishConfig.name}")
publishName = publishConfig.name
} else {
publishName = project.name
}
void setPublishName(String publishName) {
project.logger.info("Changing publishing name from ${project.name} to ${publishName}")
this.publishName = publishName
checkAndConfigurePublishing()
}
void checkAndConfigurePublishing() {
@ -157,6 +150,7 @@ class PublishTasks implements Plugin<Project> {
project.extensions.create("bintrayConfig", BintrayConfigExtension)
}
publishConfig = project.extensions.create("publish", ProjectPublishExtension)
publishConfig.setPublishTask(this)
}
void createConfigurations() {

View File

@ -12,3 +12,7 @@ dependencies {
compile gradleApi()
compile localGroovy()
}
publish {
name project.name
}

View File

@ -38,5 +38,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -1,7 +1,7 @@
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'kotlin'
apply plugin: 'kotlin-kapt'
apply plugin: 'idea'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'com.jfrog.artifactory'
description 'Corda node database schemas'
@ -33,5 +33,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -223,5 +223,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -67,6 +67,6 @@ artifacts {
}
publish {
name = 'corda'
disableDefaultJar = true
name 'corda'
}

View File

@ -30,13 +30,14 @@ import net.corda.testing.node.MockNetwork
import net.corda.testing.node.MockNetwork.MockNode
import org.assertj.core.api.Assertions.assertThat
import org.bouncycastle.asn1.x500.X500Name
import org.eclipse.jetty.util.BlockingArrayQueue
import org.junit.After
import org.junit.Before
import org.junit.Test
import java.math.BigInteger
import java.security.KeyPair
import java.time.Instant
import java.util.*
import java.util.concurrent.LinkedBlockingQueue
abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService> {
lateinit var mockNet: MockNetwork
@ -222,9 +223,9 @@ abstract class AbstractNetworkMapServiceTest<out S : AbstractNetworkMapService>
return response
}
private fun MockNode.subscribe(): List<Update> {
private fun MockNode.subscribe(): Queue<Update> {
val request = SubscribeRequest(true, network.myAddress)
val updates = BlockingArrayQueue<Update>()
val updates = LinkedBlockingQueue<Update>()
services.networkService.addMessageHandler(PUSH_TOPIC, DEFAULT_SESSION_ID) { message, _ ->
updates += message.data.deserialize<Update>()
}

View File

@ -29,6 +29,7 @@ dependencies {
compile project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':webserver')
compile project(':test-utils')
}

View File

@ -32,6 +32,7 @@ dependencies {
compile project(':client:jfx')
compile project(':client:rpc')
compile project(':finance')
compile project(':webserver')
compile project(':test-utils')
// Javax is required for webapis

View File

@ -34,4 +34,4 @@ include 'samples:network-visualiser'
include 'samples:simm-valuation-demo'
include 'samples:notary-demo'
include 'samples:bank-of-corda-demo'
include 'cordform-common'
include 'cordform-common'

View File

@ -5,5 +5,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -30,10 +30,8 @@ sourceSets {
dependencies {
compile project(':test-common')
compile project(':finance')
compile project(':core')
compile project(':node')
compile project(':webserver')
compile project(':client:mock')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
@ -67,5 +65,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -75,6 +75,6 @@ artifacts {
}
publish {
name = 'corda-verifier'
disableDefaultJar = true
name 'corda-verifier'
}

View File

@ -72,5 +72,5 @@ jar {
}
publish {
name = jar.baseName
name jar.baseName
}

View File

@ -57,7 +57,6 @@ artifacts {
}
publish {
name = 'corda-webserver'
publishWar = false // TODO: Use WAR instead of JAR
disableDefaultJar = true
name 'corda-webserver'
}