From 0a700fd3f0c8d3b6ce922d89b0e18db6a23c7c0c Mon Sep 17 00:00:00 2001 From: szymonsztuka Date: Fri, 29 Jun 2018 10:32:37 +0100 Subject: [PATCH] ENT-1741 Build standalone shell JAR distribution - fix (#3474) --- build.gradle | 3 +- docs/source/shell.rst | 4 +- tools/shell-cli/README.md | 12 ++++ tools/shell-cli/build.gradle | 112 ++++++++++------------------------- 4 files changed, 48 insertions(+), 83 deletions(-) create mode 100644 tools/shell-cli/README.md diff --git a/build.gradle b/build.gradle index 6935190f47..82c75f91ae 100644 --- a/build.gradle +++ b/build.gradle @@ -53,6 +53,7 @@ buildscript { ext.crash_version = 'cadb53544fbb3c0fb901445da614998a6a419488' ext.jsr305_version = constants.getProperty("jsr305Version") ext.shiro_version = '1.4.0' + ext.shadow_version = '2.0.2' ext.artifactory_plugin_version = constants.getProperty('artifactoryPluginVersion') ext.artifactory_contextUrl = 'https://ci-artifactory.corda.r3cev.com/artifactory' ext.snake_yaml_version = constants.getProperty('snakeYamlVersion') @@ -341,7 +342,7 @@ bintrayConfig { 'corda-node-driver', 'corda-confidential-identities', 'corda-shell', - 'corda-shell-cli', + 'corda-tools-shell-cli', 'corda-serialization', 'corda-serialization-deterministic', 'corda-tools-blob-inspector', diff --git a/docs/source/shell.rst b/docs/source/shell.rst index 30d3b7a3b3..fa261a3bc3 100644 --- a/docs/source/shell.rst +++ b/docs/source/shell.rst @@ -106,7 +106,7 @@ Linux and MacOS .. code:: bash - ./shell [--config-file PATH | --cordpass-directory PATH --commands-directory PATH --host HOST --port PORT + java -jar corda-tools-shell-cli-VERSION_NUMBER.jar [--config-file PATH | --cordpass-directory PATH --commands-directory PATH --host HOST --port PORT --user USER --password PASSWORD --sshd-port PORT --sshd-hostkey-directory PATH --keystore-password PASSWORD --keystore-file FILE --truststore-password PASSWORD --truststore-file FILE | --help] @@ -115,7 +115,7 @@ Windows .. code:: bash - shell.bat [--config-file PATH | --cordpass-directory PATH --commands-directory PATH --host HOST --port PORT + java -jar corda-tools-shell-cli-VERSION_NUMBER.jar [--config-file PATH | --cordpass-directory PATH --commands-directory PATH --host HOST --port PORT --user USER --password PASSWORD --sshd-port PORT --sshd-hostkey-directory PATH --keystore-password PASSWORD --keystore-file FILE --truststore-password PASSWORD --truststore-file FILE | --help] diff --git a/tools/shell-cli/README.md b/tools/shell-cli/README.md new file mode 100644 index 0000000000..e37a565b16 --- /dev/null +++ b/tools/shell-cli/README.md @@ -0,0 +1,12 @@ +Standalone Shell +---------------- + +Documentation for shell CLI can be found [here](http://docs.corda.net/website/releases/docs_head/shell.html) + +To build this from the command line on Unix or MacOS: + + Run ``./gradlew tools:shell-cli:buildShellCli`` to create a fat JAR in ``tools/shell-cli/build/`` + +To build this from the command line on Windows: + + Run ``gradlew tools:shell-cli:buildShellCli`` to create a fat JAR in ``tools/shell-cli/build/`` diff --git a/tools/shell-cli/build.gradle b/tools/shell-cli/build.gradle index c1848107ab..90b01a7113 100644 --- a/tools/shell-cli/build.gradle +++ b/tools/shell-cli/build.gradle @@ -1,103 +1,55 @@ -buildscript { - - repositories { - mavenLocal() - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1' - } -} - -repositories { - mavenLocal() - mavenCentral() - jcenter() -} - -apply plugin: 'kotlin' -apply plugin: 'java' -apply plugin: 'application' -apply plugin: 'net.corda.plugins.publish-utils' -apply plugin: 'com.jfrog.artifactory' -apply plugin: 'com.github.johnrengelman.shadow' -apply plugin: 'maven-publish' - description 'Corda Shell CLI' -configurations { - integrationTestCompile.extendsFrom testCompile - integrationTestRuntime.extendsFrom testRuntime -} - -sourceSets { - integrationTest { - kotlin { - compileClasspath += main.output + test.output - runtimeClasspath += main.output + test.output - srcDir file('src/integration-test/kotlin') - } - resources { - srcDir file('src/integration-test/resources') +buildscript { + repositories { + maven { + url "https://plugins.gradle.org/m2/" } } - test { - resources { - srcDir file('src/test/resources') - } + dependencies { + classpath "com.github.jengelman.gradle.plugins:shadow:$shadow_version" + classpath 'de.sebastianboegl.gradle.plugins:shadow-log4j-transformer:2.1.1' } } -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" - - compile project(':tools:shell') - - // Unit testing helpers. - testCompile "junit:junit:$junit_version" - testCompile "org.assertj:assertj-core:${assertj_version}" - testCompile project(':test-utils') - testCompile project(':finance') - -} +apply plugin: 'application' +apply plugin: 'com.github.johnrengelman.shadow' +apply plugin: 'net.corda.plugins.publish-utils' +apply plugin: 'com.jfrog.artifactory' mainClassName = 'net.corda.tools.shell.StandaloneShellKt' -jar { - baseName 'corda-shell-cli' +dependencies { + compile project(':tools:shell') + compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25' + + testCompile project(':test-utils') } processResources { from file("$rootDir/config/dev/log4j2.xml") } -task integrationTest(type: Test) { - testClassesDirs = sourceSets.integrationTest.output.classesDirs - classpath = sourceSets.integrationTest.runtimeClasspath -} - -publishing { - publications { - shadow(MavenPublication) { publication -> - project.shadow.component(publication) - artifactId = "corda-tools-shell-cli" - } - } -} - shadowJar { //transform(de.sebastianboegl.gradle.plugins.shadow.transformers.Log4j2PluginsFileTransformer) - archiveName = "corda-shell-cli-${version}.jar" + archiveName = "shell-cli-${version}.jar" - baseName = 'corda-shell-cli' - classifier = null - mainClassName = 'net.corda.tools.shell.StandaloneShellKt' mergeServiceFiles() } task buildShellCli(dependsOn: shadowJar) + +artifacts { + publish shadowJar { + classifier "" + } +} + +jar { + classifier "ignore" +} + +publish { + name 'corda-tools-shell-cli' + disableDefaultJar = true +}