Skip to content

Commit

Permalink
Upgrade gradle to v7
Browse files Browse the repository at this point in the history
Signed-off-by: Kestutis Gudynas <[email protected]>
  • Loading branch information
kemi04 committed May 4, 2021
1 parent 90bd1f8 commit d212e2a
Show file tree
Hide file tree
Showing 13 changed files with 224 additions and 173 deletions.
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ allprojects {

subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'

group = 'org.hyperledger.fabric-chaincode-java'
version = rootProject.version
Expand All @@ -42,18 +42,18 @@ subprojects {
targetCompatibility = 1.8

dependencies {
compile 'commons-cli:commons-cli:1.4'
compile 'commons-logging:commons-logging:1.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'

testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.mockito:mockito-core:2.23.0'
testCompile 'com.github.stefanbirkner:system-rules:1.17.0'

testCompileOnly 'junit:junit:4.12'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.3.1'
testCompile 'org.assertj:assertj-core:3.9.1'
implementation group: 'commons-cli', name: 'commons-cli', version: '1.4'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.3.1'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.3.1'

testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.23.0'
testImplementation group: 'com.github.stefanbirkner', name: 'system-rules', version: 'system-rules-1.17.0'

testCompileOnly group: 'junit', name: 'junit', version: '4.12'
testRuntimeOnly group: 'org.junit.vintage', name: 'junit-vintage-engine', version: '5.3.1'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.9.1'
}

if (!it.name.equals('fabric-chaincode-protos')) {
Expand Down
9 changes: 6 additions & 3 deletions ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ stages:
# Copy the built artifacts to the staging directory, tgz, and the docker image
- script: |
set -ev
./gradlew publishToMavenLocal
./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} publishProtosJarPublicationToMavenLocal
./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} publishShimJarPublicationToMavenLocal
tar -zcvf localmaven.tgz ${HOME}/.m2/repository/org/hyperledger
docker image save hyperledger/fabric-javaenv | gzip > $(Build.ArtifactStagingDirectory)/fabric-javaenv.tar.gz
displayName: 'Package tgz and docker image'
Expand Down Expand Up @@ -197,7 +198,8 @@ stages:
inputs:
secureFile: secring.gpg
- script: |
./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PossrhUsername=${OSSRH_USER} -PossrhPassword=${OSSRH_PASSWORD} uploadArchives
./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PossrhUsername=${OSSRH_USER} -PossrhPassword=${OSSRH_PASSWORD} publishMavenPublicationToReleaseRepository
./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PossrhUsername=${OSSRH_USER} -PossrhPassword=${OSSRH_PASSWORD} publishMavenPublicationToSnapshotRepository
env:
SIGNING_ID: $(JAR-Signing-Id)
SIGNING_PASSWORD: $(JAR-Signing-Password)
Expand All @@ -217,7 +219,8 @@ stages:
inputs:
secureFile: secring.gpg
- script: |
./gradlew -PNIGHTLY=true -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PartifactoryUsername=${ARTIFACTORY_USER} -PartifactoryhPassword=${ARTIFACTORY_PASSWORD} uploadArchives
./gradlew -PNIGHTLY=true -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PartifactoryUsername=${ARTIFACTORY_USER} -PartifactoryhPassword=${ARTIFACTORY_PASSWORD} publishMavenPublicationToReleaseRepository
./gradlew -PNIGHTLY=true -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PartifactoryUsername=${ARTIFACTORY_USER} -PartifactoryhPassword=${ARTIFACTORY_PASSWORD} publishMavenPublicationToSnapshotRepository
env:
SIGNING_ID: $(JAR-Signing-Id)
SIGNING_PASSWORD: $(JAR-Signing-Password)
Expand Down
10 changes: 6 additions & 4 deletions fabric-chaincode-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ RUN curl -s "https://get.sdkman.io" | bash

SHELL ["/bin/bash", "-c"]

RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install gradle 5.6.2
RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install maven 3.6.2
RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install gradle 7.0
RUN source /root/.sdkman/bin/sdkman-init.sh; sdk install maven 3.8.1

FROM adoptopenjdk/openjdk11:jdk-11.0.4_11-alpine as dependencies
RUN apk add --no-cache bash wget
Expand All @@ -33,10 +33,10 @@ WORKDIR /root/chaincode-java/shim-src
RUN gradle \
clean \
fabric-chaincode-protos:build \
fabric-chaincode-protos:install \
fabric-chaincode-protos:publishToMavenLocal \
#Wfabric-chaincode-protos:publishProtosJarPublicationToMavenLocal \
fabric-chaincode-shim:build \
fabric-chaincode-shim:install \
#fabric-chaincode-shim:publishShimJarPublicationToMavenLocal \
fabric-chaincode-shim:publishToMavenLocal \
-x javadoc \
-x test \
Expand All @@ -56,6 +56,8 @@ RUN mvn -f pom-default.xml compile
WORKDIR /root/chaincode-java
RUN rm -rf shim-src

#Gradle doesn't run without settings.gradle file, so create one
RUN touch settings.gradle
RUN gradle wrapper

# Creating final javaenv image which will include all required
Expand Down
2 changes: 1 addition & 1 deletion fabric-chaincode-docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import com.bmuschko.gradle.docker.tasks.image.*

task copyLib (type: Copy) {
dependsOn ':fabric-chaincode-shim:build'
from project(':fabric-chaincode-shim').configurations.runtime
from project(':fabric-chaincode-shim').configurations.runtimeClasspath
into('build/distributions/chaincode-java/lib')
}

Expand Down
6 changes: 3 additions & 3 deletions fabric-chaincode-integration-test/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dependencies {
compile project(':fabric-chaincode-docker')
testCompile 'org.hyperledger.fabric-sdk-java:fabric-sdk-java:1.4.4'
compile project(':fabric-chaincode-shim')
implementation project(':fabric-chaincode-docker')
testImplementation 'org.hyperledger.fabric-sdk-java:fabric-sdk-java:1.4.4'
implementation project(':fabric-chaincode-shim')
implementation group: 'org.json', name: 'json', version: '20180813'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url = "https://www.jitpack.io" }
}

