Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
c57a08d
windows build
azahnen Dec 30, 2025
c5c6f24
windows build
azahnen Dec 30, 2025
1aa4df4
windows build
azahnen Dec 30, 2025
cee1d9a
windows build
azahnen Dec 30, 2025
ffd6d60
windows build
azahnen Dec 30, 2025
e3bd8ac
windows build
azahnen Dec 30, 2025
4ab21dd
windows build
azahnen Dec 30, 2025
0cfc5a4
windows build
azahnen Dec 30, 2025
47fc179
windows build
azahnen Dec 30, 2025
f768f1e
windows build
azahnen Dec 30, 2025
5cb8800
windows build
azahnen Dec 30, 2025
395d70c
windows build
azahnen Dec 30, 2025
a23ed73
windows build
azahnen Dec 30, 2025
206f7a5
windows build
azahnen Dec 30, 2025
1c7772f
windows build
azahnen Dec 30, 2025
d674152
windows build
azahnen Dec 30, 2025
40e97a9
windows build
azahnen Dec 30, 2025
358295c
windows build
azahnen Dec 30, 2025
7240849
windows build
azahnen Dec 30, 2025
6ae7dcc
windows build
azahnen Dec 30, 2025
253702f
windows build
azahnen Dec 30, 2025
5dbc2c6
windows build
azahnen Dec 30, 2025
6e0220e
windows build
azahnen Dec 30, 2025
f719066
windows build
azahnen Dec 30, 2025
ce60947
windows build
azahnen Dec 30, 2025
4a66f37
windows build
azahnen Dec 30, 2025
a45e1a9
windows build
azahnen Dec 31, 2025
a351587
windows build
azahnen Dec 31, 2025
1a4843c
windows build
azahnen Dec 31, 2025
e517a3e
windows build
azahnen Dec 31, 2025
cb7b0f7
windows build
azahnen Dec 31, 2025
dbd2cf0
windows build
azahnen Dec 31, 2025
8b4f325
windows build
azahnen Dec 31, 2025
7a19ecd
windows build
azahnen Dec 31, 2025
bfa1f9f
windows build
azahnen Dec 31, 2025
aedd048
windows build
azahnen Dec 31, 2025
263e648
windows build
azahnen Dec 31, 2025
d282a18
windows build
azahnen Dec 31, 2025
93786a7
windows build
azahnen Dec 31, 2025
dae45b0
windows build
azahnen Jan 2, 2026
6c2108b
windows build
azahnen Jan 2, 2026
e5b6121
windows build
azahnen Jan 3, 2026
8f1f955
windows build
azahnen Jan 3, 2026
a7ffdd5
windows build
azahnen Jan 3, 2026
302b20f
Revert "windows build"
azahnen Jan 4, 2026
56d9e2f
windows build
azahnen Jan 4, 2026
48126ed
windows build
azahnen Jan 5, 2026
fead5ef
windows build
azahnen Jan 5, 2026
24d2a6d
windows build
azahnen Jan 5, 2026
53fa63c
windows build
azahnen Jan 5, 2026
d61fbac
windows build
azahnen Jan 5, 2026
8755cab
windows build
azahnen Jan 5, 2026
a8716af
windows build
azahnen Jan 5, 2026
92e6945
windows build
azahnen Jan 5, 2026
3026dee
windows build
azahnen Jan 5, 2026
97b02fe
windows build
azahnen Jan 5, 2026
35560ea
Revert "windows build"
azahnen Jan 5, 2026
1edf298
Revert "windows build"
azahnen Jan 5, 2026
26039a8
windows build
azahnen Jan 5, 2026
26c7c18
windows build
azahnen Jan 5, 2026
a778a13
Revert "windows build"
azahnen Jan 5, 2026
55e25c1
windows build
azahnen Jan 5, 2026
a98b806
windows build
azahnen Jan 5, 2026
0c9f4b5
windows build
azahnen Jan 5, 2026
22d68ce
windows build
azahnen Jan 5, 2026
00abe16
windows build
azahnen Jan 6, 2026
ce83e3b
windows build
azahnen Jan 6, 2026
e5cd69a
windows build
azahnen Jan 6, 2026
6de90c3
windows build
azahnen Jan 6, 2026
12da7c2
windows build
azahnen Jan 6, 2026
6961e76
windows build
azahnen Jan 6, 2026
4ad41b0
windows build
azahnen Jan 6, 2026
0456c39
windows build
azahnen Jan 6, 2026
71de6e2
windows build
azahnen Jan 6, 2026
02d92ba
windows build
azahnen Jan 6, 2026
8c1bdcc
Merge branch 'main' into win
azahnen Jan 6, 2026
9dc0fd5
cleanup
azahnen Jan 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions .github/workflows/xtracfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:
- runner: ubuntu-24.04
type: linux
platform: linux-amd64
- runner: ubuntu-24.04-arm #buildjet-2vcpu-ubuntu-2204-arm
- runner: ubuntu-24.04-arm
type: linux
platform: linux-arm64
- runner: macos-14
type: macos
platform: darwin-arm64
#- runner: windows-2022
# type: windows
# platform: windows-amd64
- runner: windows-2022
type: windows
platform: windows-amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -38,6 +38,10 @@ jobs:
#cache-dependency-path: |
# xtracfg/*.gradle*
# xtracfg/**/gradle-wrapper.properties
- uses: egor-tensin/vs-shell@v2
if: ${{ matrix.os.type == 'windows' }}
with:
arch: x64
- name: zlib
if: ${{ matrix.os.type == 'linux' }}
working-directory: /tmp
Expand All @@ -54,15 +58,24 @@ jobs:
working-directory: ./libxtracfg/java
run: |
./gradlew nativeCompile -PLIB=true
- name: log0
run: |
cat ./libxtracfg/java/build/native/nativeCompile/logs/compiler_commands.txt
- name: log1
run: |
ls -l ./libxtracfg/c/build
# TODO: windows
- name: c
if: ${{ matrix.os.type != 'windows' }}
working-directory: ./libxtracfg/c
run: |
./build.sh
./test.sh
- name: c
if: ${{ matrix.os.type == 'windows' }}
working-directory: ./libxtracfg/c
run: |
./build.bat
./test.bat
- name: log2
run: |
ls -l ./libxtracfg/c/build
Expand All @@ -74,13 +87,22 @@ jobs:
npm --loglevel verbose run test
- name: log3
run: |
ls -lR ./libxtracfg/js/xtracfg-native-binding/prebuilds
ls -R ./libxtracfg/js/xtracfg-native-binding/prebuilds
# TODO: run tests for java, c, go
- uses: actions/upload-artifact@v4
if: ${{ matrix.os.type != 'windows' }}
with:
name: libxtracfg-c-${{ matrix.os.platform }}
path: ./libxtracfg/c/build/libxtracfg.a
retention-days: 1
- uses: actions/upload-artifact@v4
if: ${{ matrix.os.type == 'windows' }}
with:
name: libxtracfg-c-${{ matrix.os.platform }}
path: |
./libxtracfg/c/build/libxtracfg.lib
./libxtracfg/c/build/libxtracfgjni_static_ext.lib
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: libxtracfg-c-hash-${{ matrix.os.platform }}
Expand All @@ -101,7 +123,7 @@ jobs:
- runner: ubuntu-24.04
type: linux
platform: linux-amd64
- runner: ubuntu-24.04-arm #buildjet-2vcpu-ubuntu-2204-arm
- runner: ubuntu-24.04-arm
type: linux
platform: linux-arm64
- runner: macos-14
Expand All @@ -113,6 +135,7 @@ jobs:
defaults:
run:
working-directory: ./xtracfg
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -137,7 +160,7 @@ jobs:
CMD_GIT_BRANCH: github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitBranch=${{ github.ref_name }}
CMD_GIT_SHA: github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitSha=${{ steps.short-sha.outputs.substring }}
CMD_GIT_TAG: github.com/interactive-instruments/xtraplatform-cli/xtracfg/cmd.gitTag=${{ github.ref_type == 'tag' && github.ref_name || '' }}
EXT_LDFLAGS: ${{ matrix.os.type == 'macos' && '-framework CoreServices -framework Foundation' || '-z noexecstack' }}
EXT_LDFLAGS: ${{ (matrix.os.type == 'macos' && '-framework CoreServices -framework Foundation') || (matrix.os.type == 'linux' && '-z noexecstack') || '' }}
run: |
go build -o build/xtracfg -ldflags="-s -w -X ${CMD_GIT_TAG} -X ${CMD_GIT_SHA} -X ${CMD_GIT_BRANCH} '-extldflags=${EXT_LDFLAGS}'"
- name: log1
Expand Down
40 changes: 40 additions & 0 deletions libxtracfg/c/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@echo off
REM Windows batch file conversion of build.sh

