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

Replace PLC4X with etherip #520

Merged
merged 14 commits into from
Aug 12, 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: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ val moduleReleaseBinaries: Configuration by configurations.creating {
dependencies {
hivemq("com.hivemq:hivemq-edge")
// ** module-deps ** //
edgeModule("com.hivemq:hivemq-edge-module-etherip")
edgeModule("com.hivemq:hivemq-edge-module-file")
edgeModule("com.hivemq:hivemq-edge-module-http")
edgeModule("com.hivemq:hivemq-edge-module-plc4x")
Expand All @@ -102,6 +103,7 @@ val hivemqEdgeZip by tasks.registering(Zip::class) {

val edgeProjectsToUpdate = setOf(
"hivemq-edge",
"hivemq-edge-module-etherip",
"hivemq-edge-module-file",
"hivemq-edge-module-http",
"hivemq-edge-module-modbus",
Expand Down
2 changes: 1 addition & 1 deletion edge-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ group = "com.hivemq"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(11))
}
}

Expand Down
13 changes: 13 additions & 0 deletions modules/hivemq-edge-module-etherip/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.
10 changes: 10 additions & 0 deletions modules/hivemq-edge-module-etherip/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# EtherIP Dependency

For interacting with Ethernet IP/CIP devices we rely on an open source library which isn't published on Maven-Central:

[EtherIP](https://github.com/ornl-epics/etherip/)

We build the library internall and provide the binary in **libs/etherip-1.0.0.jar**.

In case you want to build the libary yourself simply check out the original project, build the libary and put it into
the libs folder.
217 changes: 217 additions & 0 deletions modules/hivemq-edge-module-etherip/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
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")
}

group = "com.hivemq"

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

repositories {
mavenCentral()
exclusiveContent {
forRepository {
maven {
url = uri("https://jitpack.io")
}
}
filter {
codepitbull marked this conversation as resolved.
Show resolved Hide resolved
includeGroup("com.github.simon622.mqtt-sn")
includeGroup("com.github.simon622")
}
}
}

dependencies {
compileOnly(libs.hivemq.edge.adapterSdk)
compileOnly(libs.apache.commonsIO)
compileOnly(libs.apache.commonsLang)
implementation(files("libs/etherip-1.0.0.jar"))
implementation(libs.jackson.databind)
implementation(libs.slf4j.api)
}

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

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

tasks.register<Test>("vpnTests") {
useJUnitPlatform {
includeTags("requiresVpn")
}
shouldRunAfter("test")
}


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"))
}
}

artifacts {
add(releaseBinary.name, tasks.shadowJar)
}

/* ******************** 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"
}

val updateThirdPartyLicenses by tasks.registering {
group = "license"
dependsOn(tasks.downloadLicenses)
doLast {
javaexec {
classpath("gradle/tools/license-third-party-tool-2.0.jar")
args(
"$buildDir/reports/license/dependency-license.xml",
"$projectDir/src/distribution/third-party-licenses/licenses",
"$projectDir/src/distribution/third-party-licenses/licenses.html"
)
}
}
}

val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements.get()) {
skip()
}
1 change: 1 addition & 0 deletions modules/hivemq-edge-module-etherip/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version=2024.6
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>
24 changes: 24 additions & 0 deletions modules/hivemq-edge-module-etherip/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[versions]
apache-commonsIO = "2.16.1"
apache-commonsLang = "3.14.0"
assertj = "3.25.3"
hivemq-edge-adapterSdk = "2024.5"
jackson = "2.17.1"
junit-jupiter = "5.10.3"
mockito = "5.12.0"
slf4j = "2.0.13"

[libraries]
apache-commonsIO = { module = "commons-io:commons-io", version.ref = "apache-commonsIO" }
apache-commonsLang = { module = "org.apache.commons:commons-lang3", version.ref = "apache-commonsLang" }
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
hivemq-edge-adapterSdk = { module = "com.hivemq:hivemq-edge-adapter-sdk", version.ref = "hivemq-edge-adapterSdk" }
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
mockito-junitJupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }

[plugins]
license = { id = "com.github.hierynomus.license", version = "0.16.1" }
shadow = { id = "com.github.johnrengelman.shadow", version = "8.1.1" }
defaults = { id = "io.github.sgtsilvio.gradle.defaults", version = "0.2.0" }
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,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading