Skip to content

Commit cc80497

Browse files
committed
Run the bootstrap batch script in CI
1 parent 5ef9eb2 commit cc80497

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

.github/workflows/java.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Java project (CI for the C++ part not implemented, yet)
1+
name: Build C++ DLL and Java Maven project
22

33
on: push
44

@@ -17,24 +17,25 @@ jobs:
1717
uses: actions/setup-java@v1
1818
with:
1919
java-version: ${{ env.JAVA_VERSION }}
20-
21-
- name: 'Clear'
22-
shell: cmd
20+
21+
- name: 'Create "dependencies" directory'
22+
shell: pwsh
2323
run: |
24-
CALL run\clear.bat
25-
26-
- name: 'Build Java'
27-
shell: cmd
24+
[IO.Directory]::CreateDirectory("dependencies")
25+
26+
- name: 'The ADS API is available as a secret. It is a base64-encoded .zip file.'
27+
shell: pwsh
28+
env:
29+
ADS_API_ZIP_BASE64: ${{ secrets.ADS_API_ZIP_BASE64 }}
2830
run: |
29-
CALL run\build_java.bat
30-
31-
- name: 'Build Documentation'
32-
shell: cmd
31+
[IO.File]::WriteAllBytes("dependencies\AdsApi.zip", [Convert]::FromBase64String("$env:ADS_API_ZIP_BASE64"))
32+
33+
- name: 'Put the contents of the "AdsApi.zip" archive into the "dependencies" directory.'
34+
shell: pwsh
3335
run: |
34-
CALL run\build_doc.bat
36+
Expand-Archive "dependencies\AdsApi.zip" -DestinationPath dependencies\
3537
36-
- name: 'Build Samples'
38+
- name: 'Run the bootstrap batch script'
3739
shell: cmd
3840
run: |
39-
CALL run\build_samples.bat
40-
41+
CALL bootstrap.bat

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ build_win32/
33
build_x64/
44
target/
55
dist/
6+
dependencies/
67
node_modules/
78
Testing/
89
samples/[0-9][0-9]_*/*.class

cpp/CMakeLists.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ else()
5757
target_include_directories(AdsToJava PRIVATE "$ENV{JAVA_HOME}/include/unix/")
5858
endif()
5959

60-
if (WIN32)
60+
if (EXISTS "dependencies")
61+
target_include_directories(AdsToJava PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/AdsApi/TcAdsDll/Include/")
62+
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
63+
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/AdsApi/TcAdsDll/Lib/" REQUIRED)
64+
else()
65+
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/AdsApi/TcAdsDll/Lib/x64/" REQUIRED)
66+
endif()
67+
elseif (WIN32)
6168
get_filename_component(TWINCAT_INSTALL_DIR "[HKEY_CURRENT_USER\\Software\\Beckhoff\\TwinCAT3\\3.1;InstallDir]" REALPATH)
6269
if(NOT EXISTS "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll")
6370
get_filename_component(TWINCAT_INSTALL_DIR "[HKEY_LOCAL_MACHINE\\Software\\Beckhoff\\TwinCAT3\\3.1;InstallDir]" REALPATH)
@@ -68,6 +75,7 @@ if (WIN32)
6875
endif()
6976
endif()
7077
endif()
78+
7179
if(EXISTS "${TWINCAT_INSTALL_DIR}/sdk/Include")
7280
# preferring the sdk/Include directory because the header files from ../AdsApi/TcAdsDll/Include/ might be too old
7381
target_include_directories(AdsToJava PRIVATE "${TWINCAT_INSTALL_DIR}/sdk/Include/")
@@ -76,16 +84,16 @@ if (WIN32)
7684
endif()
7785

7886
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
79-
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Lib/" REQUIRED)
87+
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" HINTS "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Lib/" REQUIRED)
8088
else()
81-
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Lib/x64/" "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/x64/lib/" REQUIRED)
89+
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" HINTS "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Lib/x64/" "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/x64/lib/" REQUIRED)
8290
endif()
8391
else()
8492
target_include_directories(AdsToJava PRIVATE "/usr/local/include/")
8593
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
86-
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "/usr/local/lib32/" REQUIRED)
94+
find_library(TC_ADS_DLL_LIBRARY NAMES "libTcAdsDll" HINTS "/usr/local/lib32/" REQUIRED)
8795
else()
88-
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "/usr/local/lib/" REQUIRED)
96+
find_library(TC_ADS_DLL_LIBRARY NAMES "libTcAdsDll" HINTS "/usr/local/lib/" REQUIRED)
8997
endif()
9098
endif()
9199
target_link_libraries(AdsToJava "${TC_ADS_DLL_LIBRARY}")

0 commit comments

Comments
 (0)