SET OUT_DIR=build
SET PLATFORM=win32
SET EXT=lib

if not exist %OUT_DIR% mkdir %OUT_DIR%

cd %OUT_DIR%

echo lib

REM static
cl.exe /c /MD /W4 /I./ /I%JAVA_HOME%/include /I%JAVA_HOME%/include/%PLATFORM% /Folibxtracfg.obj ../wrapper/libxtracfg.c
lib.exe /OUT:libxtracfg.lib /VERBOSE libxtracfg.obj libxtracfgjni_static.lib

certutil -hashfile libxtracfg.lib SHA1 > libxtracfg.sha1sum.tmp
REM Extract just the hash from certutil output (it includes headers/footers)
findstr /v "SHA1 CertUtil" libxtracfg.sha1sum.tmp > libxtracfg.sha1sum
del libxtracfg.sha1sum.tmp
copy libxtracfg.sha1sum ..\..\go\xtracfg\

echo test
ls -l

REM static
cl.exe /MD /I./ /Fetest.exe ^
../test/main.c ^
libxtracfg.lib ^
libxtracfgjni_static_ext.lib ^
/link ^
/NODEFAULTLIB:LIBCMT ^
/FILEALIGN:4096 ^
/LIBPATH:./ ^
/WHOLEARCHIVE:libxtracfg.lib