dependencies {
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.1'
testImplementation group: 'junit', name: 'junit', version: '4.12'
}

shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ sourceCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url = "https://www.jitpack.io" }
}

dependencies {
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.1'
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.3.1'
implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-protos', version: '2.3.1'
testImplementation group: 'junit', name: 'junit', version: '4.12'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.4.0'
}

shadowJar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.hyperledger.fabric.metrics.MetricsProvider;
import org.hyperledger.fabric.shim.ledger.*;
import org.hyperledger.fabric.shim.*;
//import org.hyperledger.fabric.protos.peer.ChaincodeShim;
import java.util.*;
import static java.nio.charset.StandardCharsets.UTF_8;

Expand Down
153 changes: 87 additions & 66 deletions fabric-chaincode-protos/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ apply plugin: 'com.google.protobuf'
apply plugin: 'de.undercouch.download'
apply plugin: 'maven-publish'

apply plugin: 'maven'
apply plugin: 'signing'

repositories {
Expand Down Expand Up @@ -39,20 +38,20 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.16'
classpath 'de.undercouch:gradle-download-task:3.4.2'
}
}

dependencies {
compile 'com.google.protobuf:protobuf-java:3.11.1'
compile 'com.google.protobuf:protobuf-java-util:3.11.1'
compile 'io.grpc:grpc-netty-shaded:1.31.1'
compile 'io.grpc:grpc-protobuf:1.31.1'
compile 'io.grpc:grpc-stub:1.31.1'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.11.1'
implementation group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.11.1'
implementation group: 'io.grpc', name: 'grpc-netty-shaded', version: '1.31.1'
implementation group: 'io.grpc', name: 'grpc-protobuf', version: '1.31.1'
implementation group: 'io.grpc', name: 'grpc-stub', version: '1.31.1'
// Required if using Java 11+ as no longer bundled in the core libraries
compile 'javax.annotation:javax.annotation-api:1.3.2'
compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
compileOnly group: 'org.apache.tomcat', name: 'annotations-api', version: '6.0.53'
}

