Skip to content

Commit

Permalink
Merge pull request #5555 from kc284/private/konstantin1/sdk-c
Browse files Browse the repository at this point in the history
CA-387885 and templatization of the C SDK
  • Loading branch information
robhoes authored Apr 19, 2024
2 parents aeee6ce + 6681b7d commit e2b0a40
Show file tree
Hide file tree
Showing 23 changed files with 1,262 additions and 884 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/generate-and-build-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
shell: bash
run: opam exec -- make sdk

- name: Store C SDK source
uses: actions/upload-artifact@v4
with:
name: SDK_Source_C
path: _build/install/default/xapi/sdk/c/*

- name: Store C# SDK source
uses: actions/upload-artifact@v4
with:
Expand All @@ -39,6 +45,30 @@ jobs:
- name: Cleanup XenAPI environment
uses: ./.github/workflows/cleanup-xapi-environment

build-c-sdk:
name: Build C SDK
runs-on: ubuntu-latest
needs: generate-sdk-sources
steps:
- name: Install dependencies
run: sudo apt-get install libxml2-dev

- name: Retrieve C SDK source
uses: actions/download-artifact@v4
with:
name: SDK_Source_C
path: source/

- name: Build C SDK
shell: bash
run: make -C source

- name: Store C SDK
uses: actions/upload-artifact@v4
with:
name: SDK_Artifacts_C
path: source/*

build-csharp-sdk:
name: Build C# SDK
runs-on: windows-2022
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:
name: XenAPI
path: dist/

- name: Retrieve C SDK distribution binaries
uses: actions/download-artifact@v4
with:
name: SDK_Artifacts_C
path: libxenserver/usr/local/

- name: Retrieve C# SDK distribution artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -70,10 +76,19 @@ jobs:
name: SDK_Binaries_XenServerPowerShell_NET6
path: sdk_powershell_7x/

- name: Package C SDK artifacts for deployment
shell: bash
run: |
mkdir -p libxenserver/usr/local/lib
mv libxenserver/usr/local/libxenserver.* libxenserver/usr/local/lib/
tar -zcvf libxenserver-prerelease.tar.gz -C ./libxenserver usr/local/lib/ usr/local/include/xen/api
rm -rf libxenserver/usr/local/lib/
tar -zcvf libxenserver-prerelease.src.tar.gz -C ./libxenserver/usr/local .
- name: Zip PowerShell 5.x SDK artifacts for deployment
shell: bash
run: zip PowerShell-SDK-5.x-prerelease-unsigned.zip ./sdk_powershell_5x -r

- name: Zip PowerShell 7.x SDK artifacts for deployment
shell: bash
run: zip PowerShell-SDK-7.x-prerelease-unsigned.zip ./sdk_powershell_7x -r
Expand All @@ -83,7 +98,8 @@ jobs:
run: |
gh release create ${{ github.ref_name }} --repo ${{ github.repository }} --generate-notes dist/* \
PowerShell-SDK-5.x-prerelease-unsigned.zip \
PowerShell-SDK-7.x-prerelease-unsigned.zip
PowerShell-SDK-7.x-prerelease-unsigned.zip \
libxenserver-prerelease.tar.gz libxenserver-prerelease.src.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,10 @@ sdk:
sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/csharp
sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/powershell

.PHONY: sdk-build-c sdk sdksanity
.PHONY: sdk-build-c

sdk-build-c: sdk
cd _build/install/default/xapi/sdk/c && make -j $(JOBS)

# workaround for no .resx generation, just for compilation testing
sdksanity: sdk
sed -i 's/FriendlyErrorNames.ResourceManager/null/g' ./_build/install/default/xapi/sdk/csharp/src/Failure.cs
cd _build/install/default/xapi/sdk/csharp/src && dotnet add package Newtonsoft.Json && dotnet build -f netstandard2.0
cd _build/install/default/xapi/sdk/c && make clean && make -j $(JOBS)

.PHONY: sdk-build-java

Expand Down
2 changes: 1 addition & 1 deletion ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6070,7 +6070,7 @@ module Event = struct
~doc:
"Blocking call which returns a (possibly empty) batch of events. This \
method is only recommended for legacy use. New development should use \
event.from which supercedes this method."
event.from which supersedes this method."
~custom_marshaller:true ~flags:[`Session]
~result:(Set (Record _event), "A set of events")
~errs:[Api_errors.session_not_registered; Api_errors.events_lost]
Expand Down
4 changes: 2 additions & 2 deletions ocaml/idl/datamodel_observer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let set_components =
call ~name:"set_components" ~in_oss_since:None ~lifecycle:[]
~doc:
"Set the components on which the observer will broadcast to. i.e. xapi, \
xenopsd, networkd, etc"
xenopsd, networkd, etc."
~params:
[
(Ref _observer, "self", "The observer")
Expand All @@ -106,7 +106,7 @@ let set_components =
let t =
create_obj ~name:_observer
~descr:
"Describes a observer which will control observability activity in the \
"Describes an observer which will control observability activity in the \
Toolstack"
~doccomments:[] ~gen_constructor_destructor:true ~gen_events:true
~in_db:true ~lifecycle:[] ~persist:PersistEverything ~in_oss_since:None
Expand Down
1 change: 0 additions & 1 deletion ocaml/sdk-gen/c/README.dist
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ Compiling from source
---------------------

To build, simply type "make" in the libxenserver/src directory.
To build on Windows with cygwin type "make CYGWIN=1".
Loading

0 comments on commit e2b0a40

Please sign in to comment.