Skip to content

Commit

Permalink
[ISSUE #194] Check that all builds are successful with dlt-viewer v2.…
Browse files Browse the repository at this point in the history
…25.0

Change description:

- Update all CI/CD builds to fetch dlt-viewer of the version v2.25.0
- Update compatible version of the dlt-viewer in the
installation_guide.md
- Switch to the latest antlr 4.13.1
- Remove local copy of the antlr runtime. It should be downloaded from
the github

----

Verification criteria:

- Verified via the CI/CD
- Verified via the local Linux build
  • Loading branch information
Vladyslav Goncharuk committed Feb 25, 2024
1 parent abe21be commit cdd99f7
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_clang_tidy_qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install uuid-dev
shell: bash

# Checkout dlt-viewer's revision v2.24.0
# Checkout dlt-viewer's revision v2.25.0
- name: Checkout of the dlt-viewer
uses: actions/checkout@v3
with:
repository: GENIVI/dlt-viewer
ref: ebb3c355bc0edf2b6c3be84452b8afa4d1a82641
ref: v2.25.0

# Checkout project's revision, which is pushed
- name: Checkout of the project
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_clang_tidy_qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install uuid-dev
shell: bash

# Checkout dlt-viewer's revision v2.24.0
# Checkout dlt-viewer's revision v2.25.0
- name: Checkout of the dlt-viewer
uses: actions/checkout@v3
with:
repository: GENIVI/dlt-viewer
ref: ebb3c355bc0edf2b6c3be84452b8afa4d1a82641
ref: v2.25.0

# Checkout project's revision, which is pushed
- name: Checkout of the project
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_linux_qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install uuid-dev
shell: bash

# Checkout dlt-viewer's revision v2.24.0
# Checkout dlt-viewer's revision v2.25.0
- name: Checkout of the dlt-viewer
uses: actions/checkout@v3
with:
repository: GENIVI/dlt-viewer
ref: ebb3c355bc0edf2b6c3be84452b8afa4d1a82641
ref: v2.25.0

# Checkout project's revision, which is pushed
- name: Checkout of the ${{ github.event.repository.name }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_linux_qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install uuid-dev
shell: bash

# Checkout dlt-viewer's revision v2.24.0
# Checkout dlt-viewer's revision v2.25.0
- name: Checkout of the dlt-viewer
uses: actions/checkout@v3
with:
repository: GENIVI/dlt-viewer
ref: ebb3c355bc0edf2b6c3be84452b8afa4d1a82641
ref: v2.25.0

# Checkout project's revision, which is pushed
- name: Checkout of the ${{ github.event.repository.name }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_windows_qt5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
echo "D:/a/${{ github.event.repository.name }}/tools/jom/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell

# Checkout dlt-viewer's revision v2.24.0
# Checkout dlt-viewer's revision v2.25.0
- name: Checkout of the dlt-viewer
uses: actions/checkout@v3
with:
repository: GENIVI/dlt-viewer
ref: ebb3c355bc0edf2b6c3be84452b8afa4d1a82641
ref: v2.25.0

# Checkout project's revision, which is pushed
- name: Checkout of the project
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_windows_qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ jobs:
echo "D:/a/${{ github.event.repository.name }}/tools/jom/" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: powershell

# Checkout dlt-viewer's revision v2.24.0
# Checkout dlt-viewer's revision v2.25.0
- name: Checkout of the dlt-viewer
uses: actions/checkout@v3
with:
repository: GENIVI/dlt-viewer
ref: ebb3c355bc0edf2b6c3be84452b8afa4d1a82641
ref: v2.25.0

# Checkout project's revision, which is pushed
- name: Checkout of the project
Expand Down
8 changes: 4 additions & 4 deletions dltmessageanalyzerplugin/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################### CPP ###################################
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
################### CPP ( END ) ###########################

Expand Down Expand Up @@ -94,10 +94,10 @@ DMA_sync_q_custom_plot()
# minimum required CMAKE version
CMAKE_MINIMUM_REQUIRED(VERSION 3.7 FATAL_ERROR)

cmake_policy(SET CMP0071 NEW)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

cmake_policy(SET CMP0071 NEW)

# required if linking to static library
add_definitions(-DANTLR4CPP_STATIC)

Expand All @@ -110,7 +110,7 @@ include_directories(${ANTLR4_INCLUDE_DIRS})

# set variable pointing to the antlr tool that supports C++
# this is not required if the jar file can be found under PATH environment
set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/antlr/antlr-4.8-complete.jar)
set(ANTLR_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/antlr/antlr-4.13.1-complete.jar)
# add macros to generate ANTLR Cpp code from grammar
find_package(ANTLR REQUIRED)

Expand Down
38 changes: 19 additions & 19 deletions dltmessageanalyzerplugin/src/cmake/Antlr4Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

## The `antlr4-generator` Package

To use the Package you must insert a
To use the Package you must insert a
```cmake
find_package(antlr4-generator REQUIRED)
```
line in your `CMakeList.txt` file.

The package exposes a function `antlr4_generate` that generates the required setup to call ANTLR for a
The package exposes a function `antlr4_generate` that generates the required setup to call ANTLR for a
given input file during build.

The following table lists the parameters that can be used with the function:

Argument# | Required | Default | Use
----------|-----------|---------|---
0 | Yes | n/a | Unique target name. It is used to generate CMake Variables to reference the various outputs of the generation
Expand Down Expand Up @@ -42,7 +42,7 @@ Output variable | Meaning
```cmake
# generate parser with visitor classes.
# put the classes in C++ namespace 'antlrcpptest::'
antlr4_generate(
antlr4_generate(
antlrcpptest_parser
${CMAKE_CURRENT_SOURCE_DIR}/TLexer.g4
LEXER
Expand All @@ -56,7 +56,7 @@ Output variable | Meaning

## The `antlr4-runtime` Package

To use the Package you must insert a
To use the Package you must insert a
```cmake
find_package(antlr4-runtime REQUIRED)
```
Expand Down Expand Up @@ -85,7 +85,7 @@ include_directories( ${ANTLR4_INCLUDE_DIR} )
add_dependencies( Parsertest antlr4_shared )
# add runtime to project link libraries
target_link_libraries( Parsertest PRIVATE
target_link_libraries( Parsertest PRIVATE
antlr4_shared)
```

Expand All @@ -94,22 +94,22 @@ target_link_libraries( Parsertest PRIVATE
# Bring in the required packages
find_package(antlr4-runtime REQUIRED)
find_package(antlr4-generator REQUIRED)
# Set path to generator
set(ANTLR4_JAR_LOCATION ${PROJECT_SOURCE_DIR}/thirdparty/antlr/antlr-4.8-complete.jar)
set(ANTLR4_JAR_LOCATION ${PROJECT_SOURCE_DIR}/thirdparty/antlr/antlr-4.13.1-complete.jar)
# generate lexer
antlr4_generate(
antlr4_generate(
antlrcpptest_lexer
${CMAKE_CURRENT_SOURCE_DIR}/TLexer.g4
LEXER
FALSE
FALSE
"antlrcpptest"
)
# generate parser
antlr4_generate(
antlr4_generate(
antlrcpptest_parser
${CMAKE_CURRENT_SOURCE_DIR}/TParser.g4
PARSER
Expand All @@ -119,18 +119,18 @@ target_link_libraries( Parsertest PRIVATE
"${ANTLR4_TOKEN_FILES_antlrcpptest_lexer}"
"${ANTLR4_TOKEN_DIRECTORY_antlrcpptest_lexer}"
)
# add directories for generated include files
include_directories( ${PROJECT_BINARY_DIR} ${ANTLR4_INCLUDE_DIR} ${ANTLR4_INCLUDE_DIR_antlrcpptest_lexer} ${ANTLR4_INCLUDE_DIR_antlrcpptest_parser} )
# add generated source files
add_executable( Parsertest main.cpp ${ANTLR4_SRC_FILES_antlrcpptest_lexer} ${ANTLR4_SRC_FILES_antlrcpptest_parser} )
# add required runtime library
add_dependencies( Parsertest antlr4_shared )
target_link_libraries( Parsertest PRIVATE
target_link_libraries( Parsertest PRIVATE
antlr4_shared)
```

3 changes: 2 additions & 1 deletion dltmessageanalyzerplugin/src/cmake/ExternalAntlr4Cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(ExternalProject)
set(ANTLR4_ROOT ${CMAKE_CURRENT_BINARY_DIR}/antlr4_runtime/src/antlr4_runtime)
set(ANTLR4_INCLUDE_DIRS ${ANTLR4_ROOT}/runtime/Cpp/runtime/src)
set(ANTLR4_GIT_REPOSITORY https://github.com/antlr/antlr4.git)
set(ANTLR4_ZIP_REPOSITORY ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/antlr/antlr4-4.8.zip)
set(ANTLR4_ZIP_REPOSITORY https://github.com/antlr/antlr4/archive/refs/tags/4.13.1.zip)
if(NOT DEFINED ANTLR4_TAG)
# Set to branch name to keep library updated at the cost of needing to rebuild after 'clean'
# Set to commit hash to keep the build stable and does not need to rebuild after 'clean'
Expand Down Expand Up @@ -89,6 +89,7 @@ if(ANTLR4_ZIP_REPOSITORY)
CMAKE_CACHE_ARGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DWITH_STATIC_CRT:BOOL=${ANTLR4_WITH_STATIC_CRT}
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
INSTALL_COMMAND ""
EXCLUDE_FROM_ALL 1)
else()
Expand Down
4 changes: 2 additions & 2 deletions dltmessageanalyzerplugin/src/cmake/FindANTLR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ find_package(Java QUIET COMPONENTS Runtime)

if(NOT ANTLR_EXECUTABLE)
find_program(ANTLR_EXECUTABLE
NAMES antlr.jar antlr4.jar antlr-4.jar antlr-4.8-complete.jar)
NAMES antlr.jar antlr4.jar antlr-4.jar antlr-4.13.1-complete.jar)
endif()

if(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE)
Expand All @@ -14,7 +14,7 @@ if(ANTLR_EXECUTABLE AND Java_JAVA_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(ANTLR_COMMAND_RESULT EQUAL 0)
string(REGEX MATCH "Version [0-9]+(\\.[0-9])*" ANTLR_VERSION ${ANTLR_COMMAND_OUTPUT})
string(REGEX MATCH "Version [0-9]+(\\.[0-9]+)*" ANTLR_VERSION ${ANTLR_COMMAND_OUTPUT})
string(REPLACE "Version " "" ANTLR_VERSION ${ANTLR_VERSION})
else()
message(
Expand Down
22 changes: 16 additions & 6 deletions dltmessageanalyzerplugin/src/cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Here is how you can use this external project to create the antlr4cpp demo to st
1. Make a subfolder cmake
2. Copy the files in this folder to srcfolder/cmake
3. Cut below and use it to create srcfolder/CMakeLists.txt
4. Copy main.cpp, TLexer.g4 and TParser.g4 to ./srcfolder/ from [here](https://github.com/antlr/antlr4/tree/master/runtime/Cpp/demo)
4. Copy main.cpp, TLexer.g4 and TParser.g4 to srcfolder/ from [here](https://github.com/antlr/antlr4/tree/master/runtime/Cpp/demo)
2. Make a build folder e.g. ~/buildfolder/
3. From the buildfolder, run `cmake ~/srcfolder; make`

Expand All @@ -16,22 +16,30 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.7 FATAL_ERROR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# compiler must be 11 or 14
set(CMAKE_CXX_STANDARD 11)
# compiler must be 17
set(CMAKE_CXX_STANDARD 17)
# required if linking to static library
add_definitions(-DANTLR4CPP_STATIC)
# using /MD flag for antlr4_runtime (for Visual C++ compilers only)
set(ANTLR4_WITH_STATIC_CRT OFF)
# Specify the version of the antlr4 library needed for this project.
# By default the latest version of antlr4 will be used. You can specify a
# specific, stable version by setting a repository tag value or a link
# to a zip file containing the libary source.
# set(ANTLR4_TAG 4.13.1)
# set(ANTLR4_ZIP_REPOSITORY https://github.com/antlr/antlr4/archive/refs/tags/4.13.1.zip)
# add external build for antlrcpp
include(ExternalAntlr4Cpp)
# add antrl4cpp artifacts to project environment
include_directories(${ANTLR4_INCLUDE_DIRS})
# set variable pointing to the antlr tool that supports C++
# this is not required if the jar file can be found under PATH environment
set(ANTLR_EXECUTABLE /home/user/antlr-4.8-complete.jar)
set(ANTLR_EXECUTABLE /home/user/antlr-4.13.1-complete.jar)
# add macros to generate ANTLR Cpp code from grammar
find_package(ANTLR REQUIRED)
Expand Down Expand Up @@ -123,12 +131,14 @@ ANTLR4_RUNTIME_LIBRARIES - path to antlr4 shared runtime library (such as DLL, D
ANTLR4_TAG - branch/tag used for building antlr4 library
```

`ANTLR4_TAG` is set to master branch by default to keep antlr4 updated. However, it will be required to rebuild after every `clean` is called. Set `ANTLR4_TAG` to a desired commit hash value to avoid rebuilding after every `clean` and keep the build stable, at the cost of not automatically update to latest commit.
`ANTLR4_TAG` is set to master branch by default to keep the antlr4 library up to date. However, this will require a rebuild after every `clean` is called. Set `ANTLR4_TAG` to a desired commit hash value to avoid rebuilding after every `clean` and keep the build stable, at the cost of not automatically updating to latest commit.

The ANTLR C++ runtime source is downloaded from GitHub by default. However, users may specify `ANTLR4_ZIP_REPOSITORY` to list the zip file from [ANTLR downloads](http://www.antlr.org/download.html) (under *C++ Target*). This variable can list a zip file included in the project directory; this is useful for maintaining a canonical source for each new build.
By defualt the ANTLR C++ runtime source is cloned from GitHub. However, users may specify `ANTLR4_ZIP_REPOSITORY` in order to download source as a zip file from [ANTLR downloads](http://www.antlr.org/download.html) (under *C++ Target*) or other locations. For example, this variable could list a zip file included in your the project directory. This is useful for maintaining a canonical source tree for each new build.

Visual C++ compiler users may want to additionally define `ANTLR4_WITH_STATIC_CRT` before including the file. Set `ANTLR4_WITH_STATIC_CRT` to true if ANTLR4 C++ runtime library should be compiled with `/MT` flag, otherwise will be compiled with `/MD` flag. This variable has a default value of `OFF`. Changing `ANTLR4_WITH_STATIC_CRT` after building the library may require reinitialization of CMake or `clean` for the library to get rebuilt.

You may need to modify your local copy of ExternalAntlr4Cpp.cpp to modify some build settings. For example, to specify the C++ standard to use when building the runtime, add `-DCMAKE_CXX_STANDARD:STRING=17` to `CMAKE_CACHE_ARGS`.

### Examples

To build and link ANTLR4 static library to a target one may call:
Expand Down
8 changes: 4 additions & 4 deletions dltmessageanalyzerplugin/src/cmake/antlr4-generator.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function(antlr4_generate
else()
set(Antlr4_BuildListenerOption "-no-listener")
endif ()

if ( ( ARGC GREATER_EQUAL 5 ) AND ARGV4 )
set(Antlr4_BuildVisitorOption "-visitor")

Expand All @@ -101,15 +101,15 @@ function(antlr4_generate
else()
set(Antlr4_BuildVisitorOption "-no-visitor")
endif ()

if ( (ARGC GREATER_EQUAL 6 ) AND (NOT ${ARGV5} STREQUAL "") )
set(Antlr4_NamespaceOption "-package;${ARGV5}")

list( APPEND Antlr4_GeneratorStatusMessage " in Namespace ${ARGV5}" )
else()
set(Antlr4_NamespaceOption "")
endif ()

if ( (ARGC GREATER_EQUAL 7 ) AND (NOT ${ARGV6} STREQUAL "") )
set(Antlr4_AdditionalDependencies ${ARGV6})
else()
Expand Down Expand Up @@ -157,7 +157,7 @@ function(antlr4_generate

# export generated cpp files into list
foreach(generated_file ${Antlr4_GeneratedTargets})

if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set_source_files_properties(
${generated_file}
Expand Down
3 changes: 3 additions & 0 deletions dltmessageanalyzerplugin/src/cmake/antlr4-runtime.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ set(ANTLR_VERSION @ANTLR_VERSION@)
set_and_check(ANTLR4_INCLUDE_DIR "@PACKAGE_ANTLR4_INCLUDE_DIR@")
set_and_check(ANTLR4_LIB_DIR "@PACKAGE_ANTLR4_LIB_DIR@")

include(CMakeFindDependencyMacro)
find_dependency(Threads)

include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)

check_required_components(antlr)
2 changes: 1 addition & 1 deletion md/installation_guide/installation_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Table of contents

> **Note!**
>
> Currently plugin can be built against the v2.24.0 release.
> Currently plugin can be built against the v2.25.0 release.
>
> The build under the earlier versions, down to the the v2.19.0 is also supported. But you will need to use the compatibility mode. Such an option is described below later on down this page. Search for the "PLUGIN_INTERFACE_VERSION" keyword.
>
Expand Down
Binary file added thirdparty/antlr/antlr-4.13.1-complete.jar
Binary file not shown.
Binary file removed thirdparty/antlr/antlr-4.8-complete.jar
Binary file not shown.
Binary file removed thirdparty/antlr/antlr4-4.8.zip
Binary file not shown.

0 comments on commit cdd99f7

Please sign in to comment.