Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update grpc-common version to latest release #52

Merged
merged 5 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dev-java-publish-sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
with:
build-target: 'Sonatype'
runsOn: ubuntu-latest
gradleVersion: '7'
secrets:
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
9 changes: 4 additions & 5 deletions .github/workflows/dev-release-java-publish-sonatype.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: Build and publish dev-release Java distributions to sonatype.

on:
push:
tags:
- \d+.\d+.\d+-dev
workflow_dispatch:

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype'
runsOn: ubuntu-latest
gradleVersion: '7'
devRelease: true
createTag: true
secrets:
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
3 changes: 2 additions & 1 deletion .github/workflows/java-publish-sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
with:
build-target: 'Sonatype'
runsOn: ubuntu-latest
gradleVersion: '7'
createTag: true
secrets:
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
200 changes: 6 additions & 194 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 {
Expand All @@ -45,184 +31,10 @@ repositories {
}
}

dependencies {
api platform('com.exactpro.th2:bom:4.5.0')
api 'com.exactpro.th2:grpc-common:4.4.0-dev'

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 = '[email protected]'
}
}
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'
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
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-7.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion package_info.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"package_name": "th2_grpc_check1",
"package_version": "4.4.0"
"package_version": "4.4.1"
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading