github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/core/chaincode/shim/java/build.gradle (about) 1 /* 2 Copyright DTCC 2016 All Rights Reserved. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 buildscript { 18 repositories { 19 mavenLocal() 20 mavenCentral() 21 jcenter() 22 } 23 dependencies { 24 classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0' 25 } 26 } 27 28 plugins { 29 id "java" 30 id "com.google.protobuf" version "0.8.0" 31 id "eclipse" 32 id "maven-publish" 33 34 } 35 archivesBaseName = 'shim-client' 36 version = '1.0' 37 38 39 sourceSets { 40 main { 41 java { 42 srcDir 'src/main/java' 43 } 44 proto { 45 srcDir 'src/main/proto' 46 } 47 } 48 } 49 50 repositories { 51 mavenLocal() 52 mavenCentral() 53 } 54 55 apply plugin: "com.google.osdetector" 56 57 def tcnative_classifier = osdetector.classifier; 58 59 protobuf { 60 generatedFilesBaseDir = "$projectDir/src" 61 protoc { 62 artifact = 'com.google.protobuf:protoc:3.0.0' 63 } 64 plugins { 65 grpc { 66 artifact = 'io.grpc:protoc-gen-grpc-java:0.13.2' 67 } 68 } 69 generateProtoTasks { 70 all().each { task -> 71 task.builtins { 72 java { 73 outputSubDir = 'java' 74 } 75 } 76 task.plugins { 77 grpc { 78 outputSubDir = 'java' 79 } 80 } 81 } 82 } 83 } 84 85 task copyToLib(type: Copy) { 86 into "$buildDir/libs" 87 from configurations.runtime 88 } 89 90 91 task copyProtos(type:Copy){ 92 93 from ("${rootDir}/protos/peer"){ 94 include '**/chaincodeevent.proto' 95 include '**/chaincode.proto' 96 include '**/chaincodeshim.proto' 97 include '**/proposal.proto' 98 include '**/proposal_response.proto' 99 } 100 into "${projectDir}/src/main/proto/peer" 101 102 } 103 104 tasks['build'].mustRunAfter tasks['copyProtos'] 105 build.dependsOn(copyProtos) 106 build.finalizedBy(copyToLib) 107 build.finalizedBy(publishToMavenLocal) 108 109 dependencies { 110 compile 'com.google.protobuf:protobuf-java:3.0.0' 111 compile 'io.grpc:grpc-all:0.13.2' 112 compile 'commons-cli:commons-cli:1.3.1' 113 compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork21:' + tcnative_classifier 114 } 115 116 publishing { 117 publications { 118 mavenJava(MavenPublication) { 119 groupId 'org.hyperledger' 120 artifactId 'shim-client' 121 version '1.0' 122 from components.java 123 } 124 } 125 }