Skip to content

Commit

Permalink
make feature name consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
samansmink committed Oct 7, 2024
1 parent eff7f8e commit 38286cc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
LD_LIBRARY_PATH: ${{ github.workspace }}/libduckdb

- name: Build loadable extension
run: cargo build --example hello-ext-capi --features="vtab-loadable,loadable_extension"
run: cargo build --example hello-ext-capi --features="vtab-loadable,loadable-extension"
env:
DUCKDB_LIB_DIR: ${{ github.workspace }}/libduckdb
DUCKDB_INCLUDE_DIR: ${{ github.workspace }}/libduckdb
Expand Down
2 changes: 1 addition & 1 deletion crates/libduckdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ json = ["bundled"]
parquet = ["bundled"]
extensions-full = ["json", "parquet"]
winduckdb = []
loadable_extension = ["prettyplease", "quote", "syn"]
loadable-extension = ["prettyplease", "quote", "syn"]

[dependencies]

Expand Down
28 changes: 14 additions & 14 deletions crates/libduckdb-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ mod build_bundled {
{
use std::fs;
fs::copy(
#[cfg(not(feature = "loadable_extension"))]
#[cfg(not(feature = "loadable-extension"))]
"src/bindgen_bundled_version.rs",
#[cfg(feature = "loadable_extension")]
#[cfg(feature = "loadable-extension")]
"src/bindgen_bundled_version_loadable.rs",
out_path,
)
Expand Down Expand Up @@ -186,15 +186,15 @@ impl From<HeaderLocation> for String {
let prefix = env_prefix();
let mut header = env::var(format!("{prefix}_INCLUDE_DIR"))
.unwrap_or_else(|_| env::var(format!("{}_LIB_DIR", env_prefix())).unwrap());
header.push_str(if cfg!(feature = "loadable_extension") {
header.push_str(if cfg!(feature = "loadable-extension") {
"/duckdb_extension.h"
} else {
"/duckdb.h"
});
header
}
HeaderLocation::Wrapper => {
if cfg!(feature = "loadable_extension") {
if cfg!(feature = "loadable-extension") {
"wrapper_ext.h".into()
} else {
"wrapper.h".into()
Expand All @@ -203,7 +203,7 @@ impl From<HeaderLocation> for String {
HeaderLocation::FromPath(path) => format!(
"{}/{}",
path,
if cfg!(feature = "loadable_extension") {
if cfg!(feature = "loadable-extension") {
"duckdb_extension.h"
} else {
"duckdb.h"
Expand Down Expand Up @@ -232,9 +232,9 @@ mod build_linked {
#[cfg(not(feature = "buildtime_bindgen"))]
{
std::fs::copy(
#[cfg(not(feature = "loadable_extension"))]
#[cfg(not(feature = "loadable-extension"))]
"src/bindgen_bundled_version.rs",
#[cfg(feature = "loadable_extension")]
#[cfg(feature = "loadable-extension")]
"src/bindgen_bundled_version_loadable.rs",
out_path,
)
Expand All @@ -259,7 +259,7 @@ mod build_linked {
fn find_duckdb() -> HeaderLocation {
let link_lib = lib_name();

if !cfg!(feature = "loadable_extension") {
if !cfg!(feature = "loadable-extension") {
println!("cargo:rerun-if-env-changed={}_INCLUDE_DIR", env_prefix());
println!("cargo:rerun-if-env-changed={}_LIB_DIR", env_prefix());
println!("cargo:rerun-if-env-changed={}_STATIC", env_prefix());
Expand All @@ -275,7 +275,7 @@ mod build_linked {
}

if win_target() && cfg!(feature = "winduckdb") {
if !cfg!(feature = "loadable_extension") {
if !cfg!(feature = "loadable-extension") {
println!("cargo:rustc-link-lib=dylib={link_lib}");
}
return HeaderLocation::Wrapper;
Expand Down Expand Up @@ -312,7 +312,7 @@ mod build_linked {
// request and hope that the library exists on the system paths. We used to
// output /usr/lib explicitly, but that can introduce other linking problems;
// see https://github.com/rusqlite/rusqlite/issues/207.
if !cfg!(feature = "loadable_extension") {
if !cfg!(feature = "loadable-extension") {
println!("cargo:rustc-link-lib={}={}", find_link_mode(), link_lib);
}
HeaderLocation::Wrapper
Expand Down Expand Up @@ -341,7 +341,7 @@ mod bindings {

use std::{fs::OpenOptions, io::Write, path::Path};

#[cfg(feature = "loadable_extension")]
#[cfg(feature = "loadable-extension")]
fn extract_method(ty: &syn::Type) -> Option<&syn::TypeBareFn> {
match ty {
syn::Type::Path(tp) => tp.path.segments.last(),
Expand All @@ -361,7 +361,7 @@ mod bindings {
})?
}

#[cfg(feature = "loadable_extension")]
#[cfg(feature = "loadable-extension")]
fn generate_functions(output: &mut String) {
// (1) parse sqlite3_api_routines fields from bindgen output
let ast: syn::File = syn::parse_str(output).expect("could not parse bindgen output");
Expand Down Expand Up @@ -454,7 +454,7 @@ mod bindings {
let mut output = Vec::new();
let mut builder = bindgen::builder();

if cfg!(feature = "loadable_extension") {
if cfg!(feature = "loadable-extension") {
builder = builder.ignore_functions();
}

Expand All @@ -469,7 +469,7 @@ mod bindings {

let mut output = String::from_utf8(output).expect("bindgen output was not UTF-8?!");

#[cfg(feature = "loadable_extension")]
#[cfg(feature = "loadable-extension")]
{
generate_functions(&mut output);
}
Expand Down
Binary file modified crates/libduckdb-sys/duckdb.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion crates/libduckdb-sys/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ python3 "$SCRIPT_DIR/update_sources.py"
cd "$SCRIPT_DIR"
rm -f "$SCRIPT_DIR/src/bindgen_bundled_version_loadable.rs"
find "$SCRIPT_DIR/../../target" -type f -name bindgen.rs -exec rm {} \;
cargo build --features "extensions-full buildtime_bindgen loadable_extension"
cargo build --features "extensions-full buildtime_bindgen loadable-extension"
find "$SCRIPT_DIR/../../target" -type f -name bindgen.rs -exec cp {} "$SCRIPT_DIR/src/bindgen_bundled_version_loadable.rs" \;

# Sanity checks
Expand Down

0 comments on commit 38286cc

Please sign in to comment.