ls -l

cd ..
1 change: 1 addition & 0 deletions libxtracfg/c/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ echo "lib"
clang -c -Wall -fPIC -I./ -I$JAVA_HOME/include -I$JAVA_HOME/include/${PLATFORM} -o libxtracfg.o ../wrapper/libxtracfg.c
cp libxtracfgjni.a libxtracfg.a
ar -rv libxtracfg.a libxtracfg.o

if [ "$PLATFORM" = "darwin" ]; then
shasum libxtracfg.a > libxtracfg.sha1sum
else
Expand Down
44 changes: 35 additions & 9 deletions libxtracfg/c/native-image/static-compiler-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REM in a local temp directory and does not specify the output path anywhere. Tes
REM GraalVM jdk21.+35.1 on Windows 10 and may need to be modified for other versions.
REM
REM Use with --native-compiler-path=${pathToThisScript}.bat
set OUTPUT_PATH=%~dp0\..\..\target\image
set OUTPUT_PATH=%~dp0\..\..\java\build\native\nativeCompile

REM Determine the library name based on the .dll argument. ~nP returns the filename
REM without quotes, i.e., "path\myLibrary.dll" returns myLibrary
Expand All @@ -20,36 +20,62 @@ for %%P in (%*) do (
)
)

REM Do a simple forward for any calls that are used to compile individual C files
IF "%LIB_NAME%"=="" (
cmd /c cl %*
exit /b
)

REM Setup log path and log file
set LOG_PATH=%OUTPUT_PATH%\logs
set LOG_FILE=%LOG_PATH%\compiler_commands.txt
if not exist %LOG_PATH% mkdir %LOG_PATH%

echo Working directory: %CD% > %LOG_FILE%
REM Do a simple forward for any calls that are used to compile individual C files
IF "%LIB_NAME%"=="" (
echo Forwarding to cl.exe for compiling C file: %* >> %LOG_FILE%
cmd /c cl.exe %*
exit /b
)

echo Working directory: %CD% >> %LOG_FILE%
echo Output path: %OUTPUT_PATH% >> %LOG_FILE%
echo Library name: %LIB_NAME% >> %LOG_FILE%
echo Java home: %JAVA_HOME% >> %LOG_FILE%

echo ===================================================== >> %LOG_FILE%
echo SHARED LIBRARY >> %LOG_FILE%
echo ===================================================== >> %LOG_FILE%
REM Modify the arguments if needed
set CL_ARGS=%*
REM set "CL_ARGS=%CL_ARGS:/MD /LD=/MT%"
REM set "CL_ARGS=%CL_ARGS:/NODEFAULTLIB:LIBCMT=%"
echo cl.exe %CL_ARGS% >> %LOG_FILE%
cmd /c cl.exe %CL_ARGS%

echo ===================================================== >> %LOG_FILE%
echo STATIC EXTERNAL >> %LOG_FILE%
echo ===================================================== >> %LOG_FILE%
set LIBS_EXT=
for %%P in (%*) do (
echo %%P >> %LOG_FILE%
echo %%P | findstr /R /C:"^[^/].*\.lib" 1>nul
if !errorlevel!==0 (
echo *** >> %LOG_FILE%
echo !LIBS_EXT! | findstr /C:"%%P" >nul
if !errorlevel!==1 (
set "LIBS_EXT=!LIBS_EXT! %%P"
)
)

)
REM set "LIBS_EXT=!LIBS_EXT:svm\clibraries\windows-amd64\jvm.lib=jvm.lib!"
echo !LIBS_EXT! >> %LOG_FILE%

echo ===================================================== >> %LOG_FILE%
echo STATIC LIBRARY >> %LOG_FILE%
echo ===================================================== >> %LOG_FILE%
REM To create a static library on Windows we need to call lib.exe input.obj /OUT:output.lib
REM We don't want to overwrite the .lib needed to compile against the .dll, so
REM we append "_s" to indicate that it is a static library.
if not exist %OUTPUT_PATH% mkdir %OUTPUT_PATH%
set LIB_ARGS=%LIB_NAME%.obj /OUT:%OUTPUT_PATH%\%LIB_NAME%_s.lib
set LIB_ARGS=%LIB_NAME%.obj /OUT:%OUTPUT_PATH%\%LIB_NAME%_static.lib
echo lib.exe %LIB_ARGS% >> %LOG_FILE%
cmd /c lib.exe %LIB_ARGS%
set LIB_ARGS=!LIBS_EXT! /OUT:%OUTPUT_PATH%\%LIB_NAME%_static_ext.lib
echo lib.exe %LIB_ARGS% >> %LOG_FILE%
cmd /c lib.exe %LIB_ARGS%
11 changes: 11 additions & 0 deletions libxtracfg/c/test.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
REM @echo off

