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

36 : issue#36 - add a gradle task to generate manifest.json to be com… #72

Merged
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ src/integrationTest/resources/pubsubplus-connector-kafka*/

# Local testing
solace.properties
manifest.json
47 changes: 38 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import com.github.spotbugs.snom.SpotBugsTask
import io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository
import groovy.json.JsonOutput
import groovy.text.GStringTemplateEngine
import jdk.nashorn.internal.ir.debug.JSONWriter

plugins {
id 'java-library'
Expand Down Expand Up @@ -76,6 +79,31 @@ spotbugs {
reportLevel 'high' // Decrease to medium once medium errors are fixed
}

// Generate manifest.json file to be compliant with Confluent Hub client
tasks.register("genarateKafkaConnectManifestFile") {

def manifestJsonTemplate = new File('manifest.json.template')
def bindMap = [
"FEATURE_CONFLUENT_CONTROL_CENTER_INTEGRATION_ENABLED": false,
"FEATURE_KAFKA_CONNECT_API_ENABLED": true,
"FEATURE_SINGLE_MESSAGE_TRANSFORMS_ENABLED": true,
"COMPONENT_NAME": project.name,
"RELEASE_DATE": new Date().format("yyyy-MM-dd"),
"VERSION": project.version
]

def manifestJson = JsonOutput.unescaped(
new GStringTemplateEngine()
.createTemplate(manifestJsonTemplate)
.make(bindMap)
.toString()
)

new File(project.projectDir.toString() + "/manifest.json").write JsonOutput.prettyPrint(JsonOutput.toJson(manifestJson))
}

tasks.genarateKafkaConnectManifestFile.dependsOn assemble

spotbugsIntegrationTest {
enabled = false
}
Expand Down Expand Up @@ -116,13 +144,13 @@ project.integrationTest {
maxRetries = 3
}
afterSuite { desc, result ->
if (!desc.parent)
println("${result.resultType} " +
"(${result.testCount} tests, " +
"${result.successfulTestCount} successes, " +
"${result.failedTestCount} failures, " +
"${result.skippedTestCount} skipped)")
}
if (!desc.parent)
println("${result.resultType} " +
"(${result.testCount} tests, " +
"${result.successfulTestCount} successes, " +
"${result.failedTestCount} failures, " +
"${result.skippedTestCount} skipped)")
}
}

project.test {
Expand Down Expand Up @@ -167,7 +195,7 @@ task('pmdMainSarif') {
}

Provider<RegularFile> reportsDir = project.getLayout()
.file(project.getProviders().provider({a -> extension.getReportsDir()}) as Provider<File>)
.file(project.getProviders().provider({ a -> extension.getReportsDir() }) as Provider<File>)
formatter(type: 'sarif', toFile: new File(reportsDir.get().getAsFile(), 'main.sarif'))
formatter(type: 'html', toFile: new File(reportsDir.get().getAsFile(), 'main.html'))

Expand Down Expand Up @@ -230,6 +258,7 @@ distributions {
from('doc/distribution-readme.md') { into 'doc' }
from('LICENSE') { into 'doc' }
from('THIRD-PARTY-LICENSES') { into 'doc' }
from('manifest.json') { into '' }
into('lib') {
from jar
from(project.configurations.runtimeClasspath)
Expand Down Expand Up @@ -310,7 +339,7 @@ signing {

tasks.withType(Sign) {
onlyIf {
gradle.taskGraph.allTasks.any {task ->
gradle.taskGraph.allTasks.any { task ->
task.name.startsWith("publish") && task.name.contains('Sonatype')
}
}
Expand Down
3 changes: 2 additions & 1 deletion doc/distribution-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Package directory contents:

- doc: this readme and license information
- lib: Sink Connector jar file and dependencies
- etc: sample configuration properties and JSON file
- etc: sample configuration properties and JSON file
- manifest.json: manifest file for kafka-connect to be installable via confluent-hub client
44 changes: 44 additions & 0 deletions manifest.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"author": "Solace",
"component_types": [
"sink"
],
"description": "The PubSub+ Kafka Sink Connector consumes Kafka topic records and streams them to the PubSub+ Event Mesh as topic and/or queue data events.",
"documentationUrl": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink",
"features": {
"confluent_control_center_integration": $FEATURE_CONFLUENT_CONTROL_CENTER_INTEGRATION_ENABLED,
"kafka_connect_api": $FEATURE_KAFKA_CONNECT_API_ENABLED,
"single_message_transforms": $FEATURE_SINGLE_MESSAGE_TRANSFORMS_ENABLED,
"supported_encodings": [
"any"
]
},
"license": [
{
"name": "he Apache Software License, Version 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
],
"name": "$COMPONENT_NAME",
"owner": {
"name": "Solace",
"type": "organization",
"url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink",
"username": "SolaceProducts"
},
"release_date": "$RELEASE_DATE",
"source_url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink",
"support": {
"provider_name": "Solace",
"summary": "",
"url": "https://github.com/SolaceProducts/pubsubplus-connector-kafka-sink/issues"
},
"tags": [
"solace",
"kafka",
"sink",
"connector"
],
"title": "Solace PubSub+ Connector for Kafka: Sink",
"version": "$VERSION"
}
Loading