mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 08:58:35 +00:00
Compare commits
6 Commits
5cb51878a5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d2340fb52 | |||
| 6c79340736 | |||
| be14cfb8e2 | |||
| 3305915c07 | |||
| d587eba5a4 | |||
| bfd2b9d251 |
20
.github/workflows/release.yml
vendored
20
.github/workflows/release.yml
vendored
@@ -1191,6 +1191,7 @@ jobs:
|
|||||||
- name: Update Formula/dcr.rb
|
- name: Update Formula/dcr.rb
|
||||||
run: |
|
run: |
|
||||||
VERSION="${{ needs.setup.outputs.version }}"
|
VERSION="${{ needs.setup.outputs.version }}"
|
||||||
|
|
||||||
cat > Formula/dcr.rb <<FORMULA
|
cat > Formula/dcr.rb <<FORMULA
|
||||||
class Dcr < Formula
|
class Dcr < Formula
|
||||||
desc "Cargo-like utility to manage C/C++ projects"
|
desc "Cargo-like utility to manage C/C++ projects"
|
||||||
@@ -1199,37 +1200,36 @@ jobs:
|
|||||||
|
|
||||||
on_macos do
|
on_macos do
|
||||||
on_intel do
|
on_intel do
|
||||||
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-x86_64-apple-darwin-#{version}"
|
url "https://github.com/dexoron/dcr/releases/download/v${VERSION}/dcr-x86_64-apple-darwin-${VERSION}"
|
||||||
sha256 "${{ steps.sha.outputs.macos_x86 }}"
|
sha256 "${{ steps.sha.outputs.macos_x86 }}"
|
||||||
end
|
end
|
||||||
|
|
||||||
on_arm do
|
on_arm do
|
||||||
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-aarch64-apple-darwin-#{version}"
|
url "https://github.com/dexoron/dcr/releases/download/v${VERSION}/dcr-aarch64-apple-darwin-${VERSION}"
|
||||||
sha256 "${{ steps.sha.outputs.macos_arm }}"
|
sha256 "${{ steps.sha.outputs.macos_arm }}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
on_linux do
|
on_linux do
|
||||||
on_intel do
|
on_intel do
|
||||||
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-x86_64-unknown-linux-gnu-#{version}"
|
url "https://github.com/dexoron/dcr/releases/download/v${VERSION}/dcr-x86_64-unknown-linux-gnu-${VERSION}"
|
||||||
sha256 "${{ steps.sha.outputs.linux_x86 }}"
|
sha256 "${{ steps.sha.outputs.linux_x86 }}"
|
||||||
end
|
end
|
||||||
|
|
||||||
on_arm do
|
on_arm do
|
||||||
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-aarch64-unknown-linux-gnu-#{version}"
|
url "https://github.com/dexoron/dcr/releases/download/v${VERSION}/dcr-aarch64-unknown-linux-gnu-${VERSION}"
|
||||||
sha256 "${{ steps.sha.outputs.linux_arm }}"
|
sha256 "${{ steps.sha.outputs.linux_arm }}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def install
|
|
||||||
bin.install Dir["dcr*"].first => "dcr"
|
|
||||||
end
|
|
||||||
|
|
||||||
resource "man-pages" do
|
resource "man-pages" do
|
||||||
url "https://github.com/dexoron/dcr/releases/download/v#{version}/dcr-man-pages-#{version}.tar.gz"
|
url "https://github.com/dexoron/dcr/releases/download/v${VERSION}/dcr-man-pages-${VERSION}.tar.gz"
|
||||||
sha256 "${{ steps.sha.outputs.man_pages }}"
|
sha256 "${{ steps.sha.outputs.man_pages }}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
bin.install Dir["dcr*"].first => "dcr"
|
bin.install Dir["dcr*"].first => "dcr"
|
||||||
|
|
||||||
resource("man-pages").stage do
|
resource("man-pages").stage do
|
||||||
man1.install Dir["usr/share/man/man1/*.1"]
|
man1.install Dir["usr/share/man/man1/*.1"]
|
||||||
end
|
end
|
||||||
@@ -1326,4 +1326,4 @@ jobs:
|
|||||||
|
|
||||||
aws s3 sync dist/ "s3://${{ secrets.R2_BUCKET_NAME }}/${TAG}/" \
|
aws s3 sync dist/ "s3://${{ secrets.R2_BUCKET_NAME }}/${TAG}/" \
|
||||||
--endpoint-url https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com \
|
--endpoint-url https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com \
|
||||||
--region auto
|
--region auto
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [v0.9.1] - 2026-08-31 "Системные pkg-config-зависимости / System pkg-config Dependencies"
|
## [v0.9.1] - 2026-09-13 "Системные pkg-config-зависимости / System pkg-config Dependencies"
|
||||||
|
|
||||||
### RU
|
### RU
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ sidebar_label: Changelog
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.9.1 (2026-08-31)
|
## 0.9.1 (2026-09-13)
|
||||||
|
|
||||||
- **`pkg-config` dependencies** — declare `fmt = { pkg-config = "fmt" }` or multiple package names in `[dependencies]`; DCR applies `.pc` compiler/linker flags and records the resolved package in `dcr.lock`.
|
- **`pkg-config` dependencies** — declare `fmt = { pkg-config = "fmt" }` or multiple package names in `[dependencies]`; DCR applies `.pc` compiler/linker flags and records the resolved package in `dcr.lock`.
|
||||||
- **`dcr add` support for `pkg-config`** — easily add system package dependencies with `dcr add fmt pkg-config:fmt` or `dcr add openssl pkg:openssl,libcrypto`.
|
- **`dcr add` support for `pkg-config`** — easily add system package dependencies with `dcr add fmt pkg-config:fmt` or `dcr add openssl pkg:openssl,libcrypto`.
|
||||||
|
|||||||
@@ -56,9 +56,10 @@ fmt = { pkg-config = "fmt" }
|
|||||||
openssl = { pkg-config = ["openssl", "libcrypto"] }
|
openssl = { pkg-config = ["openssl", "libcrypto"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
The `pkg-config` executable and the named packages must be available in `PATH` and
|
The `pkg-config` executable must be available in `PATH`. The named `.pc` files must
|
||||||
`PKG_CONFIG_PATH`. These dependencies are not downloaded or built by DCR; they are
|
be available through pkg-config's standard search paths or via `PKG_CONFIG_PATH`.
|
||||||
recorded in `dcr.lock` with a `pkg-config+...` source.
|
These dependencies are not downloaded or built by DCR; they are recorded in
|
||||||
|
`dcr.lock` with a `pkg-config+...` source.
|
||||||
|
|
||||||
## Registry
|
## Registry
|
||||||
|
|
||||||
|
|||||||
Submodule examples/dcr-math deleted from 737d9629c5
@@ -1,4 +1,4 @@
|
|||||||
.TH DCR 1 "2026-06-02" "dcr 0.7.0" "DCR Manual"
|
.TH DCR 1 "2026-08-31" "dcr 0.9.1" "DCR Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
dcr \- Cargo\-like build tool and package manager for C/C++ projects
|
dcr \- Cargo\-like build tool and package manager for C/C++ projects
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ impl Config {
|
|||||||
let (data, doc) = if path.exists() {
|
let (data, doc) = if path.exists() {
|
||||||
load_parts(&path)?
|
load_parts(&path)?
|
||||||
} else {
|
} else {
|
||||||
let content = default_toml_text(package_name);
|
let content = default_toml_text(package_name)?;
|
||||||
let doc: DocumentMut = content.parse().map_err(ConfigError::TomlEdit)?;
|
let doc: DocumentMut = content.parse().map_err(ConfigError::TomlEdit)?;
|
||||||
fs::write(&path, doc.to_string())?;
|
fs::write(&path, doc.to_string())?;
|
||||||
let data: Value = toml::from_str(&content)?;
|
let data: Value = toml::from_str(&content)?;
|
||||||
@@ -836,7 +836,7 @@ fn load_parts(path: &Path) -> Result<(Value, DocumentMut), ConfigError> {
|
|||||||
Ok((data, doc))
|
Ok((data, doc))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_toml_text(package_name: Option<&str>) -> String {
|
fn default_toml_text(package_name: Option<&str>) -> Result<String, ConfigError> {
|
||||||
let name = package_name
|
let name = package_name
|
||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
@@ -845,9 +845,11 @@ fn default_toml_text(package_name: Option<&str>) -> String {
|
|||||||
.and_then(|p| p.file_name().map(|v| v.to_string_lossy().to_string()))
|
.and_then(|p| p.file_name().map(|v| v.to_string_lossy().to_string()))
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| "project".to_string());
|
.unwrap_or_else(|| "project".to_string());
|
||||||
|
validate_non_empty_string(&name, "package.name")?;
|
||||||
|
validate_package_name(&name)?;
|
||||||
let dcr_version = env!("CARGO_PKG_VERSION");
|
let dcr_version = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
format!(
|
Ok(format!(
|
||||||
"[package]\n\
|
"[package]\n\
|
||||||
name = \"{name}\"\n\
|
name = \"{name}\"\n\
|
||||||
version = \"{DEFAULT_VERSION}\"\n\
|
version = \"{DEFAULT_VERSION}\"\n\
|
||||||
@@ -864,7 +866,7 @@ fn default_toml_text(package_name: Option<&str>) -> String {
|
|||||||
kind = \"{DEFAULT_KIND}\"\n\
|
kind = \"{DEFAULT_KIND}\"\n\
|
||||||
\n\
|
\n\
|
||||||
[dependencies]\n"
|
[dependencies]\n"
|
||||||
)
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dcr_version_warn_once(path_key: &str) -> bool {
|
fn dcr_version_warn_once(path_key: &str) -> bool {
|
||||||
@@ -1295,6 +1297,22 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn create_rejects_invalid_name_without_writing_manifest() {
|
||||||
|
let dir = temp_dir("invalid_create_name");
|
||||||
|
let path = dir.join("dcr.toml");
|
||||||
|
for name in ["", "bad name", "../bad", "bad\"name", " bad", "bad."] {
|
||||||
|
let result = Config::create(&path.to_string_lossy(), Some(name));
|
||||||
|
assert!(matches!(result, Err(ConfigError::Invalid(_))), "{name:?}");
|
||||||
|
assert!(!path.exists(), "invalid name must not create a manifest");
|
||||||
|
}
|
||||||
|
let config = Config::create(&path.to_string_lossy(), Some("valid-name")).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
config.get("package.name").and_then(Value::as_str),
|
||||||
|
Some("valid-name")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn new_creates_default_config() {
|
fn new_creates_default_config() {
|
||||||
let dir = temp_dir("new_default");
|
let dir = temp_dir("new_default");
|
||||||
|
|||||||
Reference in New Issue
Block a user