-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly transform control file version number in sql entity graph
Commit f00c335 added the ability to use '@CARGO_VERSION@' as a placeholder for 'default_version' in the extension's .control file. That change missed the fact that the contents of the .control file are loaded into the root node of the sql entity graph. This means that when using the placeholder, the default_version in the sql entity graph's control file is '@CARGO_VERSION@'. This change replaces the placeholder with the package version when executing the compiled sql-generator.
- Loading branch information
1 parent
f3c1c25
commit a48b2e8
Showing
5 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
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
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,6 +1,7 @@ | ||
// Copyright 2020 ZomboDB, LLC <[email protected]>. All rights reserved. Use of this source code is | ||
// governed by the MIT license that can be found in the LICENSE file. | ||
|
||
use cargo_metadata::MetadataCommand; | ||
use crate::{pg_config::PgConfig, sql_entity_graph::PositioningRef}; | ||
use colored::Colorize; | ||
use eyre::{eyre, WrapErr}; | ||
|
@@ -533,6 +534,12 @@ pub fn anonymonize_lifetimes(value: &mut syn::Type) { | |
} | ||
} | ||
|
||
pub fn get_package_version() -> eyre::Result<String> { | ||
let metadata = MetadataCommand::new().exec()?; | ||
let root_package = metadata.root_package().ok_or(eyre!("no root package found"))?; | ||
Ok(root_package.version.to_string()) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::{parse_extern_attributes, ExternArgs}; | ||
|
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