github.com/myafeier/fabric@v1.0.1-0.20170722181825-3a4b1f2bce86/core/chaincode/shim/java/build.gradle (about) 1 /* 2 Copyright DTCC, IBM 2016, 2017 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 into "peer", { 93 from ("${rootDir}/protos/peer"){ 94 include 'chaincode_event.proto' 95 include 'chaincode.proto' 96 include 'chaincode_shim.proto' 97 include 'proposal.proto' 98 include 'proposal_response.proto' 99 } 100 } 101 into "common", { 102 from ("${rootDir}/protos/common"){ 103 include 'common.proto' 104 } 105 } 106 into "ledger/queryresult", { 107 from ("${rootDir}/protos/ledger/queryresult"){ 108 include 'kv_query_result.proto' 109 } 110 } 111 into "${projectDir}/src/main/proto" 112 } 113 114 task copyProtosFromDevEnv(type:Copy){ 115 into "peer", { 116 from ("../../../../protos/peer"){ 117 include 'chaincode_event.proto' 118 include 'chaincode.proto' 119 include 'chaincode_shim.proto' 120 include 'proposal.proto' 121 include 'proposal_response.proto' 122 } 123 } 124 into "common", { 125 from ("../../../../protos/common"){ 126 include 'common.proto' 127 } 128 } 129 into "ledger/queryresult", { 130 from ("../../../../protos/ledger/queryresult"){ 131 include 'kv_query_result.proto' 132 } 133 } 134 into "${projectDir}/protos" 135 } 136 137 tasks['build'].mustRunAfter tasks['copyProtos'] 138 build.dependsOn(copyProtos) 139 build.finalizedBy(copyToLib) 140 build.finalizedBy(publishToMavenLocal) 141 142 dependencies { 143 compile 'com.google.protobuf:protobuf-java:3.0.0' 144 compile 'com.google.protobuf:protobuf-java-util:3.0.0' 145 compile 'io.grpc:grpc-all:0.13.2' 146 compile 'commons-cli:commons-cli:1.3.1' 147 compile 'io.netty:netty-tcnative-boringssl-static:1.1.33.Fork21:' + tcnative_classifier 148 testCompile 'junit:junit:4.12' 149 testCompile 'org.hamcrest:hamcrest-library:1.3' 150 } 151 152 publishing { 153 publications { 154 mavenJava(MavenPublication) { 155 groupId 'org.hyperledger' 156 artifactId 'shim-client' 157 version '1.0' 158 from components.java 159 } 160 } 161 }