Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ variables:
# These are gitlab variables so that it's easier to do a manual deploy
# If these are set witih value and description, then it gives you UI elements
DOWNSTREAM_BRANCH:
value: "main"
value: "julio/use-builder-on-windows"
Comment thread
gyuheon0h marked this conversation as resolved.
Outdated
description: "downstream jobs are triggered on this branch"

include:
Expand Down
5 changes: 5 additions & 0 deletions builder/src/arch/apple.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
use std::ffi::OsStr;
use std::process::Command;

Expand Down Expand Up @@ -32,3 +33,7 @@ pub fn strip_libraries(lib_path: &str) {
}

pub fn add_additional_files(_lib_path: &str, _target_path: &OsStr) {}

pub fn add_pkg_config(crate_path: &str, target_path: &str, version: &str) -> Result<()> {
super::generate_pkg_config(crate_path, target_path, version, NATIVE_LIBS)
}
5 changes: 5 additions & 0 deletions builder/src/arch/linux.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
use std::ffi::OsStr;
use std::process::Command;

Expand Down Expand Up @@ -56,3 +57,7 @@ pub fn strip_libraries(lib_path: &str) {
}

pub fn add_additional_files(_lib_path: &str, _target_path: &OsStr) {}

pub fn add_pkg_config(crate_path: &str, target_path: &str, version: &str) -> Result<()> {
super::generate_pkg_config(crate_path, target_path, version, NATIVE_LIBS)
}
50 changes: 50 additions & 0 deletions builder/src/arch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,56 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};

use crate::utils::{file_replace, project_root};

pub fn generate_pkg_config(
crate_path: &str,
target_path: &str,
version: &str,
native_libs: &str,
) -> Result<()> {
let files: [&str; 3] = [
"datadog_profiling.pc",
"datadog_profiling_with_rpath.pc",
"datadog_profiling-static.pc",
];

let pc_dir = Path::new(target_path);
fs::create_dir_all(pc_dir).expect("Failed to create pkgconfig directory");

for file in files.iter() {
let file_in = file.to_string() + ".in";

let mut pc_origin: PathBuf = project_root();
pc_origin.push(crate_path);
pc_origin.push(file_in);

let pc_target: PathBuf = [pc_dir.as_os_str(), OsStr::new(file)].iter().collect();

file_replace(
pc_origin.to_str().unwrap(),
pc_target.to_str().unwrap(),
"@Datadog_VERSION@",
version,
)?;

if *file == files[2] {
file_replace(
pc_origin.to_str().unwrap(),
pc_target.to_str().unwrap(),
"@Datadog_LIBRARIES@",
native_libs,
)?;
}
}
Ok(())
}

#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
mod linux;
Expand Down
5 changes: 5 additions & 0 deletions builder/src/arch/musl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
use std::ffi::OsStr;
use std::process::Command;

Expand Down Expand Up @@ -56,3 +57,7 @@ pub fn strip_libraries(lib_path: &str) {
}

pub fn add_additional_files(_lib_path: &str, _target_path: &OsStr) {}

pub fn add_pkg_config(crate_path: &str, target_path: &str, version: &str) -> Result<()> {
super::generate_pkg_config(crate_path, target_path, version, NATIVE_LIBS)
}
19 changes: 15 additions & 4 deletions builder/src/arch/windows.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

use anyhow::Result;
use std::ffi::OsStr;
use std::fs;
use std::path::PathBuf;