set DIR=%~dp0
set DIR=%DIR:~0,-1%
set DIR=D:\\a\\xtraplatform-cli\\xtraplatform-cli\\libxtracfg\\c

cd build

cmd.exe /c test.exe "{\"command\": \"info\", \"source\": \"%DIR%\", \"debug\": \"true\", \"verbose\": \"true\"}"

ldd test.exe
3 changes: 3 additions & 0 deletions libxtracfg/c/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

DIR=$(dirname "$(readlink -f "$0")")

ls -l ./build
ldd ./build/test

./build/test "{\"command\": \"info\", \"source\": \"$DIR\", \"debug\": \"true\", \"verbose\": \"true\"}"
2 changes: 1 addition & 1 deletion libxtracfg/c/wrapper/libxtracfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ JNIEXPORT void JNICALL Java_de_ii_xtraplatform_cli_Cli_00024NativeProgress_updat

int xtracfg_init() {
JavaVMInitArgs vm_args;
JavaVMOption options[0];
JavaVMOption options[1];
vm_args.version = JNI_VERSION_10;
vm_args.nOptions = 0;
vm_args.options = options;
Expand Down
11 changes: 4 additions & 7 deletions libxtracfg/go/xtracfg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package xtracfg
/*
#cgo CFLAGS: -I ../../c/include
#cgo LDFLAGS: -L../../c/build -lxtracfg
#cgo windows LDFLAGS: -lxtracfgjni_static_ext

#include <stdlib.h>
#include "libxtracfg.h"
Expand Down Expand Up @@ -129,17 +130,15 @@ func (store Store) Handle(parameters map[string]interface{}, command string, sub
return nil, fmt.Errorf("Error: %s", *response.Error)
}


if response.Results == nil {
return []Result{}, nil
}


for i := range *response.Results {
(*response.Results)[i].Details = response.Details
}
(*response.Results)[i].Details = response.Details
}

return *response.Results, nil
return *response.Results, nil
}

func (store Store) request(parameters map[string]interface{}, command string, subcommands ...string) (response *Response, err error) {
Expand All @@ -149,10 +148,8 @@ func (store Store) request(parameters map[string]interface{}, command string, su
parameters["subcommand"] = subcommands[0]
}


request, err := json.Marshal(parameters)


if err != nil {
return nil, fmt.Errorf("Error: Failed to marshal the request body. %s", err)
}
Expand Down
25 changes: 22 additions & 3 deletions libxtracfg/js/xtracfg-native-binding/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{
'target_name': 'xtracfg-native',
'sources': [ 'src/xtracfg_lib.cc' ],
'libraries': [ '<(local_prefix)/../c/build/libxtracfg.a' ],
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")", "<(local_prefix)/../c/include"],
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
'cflags': ['-fPIC'],
Expand All @@ -17,8 +16,28 @@
"OTHER_CFLAGS": [ "-fPIC"]
},
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
}
'VCCLCompilerTool': {
'RuntimeLibrary': 2, # /MD
'ExceptionHandling': 1,
'AdditionalOptions': [
'/MD',
'/EHsc',
],
},
'VCLinkerTool': {
'IgnoreDefaultLibraryNames': [ 'LIBCMT' ],
'AdditionalOptions': [
'/WHOLEARCHIVE:<(local_prefix)/../c/build/libxtracfg.lib',
],
},
},
'conditions': [
['OS=="win"', {
'libraries': [ '<(local_prefix)/../c/build/libxtracfg.lib', '<(local_prefix)/../c/build/libxtracfgjni_static_ext.lib' ]
}, { # OS != "win"
'libraries': [ '<(local_prefix)/../c/build/libxtracfg.a' ]
}],
]
}
]
}
8 changes: 6 additions & 2 deletions libxtracfg/js/xtracfg-native-binding/test/test_binding.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
const xtracfgLib = require("../index.js");
const currentDir = __dirname;

function testBasic() {
const command =
'{"command": "info", "source": "/Users/az/development/configs-ldproxy/demogh", "verbose": "true", "debug": "true"}';
console.log("Testing basic execute...", currentDir);
const command = `{"command": "info", "source": "${currentDir.replaceAll(
"\\",
"/"
)}", "verbose": "true", "debug": "true"}`;

const result = xtracfgLib.execute(command);

Expand Down
Loading