Skip to content

Commit

Permalink
chore: Initialize module MTConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Feb 26, 2025
1 parent aab73b3 commit 6c8ddc8
Show file tree
Hide file tree
Showing 13 changed files with 613 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ dependencies {
edgeModule("com.hivemq:hivemq-edge-module-plc4x")
edgeModule("com.hivemq:hivemq-edge-module-opcua")
edgeModule("com.hivemq:hivemq-edge-module-modbus")
edgeModule("com.hivemq:hivemq-edge-module-mtconnect")
}

val hivemqEdgeZip by tasks.registering(Zip::class) {
Expand All @@ -108,6 +109,7 @@ val edgeProjectsToUpdate = setOf(
"hivemq-edge-module-file",
"hivemq-edge-module-http",
"hivemq-edge-module-modbus",
"hivemq-edge-module-mtconnect",
"hivemq-edge-module-opcua",
"hivemq-edge-module-plc4x"
)
Expand Down
13 changes: 13 additions & 0 deletions modules/hivemq-edge-module-mtconnect/HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2023-present HiveMQ GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
208 changes: 208 additions & 0 deletions modules/hivemq-edge-module-mtconnect/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
import nl.javadude.gradle.plugins.license.DownloadLicensesExtension.license
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent.*

plugins {
java
alias(libs.plugins.defaults)
alias(libs.plugins.shadow)
alias(libs.plugins.license)
id("com.hivemq.edge-version-updater")
id("com.hivemq.third-party-license-generator")
}

group = "com.hivemq"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}

repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
exclusiveContent {
forRepository {
maven {
url = uri("https://jitpack.io")
}
}
filter {
includeGroup("com.github.simon622.mqtt-sn")
includeGroup("com.github.simon622")
}
}
}

dependencies {
compileOnly(libs.hivemq.edge.adapterSdk)
compileOnly(libs.apache.commonsIO)
compileOnly(libs.slf4j.api)
compileOnly(libs.jackson.databind)
}

dependencies {
testImplementation("com.hivemq:hivemq-edge")
testImplementation(libs.apache.commonsIO)
testImplementation(libs.assertj)
testImplementation(libs.hivemq.edge.adapterSdk)
testImplementation(libs.jackson.databind)
testImplementation(libs.junit.jupiter)
testImplementation(libs.mockito.junitJupiter)
}

tasks.test {
useJUnitPlatform()
testLogging {
events = setOf(STARTED, PASSED, FAILED, SKIPPED, STANDARD_ERROR)
exceptionFormat = TestExceptionFormat.FULL
}
}

tasks.register<Copy>("copyAllDependencies") {
shouldRunAfter("assemble")
from(configurations.runtimeClasspath)
into("${buildDir}/deps/libs")
}

tasks.named("assemble") { finalizedBy("copyAllDependencies") }

/* ******************** artifacts ******************** */

val releaseBinary: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named("binary"))
attribute(Usage.USAGE_ATTRIBUTE, objects.named("release"))
}
}

val thirdPartyLicenses: Configuration by configurations.creating {
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named("third-party-licenses"))
}
}

artifacts {
add(releaseBinary.name, tasks.shadowJar)
add(thirdPartyLicenses.name, tasks.updateThirdPartyLicenses.flatMap { it.outputDirectory })
}
/* ******************** compliance ******************** */

license {
header = file("HEADER")
mapping("java", "SLASHSTAR_STYLE")
}