pub const NATIVE_LIBS: &str = "";
pub const PROF_DYNAMIC_LIB: &str = "datadog_profiling.dll";
pub const PROF_STATIC_LIB: &str = "datadog_profiling.lib";
pub const PROF_PDB: &str = "datadog_profiling.pdb";
pub const PROF_DYNAMIC_LIB: &str = "datadog_profiling_ffi.dll";
pub const PROF_STATIC_LIB: &str = "datadog_profiling_ffi.lib";
pub const PROF_PDB: &str = "datadog_profiling_ffi.pdb";
pub const PROF_DYNAMIC_LIB_FFI: &str = "datadog_profiling_ffi.dll";
pub const PROF_STATIC_LIB_FFI: &str = "datadog_profiling_ffi.lib";
pub const PROF_PDB_FFI: &str = "datadog_profiling_ffi.pdb";
pub const PROF_DLL_IMPORT_LIB_FFI: &str = "datadog_profiling_ffi.dll.lib";
pub const BUILD_CRASHTRACKER: bool = false;
pub const RUSTFLAGS: [&str; 4] = [
"-C",
Expand All @@ -25,6 +27,15 @@ pub fn strip_libraries(_lib_path: &str) {}
pub fn add_additional_files(lib_path: &str, target_path: &OsStr) {
let from_pdb: PathBuf = [lib_path, PROF_PDB_FFI].iter().collect();
let to_pdb: PathBuf = [target_path, OsStr::new(PROF_PDB)].iter().collect();

fs::copy(from_pdb, to_pdb).expect("unable to copy pdb file");

let from_imp: PathBuf = [lib_path, PROF_DLL_IMPORT_LIB_FFI].iter().collect();
let to_imp: PathBuf = [target_path, OsStr::new(PROF_DLL_IMPORT_LIB_FFI)]
.iter()
.collect();
fs::copy(from_imp, to_imp).expect("unable to copy dll import lib");
}

pub fn add_pkg_config(_crate_path: &str, _target_path: &str, _version: &str) -> Result<()> {
Ok(())
}
13 changes: 8 additions & 5 deletions builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,14 @@ impl Builder {
fs::create_dir_all(Path::new(self.target_include.as_ref()))
.expect("Failed to create include directory");
fs::create_dir_all(Path::new(self.target_lib.as_ref()))
.expect("Failed to create include directory");
fs::create_dir_all(Path::new(self.target_bin.as_ref()))
.expect("Failed to create include directory");
fs::create_dir_all(Path::new(self.target_pkconfig.as_ref()))
.expect("Failed to create include directory");
.expect("Failed to create lib directory");
#[cfg(not(target_os = "windows"))]
{
fs::create_dir_all(Path::new(self.target_bin.as_ref()))
.expect("Failed to create bin directory");
fs::create_dir_all(Path::new(self.target_pkconfig.as_ref()))
.expect("Failed to create pkgconfig directory");
}
}

pub fn add_cmake(&self) {
Expand Down
44 changes: 6 additions & 38 deletions builder/src/profiling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::arch;
use crate::module::Module;
use crate::utils::{adjust_extern_symbols, file_replace, project_root, wait_for_success};
use crate::utils::{adjust_extern_symbols, project_root, wait_for_success};
use anyhow::Result;
use serde::Deserialize;
use std::ffi::OsStr;
Expand Down Expand Up @@ -118,43 +118,11 @@ impl Profiling {
}

fn add_pkg_config(&self) -> Result<()> {
let files: [&str; 3] = [
"datadog_profiling.pc",
"datadog_profiling_with_rpath.pc",
"datadog_profiling-static.pc",
];

//Create directory
let pc_dir = Path::new(self.target_pkconfig.as_ref());
fs::create_dir_all(pc_dir).expect("Failed to create pkgconfig directory");

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

let mut pc_origin: PathBuf = project_root();
pc_origin.push(CRATE_FOLDER);
pc_origin.push(file_in);

let pc_target: PathBuf = [pc_dir.as_os_str(), OsStr::new(file)].iter().collect();

file_replace(
pc_origin.to_str().unwrap(),
pc_target.to_str().unwrap(),
"@Datadog_VERSION@",
&self.version,
)?;

if *file == files[2] {
file_replace(
pc_origin.to_str().unwrap(),
pc_target.to_str().unwrap(),
"@Datadog_LIBRARIES@",
arch::NATIVE_LIBS,
)?;
}
}
Ok(())
arch::add_pkg_config(
CRATE_FOLDER,
self.target_pkconfig.as_ref(),
self.version.as_ref(),
)
}
}

Expand Down
89 changes: 0 additions & 89 deletions windows/build-artifacts.ps1

This file was deleted.

44 changes: 21 additions & 23 deletions windows/libdatadog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,53 +27,51 @@
<None Include="..\LICENSE" Pack="true" PackagePath="\" />
<None Include="libdatadog.props" Pack="true" PackagePath="build\native\libdatadog.props" />

<None Include="$(LibDatadogBinariesOutputDir)\common.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\common.h" Pack="true"
PackagePath="include\native\datadog\common.h" />
<None Include="$(LibDatadogBinariesOutputDir)\profiling.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\profiling.h" Pack="true"
PackagePath="include\native\datadog\profiling.h" />
<None Include="$(LibDatadogBinariesOutputDir)\telemetry.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\telemetry.h" Pack="true"
PackagePath="include\native\datadog\telemetry.h" />
<None Include="$(LibDatadogBinariesOutputDir)\crashtracker.h" Pack="true"
PackagePath="include\native\datadog\crashtracker.h" />
<None Include="$(LibDatadogBinariesOutputDir)\data-pipeline.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\data-pipeline.h" Pack="true"
PackagePath="include\native\datadog\data-pipeline.h" />
<None Include="$(LibDatadogBinariesOutputDir)\library-config.h" Pack="true"
<None Include="$(LibDatadogBinariesOutputDir)\x64\release\include\datadog\library-config.h" Pack="true"
PackagePath="include\native\datadog\library-config.h" />

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

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

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

<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.lib"
<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\datadog_profiling_ffi.lib"
Pack="true" PackagePath="build\native\lib\x86\release\static\datadog_profiling_ffi.lib" />
<None Include="$(LibDatadogBinariesOutputDir)\i686-pc-windows-msvc\release\datadog_profiling_ffi.dll.lib"
<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\datadog_profiling_ffi.dll.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"
<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\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"
<None Include="$(LibDatadogBinariesOutputDir)\x86\release\lib\datadog_profiling_ffi.pdb"
Pack="true" PackagePath="build\native\lib\x86\release\datadog_profiling_ffi.pdb" />
</ItemGroup>
</Project>
Loading