diff --git a/.dockerignore b/.dockerignore index 8e24f8bb909..cef3f4a9186 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,21 +1,21 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# - -Dockerfile -.dockerignore -.git/** +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +Dockerfile +.dockerignore +.git/** **/target/** \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index df7383c37b0..a84ad446e94 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,31 +1,31 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# - -[*] -charset=utf-8 -end_of_line=lf -insert_final_newline=false -indent_style=space -indent_size=4 - -[{*.yml,*.yaml}] -indent_style=space -indent_size=2 - -[*.xml] -indent_style=space -indent_size=2 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +[*] +charset=utf-8 +end_of_line=lf +insert_final_newline=false +indent_style=space +indent_size=4 + +[{*.yml,*.yaml}] +indent_style=space +indent_size=2 + +[*.xml] +indent_style=space +indent_size=2 diff --git a/.gitignore b/.gitignore index 124d53fa947..e7b7c185646 100644 --- a/.gitignore +++ b/.gitignore @@ -1,170 +1,170 @@ -# User-specific stuff: -.idea/** -*.iml -.vscode/** - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# JIRA plugin -atlassian-ide-plugin.xml - -### Java template -# Compiled class file -*.class - -# Log file -*.log - -# Package Files # -*.jar -*.war -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -# Asciidoctor plugin -.asciidoctor - -### Maven template -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties -dependency-reduced-pom.xml -buildNumber.properties -.mvn/timing.properties - -### Eclipse template -.metadata -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders -.project -.classpath - -# Locally stored "Eclipse launch configurations" -*.launch - -# STS (Spring Tool Suite) -.springBeans - -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet - -# Emacs backup files -*~ -.scannerwork - -spock-reports - -# Other exclusions - -.DS_Store -elasticsearch-data/ -jqassistant/ - -# Exclude the C++ libs -plc4cpp/libs/libs/ -plc4cpp/.idea/ -plc4cpp/cmake-build-debug/ - - # Ignore VisualStudio related files -**/CMakeSettings.json -**/.vs/** - -# Exclude temporary python stuff -plc4py/venv/ -**/__pycache__/**/* -/plc4cpp/.vscode/ipch - -# Exclude gradle stuff -.gradle -/build/ - -# Ignore Gradle GUI config -gradle-app.setting - -# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) -!gradle-wrapper.jar - -# Cache of project -.gradletasknamecache - -# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 -# gradle/wrapper/gradle-wrapper.properties - -exclude ruby specifics: - -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/spec/examples.txt -/test/tmp/ -/test/version_tmp/ -/tmp/ - -# Used by dotenv library to load environment variables. -# .env - -# Ignore Byebug command history file. -.byebug_history - -## Specific to RubyMotion: -.dat* -.repl_history -build/ -*.bridgesupport -build-iPhoneOS/ -build-iPhoneSimulator/ - -## Specific to RubyMotion (use of CocoaPods): -# -# We recommend against adding the Pods directory to your .gitignore. However -# you should judge for yourself, the pros and cons are mentioned at: -# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control -# -# vendor/Pods/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalization: -/.bundle/ -/vendor/bundle -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +# User-specific stuff: +.idea/** +*.iml +.vscode/** + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# JIRA plugin +atlassian-ide-plugin.xml + +### Java template +# Compiled class file +*.class + +# Log file +*.log + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# Asciidoctor plugin +.asciidoctor + +### Maven template +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties + +### Eclipse template +.metadata +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders +.project +.classpath + +# Locally stored "Eclipse launch configurations" +*.launch + +# STS (Spring Tool Suite) +.springBeans + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Emacs backup files +*~ +.scannerwork + +spock-reports + +# Other exclusions + +.DS_Store +elasticsearch-data/ +jqassistant/ + +# Exclude the C++ libs +plc4cpp/libs/libs/ +plc4cpp/.idea/ +plc4cpp/cmake-build-debug/ + + # Ignore VisualStudio related files +**/CMakeSettings.json +**/.vs/** + +# Exclude temporary python stuff +plc4py/venv/ +**/__pycache__/**/* +/plc4cpp/.vscode/ipch + +# Exclude gradle stuff +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +exclude ruby specifics: + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# Used by dotenv library to load environment variables. +# .env + +# Ignore Byebug command history file. +.byebug_history + +## Specific to RubyMotion: +.dat* +.repl_history +build/ +*.bridgesupport +build-iPhoneOS/ +build-iPhoneSimulator/ + +## Specific to RubyMotion (use of CocoaPods): +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# vendor/Pods/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 64a03f04cbd..a191e41f564 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,48 +1,48 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# - -image: maven:3-jdk-8 - -# Asciidoctor requires some tools for generating the documentation -before_script: - - apt-get update - - apt-get install -y python-seqdiag python-nwdiag - -stages: - - build - - stage-site - -build: - stage: build - script: - - mvn clean package site site:stage - artifacts: - paths: - - target/staging - -# Have gitlab publish the content of the target/staging directory as gitlab pages website -# NOTE: Don't ask me why I have to rename it that way ... -pages: - stage: stage-site - script: - - mkdir public - - mv target/staging/* public/ - artifacts: - paths: - - public - only: - - master +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +image: maven:3-jdk-8 + +# Asciidoctor requires some tools for generating the documentation +before_script: + - apt-get update + - apt-get install -y python-seqdiag python-nwdiag + +stages: + - build + - stage-site + +build: + stage: build + script: + - mvn clean package site site:stage + artifacts: + paths: + - target/staging + +# Have gitlab publish the content of the target/staging directory as gitlab pages website +# NOTE: Don't ask me why I have to rename it that way ... +pages: + stage: stage-site + script: + - mkdir public + - mv target/staging/* public/ + artifacts: + paths: + - public + only: + - master diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index acf6e3fd534..a3572edef10 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -1,28 +1,28 @@ - - - - - + + + + + \ No newline at end of file diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java index a2fae998bed..de90d650419 100644 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -1,117 +1,117 @@ -/* - * Copyright 2007-present the original author or authors. - * - * 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. - */ -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - private static final String WRAPPER_VERSION = "0.5.2"; - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" - + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if(mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if(mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if(!outputFile.getParentFile().exists()) { - if(!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { - String username = System.getenv("MVNW_USERNAME"); - char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - } - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} +/* + * Copyright 2007-present the original author or authors. + * + * 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. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.2"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index e8975771b15..7d74bae7716 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,19 +1,19 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. - -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.2/maven-wrapper-0.5.2.jar +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.2/maven-wrapper-0.5.2.jar diff --git a/.travis.yml b/.travis.yml index 271456fc470..a386b9fe5bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,30 +1,30 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# - -language: java - -env: - - MAVEN_OPTS="-Xms512m -Xmx512m" - -matrix: - fast_finish: true - -install: true - -script: - - jdk_switcher use oraclejdk8 - - mvn clean install site:site +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +language: java + +env: + - MAVEN_OPTS="-Xms512m -Xmx512m" + +matrix: + fast_finish: true + +install: true + +script: + - jdk_switcher use oraclejdk8 + - mvn clean install site:site diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2c5316949dd..b8e11e93605 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,50 +1,50 @@ - -# Concepts (open for discussion) - -## Requirements - -- Maven >= 3.3.1 -- Java >= 8 - -## General - -- All modules should use only one primary build system -- It should be super-easy for new contributors to get started (A new contributor should be able to checkout and build with a core testsuite with a simple: 'mvn package' run) -- New code should only be accepted, if there are tests (Currently the java part of the build is configured to fail if the code coverage is below 90%) - -## Java Specific - -- Development should be done in Java 8 -- Providing Java 7 compatible versions should be possible by using the retrolambda plugin - - Usage of default implementations does cause more problems than it solves in this case. - -## IDE specific -- For formatting there is a .editorconfig defined. Intellij Idea come with a plugin for this pre-installed, for eclipse an installation is required (http://editorconfig.org/). -- Import organizing uses the Intellij Idea default: - - Import order - - all other imports - - blank - - import javax.* - - import java.* - - blank - - all other static imports - - Star imports - - number of imports needed for .* = 5 + +# Concepts (open for discussion) + +## Requirements + +- Maven >= 3.3.1 +- Java >= 8 + +## General + +- All modules should use only one primary build system +- It should be super-easy for new contributors to get started (A new contributor should be able to checkout and build with a core testsuite with a simple: 'mvn package' run) +- New code should only be accepted, if there are tests (Currently the java part of the build is configured to fail if the code coverage is below 90%) + +## Java Specific + +- Development should be done in Java 8 +- Providing Java 7 compatible versions should be possible by using the retrolambda plugin + - Usage of default implementations does cause more problems than it solves in this case. + +## IDE specific +- For formatting there is a .editorconfig defined. Intellij Idea come with a plugin for this pre-installed, for eclipse an installation is required (http://editorconfig.org/). +- Import organizing uses the Intellij Idea default: + - Import order + - all other imports + - blank + - import javax.* + - import java.* + - blank + - all other static imports + - Star imports + - number of imports needed for .* = 5 - number of static-imports needed for .* = 3 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 00a96bbc1be..871e17a0107 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,114 +1,114 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. - -########################################################################################## -# Build PLC4X -########################################################################################## - -# This is the image we'll use to execute the build (and give it the name 'build'). -# (This image is based on Ubuntu) -# Fixed version of this in order to have a fixed JDK version -FROM azul/zulu-openjdk:8.42.0.21 as build - -# Install some stuff we need to run the build -RUN apt update -y - -# Install general purpose tools -RUN apt install -y make libpcap-dev libc-dev - -# Requied for "with-boost" profile -RUN apt install -y bison flex gcc g++ - -# Required for "with-cpp" profile -RUN apt install -y gcc g++ - -# Required for "with-dotnet" profile -RUN apt install -y wget -RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb -RUN dpkg -i packages-microsoft-prod.deb -RUN apt install -y software-properties-common -RUN add-apt-repository universe -y -RUN apt install -y apt-transport-https -RUN apt update -y -RUN apt install -y dotnet-sdk-2.2 - -# Required for the general build -RUN apt install -y git - -# Required for "with-proxies" -RUN apt install -y bison flex gcc g++ - -# Required for "with-python" profile -RUN apt install -y python-setuptools python - -# Copy the project into the docker container -COPY . /ws/ - -# Change the working directory (where commands are executed) into the new "ws" directory -WORKDIR /ws - -# Tell Maven to fetch all needed dependencies first, so they can get cached -# (Tried a patched version of the plugin to allow exclusion of inner artifacts. -# See https://issues.apache.org/jira/browse/MDEP-568 for details) -RUN ./mvnw -P with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash com.offbytwo.maven.plugins:maven-dependency-plugin:3.1.1.MDEP568:go-offline -DexcludeGroupIds=org.apache.plc4x,org.apache.plc4x.examples,org.apache.plc4x.sandbox -# Build everything with all tests -RUN ./mvnw -P with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash install - -# Get the version of the project and save it in a local file on the container -RUN ./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -DforceStdout -q -pl . > project_version - -########################################################################################## -# Build a demo container -########################################################################################## - -# Move the file to a place we can reference it from without a version -RUN PROJECT_VERSION=`cat project_version`; mv plc4j/examples/hello-storage-elasticsearch/target/plc4j-hello-storage-elasticsearch-$PROJECT_VERSION-uber-jar.jar plc4xdemo.jar - -# Build a highly optimized JRE -FROM alpine:3.10 as packager - -# Install regular JDK -RUN apk update -RUN apk --no-cache add openjdk11-jdk openjdk11-jmods - -# build minimal JRE -ENV JAVA_MINIMAL="/opt/java-minimal" -RUN /usr/lib/jvm/java-11-openjdk/bin/jlink \ - --verbose \ - --add-modules \ - java.base,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \ - --compress 2 --strip-debug --no-header-files --no-man-pages \ - --release-info="add:IMPLEMENTOR=radistao:IMPLEMENTOR_VERSION=radistao_JRE" \ - --output "$JAVA_MINIMAL" - -# Now create an actuall deployment container -FROM alpine:3.10 - -# Install our optimized JRE -ENV JAVA_HOME=/opt/java-minimal -ENV PATH="$PATH:$JAVA_HOME/bin" -COPY --from=packager "$JAVA_HOME" "$JAVA_HOME" - -# Prepare the demo by copying the example artifact from the 'build' container into this new one. -COPY --from=build /ws/plc4xdemo.jar /plc4xdemo.jar - -# Let runtime know which ports we will be listening on -EXPOSE 9200 9300 - -# Allow for extra options to be passed to the jar using PLC4X_OPTIONS env variable -ENV PLC4X_OPTIONS "" - -# This will be executed as soon as the container is started. -ENTRYPOINT ["sh", "-c", "[ -f /run/plc4xdemo.env ] && . /run/plc4xdemo.env ; java -jar /plc4xdemo.jar $PLC4X_OPTIONS"] +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +########################################################################################## +# Build PLC4X +########################################################################################## + +# This is the image we'll use to execute the build (and give it the name 'build'). +# (This image is based on Ubuntu) +# Fixed version of this in order to have a fixed JDK version +FROM azul/zulu-openjdk:8.42.0.21 as build + +# Install some stuff we need to run the build +RUN apt update -y + +# Install general purpose tools +RUN apt install -y make libpcap-dev libc-dev + +# Requied for "with-boost" profile +RUN apt install -y bison flex gcc g++ + +# Required for "with-cpp" profile +RUN apt install -y gcc g++ + +# Required for "with-dotnet" profile +RUN apt install -y wget +RUN wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb +RUN dpkg -i packages-microsoft-prod.deb +RUN apt install -y software-properties-common +RUN add-apt-repository universe -y +RUN apt install -y apt-transport-https +RUN apt update -y +RUN apt install -y dotnet-sdk-2.2 + +# Required for the general build +RUN apt install -y git + +# Required for "with-proxies" +RUN apt install -y bison flex gcc g++ + +# Required for "with-python" profile +RUN apt install -y python-setuptools python + +# Copy the project into the docker container +COPY . /ws/ + +# Change the working directory (where commands are executed) into the new "ws" directory +WORKDIR /ws + +# Tell Maven to fetch all needed dependencies first, so they can get cached +# (Tried a patched version of the plugin to allow exclusion of inner artifacts. +# See https://issues.apache.org/jira/browse/MDEP-568 for details) +RUN ./mvnw -P with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash com.offbytwo.maven.plugins:maven-dependency-plugin:3.1.1.MDEP568:go-offline -DexcludeGroupIds=org.apache.plc4x,org.apache.plc4x.examples,org.apache.plc4x.sandbox +# Build everything with all tests +RUN ./mvnw -P with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash install + +# Get the version of the project and save it in a local file on the container +RUN ./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -DforceStdout -q -pl . > project_version + +########################################################################################## +# Build a demo container +########################################################################################## + +# Move the file to a place we can reference it from without a version +RUN PROJECT_VERSION=`cat project_version`; mv plc4j/examples/hello-storage-elasticsearch/target/plc4j-hello-storage-elasticsearch-$PROJECT_VERSION-uber-jar.jar plc4xdemo.jar + +# Build a highly optimized JRE +FROM alpine:3.10 as packager + +# Install regular JDK +RUN apk update +RUN apk --no-cache add openjdk11-jdk openjdk11-jmods + +# build minimal JRE +ENV JAVA_MINIMAL="/opt/java-minimal" +RUN /usr/lib/jvm/java-11-openjdk/bin/jlink \ + --verbose \ + --add-modules \ + java.base,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \ + --compress 2 --strip-debug --no-header-files --no-man-pages \ + --release-info="add:IMPLEMENTOR=radistao:IMPLEMENTOR_VERSION=radistao_JRE" \ + --output "$JAVA_MINIMAL" + +# Now create an actuall deployment container +FROM alpine:3.10 + +# Install our optimized JRE +ENV JAVA_HOME=/opt/java-minimal +ENV PATH="$PATH:$JAVA_HOME/bin" +COPY --from=packager "$JAVA_HOME" "$JAVA_HOME" + +# Prepare the demo by copying the example artifact from the 'build' container into this new one. +COPY --from=build /ws/plc4xdemo.jar /plc4xdemo.jar + +# Let runtime know which ports we will be listening on +EXPOSE 9200 9300 + +# Allow for extra options to be passed to the jar using PLC4X_OPTIONS env variable +ENV PLC4X_OPTIONS "" + +# This will be executed as soon as the container is started. +ENTRYPOINT ["sh", "-c", "[ -f /run/plc4xdemo.env ] && . /run/plc4xdemo.env ; java -jar /plc4xdemo.jar $PLC4X_OPTIONS"] diff --git a/Jenkinsfile b/Jenkinsfile index 989f0114e28..2f5fbc2a805 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,309 +1,309 @@ -#!groovy - -/* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * - */ -pipeline { - - agent { - node { - label 'plc4x' - } - } - - environment { - // It seems the login the jenkins slave uses, doesn't pick up the environment changes, - // so we have to try to manually add theme here. - MAVEN_HOME = '/opt/maven' - PATH = "${MAVEN_HOME}/bin:${env.PATH}" - - PLC4X_BUILD_ON_JENKINS = true - JENKINS_PROFILE = 'jenkins-build' - // On non develop build we don't want to pollute the global m2 repo - MVN_LOCAL_REPO_OPT = '-Dmaven.repo.local=.repository' - // Test failures will be handled by the jenkins junit steps and mark the build as unstable. - MVN_TEST_FAIL_IGNORE = '-Dmaven.test.failure.ignore=true' - - SONARCLOUD_PARAMS = "-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_plc4x -Dsonar.branch.name=develop" - } - - tools { - maven 'Maven 3 (latest)' - jdk 'JDK 1.8 (latest)' - } - - options { - // Kill this job after one hour. - timeout(time: 24, unit: 'HOURS') - // When we have test-fails e.g. we don't need to run the remaining steps - skipStagesAfterUnstable() - buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '3')) - } - - stages { - stage('Initialization') { - steps { - echo 'Building Branch: ' + env.BRANCH_NAME - echo 'Using PATH = ' + env.PATH - } - } - - stage('Cleanup') { - steps { - echo 'Cleaning up the workspace' - deleteDir() - } - } - - stage('Checkout') { - steps { - echo 'Checking out branch ' + env.BRANCH_NAME - checkout scm - } - } - - stage('Build') { - when { - expression { - env.BRANCH_NAME != 'develop' - } - } - steps { - echo 'Building' - //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash ${MVN_TEST_FAIL_IGNORE} ${MVN_LOCAL_REPO_OPT} clean install' - sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-logstash ${MVN_TEST_FAIL_IGNORE} ${MVN_LOCAL_REPO_OPT} clean install' - } - post { - always { - junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true) - junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true) - } - } - } - - stage('Build develop') { - when { - branch 'develop' - } - steps { - echo 'Building' - // Clean up the snapshots directory. - dir("local-snapshots-dir/") { - deleteDir() - } - - // We'll deploy to a relative directory so we can save - // that and deploy in a later step on a different node - //sh 'mvn -U -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash ${MVN_TEST_FAIL_IGNORE} ${JQASSISTANT_NEO4J_VERSION} -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy' - sh 'mvn -U -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-logstash ${MVN_TEST_FAIL_IGNORE} ${JQASSISTANT_NEO4J_VERSION} -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy' - - // Stash the build results so we can deploy them on another node - stash name: 'plc4x-build-snapshots', includes: 'local-snapshots-dir/**' - } - post { - always { - junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true) - junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true) - } - } - } - - stage('Code Quality') { - when { - branch 'develop' - } - steps { - echo 'Checking Code Quality on SonarCloud' - withCredentials([string(credentialsId: 'chris-sonarcloud-token', variable: 'SONAR_TOKEN')]) { - //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-python,with-proxies,with-sandbox,with-logstash sonar:sonar ${SONARCLOUD_PARAMS} -Dsonar.login=${SONAR_TOKEN}' - sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-sandbox,with-logstash sonar:sonar ${SONARCLOUD_PARAMS} -Dsonar.login=${SONAR_TOKEN}' - } - } - } - - stage('Deploy') { - when { - branch 'develop' - } - // Only the official build nodes have the credentials to deploy setup. - agent { - node { - label 'nexus-deploy' - } - } - steps { - echo 'Deploying' - // Clean up the snapshots directory. - dir("local-snapshots-dir/") { - deleteDir() - } - - // Unstash the previously stashed build results. - unstash name: 'plc4x-build-snapshots' - - // Deploy the artifacts using the wagon-maven-plugin. - sh 'mvn -f jenkins.pom -X -P deploy-snapshots wagon:upload' - - // Clean up the snapshots directory (freeing up more space after deploying). - dir("local-snapshots-dir/") { - deleteDir() - } - } - } - - stage('Build site') { - when { - branch 'develop' - } - steps { - echo 'Building Site' - //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-proxies,with-logstash site' - sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-logstash site' - } - } - - stage('Stage site') { - when { - branch 'develop' - } - steps { - echo 'Staging Site' - // Build a directory containing the aggregated website. - //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-proxies,with-logstash site:stage' - sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-logstash site:stage' - // Make sure the script is executable. - sh 'chmod +x tools/clean-site.sh' - // Remove some redundant resources, which shouldn't be required. - sh 'tools/clean-site.sh' - // Stash the generated site so we can publish it on the 'git-website' node. - stash includes: 'target/staging/**/*', name: 'plc4x-site' - } - } - - stage('Deploy site') { - when { - branch 'develop' - } - // Only the nodes labeled 'git-websites' have the credentials to commit to the. - agent { - node { - label 'git-websites' - } - } - steps { - echo 'Deploying Site' - // Clean up the site directory. - dir("target/staging") { - deleteDir() - } - - // Unstash the previously stashed site. - unstash 'plc4x-site' - // Publish the site with the scm-publish plugin. - sh 'mvn -f jenkins.pom -X -P deploy-site scm-publish:publish-scm' - - // Clean up the snapshots directory (freeing up more space after deploying). - dir("target/staging") { - deleteDir() - } - } - } - } - - // Send out notifications on unsuccessful builds. - post { - // If this build failed, send an email to the list. - failure { - script { - if(env.BRANCH_NAME == "develop") { - emailext( - subject: "[BUILD-FAILURE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'", - body: """ -BUILD-FAILURE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]': - -Check console output at "${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]" -""", - to: "dev@plc4x.apache.org", - recipientProviders: [[$class: 'DevelopersRecipientProvider']] - ) - } - } - } - - // If this build didn't fail, but there were failing tests, send an email to the list. - unstable { - script { - if(env.BRANCH_NAME == "develop") { - emailext( - subject: "[BUILD-UNSTABLE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'", - body: """ -BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]': - -Check console output at "${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]" -""", - to: "dev@plc4x.apache.org", - recipientProviders: [[$class: 'DevelopersRecipientProvider']] - ) - } - } - } - - // Send an email, if the last build was not successful and this one is. - success { - // Cleanup the build directory if the build was successful - // (in this cae we probably don't have to do any post-build analysis) - deleteDir() - script { - if ((env.BRANCH_NAME == "develop") && (currentBuild.previousBuild != null) && (currentBuild.previousBuild.result != 'SUCCESS')) { - emailext ( - subject: "[BUILD-STABLE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'", - body: """ -BUILD-STABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]': - -Is back to normal. -""", - to: "dev@plc4x.apache.org", - recipientProviders: [[$class: 'DevelopersRecipientProvider']] - ) - } - } - } - - always { - script { - if(env.BRANCH_NAME == "master") { - // Double check if something was really changed as sometimes the - // build just runs without any changes. - if(currentBuild.changeSets.size() > 0) { - emailext( - subject: "[COMMIT-TO-MASTER]: A commit to the master branch was made'", - body: """ -COMMIT-TO-MASTER: A commit to the master branch was made: - -Check console output at "${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]" -""", - to: "dev@plc4x.apache.org", - recipientProviders: [[$class: 'DevelopersRecipientProvider']] - ) - } - } - } - } - } - -} +#!groovy + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + * + */ +pipeline { + + agent { + node { + label 'plc4x' + } + } + + environment { + // It seems the login the jenkins slave uses, doesn't pick up the environment changes, + // so we have to try to manually add theme here. + MAVEN_HOME = '/opt/maven' + PATH = "${MAVEN_HOME}/bin:${env.PATH}" + + PLC4X_BUILD_ON_JENKINS = true + JENKINS_PROFILE = 'jenkins-build' + // On non develop build we don't want to pollute the global m2 repo + MVN_LOCAL_REPO_OPT = '-Dmaven.repo.local=.repository' + // Test failures will be handled by the jenkins junit steps and mark the build as unstable. + MVN_TEST_FAIL_IGNORE = '-Dmaven.test.failure.ignore=true' + + SONARCLOUD_PARAMS = "-Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=apache -Dsonar.projectKey=apache_plc4x -Dsonar.branch.name=develop" + } + + tools { + maven 'Maven 3 (latest)' + jdk 'JDK 1.8 (latest)' + } + + options { + // Kill this job after one hour. + timeout(time: 24, unit: 'HOURS') + // When we have test-fails e.g. we don't need to run the remaining steps + skipStagesAfterUnstable() + buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '3')) + } + + stages { + stage('Initialization') { + steps { + echo 'Building Branch: ' + env.BRANCH_NAME + echo 'Using PATH = ' + env.PATH + } + } + + stage('Cleanup') { + steps { + echo 'Cleaning up the workspace' + deleteDir() + } + } + + stage('Checkout') { + steps { + echo 'Checking out branch ' + env.BRANCH_NAME + checkout scm + } + } + + stage('Build') { + when { + expression { + env.BRANCH_NAME != 'develop' + } + } + steps { + echo 'Building' + //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash ${MVN_TEST_FAIL_IGNORE} ${MVN_LOCAL_REPO_OPT} clean install' + sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-logstash ${MVN_TEST_FAIL_IGNORE} ${MVN_LOCAL_REPO_OPT} clean install' + } + post { + always { + junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true) + junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true) + } + } + } + + stage('Build develop') { + when { + branch 'develop' + } + steps { + echo 'Building' + // Clean up the snapshots directory. + dir("local-snapshots-dir/") { + deleteDir() + } + + // We'll deploy to a relative directory so we can save + // that and deploy in a later step on a different node + //sh 'mvn -U -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-cpp,with-boost,with-dotnet,with-python,with-proxies,with-logstash ${MVN_TEST_FAIL_IGNORE} ${JQASSISTANT_NEO4J_VERSION} -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy' + sh 'mvn -U -P${JENKINS_PROFILE},skip-prerequisite-check,development,with-sandbox,with-logstash ${MVN_TEST_FAIL_IGNORE} ${JQASSISTANT_NEO4J_VERSION} -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy' + + // Stash the build results so we can deploy them on another node + stash name: 'plc4x-build-snapshots', includes: 'local-snapshots-dir/**' + } + post { + always { + junit(testResults: '**/surefire-reports/*.xml', allowEmptyResults: true) + junit(testResults: '**/failsafe-reports/*.xml', allowEmptyResults: true) + } + } + } + + stage('Code Quality') { + when { + branch 'develop' + } + steps { + echo 'Checking Code Quality on SonarCloud' + withCredentials([string(credentialsId: 'chris-sonarcloud-token', variable: 'SONAR_TOKEN')]) { + //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-python,with-proxies,with-sandbox,with-logstash sonar:sonar ${SONARCLOUD_PARAMS} -Dsonar.login=${SONAR_TOKEN}' + sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-sandbox,with-logstash sonar:sonar ${SONARCLOUD_PARAMS} -Dsonar.login=${SONAR_TOKEN}' + } + } + } + + stage('Deploy') { + when { + branch 'develop' + } + // Only the official build nodes have the credentials to deploy setup. + agent { + node { + label 'nexus-deploy' + } + } + steps { + echo 'Deploying' + // Clean up the snapshots directory. + dir("local-snapshots-dir/") { + deleteDir() + } + + // Unstash the previously stashed build results. + unstash name: 'plc4x-build-snapshots' + + // Deploy the artifacts using the wagon-maven-plugin. + sh 'mvn -f jenkins.pom -X -P deploy-snapshots wagon:upload' + + // Clean up the snapshots directory (freeing up more space after deploying). + dir("local-snapshots-dir/") { + deleteDir() + } + } + } + + stage('Build site') { + when { + branch 'develop' + } + steps { + echo 'Building Site' + //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-proxies,with-logstash site' + sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-logstash site' + } + } + + stage('Stage site') { + when { + branch 'develop' + } + steps { + echo 'Staging Site' + // Build a directory containing the aggregated website. + //sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-proxies,with-logstash site:stage' + sh 'mvn -P${JENKINS_PROFILE},skip-prerequisite-check,with-logstash site:stage' + // Make sure the script is executable. + sh 'chmod +x tools/clean-site.sh' + // Remove some redundant resources, which shouldn't be required. + sh 'tools/clean-site.sh' + // Stash the generated site so we can publish it on the 'git-website' node. + stash includes: 'target/staging/**/*', name: 'plc4x-site' + } + } + + stage('Deploy site') { + when { + branch 'develop' + } + // Only the nodes labeled 'git-websites' have the credentials to commit to the. + agent { + node { + label 'git-websites' + } + } + steps { + echo 'Deploying Site' + // Clean up the site directory. + dir("target/staging") { + deleteDir() + } + + // Unstash the previously stashed site. + unstash 'plc4x-site' + // Publish the site with the scm-publish plugin. + sh 'mvn -f jenkins.pom -X -P deploy-site scm-publish:publish-scm' + + // Clean up the snapshots directory (freeing up more space after deploying). + dir("target/staging") { + deleteDir() + } + } + } + } + + // Send out notifications on unsuccessful builds. + post { + // If this build failed, send an email to the list. + failure { + script { + if(env.BRANCH_NAME == "develop") { + emailext( + subject: "[BUILD-FAILURE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'", + body: """ +BUILD-FAILURE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]': + +Check console output at "${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]" +""", + to: "dev@plc4x.apache.org", + recipientProviders: [[$class: 'DevelopersRecipientProvider']] + ) + } + } + } + + // If this build didn't fail, but there were failing tests, send an email to the list. + unstable { + script { + if(env.BRANCH_NAME == "develop") { + emailext( + subject: "[BUILD-UNSTABLE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'", + body: """ +BUILD-UNSTABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]': + +Check console output at "${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]" +""", + to: "dev@plc4x.apache.org", + recipientProviders: [[$class: 'DevelopersRecipientProvider']] + ) + } + } + } + + // Send an email, if the last build was not successful and this one is. + success { + // Cleanup the build directory if the build was successful + // (in this cae we probably don't have to do any post-build analysis) + deleteDir() + script { + if ((env.BRANCH_NAME == "develop") && (currentBuild.previousBuild != null) && (currentBuild.previousBuild.result != 'SUCCESS')) { + emailext ( + subject: "[BUILD-STABLE]: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]'", + body: """ +BUILD-STABLE: Job '${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]': + +Is back to normal. +""", + to: "dev@plc4x.apache.org", + recipientProviders: [[$class: 'DevelopersRecipientProvider']] + ) + } + } + } + + always { + script { + if(env.BRANCH_NAME == "master") { + // Double check if something was really changed as sometimes the + // build just runs without any changes. + if(currentBuild.changeSets.size() > 0) { + emailext( + subject: "[COMMIT-TO-MASTER]: A commit to the master branch was made'", + body: """ +COMMIT-TO-MASTER: A commit to the master branch was made: + +Check console output at "${env.JOB_NAME} [${env.BRANCH_NAME}] [${env.BUILD_NUMBER}]" +""", + to: "dev@plc4x.apache.org", + recipientProviders: [[$class: 'DevelopersRecipientProvider']] + ) + } + } + } + } + } + +} diff --git a/LICENSE b/LICENSE index 033d5d4c161..1495f33117a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,222 +1,222 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - -=============================================================== - -The files: -plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/attic/RawEthernetSocket.java -plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/attic/RawIpSocket.java -plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/attic/RawSocketListener.java -Are copyrighted by the The Netty Project which is distributed under the Apache 2.0 license. - -The files: -.mvn/wrapper/MavenWrapperDownloader.java -mvnw -mvnw.cmd -Are provided from the Github Project: https://github.com/takari/maven-wrapper -which is distributed under the Apache 2.0 license. - -The file: -build-utils/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/Expression.g4 -is licensed under the Category A: "UNLICENSE" which is available here: -UNLICENSE file in the licenses directory. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + +=============================================================== + +The files: +plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/attic/RawEthernetSocket.java +plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/attic/RawIpSocket.java +plc4j/utils/raw-sockets/src/main/java/org/apache/plc4x/java/utils/rawsockets/attic/RawSocketListener.java +Are copyrighted by the The Netty Project which is distributed under the Apache 2.0 license. + +The files: +.mvn/wrapper/MavenWrapperDownloader.java +mvnw +mvnw.cmd +Are provided from the Github Project: https://github.com/takari/maven-wrapper +which is distributed under the Apache 2.0 license. + +The file: +build-utils/protocol-base-mspec/src/main/antlr4/org/apache/plc4x/plugins/codegenerator/language/mspec/expression/Expression.g4 +is licensed under the Category A: "UNLICENSE" which is available here: +UNLICENSE file in the licenses directory. diff --git a/NOTICE b/NOTICE index 6ff3737bfe3..30bbeb42320 100644 --- a/NOTICE +++ b/NOTICE @@ -1,13 +1,13 @@ -Apache PLC4X -Copyright 2017-2019 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - ----------------------------------------------- - -This product includes software developed at -The Netty project (https://netty.io/). - -This product includes software developed at -The Milo project (https://github.com/eclipse/milo). +Apache PLC4X +Copyright 2017-2019 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +---------------------------------------------- + +This product includes software developed at +The Netty project (https://netty.io/). + +This product includes software developed at +The Milo project (https://github.com/eclipse/milo). diff --git a/README.md b/README.md index 80504de21d6..4c4f85ecf69 100644 --- a/README.md +++ b/README.md @@ -1,280 +1,280 @@ - -[![Maven central](https://img.shields.io/maven-central/v/org.apache.plc4x/plc4j-api.svg)](https://img.shields.io/maven-central/v/org.apache.plc4x/plc4j-api.svg) -[![License](https://img.shields.io/github/license/apache/plc4x.svg)](http://www.apache.org/licenses/LICENSE-2.0) -[![Last commit](https://img.shields.io/github/last-commit/apache/plc4x.svg)]() -[![Twitter](https://img.shields.io/twitter/follow/ApachePLC4X.svg?label=Follow&style=social)](https://twitter.com/ApachePLC4X) - - -