protobuf {
Expand Down Expand Up @@ -99,18 +98,6 @@ task downloadProtoFiles {
}
}

publishing {
publications {
protosJar(MavenPublication) {
groupId = project.group
artifactId = project.name
version = project.version

from components.java
}
}
}

project.tasks.withType(Javadoc).all {
enabled = false
}
Expand All @@ -132,74 +119,108 @@ task javadocJar(type: Jar) {
from javadoc
}

signing {
required {gradle.taskGraph.hasTask(uploadArchives) }
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

if (nightly) {
repository(url: "https://hyperledger-fabric.jfrog.io/artifactory/fabric-maven") {
authentication(userName: project.findProperty('artifactoryUsername'), password: project.findProperty('artifactoryPassword'))
}

snapshotRepository(url: "https://hyperledger-fabric.jfrog.io/artifactory/fabric-maven") {
authentication(userName: project.findProperty('artifactoryUsername'), password: project.findProperty('artifactoryPassword'))
}
} else {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.findProperty('ossrhUsername'), password: project.findProperty('ossrhPassword'))
}
publishing {
publications {
protos(MavenPublication) {
groupId = project.group
artifactId = project.name
version = project.version

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: project.findProperty('ossrhUsername'), password: project.findProperty('ossrhPassword'))
}
}
from components.java

pom.project {
name 'JavaChaincodeProtobuf'
packaging 'jar'
description 'Hyperldger Fabric Java chaincode protobuf files'
url 'http://www.hyperledger.org/'
pom {
name = 'JavaChaincodeProtobuf'
packaging = 'jar'
description = 'Hyperldger Fabric Java chaincode protobuf files'
url = 'http://www.hyperledger.org/'

scm {
url 'https://github.com/hyperledger/fabric-chaincode-java.git'
url = 'https://github.com/hyperledger/fabric-chaincode-java.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id 'gennadylaventman'
name 'Gennady Laventman'
email '[email protected]'
id = 'gennadylaventman'
name = 'Gennady Laventman'
email = '[email protected]'
}
developer {
id 'luiss'
name 'Luis Sanchez'
email '[email protected]'
id = 'luiss'
name = 'Luis Sanchez'
email = '[email protected]'
}
developer {
id 'C0rWin'
name 'Artem Barger'
email '[email protected]'
id = 'C0rWin'
name = 'Artem Barger'
email = '[email protected]'
}
developer {
id 'denyeart'
name 'David Enyeart'
email '[email protected]'
id = 'denyeart'
name = 'David Enyeart'
email = '[email protected]'
}
}
}
}

protosJar(MavenPublication) {
groupId = project.group
artifactId = project.name
version = project.version
alias = true
from components.java
}
}

repositories {
maven {
name = "release"
if (nightly) {
url = "https://hyperledger-fabric.jfrog.io/artifactory/fabric-maven"
credentials {
username = project.findProperty('artifactoryUsername')
password = project.findProperty('artifactoryPassword')
}
} else {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = project.findProperty('ossrhUsername')
password = project.findProperty('ossrhPassword')
}
}
}

maven {
name = "snapshot"
if (nightly) {
url = "https://hyperledger-fabric.jfrog.io/artifactory/fabric-maven"
credentials {
username = project.findProperty('artifactoryUsername')
password = project.findProperty('artifactoryPassword')
}
} else {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
credentials {
username = project.findProperty('ossrhUsername')
password = project.findProperty('ossrhPassword')
}
}
}

}
}

signing {
if (project.findProperty('signing.keyId')) {
sign publishing.publications.protos
sign publishing.publications.protosJar
}
}

Expand Down
Loading

0 comments on commit d212e2a

Please sign in to comment.