Merge pull request #35 from corda/clint-M6publishing

Corda can be published to bintray and reduced publishing boilerplate in build.gradle.
This commit is contained in:
Clinton 2016-12-09 15:07:46 +00:00 committed by GitHub
commit b43d940297
30 changed files with 614 additions and 280 deletions

View File

@ -1,9 +1,12 @@
buildscript {
// For sharing constants between builds
Properties props = new Properties()
file("publish.properties").withInputStream { props.load(it) }
// Our version: bump this on release.
ext.corda_version = "0.7-SNAPSHOT"
ext.gradle_plugins_version = "0.6.1"
ext.kotlin_version = '1.0.5'
ext.gradle_plugins_version = props.getProperty("gradlePluginsVersion")
ext.kotlin_version = '1.0.5-2'
ext.quasar_version = '0.7.6'
ext.asm_version = '0.5.3'
ext.artemis_version = '1.4.0'
@ -45,7 +48,7 @@ plugins {
apply plugin: 'kotlin'
apply plugin: 'project-report'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'maven-publish'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.cordformation'
@ -93,7 +96,7 @@ repositories {
dependencies {
compile project(':node')
compile "com.google.guava:guava:19.0"
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
@ -153,5 +156,25 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['build']) {
}
}
// Aliasing the publishToMavenLocal for simplicity.
task(install, dependsOn: 'publishToMavenLocal')
bintrayConfig {
user = System.getenv('CORDA_BINTRAY_USER')
key = System.getenv('CORDA_BINTRAY_KEY')
repo = 'corda'
org = 'r3'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/corda/corda'
projectUrl = 'https://github.com/corda/corda'
gpgSign = true
gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
publications = ['client', 'core', 'corda', 'finance', 'node', 'test-utils']
license {
name = 'Apache-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
distribution = 'repo'
}
developer {
id = 'R3'
name = 'R3'
email = 'dev@corda.net'
}
}

View File

@ -2,6 +2,8 @@ apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
description 'Corda client modules'
repositories {
mavenLocal()
mavenCentral()
@ -38,18 +40,6 @@ sourceSets {
}
}
publishing {
publications {
client(MavenPublication) {
from components.java
artifactId 'client'
artifact sourceJar
artifact javadocJar
}
}
}
// To find potential version conflicts, run "gradle htmlDependencyReport" and then look in
// build/reports/project/dependencies/index.html for green highlighted parts of the tree.
@ -83,4 +73,4 @@ dependencies {
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
}

View File

@ -2,14 +2,14 @@ apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
description 'Corda core'
buildscript {
repositories {
mavenCentral()
}
}
// apply plugin: 'org.jetbrains.dokka'
repositories {
mavenLocal()
mavenCentral()
@ -88,16 +88,4 @@ dependencies {
// RS API: Response type and codes for ApiUtils.
compile "javax.ws.rs:javax.ws.rs-api:2.0"
}
publishing {
publications {
core(MavenPublication) {
from components.java
artifactId 'core'
artifact sourceJar
artifact javadocJar
}
}
}

View File

@ -36,7 +36,7 @@ sourceSets {
}
}
compileTestJava.dependsOn tasks.getByPath(':node:buildCordaJAR')
compileTestJava.dependsOn tasks.getByPath(':node:capsule:buildCordaJAR')
dependencies {
compile project(':core')
@ -48,7 +48,7 @@ dependencies {
exclude group: "bouncycastle"
}
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
}
mainClassName = "net.corda.docs.ClientRpcTutorialKt"

View File

@ -107,6 +107,7 @@ Read on to learn:
release-notes
codestyle
building-the-docs
publishing-corda
.. toctree::
:maxdepth: 2

View File

@ -0,0 +1,76 @@
Publishing Corda
================
Before Publishing
-----------------
Before publishing you must make sure the version you plan to publish has a unique version number. Jcenter and Maven
Central will not allow overwriting old versions _unless_ the version is a snapshot.
This guide assumes you are trying to publish to net.corda.*. Any other Maven coordinates require approval from Jcenter
and Maven Central.
Publishing Locally
------------------
To publish the codebase locally to Maven Local you must run:
.. code-block:: text
gradlew install
.. note:: This command is an alias for `publishToMavenLocal`.
Publishing to Jcenter
---------------------
.. note:: The module you wish to publish must be linked to jcenter in bintray. Only the founding account can do this.
To publish to Jcenter you must first have the following;
1. An account on bintray in the R3 organisation
2. Our GPG key's passphrase for signing the binaries to publish
Getting Setup
`````````````
You must now set the following environment variables:
* CORDA_BINTRAY_USER your Bintray username
* CORDA_BINTRAY_KEY to your bintray API key (found at: https://bintray.com/profile/edit)
* CORDA_BINTRAY_GPG_PASSPHRASE to our GPG passphrase
Publishing
``````````
Once you are setup you can upload all modules in a project with
.. code-block:: text
gradlew bintrayUpload
Now login to Bintray and navigate to the corda repository, you will see a box stating you have published N files
and asking if you wish to publish. You can now publish to Bintray and Jcenter by clicking this button.
.. warning:: Before publishing you should check that all of the files are uploaded and are signed.
Within a minute your new version will be available to download and use.
Publishing to Maven Central
---------------------------
To publish to Maven Central you need the following;
1. An admin account on our Bintray R3 organisation
2. A published version in Bintray
3. An account with our Sonatype organisation (Maven Central's host)
Publishing
``````````
1. Publish to Bintray
2. Navigate to the project you wish to publish
3. Click "Maven Central"
4. Enter your Sonatype credentials to publish a new version
.. note:: The project you publish must be already published to Bintray and the project must be linked to Jcenter

View File

@ -3,6 +3,8 @@ apply plugin: CanonicalizerPlugin
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'net.corda.plugins.quasar-utils'
description 'Corda finance modules'
repositories {
mavenLocal()
mavenCentral()
@ -28,16 +30,4 @@ sourceSets {
srcDir "../config/test"
}
}
}
publishing {
publications {
finance(MavenPublication) {
from components.java
artifactId 'finance'
artifact sourceJar
artifact javadocJar
}
}
}
}

View File

@ -15,5 +15,10 @@ Installing
If you need to bootstrap the corda repository you can install these plugins with
.. code-block:: text
cd publish-utils
../../gradlew -u install
cd ../
../gradlew install
gradle install

View File

@ -2,30 +2,50 @@
// or if you are developing these plugins. See the readme for more information.
buildscript {
ext.gradle_plugins_version = "0.6.1" // Our version: bump this on release.
ext.corda_published_version = "0.5" // Depend on our existing published publishing plugin.
// For sharing constants between builds
Properties props = new Properties()
file("../publish.properties").withInputStream { props.load(it) }
// If you bump this version you must re-bootstrap the codebase. See the README for more information.
ext.gradle_plugins_version = props.getProperty("gradlePluginsVersion")
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath "net.corda.plugins:publish-utils:$corda_published_version"
classpath "net.corda.plugins:publish-utils:$gradle_plugins_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
}
}
apply plugin: 'maven-publish'
apply plugin: 'net.corda.plugins.publish-utils'
allprojects {
version "$gradle_plugins_version"
group 'net.corda'
group 'net.corda.plugins'
}
subprojects {
task(install, dependsOn: 'publishToMavenLocal')
}
// Aliasing the publishToMavenLocal for simplicity.
task(install, dependsOn: 'publishToMavenLocal')
bintrayConfig {
user = System.getenv('CORDA_BINTRAY_USER')
key = System.getenv('CORDA_BINTRAY_KEY')
repo = 'corda'
org = 'r3'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/corda/corda'
projectUrl = 'https://github.com/corda/corda'
gpgSign = true
gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
publications = ['cordformation', 'quasar-utils']
license {
name = 'Apache-2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
distribution = 'repo'
}
developer {
id = 'R3'
name = 'R3'
email = 'dev@corda.net'
}
}

View File

@ -1,7 +1,11 @@
apply plugin: 'groovy'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
repositories {
mavenCentral()
}
dependencies {
compile gradleApi()
@ -10,67 +14,3 @@ dependencies {
compile "com.typesafe:config:1.3.0"
}
repositories {
mavenCentral()
}
bintray {
user = System.getenv('CORDA_BINTRAY_USER')
key = System.getenv('CORDA_BINTRAY_KEY')
publications = ['cordformation']
dryRun = false
pkg {
repo = 'corda'
name = 'cordformation'
userOrg = 'r3'
licenses = ['Apache-2.0']
version {
gpg {
sign = true
passphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
}
}
}
}
publishing {
publications {
cordformation(MavenPublication) {
from components.java
groupId 'net.corda.plugins'
artifactId 'cordformation'
artifact sourceJar
artifact javadocJar
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'cordformation'
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
url 'https://github.com/corda/corda'
scm {
url 'https://github.com/corda/corda'
}
licenses {
license {
name 'Apache-2.0'
url 'https://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}
developers {
developer {
id 'R3'
name 'R3'
email 'dev@corda.net'
}
}
}
}
}
}
}

View File

@ -23,3 +23,70 @@ It is used within the `publishing` block of a build.gradle as such;
}
}
Bintray Publishing
------------------
For large multibuild projects it can be inconvenient to store the entire configuration for bintray and maven central
per project (with a bintray and publishing block with extended POM information). Publish utils can bring the number of
configuration blocks down to one in the ideal scenario.
To use this plugin you must first apply it to both the root project and any project that will be published with
.. code-block:: text
apply plugin: 'net.corda.plugins.publish-utils'
Next you must setup the general bintray configuration you wish to use project wide, for example:
.. code-block:: text
bintrayConfig {
user = <your bintray username>
key = <your bintray user key>
repo = 'example repo'
org = 'example organisation'
licenses = ['a license']
vcsUrl = 'https://example.com'
projectUrl = 'https://example.com'
gpgSign = true // Whether to GPG sign
gpgPassphrase = <your bintray GPG key passphrase> // Only required if gpgSign is true and your key is passworded
publications = ['example'] // a list of publications (see below)
license {
name = 'example'
url = 'https://example.com'
distribution = 'repo'
}
developer {
id = 'a developer id'
name = 'a developer name'
email = 'example@example.com'
}
}
.. note:: You can currently only have one license and developer in the maven POM sections
**Publications**
This plugin assumes, by default, that publications match the name of the project. This means, by default, you can
just list the names of the projects you wish to publish (e.g. to publish `test:myapp` you need `publications = ['myapp']`.
If a project requires a different name you can configure it *per project* with the project configuration block.
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)
}
**Artifacts**
To add additional artifacts to the project you can use the default gradle `artifacts` block with the `publish`
configuration. For example:
artifacts {
publish buildFatJar {
// You can configure this as a regular maven publication
}
}

View File

@ -2,6 +2,25 @@ apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
// Used for bootstrapping project
buildscript {
// For sharing constants between builds
Properties props = new Properties()
file("../../publish.properties").withInputStream { props.load(it) }
ext.gradle_plugins_version = props.getProperty("gradlePluginsVersion")
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
}
}
version "$gradle_plugins_version"
dependencies {
compile gradleApi()
compile localGroovy()
@ -81,3 +100,6 @@ publishing {
}
}
}
// Aliasing the publishToMavenLocal for simplicity.
task(install, dependsOn: 'publishToMavenLocal')

View File

@ -0,0 +1,12 @@
package net.corda.plugins
class ProjectPublishExtension {
/**
* Use a different name from the current project name for publishing
*/
String name
/**
* True when we do not want to publish default Java components
*/
Boolean disableDefaultJar = false
}

View File

@ -4,20 +4,159 @@ import org.gradle.api.*
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.MavenPom
import net.corda.plugins.bintray.*
/**
* A utility plugin that when applied will automatically create source and javadoc publishing tasks
* To apply this plugin you must also add 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4' to your
* buildscript's classpath dependencies.
*
* To use this plugin you can add a new configuration block (extension) to your root build.gradle. See the fields
* in BintrayConfigExtension.
*/
class PublishTasks implements Plugin<Project> {
void apply(Project project) {
project.task("sourceJar", type: Jar, dependsOn: project.classes) {
classifier = 'sources'
from project.sourceSets.main.allSource
}
Project project
String publishName
ProjectPublishExtension publishConfig
project.task("javadocJar", type: Jar, dependsOn: project.javadoc) {
classifier = 'javadoc'
from project.javadoc.destinationDir
void apply(Project project) {
this.project = project
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 checkAndConfigurePublishing() {
project.logger.info("Checking whether to publish $publishName")
def bintrayConfig = project.rootProject.extensions.findByType(BintrayConfigExtension.class)
if((bintrayConfig != null) && (bintrayConfig.publications) && (bintrayConfig.publications.findAll { it == publishName }.size() > 0)) {
configurePublishing(bintrayConfig)
}
}
void configurePublishing(BintrayConfigExtension bintrayConfig) {
project.logger.info("Configuring bintray for ${publishName}")
configureMavenPublish(bintrayConfig)
configureBintray(bintrayConfig)
}
void configureMavenPublish(BintrayConfigExtension bintrayConfig) {
project.apply([plugin: 'maven-publish'])
project.publishing.publications.create(publishName, MavenPublication) {
if(!publishConfig.disableDefaultJar) {
from project.components.java
}
groupId project.group
artifactId publishName
artifact project.tasks.sourceJar
artifact project.tasks.javadocJar
project.configurations.publish.artifacts.each {
project.logger.debug("Adding artifact: $it")
delegate.artifact it
}
extendPomForMavenCentral(pom, bintrayConfig)
}
project.task("install", dependsOn: "publishToMavenLocal")
}
// Maven central requires all of the below fields for this to be a valid POM
void extendPomForMavenCentral(MavenPom pom, BintrayConfigExtension config) {
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name publishName
description project.description
url config.projectUrl
scm {
url config.vcsUrl
}
licenses {
license {
name config.license.name
url config.license.url
distribution config.license.url
}
}
developers {
developer {
id config.developer.id
name config.developer.name
email config.developer.email
}
}
}
}
}
void configureBintray(BintrayConfigExtension bintrayConfig) {
project.apply([plugin: 'com.jfrog.bintray'])
project.bintray {
user = bintrayConfig.user
key = bintrayConfig.key
publications = [ publishName ]
dryRun = bintrayConfig.dryRun ?: false
pkg {
repo = bintrayConfig.repo
name = publishName
userOrg = bintrayConfig.org
licenses = bintrayConfig.licenses
version {
gpg {
sign = bintrayConfig.gpgSign ?: false
passphrase = bintrayConfig.gpgPassphrase
}
}
}
}
}
void createTasks() {
if(project.hasProperty('classes')) {
project.task("sourceJar", type: Jar, dependsOn: project.classes) {
classifier = 'sources'
from project.sourceSets.main.allSource
}
}
if(project.hasProperty('javadoc')) {
project.task("javadocJar", type: Jar, dependsOn: project.javadoc) {
classifier = 'javadoc'
from project.javadoc.destinationDir
}
}
}
void createExtensions() {
if(project == project.rootProject) {
project.extensions.create("bintrayConfig", BintrayConfigExtension)
}
publishConfig = project.extensions.create("publish", ProjectPublishExtension)
}
void createConfigurations() {
project.configurations.create("publish")
}
}

View File

@ -0,0 +1,70 @@
package net.corda.plugins.bintray
import org.gradle.util.ConfigureUtil
class BintrayConfigExtension {
/**
* Bintray username
*/
String user
/**
* Bintray access key
*/
String key
/**
* Bintray repository
*/
String repo
/**
* Bintray organisation
*/
String org
/**
* Licenses for packages uploaded by this configuration
*/
String[] licenses
/**
* Whether to sign packages uploaded by this configuration
*/
Boolean gpgSign
/**
* The passphrase for the key used to sign releases.
*/
String gpgPassphrase
/**
* VCS URL
*/
String vcsUrl
/**
* Project URL
*/
String projectUrl
/**
* The publications that will be uploaded as a part of this configuration. These must match both the name on
* bintray and the gradle module name. ie; it must be "some-package" as a gradle sub-module (root project not
* supported, this extension is to improve multi-build bintray uploads). The publication must also be called
* "some-package". Only one publication can be uploaded per module (a bintray plugin restriction(.
* If any of these conditions are not met your package will not be uploaded.
*/
String[] publications
/**
* Whether to test the publication without uploading to bintray.
*/
Boolean dryRun
/**
* The license this project will use (currently limited to one)
*/
License license = new License()
/**
* The developer of this project (currently limited to one)
*/
Developer developer = new Developer()
void license(Closure closure) {
ConfigureUtil.configure(closure, license)
}
void developer(Closure closure) {
ConfigureUtil.configure(closure, developer)
}
}

View File

@ -0,0 +1,16 @@
package net.corda.plugins.bintray
class Developer {
/**
* A unique identifier the developer (eg; organisation ID)
*/
String id
/**
* The full name of the developer
*/
String name
/**
* An email address for contacting the developer
*/
String email
}

View File

@ -0,0 +1,16 @@
package net.corda.plugins.bintray
class License {
/**
* The name of license (eg; Apache 2.0)
*/
String name
/**
* URL to the full license file
*/
String url
/**
* The distribution level this license corresponds to (eg: repo)
*/
String distribution
}

View File

@ -1,74 +1,14 @@
apply plugin: 'groovy'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
apply plugin: 'net.corda.plugins.publish-utils'
dependencies {
compile gradleApi()
compile localGroovy()
}
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
repositories {
mavenCentral()
}
bintray {
user = System.getenv('CORDA_BINTRAY_USER')
key = System.getenv('CORDA_BINTRAY_KEY')
publications = ['quasarUtils']
dryRun = false
pkg {
repo = 'corda'
name = 'quasar-utils'
userOrg = 'r3'
licenses = ['Apache-2.0']
version {
gpg {
sign = true
passphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE')
}
}
}
}
publishing {
publications {
quasarUtils(MavenPublication) {
from components.java
groupId 'net.corda.plugins'
artifactId 'quasar-utils'
artifact sourceJar
artifact javadocJar
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'quasar-utils'
description 'A small gradle plugin for adding some basic Quasar tasks and configurations to reduce build.gradle bloat.'
url 'https://github.com/corda/corda'
scm {
url 'https://github.com/corda/corda'
}
licenses {
license {
name 'Apache-2.0'
url 'https://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}
developers {
developer {
id 'R3'
name 'R3'
email 'dev@corda.net'
}
}
}
}
}
}
}
dependencies {
compile gradleApi()
compile localGroovy()
}

View File

@ -1,4 +1,4 @@
rootProject.name = 'corda-gradle-plugins'
include 'quasar-utils'
include 'publish-utils'
include 'quasar-utils'
include 'cordformation'

View File

@ -2,7 +2,8 @@ apply plugin: 'kotlin'
apply plugin: 'java'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'us.kirchmeier.capsule'
description 'Corda node modules'
repositories {
mavenLocal()
@ -24,18 +25,8 @@ configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
runtimeArtifacts.extendsFrom runtime
}
// Force the Caplet to target Java 6. This ensures that running 'java -jar corda.jar' on any Java 6 VM upwards
// will get as far as the Capsule version checks, meaning that if your JVM is too old, you will at least get
// a sensible error message telling you what to do rather than a bytecode version exception that doesn't.
// If we introduce .java files into this module that need Java 8+ then we will have to push the caplet into
// its own module so its target can be controlled individually, but for now this suffices.
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceSets {
integrationTest {
kotlin {
@ -168,50 +159,4 @@ dependencies {
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
task buildCordaJAR(type: FatCapsule, dependsOn: ['jar', 'buildCertSigningRequestUtilityJAR']) {
applicationClass 'net.corda.node.MainKt'
archiveName "corda-${corda_version}.jar"
applicationSource = files(project.tasks.findByName('jar'), 'build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml')
capsuleManifest {
appClassPath = ["jolokia-agent-war-${project.rootProject.ext.jolokia_version}.war"]
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"]
minJavaVersion = '1.8.0'
caplets = ['CordaCaplet']
}
}
task buildCertSigningRequestUtilityJAR(type: FatCapsule, dependsOn: project.jar) {
applicationClass 'net.corda.node.utilities.certsigning.CertificateSignerKt'
archiveName 'certSigningRequestUtility.jar'
capsuleManifest {
systemProperties['log4j.configuration'] = 'log4j2.xml'
minJavaVersion = '1.8.0'
}
}
artifacts {
runtimeArtifacts buildCordaJAR
}
publishing {
publications {
node(MavenPublication) {
from components.java
artifactId 'node'
artifact sourceJar
artifact javadocJar
}
corda(MavenPublication) {
artifactId 'corda'
artifact buildCordaJAR {
classifier ""
}
}
}
}

83
node/capsule/build.gradle Normal file
View File

@ -0,0 +1,83 @@
/**
* This build.gradle exists to publish our capsule (executable fat jar) to maven. It cannot be placed in the
* node project because the bintray plugin cannot publish two modules from one project.
*/
apply plugin: 'net.corda.plugins.publish-utils'
apply plugin: 'us.kirchmeier.capsule'
description 'Corda standalone node'
repositories {
mavenLocal()
mavenCentral()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
jcenter()
maven {
url 'https://dl.bintray.com/kotlin/exposed'
}
}
configurations {
runtimeArtifacts.extendsFrom runtime
}
// Force the Caplet to target Java 6. This ensures that running 'java -jar corda.jar' on any Java 6 VM upwards
// will get as far as the Capsule version checks, meaning that if your JVM is too old, you will at least get
// a sensible error message telling you what to do rather than a bytecode version exception that doesn't.
// If we introduce .java files into this module that need Java 8+ then we will have to push the caplet into
// its own module so its target can be controlled individually, but for now this suffices.
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceSets {
test {
resources {
srcDir "../../config/test"
}
}
main {
resources {
srcDir "../../config/dev"
}
}
}
dependencies {
compile project(':node')
}
task buildCordaJAR(type: FatCapsule, dependsOn: ['buildCertSigningRequestUtilityJAR']) {
applicationClass 'net.corda.node.MainKt'
archiveName "corda-${corda_version}.jar"
applicationSource = files(project.tasks.findByName('jar'), 'build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml')
capsuleManifest {
appClassPath = ["jolokia-agent-war-${project.rootProject.ext.jolokia_version}.war"]
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"]
minJavaVersion = '1.8.0'
caplets = ['CordaCaplet']
}
}
task buildCertSigningRequestUtilityJAR(type: FatCapsule) {
applicationClass 'net.corda.node.utilities.certsigning.CertificateSignerKt'
archiveName 'certSigningRequestUtility.jar'
capsuleManifest {
systemProperties['log4j.configuration'] = 'log4j2.xml'
minJavaVersion = '1.8.0'
}
}
artifacts {
runtimeArtifacts buildCordaJAR
publish buildCordaJAR {
classifier ""
}
}
publish {
name = 'corda'
disableDefaultJar = true
}

1
publish.properties Normal file
View File

@ -0,0 +1 @@
gradlePluginsVersion=0.6.2

View File

@ -45,7 +45,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':test-utils')

View File

@ -48,7 +48,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':finance')
compile project(':test-utils')

View File

@ -21,7 +21,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':finance')
testCompile project(':test-utils')

View File

@ -45,7 +45,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':client')
compile project(':node')

View File

@ -41,7 +41,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':node')
compile project(':finance')

View File

@ -45,7 +45,7 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
// Corda integration dependencies
runtime project(path: ":node", configuration: 'runtimeArtifacts')
runtime project(path: ":node:capsule", configuration: 'runtimeArtifacts')
compile project(':core')
compile project(':finance')
compile project(':test-utils')

View File

@ -5,6 +5,7 @@ include 'finance'
include 'finance:isolated'
include 'core'
include 'node'
include 'node:capsule'
include 'client'
include 'experimental'
include 'experimental:sandbox'

View File

@ -2,6 +2,8 @@ apply plugin: 'kotlin'
apply plugin: 'net.corda.plugins.quasar-utils'
apply plugin: 'net.corda.plugins.publish-utils'
description 'Testing utilities for Corda'
repositories {
mavenLocal()
mavenCentral()
@ -16,7 +18,6 @@ repositories {
//noinspection GroovyAssignabilityCheck
configurations {
// we don't want isolated.jar in classPath, since we want to test jar being dynamically loaded as an attachment
runtime.exclude module: 'isolated'
}
@ -47,16 +48,4 @@ dependencies {
// OkHTTP: Simple HTTP library.
compile 'com.squareup.okhttp3:okhttp:3.3.1'
}
publishing {
publications {
testutils(MavenPublication) {
from components.java
artifactId 'test-utils'
artifact sourceJar
artifact javadocJar
}
}
}
}