-
- Apache PLC4X Logo -
-

-

The Industrial IoT adapter

-

The ultimate goal of PLC4X is to create a set of libraries, that allow unified access to any type of - PLC

- -*** - -# Table of contents - - * [About PLC4X](#about-apache-plc4x) - * [Getting Started](#getting-started) - * [Developers](#developers) - * [Community](#community) - * [Contributing](#contributing) - * [Licensing](#licensing) - -*** - -## About Apache PLC4X - -Apache PLC4X is an effort to create a set of libraries for communicating with industrial grade programmable logic controllers (PLCs) in a uniform way. -We are planning on shipping libraries for usage in: - -1. Java -2. C/C++ (not ready for usage) -3. C# (.Net) (not ready for usage) -4. Python (not ready for usage) - -PLC4X also integrates with other Apache projects, such as: - -* [Apache Calcite](https://calcite.apache.org/) -* [Apache Camel](https://camel.apache.org/) -* [Apache Edgent](https://edgent.apache.org/) -* [Apache Kafka-Connect](https://kafka.apache.org) -* [Apache Karaf](https://karaf.apache.org/) -* [Apache NiFi](https://nifi.apache.org/) - -## Getting started - -Depending on the programming language, the usage will differ, therefore please go to the -[Getting Started](https://plc4x.apache.org/users/gettingstarted.html) on the PLC4X website to look up -the language of choice. - -### Java - -See the PLC4J user guide on the website to start using PLC4X in your Java application: -[https://plc4x.apache.org/plc4j/users/gettingstarted.html](https://plc4x.apache.org/plc4j/users/gettingstarted.html) - -## Developers - -### Environment - -Currently the project is configured to require the following software: - -1. Java 8 JDK: For running Maven in general as well as compiling the Java and Scala modules `JAVA_HOME` configured to - point to that. -2. libpcap/WinPcap for raw socket tests in Java or use of `passive-mode` drivers -3. (Optional) Graphwiz: For generating the graphs in the documentation (http://www.graphviz.org/) -4. Git (even when working on the source distribution) - -With this setup you will be able to build the Java part of PLC4X excluding the "proxy" drivers and servers. -For a full build of PLC4X with all options the following has to be provided: - -#### Linux - -On a clean Ubuntu 18.04 the following software needs to be installed: - -``` - sudo apt install python-setuptools gcc g++ make libpcap-dev -``` - -If you're building a source-distribution and haven't installed git yet, be sure to do so: - -``` - sudo get install git -``` - -In order to build the .Net version, please install the .Net package according to this guide: - -https://dev.to/carlos487/installing-dotnet-core-in-ubuntu-1804-7lp - -#### Mac - -Make sure `Homebrew` ist installed in order to update `Bison` to a newer version (the version 2.3 installed per default is too old) - -``` - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -``` - -Then update `Bison`: - -``` - brew install bison - brew link bison --force - echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile -``` - -Install `Python 2.7`: - -``` - brew install python@2 -``` - -Be sure to re-open the command window or the changes will not apply. - -If you're going to build the `with-dotnet` profile you also need to install DotNet. -Please download it from: https://dotnet.microsoft.com/download and run the installer. - -LibPCAP is also installed via Homebrew: - -``` - brew install libpcap -``` - -#### Windows - -Some tools need to be installed before being able to build on Windows: - -* WinBuilds (for `with-cpp`, `with-proxies` profiles) -* Bison (for `with-cpp` profiles) -* Flex (for `with-cpp` profiles) -* Python 2.7 (for `with-python`, `with-proxies` profiles) -* Dotnet (for `with-dotnet` profiles) -* WinPCAP -* OpenSSL - -He have tested `WinBuilds` with the bundle of: http://win-builds.org/doku.php/download_and_installation_from_windows -Run the installer as "Administrator" or you won't be able to install it to "C:\Program Files" or the 32 Bit counterpart. -When running the installer, make sure to select the options: -* Native Windows -* x86_64 -Not quite sure which elements are really needed, better just install all of them. -If the installer fails to do something complaining about having to use a different mirror, enter "http://win-builds.org/1.5.0" as mirror address. - -WARNING: If you don't use the installer version of the distribution. The build will probably fail and it will be pretty -impossible to see the problem. When manually executing the command, a popup will appear complaining about not being able -to find some DLL. So if you are having these problems, please try using the installer instead of manually unpacking -the archive. - -For `Bison`, please download the Setup installer version from here: http://gnuwin32.sourceforge.net/packages/bison.htm (When using the zip version the bison.exe couldn't find some DLL files) -It seems the official 2.4.1 version has issues when installed in a directory which's path contains spaces. Please make sure you replace the exe with a patched version form here: http://marin.jb.free.fr/bison/bison-2.4.1-modified.zip -(More infos on this issue here: https://sourceforge.net/p/gnuwin32/bugs/473/) - -Please download the `Flex` compiler from here: http://gnuwin32.sourceforge.net/packages/flex.htm (Ideally download the binary zip distribution) - -You can get `Python` from here: https://www.python.org/downloads/release/python-2716/ - -For `.Net`, you need the `Developer Pack` in order to build .Net applications. So be sure to get a reasonably fresh installation from https://dotnet.microsoft.com - -If you're building a source-distribution and haven't installed git yet, be sure to do so. - -The windows version of the PCAP library can be found here: https://sourceforge.net/projects/winpcap413-176/ -(In order to read PCAPNG files we require a libpcap version 1.1.0 or greater. The default -Windows version is 1.0. At this location there is a patched version based on libpcap 1.7.4) - -Last not least we need to install OpenSSL, which is available from here: https://indy.fulgan.com/SSL/ -The letter at the end of the version is sort of a "sub-minor" version, so I usually just take the version with the highest letter. - -Make sure the `bin` directories of containing the executables `mingw32-make.exe`, `bison.exe` and `flex.exe` are all on your systems `PATH` as well as the directory containing the `openssl.exe`. - -### Building with Docker - -If you don't want to bother setting up the environment on your normal system and you have Docker installed, you can also build everything in a Docker container: - -``` - docker build -t plc4x . - - docker run -p 9200:9200 -p 9300:9300 --name plc4x plc4x -``` - -### Getting Started - -You must have Java 8 installed on your system and connectivity to Maven Central -(for downloading external third party dependencies). Maven will be automatically -downloaded and installed by the maven wrapper `mvnw`. - -Build PLC4X Java jars and install them in your local maven repository - -``` -./mvnw install # add -DskipTests to omit running the tests -``` - -You can now construct Java applications that use PLC4X. The PLC4X examples -are a good place to start and are available inside the `plc4j/examples` -directory. - -The `C++` drivers are still under development and still not really usable. -Therefore they are located in the so-called `sandbox`. -If you want to build them, this has to be enabled by activating the `with-sandbox` and `with-cpp` maven profiles: - -``` -./mvnw -P with-sandbox,with-cpp install # add -DskipTests to omit running the tests -``` - -Same applies for the `C# / .Net` implementation with `with-dotnet` profiles. - -``` -./mvnw -P with-sandbox,with-dotnet install # add -DskipTests to omit running the tests -``` - -The Python implementation is currently in a somewhat unclean state and still needs refactoring. -In order to be able to build the Python module, you currently need to activate the: -`with-sandbox`, `with-python` and `with-proxies` profiles. - -``` -./mvnw -P with-sandbox,with-python,with-proxies install # add -DskipTests to omit running the tests -``` - -In order to build everything the following command should work: - -``` -./mvnw -P with-boost,with-cpp,with-dotnet,with-logstash,with-proxies,with-python,with-sandbox install -``` - -## Community - -Join the PLC4X community by using one of the following channels. We'll be glad to help! - -### Mailing Lists - -Subscribe to the following mailing lists: -* Apache PLC4X Developer List: [dev-subscribe@plc4x.apache.org](mailto:dev-subscribe@plc4x.apache.org) -* Apache PLC4X Commits List: [commit-subscribe@plc4x.apache.org](mailto:commit-subscribe@plc4x.apache.org) -* Apache PLC4X Jira Notification List: [issues-subscribe@plc4x.apache.org](mailto:issues-subscribe@plc4x.apache.org) - -See also: [https://plc4x.apache.org/mailing-lists.html](https://plc4x.apache.org/mailing-lists.html) - -### Twitter - -Get the latest PLC4X news on Twitter: [https://twitter.com/ApachePlc4x](https://twitter.com/ApachePlc4x) - -## Contributing - -There are multiple forms in which you can become involved with the PLC4X project. - -These usually are, but are not limited to: - -* Submitting Pull Requests -* Filing Bug-Reports -* Active communication on our mailing lists -* Promoting the project (articles, blog posts, talks at conferences) -* Documentation - -We are a very friendly bunch and don’t be afraid to step forward. -If you'd like to contribute to PLC4X, have a look at our -[contribution guide](https://plc4x.apache.org/developers/contributing.html)! - - -## Licensing - -Apache PLC4X is released under the Apache License Version 2.0. + +[![Maven central](https://img.shields.io/maven-central/v/org.apache.plc4x/plc4j-api.svg)](https://img.shields.io/maven-central/v/org.apache.plc4x/plc4j-api.svg) +[![License](https://img.shields.io/github/license/apache/plc4x.svg)](http://www.apache.org/licenses/LICENSE-2.0) +[![Last commit](https://img.shields.io/github/last-commit/apache/plc4x.svg)]() +[![Twitter](https://img.shields.io/twitter/follow/ApachePLC4X.svg?label=Follow&style=social)](https://twitter.com/ApachePLC4X) + + +