downloadLicenses {
aliases = mapOf(
license("Apache License, Version 2.0", "https://opensource.org/licenses/Apache-2.0") to listOf(
"Apache 2",
"Apache 2.0",
"Apache-2.0",
"Apache License 2.0",
"Apache License, 2.0",
"Apache License v2.0",
"Apache License, Version 2",
"Apache License Version 2.0",
"Apache License, Version 2.0",
"Apache License, version 2.0",
"The Apache License, Version 2.0",
"Apache Software License - Version 2.0",
"Apache Software License, version 2.0",
"The Apache Software License, Version 2.0"
),
license("MIT License", "https://opensource.org/licenses/MIT") to listOf(
"MIT License",
"MIT license",
"The MIT License",
"The MIT License (MIT)"
),
license("CDDL, Version 1.0", "https://opensource.org/licenses/CDDL-1.0") to listOf(
"CDDL, Version 1.0",
"Common Development and Distribution License 1.0",
"COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0",
license("CDDL", "https://glassfish.dev.java.net/public/CDDLv1.0.html")
),
license("CDDL, Version 1.1", "https://oss.oracle.com/licenses/CDDL+GPL-1.1") to listOf(
"CDDL 1.1",
"CDDL, Version 1.1",
"Common Development And Distribution License 1.1",
"CDDL+GPL License",
"CDDL + GPLv2 with classpath exception",
"Dual license consisting of the CDDL v1.1 and GPL v2",
"CDDL or GPLv2 with exceptions",
"CDDL/GPLv2+CE"
),
license("LGPL, Version 2.0", "https://opensource.org/licenses/LGPL-2.0") to listOf(
"LGPL, Version 2.0",
"GNU General Public License, version 2"
),
license("LGPL, Version 2.1", "https://opensource.org/licenses/LGPL-2.1") to listOf(
"LGPL, Version 2.1",
"LGPL, version 2.1",
"GNU Lesser General Public License version 2.1 (LGPLv2.1)",
license("GNU Lesser General Public License", "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html")
),
license("LGPL, Version 3.0", "https://opensource.org/licenses/LGPL-3.0") to listOf(
"LGPL, Version 3.0",
"Lesser General Public License, version 3 or greater"
),
license("EPL, Version 1.0", "https://opensource.org/licenses/EPL-1.0") to listOf(
"EPL, Version 1.0",
"Eclipse Public License - v 1.0",
"Eclipse Public License - Version 1.0",
license("Eclipse Public License", "http://www.eclipse.org/legal/epl-v10.html")
),
license("EPL, Version 2.0", "https://opensource.org/licenses/EPL-2.0") to listOf(
"EPL 2.0",
"EPL, Version 2.0"
),
license("EDL, Version 1.0", "https://www.eclipse.org/org/documents/edl-v10.php") to listOf(
"EDL 1.0",
"EDL, Version 1.0",
"Eclipse Distribution License - v 1.0"
),
license("BSD 3-Clause License", "https://opensource.org/licenses/BSD-3-Clause") to listOf(
"BSD 3-clause",
"BSD-3-Clause",
"BSD 3-Clause License",
"3-Clause BSD License",
"New BSD License",
license("BSD", "http://asm.ow2.org/license.html"),
license("BSD", "http://asm.objectweb.org/license.html"),
license("BSD", "LICENSE.txt")
),
license("Bouncy Castle License", "https://www.bouncycastle.org/licence.html") to listOf(
"Bouncy Castle Licence"
),
license("W3C License", "https://opensource.org/licenses/W3C") to listOf(
"W3C License",
"W3C Software Copyright Notice and License",
"The W3C Software License"
),
license("CC0", "https://creativecommons.org/publicdomain/zero/1.0/") to listOf(
"CC0",
"Public Domain"
)
)

dependencyConfiguration = "runtimeClasspath"
}

tasks.updateThirdPartyLicenses {
dependsOn(tasks.downloadLicenses)
projectName.set(project.name)
group = "license"
dependencyLicense.set(tasks.downloadLicenses.get().xmlDestination.resolve("dependency-license.xml"))
outputDirectory.set(layout.buildDirectory.dir("distribution/third-party-licenses"))
}

val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements.get()) {
skip()
}
5 changes: 5 additions & 0 deletions modules/hivemq-edge-module-mtconnect/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version=2025.4-SNAPSHOT

# Enable build cache.
org.gradle.caching=true
org.gradle.jvmargs=-Xmx1024M
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.1.xsd">
<suppress>
<notes><![CDATA[
CVE has been fixed with jsoup-1.8.3, false positive.
See https://github.com/hibernate/hibernate-validator/pull/424
]]></notes>
<gav regex="true">^org\.jsoup:jsoup:.*$</gav>
<cve>CVE-2015-6748</cve>
</suppress>
<suppress>
<notes><![CDATA[
This CVE only applies to a Drupal module which uses the API
]]></notes>
<gav regex="true">^javax\.ws\.rs:javax\.ws\.rs-api:.*$</gav>
<cve>CVE-2015-4345</cve>
</suppress>
</suppressions>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 6c8ddc8

Please sign in to comment.