-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
321 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[target.x86_64-unknown-linux-gnu] | ||
rustflags = [ | ||
"-C", "link-arg=-fuse-ld=lld", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update && apt-get upgrade | ||
|
||
# install sf | ||
RUN apt-get install apt-transport-https curl lsb-release wget gnupg2 software-properties-common debconf-utils -y | ||
|
||
RUN wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb \ | ||
&& dpkg -i packages-microsoft-prod.deb \ | ||
&& curl -fsSL https://packages.microsoft.com/keys/msopentech.asc | apt-key add - \ | ||
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ | ||
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ | ||
&& apt-get update | ||
|
||
RUN echo "servicefabric servicefabric/accepted-eula-ga select true" | debconf-set-selections \ | ||
&& echo "servicefabricsdkcommon servicefabricsdkcommon/accepted-eula-ga select true" | debconf-set-selections \ | ||
&& apt-get install servicefabricsdkcommon -y | ||
|
||
# install rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ./rustup.sh | ||
RUN chmod u+x ./rustup.sh && ./rustup.sh -y | ||
|
||
# more tools | ||
RUN apt-get install cmake git -y | ||
RUN apt-get install clang lld -y | ||
|
||
# expose sf shared libs | ||
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/opt/microsoft/servicefabric/bin/Fabric/Fabric.Code:/workspaces/service-fabric-rs/bintemp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp | ||
{ | ||
"name": "C++", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
|
||
// "image" : "fabric-metadata:v1", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "gcc -v", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-vscode.cpptools-extension-pack", | ||
"rust-lang.rust-analyzer"] | ||
} | ||
} | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ jobs: | |
BUILD_TYPE: ["Debug"] | ||
os: [ windows-latest ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get MSVC | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
|
@@ -46,4 +46,52 @@ jobs: | |
run: Powershell.exe -File .\build\_deps\service_fabric_cpp-src\scripts\check_cluster_online.ps1 | ||
|
||
- name: run echo example app | ||
run: Powershell.exe -File .\tests\echo_script_test.ps1 | ||
run: Powershell.exe -File .\tests\echo_script_test.ps1 | ||
|
||
build-linux: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
BUILD_TYPE: ["Debug"] | ||
os: [ ubuntu-20.04 ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: apt-get | ||
run: sudo apt-get update && sudo apt-get install apt-transport-https curl lsb-release wget gnupg2 software-properties-common debconf-utils clang lld -y | ||
|
||
- name: install sf | ||
run: | | ||
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb; | ||
sudo dpkg -i packages-microsoft-prod.deb; | ||
curl -fsSL https://packages.microsoft.com/keys/msopentech.asc | sudo apt-key add - ; | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - ; | ||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" ; | ||
sudo apt-get update; | ||
echo "servicefabric servicefabric/accepted-eula-ga select true" | sudo debconf-set-selections ; | ||
echo "servicefabricsdkcommon servicefabricsdkcommon/accepted-eula-ga select true" | sudo debconf-set-selections ; | ||
sudo apt-get install servicefabricsdkcommon -y | ||
- name: Get specific version CMake, v3.21.2 | ||
uses: lukka/[email protected] | ||
|
||
- name: Install rust stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
- name: run cmake | ||
run: > | ||
cmake . -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} -B build | ||
- name: run build | ||
run: cmake --build build --config ${{ matrix.BUILD_TYPE }} | ||
|
||
|
||
# - uses: actions/checkout@v2 | ||
|
||
# - name: apt-get | ||
# run: sudo apt-get install apt-transport-https curl lsb-release wget gnupg2 software-properties-common debconf-utils -y | ||
|
||
# - name: Install rust stable | ||
# uses: actions-rs/toolchain@v1 | ||
# with: | ||
# toolchain: stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
//use std::{path::Path, env}; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
// add link dir for fabric support libs. This is propagated to downstream targets | ||
// let dir = String::from("build\\_deps\\fabric_metadata-build\\src"); | ||
// let package_root = env::var("CARGO_MANIFEST_DIR").unwrap(); | ||
// let abs_dir = package_root + &dir; | ||
// println!( | ||
// "cargo:rustc-link-search=native={}", | ||
// Path::new(&abs_dir).display() | ||
// ); | ||
if cfg!(unix) { | ||
// Add link dir for fabric libs on linux. | ||
let dir = String::from("/opt/microsoft/servicefabric/bin/Fabric/Fabric.Code/"); | ||
println!("cargo:rustc-link-search={}", Path::new(&dir).display()); | ||
|
||
// On linux, for windows-rs to work we need have a pal shared lib. | ||
// No need to have search dir since it is in the target dir | ||
println!("cargo:rustc-link-lib=dylib=fabric_rust_pal"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "pal" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
||
[lib] | ||
name = "fabric_rust_pal" | ||
path = "src/lib.rs" | ||
crate-type = ["cdylib"] | ||
|
||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies.windows] | ||
version = "0.51" | ||
features = [ | ||
"Win32_Foundation" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#[cfg(unix)] | ||
pub mod pal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#[allow(non_camel_case_types, non_snake_case, dead_code)] | ||
use std::ffi::c_void; | ||
|
||
use windows::core::imp::LOAD_LIBRARY_FLAGS; | ||
use windows::{ | ||
core::{HRESULT, PCSTR, PWSTR}, | ||
Win32::Foundation::{HANDLE, HMODULE}, | ||
}; | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetLastError() -> u32 { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetProcessHeap() -> isize { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn HeapAlloc(_heap: isize, _flags: u32, _len: usize) -> *mut c_void { | ||
std::ptr::null_mut() | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn HeapFree(_heap: isize, _flags: u32, _ptr: *const c_void) -> i32 { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetErrorInfo(_reserved: u32, _info: *mut *mut c_void) -> HRESULT { | ||
HRESULT(0) | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn SetErrorInfo(_reserved: u32, _info: *const c_void) -> HRESULT { | ||
HRESULT(0) | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn LoadLibraryA(_name: PCSTR) -> isize { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn LoadLibraryExA( | ||
_lplibfilename: PCSTR, | ||
_hfile: HANDLE, | ||
_dwflags: LOAD_LIBRARY_FLAGS, | ||
) -> HMODULE { | ||
windows::Win32::Foundation::HMODULE(0) | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn FreeLibrary(_library: isize) -> i32 { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn GetProcAddress(_library: isize, _name: PCSTR) -> *const c_void { | ||
std::ptr::null() | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn SysFreeString(_bstr: *const u16) {} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn SysStringLen(_bstr: *const u16) -> u32 { | ||
0 | ||
} | ||
|
||
#[no_mangle] | ||
pub unsafe extern "system" fn FormatMessageW( | ||
_flags: u32, | ||
_source: *const c_void, | ||
_code: u32, | ||
_lang: u32, | ||
_buffer: PWSTR, | ||
_len: u32, | ||
_args: *const *const i8, | ||
) -> u32 { | ||
0 | ||
} |
Oops, something went wrong.