Skip to content

Commit

Permalink
reduce bin filename length
Browse files Browse the repository at this point in the history
Signed-off-by: usamoi <[email protected]>
  • Loading branch information
usamoi committed Feb 7, 2024
1 parent c10fa1a commit 5566cea
Show file tree
Hide file tree
Showing 54 changed files with 111 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cargo-pgrx/src/command/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) fn create_crate_template(
create_dotcargo_config_toml(&path, name)?;
create_lib_rs(&path, name, is_bgworker)?;
create_git_ignore(&path, name)?;
create_pgrx_embed_rs(&path, name)?;
create_pgrx_embed_rs(&path)?;

Ok(())
}
Expand Down Expand Up @@ -148,11 +148,11 @@ fn create_git_ignore(path: &PathBuf, _name: &str) -> Result<(), std::io::Error>
Ok(())
}

fn create_pgrx_embed_rs(path: &PathBuf, name: &str) -> Result<(), std::io::Error> {
fn create_pgrx_embed_rs(path: &PathBuf) -> Result<(), std::io::Error> {
let mut filename = path.clone();
filename.push("src");
filename.push("bin");
filename.push(format!("pgrx_embed_{name}.rs"));
filename.push(format!("pgrx_embed.rs"));
let mut file = std::fs::File::create(filename)?;
file.write_all(include_bytes!("../templates/pgrx_embed_rs"))?;
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions cargo-pgrx/src/templates/cargo_toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_{name}"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/aggregate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_aggregate"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/arrays/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_arrays"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/bad_ideas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_bad_ideas"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/bgworker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_bgworker"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/bytea/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_bytea"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/composite_type/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_composite_type"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/custom_libname/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ publish = false
crate-type = ["cdylib", "lib"]
name = "other_name"

[[bin]]
name = "pgrx_embed_custom_libname"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/custom_sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_custom_sql"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/custom_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_custom_types"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/datetime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_datetime"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_errors"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/nostd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_nostd"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/numeric/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ rust-version = "1.58"
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_numeric"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/operators/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_operators"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/pgtrybuilder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_pgtrybuilder"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/range/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_range"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/schemas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_schemas"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/shmem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_shmem"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/spi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_spi"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/spi_srf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ rust-version = "1.58"
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_spi_srf"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/srf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_srf"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/strings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_strings"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions pgrx-examples/triggers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_triggers"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/versioned_custom_libname_so/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ publish = false
crate-type = ["cdylib", "lib"]
name = "versioned_othername"

[[bin]]
name = "pgrx_embed_versioned_custom_libname_so"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-examples/versioned_so/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ publish = false
[lib]
crate-type = ["cdylib", "lib"]

[[bin]]
name = "pgrx_embed_versioned_so"
path = "./src/bin/pgrx_embed.rs"

[features]
default = ["pg13"]
pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ]
Expand Down
4 changes: 4 additions & 0 deletions pgrx-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ edition = "2021"
[lib]
crate-type = [ "cdylib", "lib" ]

[[bin]]
name = "pgrx_embed_pgrx-tests"
path = "./src/bin/pgrx_embed.rs"

[features]
default = [ "proptest" ]
pg12 = [ "pgrx/pg12" ]
Expand Down
File renamed without changes.

0 comments on commit 5566cea

Please sign in to comment.