Skip to content

Commit 091a081

Browse files
committed
[FAB-8986]: Harden gradle build configuration
1. Extract dependencies into parent project. 2. Define source and target java version. 3. Add IDE's gradle plugins 4. Add java and maven plugin to make it possible to execute `./gradlew build install` to promote resulting artifacts into local maven repository. Change-Id: Ie1918ed0ea08fc626aca4417d0cc3c4756bc9057 Signed-off-by: Artem Barger <bartem@il.ibm.com>
1 parent 9be9929 commit 091a081

File tree

4 files changed

+40
-12
lines changed

4 files changed

+40
-12
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
/.project
44
/.idea
55
*.iml
6-
*.log
6+
*.log
7+
*.swp
8+
.gradletasknamecache

build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,32 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
apply plugin: 'idea'
8+
apply plugin: 'eclipse-wtp'
9+
710
allprojects {
811
repositories {
12+
mavenLocal()
913
jcenter()
1014
}
1115
}
16+
1217
subprojects {
18+
apply plugin: 'java'
19+
apply plugin: 'maven'
20+
1321
group = "org.hyperledger.fabric"
1422
version = '1.2.0-SNAPSHOT'
23+
24+
sourceCompatibility = 1.8
25+
targetCompatibility = 1.8
26+
27+
dependencies {
28+
compile 'commons-cli:commons-cli:1.4'
29+
compile 'commons-logging:commons-logging:1.2'
30+
31+
testCompile 'junit:junit:4.12'
32+
testCompile 'org.hamcrest:hamcrest-library:1.3'
33+
testCompile 'org.mockito:mockito-core:2.+'
34+
}
1535
}

settings.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
rootProject.name = 'fabric-chaincode-java'
7-
include 'shim'
7+
8+
include 'shim'

shim/build.gradle

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
*/
66

77
plugins {
8-
id 'java'
98
id 'maven-publish'
109
id 'jacoco'
11-
id 'com.google.protobuf' version '0.8.3'
10+
id 'com.google.protobuf' version '0.8.5'
1211
id 'net.linguica.maven-settings' version '0.5'
1312
}
1413

@@ -36,10 +35,20 @@ sourceSets {
3635
java {
3736
// adding the protobuf & grpc generated source explicitly,
3837
// so that IDEs can find the generated sources.
39-
srcDirs 'build/generated/source/proto/main/grpc'
40-
srcDirs 'build/generated/source/proto/main/java'
38+
srcDirs = ['build/generated/source/proto/main/grpc',
39+
'build/generated/source/proto/main/java',
40+
'src/main/java']
4141
}
42+
proto {
43+
srcDirs 'src/main/proto'
44+
}
4245
}
46+
47+
test {
48+
java {
49+
srcDir 'src/test'
50+
}
51+
}
4352
}
4453

4554
dependencies {
@@ -48,11 +57,6 @@ dependencies {
4857
compile 'io.grpc:grpc-netty:1.6.1'
4958
compile 'io.grpc:grpc-protobuf:1.6.1'
5059
compile 'io.grpc:grpc-stub:1.6.1'
51-
compile 'commons-cli:commons-cli:1.4'
52-
compile 'commons-logging:commons-logging:1.2'
53-
testCompile 'junit:junit:4.12'
54-
testCompile 'org.hamcrest:hamcrest-library:1.3'
55-
testCompile "org.mockito:mockito-core:2.+"
5660
}
5761

5862
publishing {
@@ -171,4 +175,5 @@ task licenseCheck {
171175
}
172176
}
173177

174-
build.dependsOn licenseCheck
178+
build.dependsOn licenseCheck
179+

0 commit comments

Comments
 (0)