mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
Merged in clint-cordformdeps (pull request #424)
Cordapps now correctly resolve dependencies.
This commit is contained in:
commit
3b0f173984
@ -2,6 +2,7 @@ package com.r3corda.plugins
|
|||||||
|
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.Configuration
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Cordformation plugin deploys nodes to a directory in a state ready to be used by a developer for experimentation,
|
* The Cordformation plugin deploys nodes to a directory in a state ready to be used by a developer for experimentation,
|
||||||
@ -9,7 +10,9 @@ import org.gradle.api.Project
|
|||||||
*/
|
*/
|
||||||
class Cordformation implements Plugin<Project> {
|
class Cordformation implements Plugin<Project> {
|
||||||
void apply(Project project) {
|
void apply(Project project) {
|
||||||
|
Configuration cordappConf = project.configurations.create("cordapp")
|
||||||
|
cordappConf.transitive = false
|
||||||
|
project.configurations.compile.extendsFrom cordappConf
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,8 @@ class Node {
|
|||||||
*/
|
*/
|
||||||
protected List<String> advertisedServices = []
|
protected List<String> advertisedServices = []
|
||||||
/**
|
/**
|
||||||
* Set thThe list of cordapps to install to the plugins directory.
|
* Set the list of CorDapps to install to the plugins directory. Each cordapp is a fully qualified Maven
|
||||||
|
* dependency name, eg: com.example:product-name:0.1
|
||||||
*
|
*
|
||||||
* @note Your app will be installed by default and does not need to be included here.
|
* @note Your app will be installed by default and does not need to be included here.
|
||||||
*/
|
*/
|
||||||
@ -174,9 +175,9 @@ class Node {
|
|||||||
*/
|
*/
|
||||||
private void installDependencies() {
|
private void installDependencies() {
|
||||||
def cordaJar = verifyAndGetCordaJar()
|
def cordaJar = verifyAndGetCordaJar()
|
||||||
def cordappList = getCordappList()
|
def cordappDeps = getCordappList()
|
||||||
def depsDir = new File(nodeDir, "dependencies")
|
def depsDir = new File(nodeDir, "dependencies")
|
||||||
def appDeps = project.configurations.runtime.filter { it != cordaJar && !cordappList.contains(it) }
|
def appDeps = project.configurations.runtime.filter { it != cordaJar && !cordappDeps.contains(it) }
|
||||||
project.copy {
|
project.copy {
|
||||||
from appDeps
|
from appDeps
|
||||||
into depsDir
|
into depsDir
|
||||||
@ -224,11 +225,9 @@ class Node {
|
|||||||
*
|
*
|
||||||
* @return List of this node's cordapps.
|
* @return List of this node's cordapps.
|
||||||
*/
|
*/
|
||||||
private AbstractFileCollection getCordappList() {
|
private Collection<File> getCordappList() {
|
||||||
def cordaJar = verifyAndGetCordaJar()
|
return project.configurations.cordapp.files {
|
||||||
return project.configurations.runtime.filter {
|
cordapps.contains("${it.group}:${it.name}:${it.version}")
|
||||||
def jarName = it.name.split('-').first()
|
|
||||||
return (it != cordaJar) && cordapps.contains(jarName)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user