+
+ Apache PLC4X Logo +
+

+

The Industrial IoT adapter

+

The ultimate goal of PLC4X is to create a set of libraries, that allow unified access to any type of + PLC

+ +*** + +# Table of contents + + * [About PLC4X](#about-apache-plc4x) + * [Getting Started](#getting-started) + * [Developers](#developers) + * [Community](#community) + * [Contributing](#contributing) + * [Licensing](#licensing) + +*** + +## About Apache PLC4X + +Apache PLC4X is an effort to create a set of libraries for communicating with industrial grade programmable logic controllers (PLCs) in a uniform way. +We are planning on shipping libraries for usage in: + +1. Java +2. C/C++ (not ready for usage) +3. C# (.Net) (not ready for usage) +4. Python (not ready for usage) + +PLC4X also integrates with other Apache projects, such as: + +* [Apache Calcite](https://calcite.apache.org/) +* [Apache Camel](https://camel.apache.org/) +* [Apache Edgent](https://edgent.apache.org/) +* [Apache Kafka-Connect](https://kafka.apache.org) +* [Apache Karaf](https://karaf.apache.org/) +* [Apache NiFi](https://nifi.apache.org/) + +## Getting started + +Depending on the programming language, the usage will differ, therefore please go to the +[Getting Started](https://plc4x.apache.org/users/gettingstarted.html) on the PLC4X website to look up +the language of choice. + +### Java + +See the PLC4J user guide on the website to start using PLC4X in your Java application: +[https://plc4x.apache.org/plc4j/users/gettingstarted.html](https://plc4x.apache.org/plc4j/users/gettingstarted.html) + +## Developers + +### Environment + +Currently the project is configured to require the following software: + +1. Java 8 JDK: For running Maven in general as well as compiling the Java and Scala modules `JAVA_HOME` configured to + point to that. +2. libpcap/WinPcap for raw socket tests in Java or use of `passive-mode` drivers +3. (Optional) Graphwiz: For generating the graphs in the documentation (http://www.graphviz.org/) +4. Git (even when working on the source distribution) + +With this setup you will be able to build the Java part of PLC4X excluding the "proxy" drivers and servers. +For a full build of PLC4X with all options the following has to be provided: + +#### Linux + +On a clean Ubuntu 18.04 the following software needs to be installed: + +``` + sudo apt install python-setuptools gcc g++ make libpcap-dev +``` + +If you're building a source-distribution and haven't installed git yet, be sure to do so: + +``` + sudo get install git +``` + +In order to build the .Net version, please install the .Net package according to this guide: + +https://dev.to/carlos487/installing-dotnet-core-in-ubuntu-1804-7lp + +#### Mac + +Make sure `Homebrew` ist installed in order to update `Bison` to a newer version (the version 2.3 installed per default is too old) + +``` + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +Then update `Bison`: + +``` + brew install bison + brew link bison --force + echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile +``` + +Install `Python 2.7`: + +``` + brew install python@2 +``` + +Be sure to re-open the command window or the changes will not apply. + +If you're going to build the `with-dotnet` profile you also need to install DotNet. +Please download it from: https://dotnet.microsoft.com/download and run the installer. + +LibPCAP is also installed via Homebrew: + +``` + brew install libpcap +``` + +#### Windows + +Some tools need to be installed before being able to build on Windows: + +* WinBuilds (for `with-cpp`, `with-proxies` profiles) +* Bison (for `with-cpp` profiles) +* Flex (for `with-cpp` profiles) +* Python 2.7 (for `with-python`, `with-proxies` profiles) +* Dotnet (for `with-dotnet` profiles) +* WinPCAP +* OpenSSL + +He have tested `WinBuilds` with the bundle of: http://win-builds.org/doku.php/download_and_installation_from_windows +Run the installer as "Administrator" or you won't be able to install it to "C:\Program Files" or the 32 Bit counterpart. +When running the installer, make sure to select the options: +* Native Windows +* x86_64 +Not quite sure which elements are really needed, better just install all of them. +If the installer fails to do something complaining about having to use a different mirror, enter "http://win-builds.org/1.5.0" as mirror address. + +WARNING: If you don't use the installer version of the distribution. The build will probably fail and it will be pretty +impossible to see the problem. When manually executing the command, a popup will appear complaining about not being able +to find some DLL. So if you are having these problems, please try using the installer instead of manually unpacking +the archive. + +For `Bison`, please download the Setup installer version from here: http://gnuwin32.sourceforge.net/packages/bison.htm (When using the zip version the bison.exe couldn't find some DLL files) +It seems the official 2.4.1 version has issues when installed in a directory which's path contains spaces. Please make sure you replace the exe with a patched version form here: http://marin.jb.free.fr/bison/bison-2.4.1-modified.zip +(More infos on this issue here: https://sourceforge.net/p/gnuwin32/bugs/473/) + +Please download the `Flex` compiler from here: http://gnuwin32.sourceforge.net/packages/flex.htm (Ideally download the binary zip distribution) + +You can get `Python` from here: https://www.python.org/downloads/release/python-2716/ + +For `.Net`, you need the `Developer Pack` in order to build .Net applications. So be sure to get a reasonably fresh installation from https://dotnet.microsoft.com + +If you're building a source-distribution and haven't installed git yet, be sure to do so. + +The windows version of the PCAP library can be found here: https://sourceforge.net/projects/winpcap413-176/ +(In order to read PCAPNG files we require a libpcap version 1.1.0 or greater. The default +Windows version is 1.0. At this location there is a patched version based on libpcap 1.7.4) + +Last not least we need to install OpenSSL, which is available from here: https://indy.fulgan.com/SSL/ +The letter at the end of the version is sort of a "sub-minor" version, so I usually just take the version with the highest letter. + +Make sure the `bin` directories of containing the executables `mingw32-make.exe`, `bison.exe` and `flex.exe` are all on your systems `PATH` as well as the directory containing the `openssl.exe`. + +### Building with Docker + +If you don't want to bother setting up the environment on your normal system and you have Docker installed, you can also build everything in a Docker container: + +``` + docker build -t plc4x . + + docker run -p 9200:9200 -p 9300:9300 --name plc4x plc4x +``` + +### Getting Started + +You must have Java 8 installed on your system and connectivity to Maven Central +(for downloading external third party dependencies). Maven will be automatically +downloaded and installed by the maven wrapper `mvnw`. + +Build PLC4X Java jars and install them in your local maven repository + +``` +./mvnw install # add -DskipTests to omit running the tests +``` + +You can now construct Java applications that use PLC4X. The PLC4X examples +are a good place to start and are available inside the `plc4j/examples` +directory. + +The `C++` drivers are still under development and still not really usable. +Therefore they are located in the so-called `sandbox`. +If you want to build them, this has to be enabled by activating the `with-sandbox` and `with-cpp` maven profiles: + +``` +./mvnw -P with-sandbox,with-cpp install # add -DskipTests to omit running the tests +``` + +Same applies for the `C# / .Net` implementation with `with-dotnet` profiles. + +``` +./mvnw -P with-sandbox,with-dotnet install # add -DskipTests to omit running the tests +``` + +The Python implementation is currently in a somewhat unclean state and still needs refactoring. +In order to be able to build the Python module, you currently need to activate the: +`with-sandbox`, `with-python` and `with-proxies` profiles. + +``` +./mvnw -P with-sandbox,with-python,with-proxies install # add -DskipTests to omit running the tests +``` + +In order to build everything the following command should work: + +``` +./mvnw -P with-boost,with-cpp,with-dotnet,with-logstash,with-proxies,with-python,with-sandbox install +``` + +## Community + +Join the PLC4X community by using one of the following channels. We'll be glad to help! + +### Mailing Lists + +Subscribe to the following mailing lists: +* Apache PLC4X Developer List: [dev-subscribe@plc4x.apache.org](mailto:dev-subscribe@plc4x.apache.org) +* Apache PLC4X Commits List: [commit-subscribe@plc4x.apache.org](mailto:commit-subscribe@plc4x.apache.org) +* Apache PLC4X Jira Notification List: [issues-subscribe@plc4x.apache.org](mailto:issues-subscribe@plc4x.apache.org) + +See also: [https://plc4x.apache.org/mailing-lists.html](https://plc4x.apache.org/mailing-lists.html) + +### Twitter + +Get the latest PLC4X news on Twitter: [https://twitter.com/ApachePlc4x](https://twitter.com/ApachePlc4x) + +## Contributing + +There are multiple forms in which you can become involved with the PLC4X project. + +These usually are, but are not limited to: + +* Submitting Pull Requests +* Filing Bug-Reports +* Active communication on our mailing lists +* Promoting the project (articles, blog posts, talks at conferences) +* Documentation + +We are a very friendly bunch and don’t be afraid to step forward. +If you'd like to contribute to PLC4X, have a look at our +[contribution guide](https://plc4x.apache.org/developers/contributing.html)! + + +## Licensing + +Apache PLC4X is released under the Apache License Version 2.0. diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 80528f8ff22..185bacb0acc 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -1,236 +1,236 @@ -============================================================== -(Unreleased) Apache PLC4X 0.6.0-SNAPSHOT -============================================================== - -New Features ------------- - -Incompatible changes --------------------- - -- Moved the C++, C# and Python drivers into the `sandbox` - -Bug Fixes ---------- - -============================================================== -Apache PLC4X 0.6.0-SNAPSHOT -============================================================== - -This is the first release containing our new generaed drivers (AB-ETH) - -New Features ------------- - -- Implemented a new Apache Kafka Connect integration module -- Implemented a new Apache NiFi integration module -- Implemented a new Logstash integration module -- Implemented a driver for the AB-ETH protocol -- Implemented Apache Karaf features for S7 OSGI drivers -- PLC4X-121 Develop Code Generation to allow Generated Drivers in multiple Languages - -Sandbox (Beta-Features) -- Implemented a new BACnet/IP passive mode driver -- Implemented a new Serial DF1 driver - -Incompatible changes --------------------- - -Bug Fixes ---------- - -- PLC4X-104 S7 Driver Datatype TIME_OF_DAY causes ArrayOutOfBoundException -- PLC4X-134 S7 is terminating the connection during handshake -- PLC4X-139 PLC4X leaks sockets in case of connection problems -- PLC4X-141 String with real length of greater 127 throw an exception -- PLC4X-144 When requesting invalid addresses, the DefaultS7MessageProcessor produces errors - -============================================================== -Apache PLC4X 0.4.0 -============================================================== - -This is the first release of Apache PLC4X as top-level project. - -New Features ------------- - -- The PlcConnection now supports a `ping` method to allow checking if an existing connection is still alive. -- Support of the OPC-UA protocol with the `opc-ua-driver`. -- Other Languages Support: --- Added first versions of a C# .Net PLC4X API (`plc4net`) --- Added first versions of a Python PLC4X API (`plc4py`) -- Added an Interop server which allows to relay requests from other languages to a Java Server - -Incompatible changes --------------------- - -- ElasticSearch example was updated to use ElasticSearch 7.0.1, this might cause problems with older Kibana versions. - -Bug Fixes ---------- - - -============================================================== -Apache PLC4X (incubating) 0.3.1 -============================================================== - -This is a bugfix-release, that fixes some problems with S7 driver. - -Bug Fixes ---------- - -- The S7 driver didn't correctly handle "fill-bytes" in multi-item read-responses and multi-item write-requests -- PLC4X-83: fixed NPE when reading odd-length array of one-byte base types -- PLC4X-82: renamed flags "F" to Siemens Standard "M" (Marker) -- PLC4X-84: Fixed a bug in the DefaultS7MessageProcessor which didn't correctly merge together split up items - - -============================================================== -Apache PLC4X (incubating) 0.3.0 -============================================================== - -This is the third official release of Apache PLC4X. - -Some new features have been added (e.g. plc-scraper) multiple -new integrations are included (apache-karaf, apache-calcite) -and a lot of (technical) refactoring has been done to prepare -future work on adapters in different languages. - -New Features ------------- - -- Object PLC Mapping (OPM) now has a Alias Registry to allow - variable substitution at runtime and write support -- New module `plc-scraper` for applications that have to - scrape a lot of sps fields with high frequency -- New integration `apache-karaf` to enable plc4j in a karaf - runtime environment - -Incompatible changes --------------------- -- The 'plc4j-core' module has been merged into 'plc4j-api'. - So there is no 'plc4j-core' module anymore. Just remove that - dependency. -- The driver artifact names have changed so if you were using - a `plc4j-protocol-{name}` you now need to change this to - `plc4j-driver-{name}` - -Bug Fixes ---------- - -PLC4X-75 Fixing dependency to the wrap url-handler -PLC4X-76 When receiving responses with more than 512 byte, - the IsoOnTcp protocol doesn't work -PLC4X-77 When the last item in a request is a DINT, the - DefaultS7MessageProcessor dies -PLC4X-78 Write operations seem to fail -- Fixed a Bug where S7 was not able to read arrays. - - -============================================================== -Apache PLC4X (incubating) 0.2.0 -============================================================== - -This is the second official release of Apache PLC4X. - -Especially have we addressed all issues reported during -our first release, that were of non-technical nature. -These were tracked in: - -PLC4X-60 Fix findings by the last release - -New Features ------------- -A new connection-pool was added, which allows automatic -pooling and reuse of PLC connections. - -A new OPM module was added, which allows JPA like read- -communication using POJOs, very similar to JPA. - -A stub of a new driver for the Emerson DeltaV protocol -has been added, but is not yet a fully functional PLC4X -driver. This is also a first test of our new `passive- -mode-driver` concept. - -Incompatible changes --------------------- - -We have refactored the API in order to eliminate the -need of passing `x-requests` to `x-methods` and added -an `execute` method to each request type. This greatly -simplifies the client code. However this requires -refactoring of applications using the direct PLC4X API. - -Miscellaneous changes ---------------------- - -We have increased the test coverage greatly and fixed -a lot of little errors we found on the way. - -Known Issues ------------- - -Bug Fixes ---------- - -PLC4X-56 [S7] S7Field does not recognize addresses - with numElements present -PLC4X-57 [S7] Response for address with numElements - contains only first item -PLC4X-61 Installation fails plc4j-protocoll-ethernetip - needs license -PLC4X-62 Modbus results deliver null-Value due to missing - implementation of getShort, getLong ... - - - -============================================================== -Apache PLC4X (incubating) 0.1.0 -============================================================== - -This is the first official release of Apache PLC4X. -It contains drivers for the following protocols: -- Siemens S7comm (0x32) -- Beckhoff ADS -- Modbus -- EtherNet/IP - -However the Siemens driver definitely is the most -mature driver, the rest should be treated experimental. - -New Features ------------- - -PLC4X-29 [S7] Implement PDU Fragmentation -PLC4X-39 Extend the Edgent integration with the new Subscription features of PLC4X - -Incompatible changes --------------------- - -- NONE - - -Miscellaneous changes ---------------------- - -- NONE - - -Known Issues ------------- - -- NONE - - -Most drivers should be treated experimental and are not near production ready. -The S7 driver is probably the furthest implemented and tested driver and hereby can be -considered to be the most mature. - -Bug Fixes ---------- - -PLC4X-20 Jacoco doesn't seem to be working at all -PLC4X-21 Code coverage doesn't seem to work -PLC4X-47 S7 driver silently ignores surplus ReadRequestItems -PLC4X-48 S7 driver failes to parse response with multiple items - - - - +============================================================== +(Unreleased) Apache PLC4X 0.6.0-SNAPSHOT +============================================================== + +New Features +------------ + +Incompatible changes +-------------------- + +- Moved the C++, C# and Python drivers into the `sandbox` + +Bug Fixes +--------- + +============================================================== +Apache PLC4X 0.6.0-SNAPSHOT +============================================================== + +This is the first release containing our new generaed drivers (AB-ETH) + +New Features +------------ + +- Implemented a new Apache Kafka Connect integration module +- Implemented a new Apache NiFi integration module +- Implemented a new Logstash integration module +- Implemented a driver for the AB-ETH protocol +- Implemented Apache Karaf features for S7 OSGI drivers +- PLC4X-121 Develop Code Generation to allow Generated Drivers in multiple Languages + +Sandbox (Beta-Features) +- Implemented a new BACnet/IP passive mode driver +- Implemented a new Serial DF1 driver + +Incompatible changes +-------------------- + +Bug Fixes +--------- + +- PLC4X-104 S7 Driver Datatype TIME_OF_DAY causes ArrayOutOfBoundException +- PLC4X-134 S7 is terminating the connection during handshake +- PLC4X-139 PLC4X leaks sockets in case of connection problems +- PLC4X-141 String with real length of greater 127 throw an exception +- PLC4X-144 When requesting invalid addresses, the DefaultS7MessageProcessor produces errors + +============================================================== +Apache PLC4X 0.4.0 +============================================================== + +This is the first release of Apache PLC4X as top-level project. + +New Features +------------ + +- The PlcConnection now supports a `ping` method to allow checking if an existing connection is still alive. +- Support of the OPC-UA protocol with the `opc-ua-driver`. +- Other Languages Support: +-- Added first versions of a C# .Net PLC4X API (`plc4net`) +-- Added first versions of a Python PLC4X API (`plc4py`) +- Added an Interop server which allows to relay requests from other languages to a Java Server + +Incompatible changes +-------------------- + +- ElasticSearch example was updated to use ElasticSearch 7.0.1, this might cause problems with older Kibana versions. + +Bug Fixes +--------- + + +============================================================== +Apache PLC4X (incubating) 0.3.1 +============================================================== + +This is a bugfix-release, that fixes some problems with S7 driver. + +Bug Fixes +--------- + +- The S7 driver didn't correctly handle "fill-bytes" in multi-item read-responses and multi-item write-requests +- PLC4X-83: fixed NPE when reading odd-length array of one-byte base types +- PLC4X-82: renamed flags "F" to Siemens Standard "M" (Marker) +- PLC4X-84: Fixed a bug in the DefaultS7MessageProcessor which didn't correctly merge together split up items + + +============================================================== +Apache PLC4X (incubating) 0.3.0 +============================================================== + +This is the third official release of Apache PLC4X. + +Some new features have been added (e.g. plc-scraper) multiple +new integrations are included (apache-karaf, apache-calcite) +and a lot of (technical) refactoring has been done to prepare +future work on adapters in different languages. + +New Features +------------ + +- Object PLC Mapping (OPM) now has a Alias Registry to allow + variable substitution at runtime and write support +- New module `plc-scraper` for applications that have to + scrape a lot of sps fields with high frequency +- New integration `apache-karaf` to enable plc4j in a karaf + runtime environment + +Incompatible changes +-------------------- +- The 'plc4j-core' module has been merged into 'plc4j-api'. + So there is no 'plc4j-core' module anymore. Just remove that + dependency. +- The driver artifact names have changed so if you were using + a `plc4j-protocol-{name}` you now need to change this to + `plc4j-driver-{name}` + +Bug Fixes +--------- + +PLC4X-75 Fixing dependency to the wrap url-handler +PLC4X-76 When receiving responses with more than 512 byte, + the IsoOnTcp protocol doesn't work +PLC4X-77 When the last item in a request is a DINT, the + DefaultS7MessageProcessor dies +PLC4X-78 Write operations seem to fail +- Fixed a Bug where S7 was not able to read arrays. + + +============================================================== +Apache PLC4X (incubating) 0.2.0 +============================================================== + +This is the second official release of Apache PLC4X. + +Especially have we addressed all issues reported during +our first release, that were of non-technical nature. +These were tracked in: + +PLC4X-60 Fix findings by the last release + +New Features +------------ +A new connection-pool was added, which allows automatic +pooling and reuse of PLC connections. + +A new OPM module was added, which allows JPA like read- +communication using POJOs, very similar to JPA. + +A stub of a new driver for the Emerson DeltaV protocol +has been added, but is not yet a fully functional PLC4X +driver. This is also a first test of our new `passive- +mode-driver` concept. + +Incompatible changes +-------------------- + +We have refactored the API in order to eliminate the +need of passing `x-requests` to `x-methods` and added +an `execute` method to each request type. This greatly +simplifies the client code. However this requires +refactoring of applications using the direct PLC4X API. + +Miscellaneous changes +--------------------- + +We have increased the test coverage greatly and fixed +a lot of little errors we found on the way. + +Known Issues +------------ + +Bug Fixes +--------- + +PLC4X-56 [S7] S7Field does not recognize addresses + with numElements present +PLC4X-57 [S7] Response for address with numElements + contains only first item +PLC4X-61 Installation fails plc4j-protocoll-ethernetip + needs license +PLC4X-62 Modbus results deliver null-Value due to missing + implementation of getShort, getLong ... + + + +============================================================== +Apache PLC4X (incubating) 0.1.0 +============================================================== + +This is the first official release of Apache PLC4X. +It contains drivers for the following protocols: +- Siemens S7comm (0x32) +- Beckhoff ADS +- Modbus +- EtherNet/IP + +However the Siemens driver definitely is the most +mature driver, the rest should be treated experimental. + +New Features +------------ + +PLC4X-29 [S7] Implement PDU Fragmentation +PLC4X-39 Extend the Edgent integration with the new Subscription features of PLC4X + +Incompatible changes +-------------------- + +- NONE - + +Miscellaneous changes +--------------------- + +- NONE - + +Known Issues +------------ + +- NONE - + +Most drivers should be treated experimental and are not near production ready. +The S7 driver is probably the furthest implemented and tested driver and hereby can be +considered to be the most mature. + +Bug Fixes +--------- + +PLC4X-20 Jacoco doesn't seem to be working at all +PLC4X-21 Code coverage doesn't seem to work +PLC4X-47 S7 driver silently ignores surplus ReadRequestItems +PLC4X-48 S7 driver failes to parse response with multiple items + + + + diff --git a/Sometimes-Failling-Tests.md b/Sometimes-Failling-Tests.md index 818bfa31d52..017bfac5c56 100644 --- a/Sometimes-Failling-Tests.md +++ b/Sometimes-Failling-Tests.md @@ -1,32 +1,32 @@ - - -# Sometimes Failing Tests - -This File contains the names and outputs of some tests that have been seen to fail without direct code-changes. -It's sort of a collection of places we should keep an eye out for improving tests- - -## Module: plc4l-opm - -[ERROR] ConnectedEntityTest.useCache_timeout_refetches:83 -mockDevice.read(); -Wanted 2 times: --> at org.apache.plc4x.java.opm.ConnectedEntityTest.useCache_timeout_refetches(ConnectedEntityTest.java:83) -But was 1 time: --> at org.apache.plc4x.java.mock.PlcMockConnection.lambda$null$0(PlcMockConnection.java:111) + + +# Sometimes Failing Tests + +This File contains the names and outputs of some tests that have been seen to fail without direct code-changes. +It's sort of a collection of places we should keep an eye out for improving tests- + +## Module: plc4l-opm + +[ERROR] ConnectedEntityTest.useCache_timeout_refetches:83 +mockDevice.read(); +Wanted 2 times: +-> at org.apache.plc4x.java.opm.ConnectedEntityTest.useCache_timeout_refetches(ConnectedEntityTest.java:83) +But was 1 time: +-> at org.apache.plc4x.java.mock.PlcMockConnection.lambda$null$0(PlcMockConnection.java:111) diff --git a/build-reproducible.sh b/build-reproducible.sh index 885dbf5992b..8cc0081bd40 100755 --- a/build-reproducible.sh +++ b/build-reproducible.sh @@ -1,68 +1,68 @@ -#!/bin/bash -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# Run a standard build -function build() { - echo "Building ..." - mvn -U -P apache-release,with-boost,with-dotnet,with-cpp,with-python,with-proxies,with-sandbox,with-logstash -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy - echo "Done" -} - -# Just remove all the metadata information and all the hashes and signatures -function clean() { - echo "Cleaning ..." - cd local-snapshots-dir || exit - find ./ -name "*.asc" -exec rm -rf {} \; - find ./ -name "*.md5" -exec rm -rf {} \; - find ./ -name "*.sha1" -exec rm -rf {} \; - find ./ -name "maven-metadata.xml" -exec rm -rf {} \; - find ./ -name "maven-metadata.xml.md5" -exec rm -rf {} \; - find ./ -name "maven-metadata.xml.sha1" -exec rm -rf {} \; - cd .. - echo "Done" - pwd -} - -# Rename all snapshot files to not contain the timestamps -function renameArtifacts() { - echo "Renaming ..." - cd local-snapshots-dir || exit - # Remove the timestamp from the file-names - find . -type f | rename 's/-\d{8}\.\d{6}-\d{1,2}//' - cd .. - echo "Done" - pwd -} - -# Package the remaiing files into one tgz archive -function packageDirectory() { - echo "Packaging ..." - tar -cvf reproducible-build-candidate.tgz local-snapshots-dir/ - echo "Done" - pwd -} - -# Remove any pre-existing directory -rm -r local-snapshots-dir - -build -clean -renameArtifacts -packageDirectory +#!/bin/bash +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# ---------------------------------------------------------------------------- + +# Run a standard build +function build() { + echo "Building ..." + mvn -U -P apache-release,with-boost,with-dotnet,with-cpp,with-python,with-proxies,with-sandbox,with-logstash -DaltDeploymentRepository=snapshot-repo::default::file:./local-snapshots-dir clean deploy + echo "Done" +} + +# Just remove all the metadata information and all the hashes and signatures +function clean() { + echo "Cleaning ..." + cd local-snapshots-dir || exit + find ./ -name "*.asc" -exec rm -rf {} \; + find ./ -name "*.md5" -exec rm -rf {} \; + find ./ -name "*.sha1" -exec rm -rf {} \; + find ./ -name "maven-metadata.xml" -exec rm -rf {} \; + find ./ -name "maven-metadata.xml.md5" -exec rm -rf {} \; + find ./ -name "maven-metadata.xml.sha1" -exec rm -rf {} \; + cd .. + echo "Done" + pwd +} + +# Rename all snapshot files to not contain the timestamps +function renameArtifacts() { + echo "Renaming ..." + cd local-snapshots-dir || exit + # Remove the timestamp from the file-names + find . -type f | rename 's/-\d{8}\.\d{6}-\d{1,2}//' + cd .. + echo "Done" + pwd +} + +# Package the remaiing files into one tgz archive +function packageDirectory() { + echo "Packaging ..." + tar -cvf reproducible-build-candidate.tgz local-snapshots-dir/ + echo "Done" + pwd +} + +# Remove any pre-existing directory +rm -r local-snapshots-dir + +build +clean +renameArtifacts +packageDirectory diff --git a/build-utils/language-base-freemarker/pom.xml b/build-utils/language-base-freemarker/pom.xml index 6d01362a086..fe703adface 100644 --- a/build-utils/language-base-freemarker/pom.xml +++ b/build-utils/language-base-freemarker/pom.xml @@ -1,56 +1,56 @@ - - - - - 4.0.0 - - - org.apache.plc4x - plc4x-build-utils - 0.6.0-SNAPSHOT - - - plc4x-build-utils-language-base-freemarker - - PLC4X: Build Utils: Language Base: Freemarker - Base code for building language outputs based on Freemarker - - - - org.apache.plc4x.plugins - plc4x-code-generation-language-base - - - - org.freemarker - freemarker - - - org.apache.commons - commons-text - - - - org.slf4j - slf4j-api - - - + + + + + 4.0.0 + + + org.apache.plc4x + plc4x-build-utils + 0.6.0-SNAPSHOT + + + plc4x-build-utils-language-base-freemarker + + PLC4X: Build Utils: Language Base: Freemarker + Base code for building language outputs based on Freemarker + + + + org.apache.plc4x.plugins + plc4x-code-generation-language-base + + + + org.freemarker + freemarker + + + org.apache.commons + commons-text + + + + org.slf4j + slf4j-api + + + \ No newline at end of file diff --git a/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java b/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java index 5ca25bca445..dde911c34ff 100644 --- a/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java +++ b/build-utils/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/FreemarkerLanguageOutput.java @@ -1,129 +1,129 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you 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. - */ - -package org.apache.plc4x.plugins.codegenerator.protocol.freemarker; - -import freemarker.cache.ClassTemplateLoader; -import freemarker.core.ParseException; -import freemarker.template.*; -import org.apache.plc4x.plugins.codegenerator.language.LanguageOutput; -import org.apache.plc4x.plugins.codegenerator.types.definitions.EnumTypeDefinition; -import org.apache.plc4x.plugins.codegenerator.types.definitions.TypeDefinition; -import org.apache.plc4x.plugins.codegenerator.types.exceptions.GenerationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public abstract class FreemarkerLanguageOutput implements LanguageOutput { - - private static final Logger LOGGER = LoggerFactory.getLogger(FreemarkerLanguageOutput.class); - - @Override - public void generate(File outputDir, String languageName, String protocolName, String outputFlavor, Map types) - throws GenerationException { - - try { - // Configure the Freemarker template engine - Configuration freemarkerConfiguration = getFreemarkerConfiguration(); - - ClassTemplateLoader classTemplateLoader = new ClassTemplateLoader(FreemarkerLanguageOutput.class, "/"); - freemarkerConfiguration.setTemplateLoader(classTemplateLoader); - - // Initialize all templates - List