Skip to content

Commit

Permalink
Revert changes in windows build script
Browse files Browse the repository at this point in the history
  • Loading branch information
gleocadie authored and hoolioh committed Nov 7, 2024
1 parent a836f5e commit ea4e7c3
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 95 deletions.
2 changes: 0 additions & 2 deletions builder/src/bin/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct ReleaseArgs {
impl From<pico_args::Arguments> for ReleaseArgs {
fn from(mut args: pico_args::Arguments) -> Self {
let release_args = ReleaseArgs {
// out_dir: args.value_from_str("--out").map_or(None, Some),
out_dir: match args.value_from_str("--out") {
Ok(v) => Some(v),
Err(_) => None,
Expand All @@ -41,7 +40,6 @@ impl From<pico_args::Arguments> for ReleaseArgs {
pub fn main() {
let args: ReleaseArgs = pico_args::Arguments::from_env().into();

println!("{:?}", std::env::vars());
let (_, source_path) = determine_paths();

let profile = env::var("PROFILE").unwrap();
Expand Down
22 changes: 13 additions & 9 deletions builder/src/crashtracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ pub struct CrashTracker {
}

impl CrashTracker {
fn gen_binaries(&self) -> Result<()> {
if arch::BUILD_CRASHTRACKER {
let mut crashtracker_dir = project_root();
crashtracker_dir.push("crashtracker");
let _dst = cmake::Config::new(crashtracker_dir.to_str().unwrap())
.define("Datadog_ROOT", self.target_dir.as_ref())
.define("CMAKE_INSTALL_PREFIX", self.target_dir.as_ref())
.build();
}

Ok(())
}
fn add_headers(&self) -> Result<()> {
let origin_path: PathBuf = [self.source_include.as_ref(), "crashtracker.h"]
.iter()
Expand All @@ -39,20 +51,12 @@ impl CrashTracker {

impl Module for CrashTracker {
fn build(&self) -> Result<()> {
if arch::BUILD_CRASHTRACKER {
let mut crashtracker_dir = project_root();
crashtracker_dir.push("crashtracker");
let _dst = cmake::Config::new(crashtracker_dir.to_str().unwrap())
.define("Datadog_ROOT", self.target_dir.as_ref())
.define("CMAKE_INSTALL_PREFIX", self.target_dir.as_ref())
.build();
}

Ok(())
}

fn install(&self) -> Result<()> {
self.add_headers()?;
self.gen_binaries()?;
Ok(())
}
}
1 change: 0 additions & 1 deletion builder/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ impl Profiling {

// Create files
for file in files.iter() {
// let file_in = "../profiling-ffi/".to_string() + file + ".in";
let file_in = file.to_string() + ".in";

let mut pc_origin: PathBuf = project_root();
Expand Down
70 changes: 20 additions & 50 deletions windows/build-artifacts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,27 @@ if (![System.IO.Path]::IsPathRooted($output_dir)) {
$output_dir = [System.IO.Path]::Combine($(Get-Location), $output_dir)
}

$x86_release_dir = "$($output_dir)-x86-release"
$x86_debug_dir = "$($output_dir)-x86-debug"
$x86_64_release_dir = "$($output_dir)-x86_64-release"
$x86_64_debug_dir = "$($output_dir)-x86_64-debug"

Remove-Item -Recurse -Force -ErrorAction Ignore $output_dir
Remove-Item -Recurse -Force -ErrorAction Ignore $x86_release_dir
Remove-Item -Recurse -Force -ErrorAction Ignore $x86_debug_dir
Remove-Item -Recurse -Force -ErrorAction Ignore $x86_64_release_dir
Remove-Item -Recurse -Force -ErrorAction Ignore $x86_64_debug_dir
Write-Host "Building project into $($output_dir)" -ForegroundColor Magenta

# build inside the crate to use the config.toml file
#pushd profiling-ffi

# cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --release -- --out $LIBDD_OUTPUT_FOLDER
Write-Host "Building project into $($x86_64_release_dir)" -ForegroundColor Magenta
Invoke-Call -ScriptBlock { cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --release --target x86_64-pc-windows-msvc -- --out $x86_64_release_dir }

Write-Host "Building project into $($x86_64_debug_dir)" -ForegroundColor Magenta
Invoke-Call -ScriptBlock { cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --target x86_64-pc-windows-msvc -- --out $x86_64_debug_dir }

Write-Host "Building project into $($x86_release_dir)" -ForegroundColor Magenta
Invoke-Call -ScriptBlock { cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --release --target i686-pc-windows-msvc -- --out $x86_release_dir }

Write-Host "Building project into $($x86_debug_dir)" -ForegroundColor Magenta
Invoke-Call -ScriptBlock { cargo run --bin release --features profiling,telemetry,data-pipeline,symbolizer,crashtracker --target i686-pc-windows-msvc -- --out $x86_debug_dir }

#Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target i686-pc-windows-msvc --release --target-dir $output_dir }
#Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target i686-pc-windows-msvc --target-dir $output_dir }
#Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target x86_64-pc-windows-msvc --release --target-dir $output_dir }
#Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target x86_64-pc-windows-msvc --target-dir $output_dir }
#popd

# Write-Host "Building tools" -ForegroundColor Magenta
# Set-Location tools
# Invoke-Call -ScriptBlock { cargo build --release }
# Set-Location ..

Write-Host "Copying artifacts" -ForegroundColor Magenta
Copy-Item -Path $x86_64_release_dir $output_dir\x64\release\ -Recurse
Copy-Item -Path $x86_64_debug_dir $output_dir\x64\debug\ -Recurse
Copy-Item -Path $x86_release_dir $output_dir\x86\release -Recurse
Copy-Item -Path $x86_debug_dir $output_dir\x86\debug\ -Recurse


# Write-Host "Generating headers" -ForegroundColor Magenta
# Invoke-Call -ScriptBlock { cbindgen --crate ddcommon-ffi --config ddcommon-ffi/cbindgen.toml --output $output_dir\common.h }
# Invoke-Call -ScriptBlock { cbindgen --crate datadog-profiling-ffi --config profiling-ffi/cbindgen.toml --output $output_dir\profiling.h }
# Invoke-Call -ScriptBlock { cbindgen --crate ddtelemetry-ffi --config ddtelemetry-ffi/cbindgen.toml --output $output_dir\telemetry.h }
# Invoke-Call -ScriptBlock { cbindgen --crate data-pipeline-ffi --config data-pipeline-ffi/cbindgen.toml --output $output_dir"\data-pipeline.h" }
# Invoke-Call -ScriptBlock { cbindgen --crate datadog-crashtracker-ffi --config crashtracker-ffi/cbindgen.toml --output $output_dir"\crashtracker.h" }
# Invoke-Call -ScriptBlock { .\target\release\dedup_headers $output_dir"\common.h" $output_dir"\profiling.h" $output_dir"\telemetry.h" $output_dir"\data-pipeline.h" $output_dir"\crashtracker.h"}
pushd profiling-ffi
Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target i686-pc-windows-msvc --release --target-dir $output_dir }
Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target i686-pc-windows-msvc --target-dir $output_dir }
Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target x86_64-pc-windows-msvc --release --target-dir $output_dir }
Invoke-Call -ScriptBlock { cargo build --features datadog-profiling-ffi/ddtelemetry-ffi,datadog-profiling-ffi/crashtracker-receiver,datadog-profiling-ffi/crashtracker-collector,datadog-profiling-ffi/demangler --target x86_64-pc-windows-msvc --target-dir $output_dir }
popd

Write-Host "Building tools" -ForegroundColor Magenta
Set-Location tools
Invoke-Call -ScriptBlock { cargo build --release }
Set-Location ..

Write-Host "Generating headers" -ForegroundColor Magenta
Invoke-Call -ScriptBlock { cbindgen --crate ddcommon-ffi --config ddcommon-ffi/cbindgen.toml --output $output_dir\common.h }
Invoke-Call -ScriptBlock { cbindgen --crate datadog-profiling-ffi --config profiling-ffi/cbindgen.toml --output $output_dir\profiling.h }
Invoke-Call -ScriptBlock { cbindgen --crate ddtelemetry-ffi --config ddtelemetry-ffi/cbindgen.toml --output $output_dir\telemetry.h }
Invoke-Call -ScriptBlock { cbindgen --crate data-pipeline-ffi --config data-pipeline-ffi/cbindgen.toml --output $output_dir"\data-pipeline.h" }
Invoke-Call -ScriptBlock { cbindgen --crate datadog-crashtracker-ffi --config crashtracker-ffi/cbindgen.toml --output $output_dir"\crashtracker.h" }
Invoke-Call -ScriptBlock { .\target\release\dedup_headers $output_dir"\common.h" $output_dir"\profiling.h" $output_dir"\telemetry.h" $output_dir"\data-pipeline.h" $output_dir"\crashtracker.h"}

Write-Host "Build finished" -ForegroundColor Magenta
63 changes: 30 additions & 33 deletions windows/libdatadog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,43 @@
<None Include="..\LICENSE" Pack="true" PackagePath="\" />
<None Include="libdatadog.props" Pack="true" PackagePath="build\native\libdatadog.props" />

<!-- header files are the same between x64/x86/debug/release, so taking it from x64/release it's enough -->
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\common.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\common.h" Pack="true"
PackagePath="include\native\datadog\common.h" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\profiling.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\profiling.h" Pack="true"
PackagePath="include\native\datadog\profiling.h" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\telemetry.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\telemetry.h" Pack="true"
PackagePath="include\native\datadog\telemetry.h" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\blazesym.h" Pack="true"
PackagePath="include\native\datadog\blazesym.h" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\crashtracker.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\crashtracker.h" Pack="true"
PackagePath="include\native\datadog\crashtracker.h" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\data-pipeline.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\data-pipeline.h" Pack="true"
PackagePath="include\native\datadog\data-pipeline.h" />

<None Include="$(LibDatadogBinariesOutputDir)\x64\debug\lib\datadog_profiling.lib"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\debug\lib\datadog_profiling.dll"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\debug\lib\datadog_profiling.pdb"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling.pdb" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\debug\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x64\debug\datadog_profiling_ffi.pdb" />

<None Include="$(LibDatadogBinariesOutputDir)\x64\release\lib\datadog_profiling.lib"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\lib\datadog_profiling.dll"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\lib\datadog_profiling.pdb"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling.pdb" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x86_64-pc-windows-msvc\release\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x64\release\datadog_profiling_ffi.pdb" />

<None Include="$(LibDatadogBinariesOutputDir)\x86\debug\lib\datadog_profiling.lib"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86\debug\lib\datadog_profiling.dll"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x86\debug\lib\datadog_profiling.pdb"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling.pdb" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\debug\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x86\debug\datadog_profiling_ffi.pdb" />

<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\datadog_profiling.lib"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\datadog_profiling.dll"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\datadog_profiling.pdb"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling.pdb" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.dll"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling_ffi.dll" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling_ffi.pdb" />
</ItemGroup>
</Project>
</Project>

0 comments on commit ea4e7c3

Please sign in to comment.