From c926ea2edd23ab139af4a5f86dc206d13c0e019a Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Thu, 18 Jul 2024 17:01:59 +0500 Subject: [PATCH 1/5] Update grpc-common version to latest release --- build.gradle | 2 +- gradle.properties | 2 +- package_info.json | 2 +- requirements.txt | 2 +- setup.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index dd68ee8..b8701ce 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ repositories { dependencies { api platform('com.exactpro.th2:bom:4.5.0') - api 'com.exactpro.th2:grpc-common:4.4.0-dev' + api 'com.exactpro.th2:grpc-common:4.5.0' api "com.google.protobuf:protobuf-java-util" api "io.grpc:grpc-stub" diff --git a/gradle.properties b/gradle.properties index a44cdb3..fbba00c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -release_version=4.4.0 +release_version=4.4.1 description='th2 gRPC check1 library' vcs_url=https://github.com/th2-net/th2-grpc-check1 \ No newline at end of file diff --git a/package_info.json b/package_info.json index 8f08c78..c3f8aa3 100644 --- a/package_info.json +++ b/package_info.json @@ -1,4 +1,4 @@ { "package_name": "th2_grpc_check1", - "package_version": "4.4.0" + "package_version": "4.4.1" } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9995a44..bae22ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,5 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -th2-grpc-common==4.4.0rc1 +th2-grpc-common~=4.5 mypy-protobuf==3.4 diff --git a/setup.py b/setup.py index 9fbaa1c..5f71b09 100644 --- a/setup.py +++ b/setup.py @@ -120,7 +120,7 @@ def make_packages(root_dir): license='Apache License 2.0', python_requires='>=3.7', install_requires=[ - 'th2-grpc-common==4.4.0rc1', + 'th2-grpc-common~=4.5', 'mypy-protobuf==3.4' ], packages=packages, From 63135b1479b0e31a15c5be9dec322f12d5840287 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Thu, 18 Jul 2024 17:04:08 +0500 Subject: [PATCH 2/5] Add NVD API key --- .github/workflows/dev-java-publish-sonatype.yml | 1 + .github/workflows/dev-release-java-publish-sonatype.yml | 3 ++- .github/workflows/java-publish-sonatype.yml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-java-publish-sonatype.yml b/.github/workflows/dev-java-publish-sonatype.yml index 61d4763..3e3c6bb 100644 --- a/.github/workflows/dev-java-publish-sonatype.yml +++ b/.github/workflows/dev-java-publish-sonatype.yml @@ -20,3 +20,4 @@ jobs: sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }} sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} + nvd-api-key: ${{ secrets.NVD_APIKEY }} diff --git a/.github/workflows/dev-release-java-publish-sonatype.yml b/.github/workflows/dev-release-java-publish-sonatype.yml index b0f32b6..b40bd8b 100644 --- a/.github/workflows/dev-release-java-publish-sonatype.yml +++ b/.github/workflows/dev-release-java-publish-sonatype.yml @@ -17,4 +17,5 @@ jobs: sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }} - sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} \ No newline at end of file + sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} + nvd-api-key: ${{ secrets.NVD_APIKEY }} \ No newline at end of file diff --git a/.github/workflows/java-publish-sonatype.yml b/.github/workflows/java-publish-sonatype.yml index 81e013b..856ab18 100644 --- a/.github/workflows/java-publish-sonatype.yml +++ b/.github/workflows/java-publish-sonatype.yml @@ -20,3 +20,4 @@ jobs: sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }} sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }} + nvd-api-key: ${{ secrets.NVD_APIKEY }} From b7ad2b46db0be5726e1b6c862661fe12bf51974a Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Thu, 18 Jul 2024 17:07:11 +0500 Subject: [PATCH 3/5] Migrate to th2 gradle plugins --- build.gradle | 200 ++------------------------------------------------- 1 file changed, 6 insertions(+), 194 deletions(-) diff --git a/build.gradle b/build.gradle index b8701ce..ff3196c 100644 --- a/build.gradle +++ b/build.gradle @@ -2,16 +2,10 @@ import com.github.jk1.license.filter.LicenseBundleNormalizer import com.github.jk1.license.render.JsonReportRenderer plugins { - id 'java' id 'java-library' id 'maven-publish' - id "io.github.gradle-nexus.publish-plugin" version "1.3.0" - id 'signing' - id "com.google.protobuf" version "0.9.3" - id "org.owasp.dependencycheck" version "8.3.1" - id "com.gorylenko.gradle-git-properties" version "2.4.1" - id 'com.github.jk1.dependency-license-report' version '2.5' - id "de.undercouch.download" version "5.4.0" + id 'com.exactpro.th2.gradle.grpc' version '0.1.1' + id 'com.exactpro.th2.gradle.publish' version '0.1.1' } group = 'com.exactpro.th2' @@ -20,14 +14,6 @@ version = release_version sourceCompatibility = 11 targetCompatibility = 11 -ext { - grpcVersion = '1.56.0' - protobufVersion = '3.23.2' // The protoc:3.23.3 https://github.com/protocolbuffers/protobuf/issues/13070 - serviceGeneratorVersion = '3.4.0' - - genBaseDir = file("${buildDir}/generated/source/proto") // from protobuf plugin -} - repositories { mavenCentral() maven { @@ -45,184 +31,10 @@ repositories { } } -dependencies { - api platform('com.exactpro.th2:bom:4.5.0') - api 'com.exactpro.th2:grpc-common:4.5.0' - - api "com.google.protobuf:protobuf-java-util" - api "io.grpc:grpc-stub" - implementation "io.grpc:grpc-protobuf" - implementation "io.grpc:grpc-core" - implementation "io.grpc:grpc-netty" - - implementation "javax.annotation:javax.annotation-api:1.3.2" - - api "com.exactpro.th2:grpc-service-generator:${serviceGeneratorVersion}" -} - -sourceSets { - main { - // the proto plugins add generated dir to source sets - resources { - srcDirs "$genBaseDir/main/services/java/resources" - } - } -} - -protobuf { - protoc { - artifact = "com.google.protobuf:protoc:${protobufVersion}" - } - plugins { - grpc { - artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" - } - services { - artifact = "com.exactpro.th2:grpc-service-generator:${serviceGeneratorVersion}:all@jar" - } - } - generateProtoTasks { - all()*.plugins { - grpc {} - services { - option 'javaInterfacesPath=./java/src' - option 'javaInterfacesImplPath=./java/src' - option 'javaMetaInfPath=./java/resources' - option 'pythonPath=./python' - } - } - ofSourceSet('main') - } -} - -compileJava.dependsOn.add('generateProto') -processResources.dependsOn.add('generateProto') - -java { - withJavadocJar() - withSourcesJar() -} - -// conditionals for publications -tasks.withType(PublishToMavenRepository).configureEach { - onlyIf { - (repository == publishing.repositories.nexusRepository && - project.hasProperty('nexus_user') && - project.hasProperty('nexus_password') && - project.hasProperty('nexus_url')) || - (repository == publishing.repositories.sonatype && - project.hasProperty('sonatypeUsername') && - project.hasProperty('sonatypePassword')) - } -} -tasks.withType(Sign).configureEach { - onlyIf { - project.hasProperty('signingKey') && - project.hasProperty('signingPassword') - } +th2Grpc { + service.set(true) } -// disable running task 'initializeSonatypeStagingRepository' on a gitlab -tasks.configureEach { task -> - if (task.name == 'initializeSonatypeStagingRepository' && - !(project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) - ) { - task.enabled = false - } -} - -publishing { - publications { - mavenJava(MavenPublication) { - from(components.java) - pom { - name = rootProject.name - packaging = 'jar' - description = rootProject.description - url = vcs_url - scm { - url = vcs_url - } - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id = 'developer' - name = 'developer' - email = 'developer@exactpro.com' - } - } - scm { - url = vcs_url - } - } - } - } - repositories { - //Nexus repo to publish from gitlab - maven { - name = 'nexusRepository' - credentials { - username = project.findProperty('nexus_user') - password = project.findProperty('nexus_password') - } - url = project.findProperty('nexus_url') - } - } -} - -nexusPublishing { - repositories { - sonatype { - nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) - snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) - } - } -} - -signing { - String signingKey = findProperty("signingKey") - String signingPassword = findProperty("signingPassword") - useInMemoryPgpKeys(signingKey, signingPassword) - sign publishing.publications.mavenJava -} - -dependencyLocking { - lockAllConfigurations() -} - -dependencyCheck { - formats = ['SARIF', 'JSON', 'HTML'] - failBuildOnCVSS = 5 - - analyzers { - assemblyEnabled = false - nugetconfEnabled = false - nodeEnabled = false - } -} - -licenseReport { - def licenseNormalizerBundlePath = "$buildDir/license-normalizer-bundle.json" - - if (!file(licenseNormalizerBundlePath).exists()) { - download.run { - src 'https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/license-normalizer-bundle.json' - dest "$buildDir/license-normalizer-bundle.json" - overwrite false - } - } - - filters = [ - new LicenseBundleNormalizer(licenseNormalizerBundlePath, false) - ] - renderers = [ - new JsonReportRenderer('licenses.json', false), - ] - excludeOwnGroup = false - allowedLicensesFile = new URL("https://raw.githubusercontent.com/th2-net/.github/main/license-compliance/gradle-license-report/allowed-licenses.json") +dependencies { + api 'com.exactpro.th2:grpc-common:4.5.0' } \ No newline at end of file From 5f5e5a7e68fbc0ea31a04f595da6915f3adb1e9a Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Thu, 18 Jul 2024 17:07:57 +0500 Subject: [PATCH 4/5] Use gradle 8.7 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f42e62f..d951fac 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 159566ceefecaaa195709c5330f7a35561129185 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Thu, 18 Jul 2024 18:08:42 +0500 Subject: [PATCH 5/5] Update workflows --- .github/workflows/dev-java-publish-sonatype.yml | 1 - .github/workflows/dev-release-java-publish-sonatype.yml | 6 ++---- .github/workflows/java-publish-sonatype.yml | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-java-publish-sonatype.yml b/.github/workflows/dev-java-publish-sonatype.yml index 3e3c6bb..a617196 100644 --- a/.github/workflows/dev-java-publish-sonatype.yml +++ b/.github/workflows/dev-java-publish-sonatype.yml @@ -14,7 +14,6 @@ jobs: with: build-target: 'Sonatype' runsOn: ubuntu-latest - gradleVersion: '7' secrets: sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} diff --git a/.github/workflows/dev-release-java-publish-sonatype.yml b/.github/workflows/dev-release-java-publish-sonatype.yml index b40bd8b..09d8030 100644 --- a/.github/workflows/dev-release-java-publish-sonatype.yml +++ b/.github/workflows/dev-release-java-publish-sonatype.yml @@ -1,9 +1,7 @@ name: Build and publish dev-release Java distributions to sonatype. on: - push: - tags: - - \d+.\d+.\d+-dev + workflow_dispatch: jobs: build: @@ -11,8 +9,8 @@ jobs: with: build-target: 'Sonatype' runsOn: ubuntu-latest - gradleVersion: '7' devRelease: true + createTag: true secrets: sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} diff --git a/.github/workflows/java-publish-sonatype.yml b/.github/workflows/java-publish-sonatype.yml index 856ab18..b8862ad 100644 --- a/.github/workflows/java-publish-sonatype.yml +++ b/.github/workflows/java-publish-sonatype.yml @@ -14,7 +14,7 @@ jobs: with: build-target: 'Sonatype' runsOn: ubuntu-latest - gradleVersion: '7' + createTag: true secrets: sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}