mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 23:39:35 +00:00
Compare commits
11 Commits
v0.7.0
...
v0.7.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef9ca57295 | ||
|
|
8e1fb60692 | ||
|
|
d6ddb5da3d | ||
|
|
d26e93dd47 | ||
| 97d2970727 | |||
|
|
35f9b6be94 | ||
| 6885a82be7 | |||
| 5d587db227 | |||
| 424f4f6929 | |||
| 443306aa5f | |||
| f21f50facb |
408
.github/workflows/release.yml
vendored
408
.github/workflows/release.yml
vendored
@@ -21,6 +21,10 @@ on:
|
|||||||
description: "Update AUR packages (dcr & dcr-bin)"
|
description: "Update AUR packages (dcr & dcr-bin)"
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
run_aur_dev:
|
||||||
|
description: "Update Dev AUR packages (dcr-dev, dcr-dev-bin)"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
run_bsd:
|
run_bsd:
|
||||||
description: "Build BSD"
|
description: "Build BSD"
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -56,6 +60,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
tag: ${{ steps.tag.outputs.value }}
|
tag: ${{ steps.tag.outputs.value }}
|
||||||
version: ${{ steps.tag.outputs.version }}
|
version: ${{ steps.tag.outputs.version }}
|
||||||
|
clean_version: ${{ steps.tag.outputs.clean_version }}
|
||||||
prerelease: ${{ steps.tag.outputs.prerelease }}
|
prerelease: ${{ steps.tag.outputs.prerelease }}
|
||||||
steps:
|
steps:
|
||||||
- name: Resolve tag
|
- name: Resolve tag
|
||||||
@@ -67,9 +72,11 @@ jobs:
|
|||||||
TAG="${GITHUB_REF_NAME}"
|
TAG="${GITHUB_REF_NAME}"
|
||||||
fi
|
fi
|
||||||
VERSION="${TAG#v}"
|
VERSION="${TAG#v}"
|
||||||
|
CLEAN_VERSION="${VERSION%-dev}"
|
||||||
[[ "$TAG" == *"-"* ]] && PRERELEASE="true" || PRERELEASE="false"
|
[[ "$TAG" == *"-"* ]] && PRERELEASE="true" || PRERELEASE="false"
|
||||||
echo "value=${TAG}" >> "$GITHUB_OUTPUT"
|
echo "value=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "clean_version=${CLEAN_VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# ── Release Notes ──────────────────────────────────────────────────────────
|
# ── Release Notes ──────────────────────────────────────────────────────────
|
||||||
@@ -135,6 +142,12 @@ jobs:
|
|||||||
- target: aarch64-unknown-linux-gnu
|
- target: aarch64-unknown-linux-gnu
|
||||||
- target: x86_64-unknown-linux-musl
|
- target: x86_64-unknown-linux-musl
|
||||||
- target: aarch64-unknown-linux-musl
|
- target: aarch64-unknown-linux-musl
|
||||||
|
- target: i686-unknown-linux-gnu
|
||||||
|
- target: i686-unknown-linux-musl
|
||||||
|
- target: armv7-unknown-linux-gnueabihf
|
||||||
|
- target: armv7-unknown-linux-musleabihf
|
||||||
|
- target: riscv64gc-unknown-linux-gnu
|
||||||
|
- target: riscv64gc-unknown-linux-musl
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -271,6 +284,8 @@ jobs:
|
|||||||
sha256sums=('${SHA256}')
|
sha256sums=('${SHA256}')
|
||||||
build() {
|
build() {
|
||||||
cd "\$srcdir/\$pkgname-${PKGVER_ORIG}"
|
cd "\$srcdir/\$pkgname-${PKGVER_ORIG}"
|
||||||
|
unset CFLAGS CXXFLAGS LDFLAGS
|
||||||
|
export RUSTFLAGS="-C linker=cc"
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
}
|
}
|
||||||
package() {
|
package() {
|
||||||
@@ -450,8 +465,6 @@ jobs:
|
|||||||
cp target/release/dcr "$ASSET"
|
cp target/release/dcr "$ASSET"
|
||||||
echo "BSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
|
echo "BSD_ASSET=${ASSET}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# --- UPLOAD TARGET ---
|
# --- UPLOAD TARGET ---
|
||||||
- name: Upload BSD Asset to Release
|
- name: Upload BSD Asset to Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
@@ -472,7 +485,9 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- target: x86_64-pc-windows-msvc
|
- target: x86_64-pc-windows-msvc
|
||||||
- target: aarch64-pc-windows-msvc
|
- target: aarch64-pc-windows-msvc
|
||||||
|
- target: i686-pc-windows-msvc
|
||||||
- target: x86_64-pc-windows-gnu
|
- target: x86_64-pc-windows-gnu
|
||||||
|
- target: i686-pc-windows-gnu
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -552,14 +567,13 @@ jobs:
|
|||||||
'gcc: build C/C++ projects with GCC'
|
'gcc: build C/C++ projects with GCC'
|
||||||
'clang: build C/C++ projects with Clang'
|
'clang: build C/C++ projects with Clang'
|
||||||
)
|
)
|
||||||
source=("\$pkgname-\$pkgver.tar.gz::\${SRC_URL}")
|
source=("\$pkgname-\$pkgver.tar.gz::${SRC_URL}")
|
||||||
sha256sums=('${SHA256}')
|
sha256sums=('${SHA256}')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "\$srcdir/\$pkgname-${PKGVER_ORIG}"
|
cd "\$srcdir/\$pkgname-${PKGVER_ORIG}"
|
||||||
export CARGO_PROFILE_RELEASE_LTO=false
|
unset CFLAGS CXXFLAGS LDFLAGS
|
||||||
export RUSTFLAGS="\${RUSTFLAGS:-}"
|
export RUSTFLAGS="-C linker=cc"
|
||||||
export RUSTFLAGS="\${RUSTFLAGS/-C link-arg=-fuse-ld=lld/}"
|
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,22 +617,31 @@ jobs:
|
|||||||
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
||||||
git clone "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git" aur-repo
|
|
||||||
cp packages/aur/dcr/PKGBUILD aur-repo/PKGBUILD
|
mkdir -p aur-repo
|
||||||
cp packages/aur/dcr/.SRCINFO aur-repo/.SRCINFO
|
|
||||||
|
|
||||||
cd aur-repo
|
cd aur-repo
|
||||||
|
git init
|
||||||
|
git remote add origin "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git"
|
||||||
|
|
||||||
|
git fetch origin master || true
|
||||||
|
git checkout master || git checkout -b master
|
||||||
|
|
||||||
|
cp ../packages/aur/dcr/PKGBUILD .
|
||||||
|
cp ../packages/aur/dcr/.SRCINFO .
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
if git diff --quiet; then
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
echo "No AUR changes"
|
if git diff --quiet; then
|
||||||
exit 0
|
echo "No AUR changes"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git add PKGBUILD .SRCINFO
|
git add PKGBUILD .SRCINFO
|
||||||
git commit -m "dcr ${{ needs.setup.outputs.version }}"
|
git commit -m "dcr ${{ needs.setup.outputs.version }}"
|
||||||
git push
|
git push -u origin master
|
||||||
|
|
||||||
# ── Arch User Repository (dcr-bin) ────────────────────────────────
|
# ── Arch User Repository (dcr-bin) ────────────────────────────────
|
||||||
publish-aur-bin:
|
publish-aur-bin:
|
||||||
@@ -635,10 +658,22 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
BIN_URL="https://github.com/dexoron/dcr/releases/download/${{ needs.setup.outputs.tag }}/dcr-x86_64-unknown-linux-musl-${{ needs.setup.outputs.version }}"
|
TAG="${{ needs.setup.outputs.tag }}"
|
||||||
SHA256="$(curl -fsSL "$BIN_URL" | sha256sum | awk '{print $1}')"
|
VER="${{ needs.setup.outputs.version }}"
|
||||||
echo "bin_url=$BIN_URL" >> "$GITHUB_OUTPUT"
|
BASE_URL="https://github.com/dexoron/dcr/releases/download/${TAG}"
|
||||||
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
|
for arch in x86_64 aarch64 i686 armv7h riscv64; do
|
||||||
|
case "$arch" in
|
||||||
|
x86_64) triple="x86_64-unknown-linux-musl" ;;
|
||||||
|
aarch64) triple="aarch64-unknown-linux-musl" ;;
|
||||||
|
i686) triple="i686-unknown-linux-musl" ;;
|
||||||
|
armv7h) triple="armv7-unknown-linux-musleabihf" ;;
|
||||||
|
riscv64) triple="riscv64gc-unknown-linux-musl" ;;
|
||||||
|
esac
|
||||||
|
url="${BASE_URL}/dcr-${triple}-${VER}"
|
||||||
|
sha256="$(curl -fsSL "$url" | sha256sum | awk '{print $1}')"
|
||||||
|
echo "${arch}_url=${url}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "${arch}_sha256=${sha256}" >> "$GITHUB_OUTPUT"
|
||||||
|
done
|
||||||
|
|
||||||
- name: Render AUR Metadata
|
- name: Render AUR Metadata
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -646,16 +681,13 @@ jobs:
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
PKGVER_ORIG='${{ needs.setup.outputs.version }}'
|
PKGVER_ORIG='${{ needs.setup.outputs.version }}'
|
||||||
PKGVER_CLEAN="${PKGVER_ORIG//-/.}"
|
PKGVER_CLEAN="${PKGVER_ORIG//-/.}"
|
||||||
BIN_URL='${{ steps.meta.outputs.bin_url }}'
|
|
||||||
SHA256='${{ steps.meta.outputs.sha256 }}'
|
|
||||||
|
|
||||||
mkdir -p packages/aur/dcr-bin
|
mkdir -p packages/aur/dcr-bin
|
||||||
cat > packages/aur/dcr-bin/PKGBUILD <<PKG
|
cat > packages/aur/dcr-bin/PKGBUILD <<PKG
|
||||||
pkgname=dcr-bin
|
pkgname=dcr-bin
|
||||||
pkgver=${PKGVER_CLEAN}
|
pkgver=${PKGVER_CLEAN}
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Cargo-like utility to manage C/C++ projects (pre-compiled musl binary)"
|
pkgdesc="Cargo-like utility to manage C/C++ projects (pre-compiled musl binary)"
|
||||||
arch=('x86_64')
|
arch=('x86_64' 'aarch64' 'i686' 'armv7h' 'riscv64')
|
||||||
url="https://github.com/dexoron/dcr"
|
url="https://github.com/dexoron/dcr"
|
||||||
license=('GPL-3.0-or-later')
|
license=('GPL-3.0-or-later')
|
||||||
provides=('dcr')
|
provides=('dcr')
|
||||||
@@ -664,8 +696,16 @@ jobs:
|
|||||||
'gcc: build C/C++ projects with GCC'
|
'gcc: build C/C++ projects with GCC'
|
||||||
'clang: build C/C++ projects with Clang'
|
'clang: build C/C++ projects with Clang'
|
||||||
)
|
)
|
||||||
source_x86_64=("dcr-\$pkgver::${BIN_URL}")
|
source_x86_64=("dcr-\$pkgver::${{ steps.meta.outputs.x86_64_url }}")
|
||||||
sha256sums_x86_64=('${SHA256}')
|
sha256sums_x86_64=('${{ steps.meta.outputs.x86_64_sha256 }}')
|
||||||
|
source_aarch64=("dcr-\$pkgver::${{ steps.meta.outputs.aarch64_url }}")
|
||||||
|
sha256sums_aarch64=('${{ steps.meta.outputs.aarch64_sha256 }}')
|
||||||
|
source_i686=("dcr-\$pkgver::${{ steps.meta.outputs.i686_url }}")
|
||||||
|
sha256sums_i686=('${{ steps.meta.outputs.i686_sha256 }}')
|
||||||
|
source_armv7h=("dcr-\$pkgver::${{ steps.meta.outputs.armv7h_url }}")
|
||||||
|
sha256sums_armv7h=('${{ steps.meta.outputs.armv7h_sha256 }}')
|
||||||
|
source_riscv64=("dcr-\$pkgver::${{ steps.meta.outputs.riscv64_url }}")
|
||||||
|
sha256sums_riscv64=('${{ steps.meta.outputs.riscv64_sha256 }}')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm755 "\$srcdir/dcr-\$pkgver" "\$pkgdir/usr/bin/dcr"
|
install -Dm755 "\$srcdir/dcr-\$pkgver" "\$pkgdir/usr/bin/dcr"
|
||||||
@@ -679,13 +719,25 @@ jobs:
|
|||||||
pkgrel = 1
|
pkgrel = 1
|
||||||
url = https://github.com/dexoron/dcr
|
url = https://github.com/dexoron/dcr
|
||||||
arch = x86_64
|
arch = x86_64
|
||||||
|
arch = aarch64
|
||||||
|
arch = i686
|
||||||
|
arch = armv7h
|
||||||
|
arch = riscv64
|
||||||
license = GPL-3.0-or-later
|
license = GPL-3.0-or-later
|
||||||
provides = dcr
|
provides = dcr
|
||||||
conflicts = dcr
|
conflicts = dcr
|
||||||
optdepends = gcc: build C/C++ projects with GCC
|
optdepends = gcc: build C/C++ projects with GCC
|
||||||
optdepends = clang: build C/C++ projects with Clang
|
optdepends = clang: build C/C++ projects with Clang
|
||||||
source_x86_64 = dcr-${PKGVER_CLEAN}::${BIN_URL}
|
source_x86_64 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.x86_64_url }}
|
||||||
sha256sums_x86_64 = ${SHA256}
|
sha256sums_x86_64 = ${{ steps.meta.outputs.x86_64_sha256 }}
|
||||||
|
source_aarch64 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.aarch64_url }}
|
||||||
|
sha256sums_aarch64 = ${{ steps.meta.outputs.aarch64_sha256 }}
|
||||||
|
source_i686 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.i686_url }}
|
||||||
|
sha256sums_i686 = ${{ steps.meta.outputs.i686_sha256 }}
|
||||||
|
source_armv7h = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.armv7h_url }}
|
||||||
|
sha256sums_armv7h = ${{ steps.meta.outputs.armv7h_sha256 }}
|
||||||
|
source_riscv64 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.riscv64_url }}
|
||||||
|
sha256sums_riscv64 = ${{ steps.meta.outputs.riscv64_sha256 }}
|
||||||
|
|
||||||
pkgname = dcr-bin
|
pkgname = dcr-bin
|
||||||
SRC
|
SRC
|
||||||
@@ -703,22 +755,296 @@ jobs:
|
|||||||
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
||||||
git clone "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git" aur-repo
|
|
||||||
cp packages/aur/dcr-bin/PKGBUILD aur-repo/PKGBUILD
|
mkdir -p aur-repo
|
||||||
cp packages/aur/dcr-bin/.SRCINFO aur-repo/.SRCINFO
|
|
||||||
|
|
||||||
cd aur-repo
|
cd aur-repo
|
||||||
|
git init
|
||||||
|
git remote add origin "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git"
|
||||||
|
|
||||||
|
git fetch origin master || true
|
||||||
|
git checkout master || git checkout -b master
|
||||||
|
|
||||||
|
cp ../packages/aur/dcr-bin/PKGBUILD .
|
||||||
|
cp ../packages/aur/dcr-bin/.SRCINFO .
|
||||||
|
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
if git diff --quiet; then
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
echo "No AUR changes"
|
if git diff --quiet; then
|
||||||
exit 0
|
echo "No AUR changes"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git add PKGBUILD .SRCINFO
|
git add PKGBUILD .SRCINFO
|
||||||
git commit -m "dcr-bin ${{ needs.setup.outputs.version }}"
|
git commit -m "dcr-bin ${{ needs.setup.outputs.version }}"
|
||||||
git push
|
git push -u origin master
|
||||||
|
|
||||||
|
|
||||||
|
# ── Arch User Repository (dcr-dev) ────────────────────────────────
|
||||||
|
publish-aur-dev:
|
||||||
|
if: ${{ (github.event_name == 'push' && needs.setup.outputs.prerelease == 'true') || github.event.inputs.run_aur_dev == 'true' }}
|
||||||
|
needs: [setup]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: aur
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Derive checksum
|
||||||
|
id: meta
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
SRC_URL="https://github.com/dexoron/dcr/archive/refs/tags/${{ needs.setup.outputs.tag }}.tar.gz"
|
||||||
|
SHA256="$(curl -fsSL "$SRC_URL" | sha256sum | awk '{print $1}')"
|
||||||
|
echo "source_url=$SRC_URL" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Render AUR metadata
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
PKGVER_ORIG='${{ needs.setup.outputs.version }}'
|
||||||
|
PKGVER_CLEAN='${{ needs.setup.outputs.clean_version }}'
|
||||||
|
SRC_URL='${{ steps.meta.outputs.source_url }}'
|
||||||
|
SHA256='${{ steps.meta.outputs.sha256 }}'
|
||||||
|
|
||||||
|
mkdir -p packages/aur/dcr-dev
|
||||||
|
cat > packages/aur/dcr-dev/PKGBUILD <<PKG
|
||||||
|
pkgname=dcr-dev
|
||||||
|
pkgver=${PKGVER_CLEAN}
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Cargo-like utility to manage C/C++ projects (development release)"
|
||||||
|
arch=('x86_64' 'aarch64')
|
||||||
|
url="https://github.com/dexoron/dcr"
|
||||||
|
license=('GPL-3.0-or-later')
|
||||||
|
depends=('gcc-libs')
|
||||||
|
makedepends=('cargo')
|
||||||
|
options=('!lto')
|
||||||
|
provides=('dcr')
|
||||||
|
conflicts=('dcr')
|
||||||
|
optdepends=(
|
||||||
|
'gcc: build C/C++ projects with GCC'
|
||||||
|
'clang: build C/C++ projects with Clang'
|
||||||
|
)
|
||||||
|
source=("\$pkgname-\$pkgver.tar.gz::${SRC_URL}")
|
||||||
|
sha256sums=('${SHA256}')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "\$srcdir/dcr-${PKGVER_ORIG}"
|
||||||
|
unset CFLAGS CXXFLAGS LDFLAGS
|
||||||
|
export RUSTFLAGS="-C linker=cc"
|
||||||
|
cargo build --release --locked
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "\$srcdir/dcr-${PKGVER_ORIG}"
|
||||||
|
install -Dm755 "target/release/dcr" "\$pkgdir/usr/bin/dcr"
|
||||||
|
install -Dm644 LICENSE "\$pkgdir/usr/share/licenses/\$pkgname/LICENSE"
|
||||||
|
}
|
||||||
|
PKG
|
||||||
|
|
||||||
|
cat > packages/aur/dcr-dev/.SRCINFO <<SRC
|
||||||
|
pkgbase = dcr-dev
|
||||||
|
pkgdesc = Cargo-like utility to manage C/C++ projects (development release)
|
||||||
|
pkgver = ${PKGVER_CLEAN}
|
||||||
|
pkgrel = 1
|
||||||
|
url = https://github.com/dexoron/dcr
|
||||||
|
arch = x86_64
|
||||||
|
arch = aarch64
|
||||||
|
license = GPL-3.0-or-later
|
||||||
|
makedepends = cargo
|
||||||
|
depends = gcc-libs
|
||||||
|
provides = dcr
|
||||||
|
conflicts = dcr
|
||||||
|
optdepends = gcc: build C/C++ projects with GCC
|
||||||
|
optdepends = clang: build C/C++ projects with Clang
|
||||||
|
options = !lto
|
||||||
|
source = dcr-${PKGVER_CLEAN}.tar.gz::${SRC_URL}
|
||||||
|
sha256sums = ${SHA256}
|
||||||
|
|
||||||
|
pkgname = dcr-dev
|
||||||
|
SRC
|
||||||
|
|
||||||
|
- name: Push to AUR
|
||||||
|
env:
|
||||||
|
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
|
AUR_PACKAGE: dcr-dev
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
install -d -m 700 ~/.ssh
|
||||||
|
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/aur
|
||||||
|
chmod 600 ~/.ssh/aur
|
||||||
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
||||||
|
|
||||||
|
mkdir -p aur-repo
|
||||||
|
cd aur-repo
|
||||||
|
git init
|
||||||
|
git remote add origin "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git"
|
||||||
|
|
||||||
|
git fetch origin master || true
|
||||||
|
git checkout master || git checkout -b master
|
||||||
|
|
||||||
|
cp ../packages/aur/dcr-dev/PKGBUILD .
|
||||||
|
cp ../packages/aur/dcr-dev/.SRCINFO .
|
||||||
|
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
|
if git diff --quiet; then
|
||||||
|
echo "No AUR changes"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add PKGBUILD .SRCINFO
|
||||||
|
git commit -m "dcr-dev ${{ needs.setup.outputs.version }}"
|
||||||
|
git push -u origin master
|
||||||
|
|
||||||
|
# ── Arch User Repository (dcr-dev-bin) ────────────────────────────
|
||||||
|
publish-aur-dev-bin:
|
||||||
|
if: ${{ (github.event_name == 'push' && needs.setup.outputs.prerelease == 'true') || github.event.inputs.run_aur_dev == 'true' }}
|
||||||
|
needs: [setup, build-linux]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: aur
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Derive checksum
|
||||||
|
id: meta
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
TAG="${{ needs.setup.outputs.tag }}"
|
||||||
|
VER="${{ needs.setup.outputs.version }}"
|
||||||
|
BASE_URL="https://github.com/dexoron/dcr/releases/download/${TAG}"
|
||||||
|
for arch in x86_64 aarch64 i686 armv7h riscv64; do
|
||||||
|
case "$arch" in
|
||||||
|
x86_64) triple="x86_64-unknown-linux-musl" ;;
|
||||||
|
aarch64) triple="aarch64-unknown-linux-musl" ;;
|
||||||
|
i686) triple="i686-unknown-linux-musl" ;;
|
||||||
|
armv7h) triple="armv7-unknown-linux-musleabihf" ;;
|
||||||
|
riscv64) triple="riscv64gc-unknown-linux-musl" ;;
|
||||||
|
esac
|
||||||
|
url="${BASE_URL}/dcr-${triple}-${VER}"
|
||||||
|
sha256="$(curl -fsSL "$url" | sha256sum | awk '{print $1}')"
|
||||||
|
echo "${arch}_url=${url}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "${arch}_sha256=${sha256}" >> "$GITHUB_OUTPUT"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Render AUR Metadata
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
PKGVER_ORIG='${{ needs.setup.outputs.version }}'
|
||||||
|
PKGVER_CLEAN='${{ needs.setup.outputs.clean_version }}'
|
||||||
|
mkdir -p packages/aur/dcr-dev-bin
|
||||||
|
cat > packages/aur/dcr-dev-bin/PKGBUILD <<PKG
|
||||||
|
pkgname=dcr-dev-bin
|
||||||
|
pkgver=${PKGVER_CLEAN}
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Cargo-like utility to manage C/C++ projects (pre-compiled musl binary dev release)"
|
||||||
|
arch=('x86_64' 'aarch64' 'i686' 'armv7h' 'riscv64')
|
||||||
|
url="https://github.com/dexoron/dcr"
|
||||||
|
license=('GPL-3.0-or-later')
|
||||||
|
provides=('dcr')
|
||||||
|
conflicts=('dcr')
|
||||||
|
optdepends=(
|
||||||
|
'gcc: build C/C++ projects with GCC'
|
||||||
|
'clang: build C/C++ projects with Clang'
|
||||||
|
)
|
||||||
|
source_x86_64=("dcr-\$pkgver::${{ steps.meta.outputs.x86_64_url }}")
|
||||||
|
sha256sums_x86_64=('${{ steps.meta.outputs.x86_64_sha256 }}')
|
||||||
|
source_aarch64=("dcr-\$pkgver::${{ steps.meta.outputs.aarch64_url }}")
|
||||||
|
sha256sums_aarch64=('${{ steps.meta.outputs.aarch64_sha256 }}')
|
||||||
|
source_i686=("dcr-\$pkgver::${{ steps.meta.outputs.i686_url }}")
|
||||||
|
sha256sums_i686=('${{ steps.meta.outputs.i686_sha256 }}')
|
||||||
|
source_armv7h=("dcr-\$pkgver::${{ steps.meta.outputs.armv7h_url }}")
|
||||||
|
sha256sums_armv7h=('${{ steps.meta.outputs.armv7h_sha256 }}')
|
||||||
|
source_riscv64=("dcr-\$pkgver::${{ steps.meta.outputs.riscv64_url }}")
|
||||||
|
sha256sums_riscv64=('${{ steps.meta.outputs.riscv64_sha256 }}')
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -Dm755 "\$srcdir/dcr-\$pkgver" "\$pkgdir/usr/bin/dcr"
|
||||||
|
}
|
||||||
|
PKG
|
||||||
|
|
||||||
|
cat > packages/aur/dcr-dev-bin/.SRCINFO <<SRC
|
||||||
|
pkgbase = dcr-dev-bin
|
||||||
|
pkgdesc = Cargo-like utility to manage C/C++ projects (pre-compiled musl binary dev release)
|
||||||
|
pkgver = ${PKGVER_CLEAN}
|
||||||
|
pkgrel = 1
|
||||||
|
url = https://github.com/dexoron/dcr
|
||||||
|
arch = x86_64
|
||||||
|
arch = aarch64
|
||||||
|
arch = i686
|
||||||
|
arch = armv7h
|
||||||
|
arch = riscv64
|
||||||
|
license = GPL-3.0-or-later
|
||||||
|
provides = dcr
|
||||||
|
conflicts = dcr
|
||||||
|
optdepends = gcc: build C/C++ projects with GCC
|
||||||
|
optdepends = clang: build C/C++ projects with Clang
|
||||||
|
source_x86_64 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.x86_64_url }}
|
||||||
|
sha256sums_x86_64 = ${{ steps.meta.outputs.x86_64_sha256 }}
|
||||||
|
source_aarch64 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.aarch64_url }}
|
||||||
|
sha256sums_aarch64 = ${{ steps.meta.outputs.aarch64_sha256 }}
|
||||||
|
source_i686 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.i686_url }}
|
||||||
|
sha256sums_i686 = ${{ steps.meta.outputs.i686_sha256 }}
|
||||||
|
source_armv7h = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.armv7h_url }}
|
||||||
|
sha256sums_armv7h = ${{ steps.meta.outputs.armv7h_sha256 }}
|
||||||
|
source_riscv64 = dcr-${PKGVER_CLEAN}::${{ steps.meta.outputs.riscv64_url }}
|
||||||
|
sha256sums_riscv64 = ${{ steps.meta.outputs.riscv64_sha256 }}
|
||||||
|
|
||||||
|
pkgname = dcr-dev-bin
|
||||||
|
SRC
|
||||||
|
|
||||||
|
- name: Push to AUR
|
||||||
|
env:
|
||||||
|
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||||
|
AUR_PACKAGE: dcr-dev-bin
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
install -d -m 700 ~/.ssh
|
||||||
|
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > ~/.ssh/aur
|
||||||
|
chmod 600 ~/.ssh/aur
|
||||||
|
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
export GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes'
|
||||||
|
|
||||||
|
mkdir -p aur-repo
|
||||||
|
cd aur-repo
|
||||||
|
git init
|
||||||
|
git remote add origin "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git"
|
||||||
|
|
||||||
|
git fetch origin master || true
|
||||||
|
git checkout master || git checkout -b master
|
||||||
|
|
||||||
|
cp ../packages/aur/dcr-dev-bin/PKGBUILD .
|
||||||
|
cp ../packages/aur/dcr-dev-bin/.SRCINFO .
|
||||||
|
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
|
if git rev-parse --verify HEAD >/dev/null 2>&1; then
|
||||||
|
if git diff --quiet; then
|
||||||
|
echo "No AUR changes"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
git add PKGBUILD .SRCINFO
|
||||||
|
git commit -m "dcr-dev-bin ${{ needs.setup.outputs.version }}"
|
||||||
|
git push -u origin master
|
||||||
|
|
||||||
|
|
||||||
# ── crates.io ──────────────────────────────────────────────────────────────
|
# ── crates.io ──────────────────────────────────────────────────────────────
|
||||||
publish-crates:
|
publish-crates:
|
||||||
@@ -738,6 +1064,8 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Publish to crates.io
|
- name: Publish to crates.io
|
||||||
|
env:
|
||||||
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
run: cargo publish
|
run: cargo publish
|
||||||
|
|
||||||
# ── Homebrew tap ───────────────────────────────────────────────────────────
|
# ── Homebrew tap ───────────────────────────────────────────────────────────
|
||||||
@@ -833,10 +1161,20 @@ jobs:
|
|||||||
name: snap-package
|
name: snap-package
|
||||||
path: dist-packages
|
path: dist-packages
|
||||||
|
|
||||||
|
- name: Resolve Snap File
|
||||||
|
id: snap-file
|
||||||
|
run: |
|
||||||
|
snap_file=$(ls dist-packages/*.snap 2>/dev/null | head -1)
|
||||||
|
if [ -z "$snap_file" ]; then
|
||||||
|
echo "No .snap file found in dist-packages/"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "snap=$snap_file" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Publish to Snap Store
|
- name: Publish to Snap Store
|
||||||
uses: snapcore/action-publish@v1
|
uses: snapcore/action-publish@v1
|
||||||
env:
|
env:
|
||||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
|
||||||
with:
|
with:
|
||||||
snap: dist-packages/*.snap
|
snap: ${{ steps.snap-file.outputs.snap }}
|
||||||
release: stable
|
release: stable
|
||||||
@@ -48,4 +48,11 @@ git2 = { version = "0.20.4", features = ["vendored-libgit2", "vendored-openssl"]
|
|||||||
openssl = { version = "0.10", features = ["vendored"] }
|
openssl = { version = "0.10", features = ["vendored"] }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
git2 = { version = "0.20.4", features = ["vendored-libgit2"] }
|
git2 = { version = "0.20.4", features = ["vendored-libgit2"] }
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
opt-level = "z"
|
||||||
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
panic = "abort"
|
||||||
|
strip = true
|
||||||
@@ -106,7 +106,7 @@ cargo install dcr
|
|||||||
<td>
|
<td>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -fsSL https://dcr.dexoron.su/install.sh | bash
|
curl -fsSL https://dcr.dexoron.su/install.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
@@ -116,7 +116,7 @@ curl -fsSL https://dcr.dexoron.su/install.sh | bash
|
|||||||
<td>
|
<td>
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl -fsSL https://dcr.dexoron.su/install_bsd.sh | bash
|
curl -fsSL https://dcr.dexoron.su/install_bsd.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
@@ -259,4 +259,4 @@ cargo test
|
|||||||
GPL-3.0 — see [LICENSE](LICENSE)<br/>
|
GPL-3.0 — see [LICENSE](LICENSE)<br/>
|
||||||
Made with ❤️ by [Dexoron](https://github.com/dexoron) and contributors.
|
Made with ❤️ by [Dexoron](https://github.com/dexoron) and contributors.
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
12
install.ps1
12
install.ps1
@@ -47,10 +47,16 @@ function Select-Mode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-Target {
|
function Get-Target {
|
||||||
if ($env:PROCESSOR_ARCHITECTURE -ne 'AMD64') {
|
$arch = $env:PROCESSOR_ARCHITECTURE
|
||||||
Fail "Only x86_64 Windows is supported, current architecture: $env:PROCESSOR_ARCHITECTURE"
|
if ($env:PROCESSOR_ARCHITEW6432) {
|
||||||
|
$arch = $env:PROCESSOR_ARCHITEW6432
|
||||||
|
}
|
||||||
|
switch ($arch) {
|
||||||
|
'AMD64' { return 'x86_64-pc-windows-msvc' }
|
||||||
|
'ARM64' { return 'aarch64-pc-windows-msvc' }
|
||||||
|
'x86' { return 'i686-pc-windows-msvc' }
|
||||||
|
default { Fail "Unsupported Windows architecture: $arch" }
|
||||||
}
|
}
|
||||||
return 'x86_64-pc-windows-msvc'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Fetch-ReleaseJson($channel) {
|
function Fetch-ReleaseJson($channel) {
|
||||||
|
|||||||
@@ -43,11 +43,20 @@ detect_target() {
|
|||||||
case "$os:$arch" in
|
case "$os:$arch" in
|
||||||
Linux:x86_64) TARGET_TRIPLE="x86_64-unknown-linux-gnu" ;;
|
Linux:x86_64) TARGET_TRIPLE="x86_64-unknown-linux-gnu" ;;
|
||||||
Linux:aarch64|Linux:arm64) TARGET_TRIPLE="aarch64-unknown-linux-gnu" ;;
|
Linux:aarch64|Linux:arm64) TARGET_TRIPLE="aarch64-unknown-linux-gnu" ;;
|
||||||
|
Linux:i686|Linux:i386) TARGET_TRIPLE="i686-unknown-linux-gnu" ;;
|
||||||
|
Linux:armv7l|Linux:armv7) TARGET_TRIPLE="armv7-unknown-linux-gnueabihf" ;;
|
||||||
|
Linux:riscv64) TARGET_TRIPLE="riscv64gc-unknown-linux-gnu" ;;
|
||||||
Darwin:x86_64) TARGET_TRIPLE="x86_64-apple-darwin" ;;
|
Darwin:x86_64) TARGET_TRIPLE="x86_64-apple-darwin" ;;
|
||||||
Darwin:arm64|Darwin:aarch64) TARGET_TRIPLE="aarch64-apple-darwin" ;;
|
Darwin:arm64|Darwin:aarch64) TARGET_TRIPLE="aarch64-apple-darwin" ;;
|
||||||
FreeBSD:x86_64|FreeBSD:amd64) TARGET_TRIPLE="x86_64-unknown-freebsd" ;;
|
FreeBSD:x86_64|FreeBSD:amd64) TARGET_TRIPLE="x86_64-unknown-freebsd" ;;
|
||||||
|
FreeBSD:aarch64|FreeBSD:arm64) TARGET_TRIPLE="aarch64-unknown-freebsd" ;;
|
||||||
|
FreeBSD:i686|FreeBSD:i386) TARGET_TRIPLE="i686-unknown-freebsd" ;;
|
||||||
OpenBSD:x86_64|OpenBSD:amd64) TARGET_TRIPLE="x86_64-unknown-openbsd" ;;
|
OpenBSD:x86_64|OpenBSD:amd64) TARGET_TRIPLE="x86_64-unknown-openbsd" ;;
|
||||||
|
OpenBSD:aarch64|OpenBSD:arm64) TARGET_TRIPLE="aarch64-unknown-openbsd" ;;
|
||||||
|
OpenBSD:i686|OpenBSD:i386) TARGET_TRIPLE="i686-unknown-openbsd" ;;
|
||||||
NetBSD:x86_64|NetBSD:amd64) TARGET_TRIPLE="x86_64-unknown-netbsd" ;;
|
NetBSD:x86_64|NetBSD:amd64) TARGET_TRIPLE="x86_64-unknown-netbsd" ;;
|
||||||
|
NetBSD:aarch64|NetBSD:arm64) TARGET_TRIPLE="aarch64-unknown-netbsd" ;;
|
||||||
|
NetBSD:i686|NetBSD:i386) TARGET_TRIPLE="i686-unknown-netbsd" ;;
|
||||||
|
|
||||||
*) error "Unsupported platform: $os/$arch"; exit 1 ;;
|
*) error "Unsupported platform: $os/$arch"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -39,8 +39,14 @@ detect_target() {
|
|||||||
|
|
||||||
case "$os:$arch" in
|
case "$os:$arch" in
|
||||||
FreeBSD:x86_64|FreeBSD:amd64) TARGET_TRIPLE="x86_64-unknown-freebsd" ;;
|
FreeBSD:x86_64|FreeBSD:amd64) TARGET_TRIPLE="x86_64-unknown-freebsd" ;;
|
||||||
|
FreeBSD:aarch64|FreeBSD:arm64) TARGET_TRIPLE="aarch64-unknown-freebsd" ;;
|
||||||
|
FreeBSD:i686|FreeBSD:i386) TARGET_TRIPLE="i686-unknown-freebsd" ;;
|
||||||
OpenBSD:x86_64|OpenBSD:amd64) TARGET_TRIPLE="x86_64-unknown-openbsd" ;;
|
OpenBSD:x86_64|OpenBSD:amd64) TARGET_TRIPLE="x86_64-unknown-openbsd" ;;
|
||||||
|
OpenBSD:aarch64|OpenBSD:arm64) TARGET_TRIPLE="aarch64-unknown-openbsd" ;;
|
||||||
|
OpenBSD:i686|OpenBSD:i386) TARGET_TRIPLE="i686-unknown-openbsd" ;;
|
||||||
NetBSD:x86_64|NetBSD:amd64) TARGET_TRIPLE="x86_64-unknown-netbsd" ;;
|
NetBSD:x86_64|NetBSD:amd64) TARGET_TRIPLE="x86_64-unknown-netbsd" ;;
|
||||||
|
NetBSD:aarch64|NetBSD:arm64) TARGET_TRIPLE="aarch64-unknown-netbsd" ;;
|
||||||
|
NetBSD:i686|NetBSD:i386) TARGET_TRIPLE="i686-unknown-netbsd" ;;
|
||||||
DragonFly:x86_64|DragonFly:amd64) TARGET_TRIPLE="x86_64-unknown-dragonfly" ;;
|
DragonFly:x86_64|DragonFly:amd64) TARGET_TRIPLE="x86_64-unknown-dragonfly" ;;
|
||||||
*) error "Unsupported BSD platform: $os/$arch"; exit 1 ;;
|
*) error "Unsupported BSD platform: $os/$arch"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
1
packaging/aur/dcr-dev-git
Submodule
1
packaging/aur/dcr-dev-git
Submodule
Submodule packaging/aur/dcr-dev-git added at 93bdce858b
Submodule packaging/aur/dcr-git updated: 12038a613e...2c5743a456
@@ -16,7 +16,7 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::config::FILE_MAIN_C;
|
use crate::config::FILE_MAIN_C;
|
||||||
use crate::core::config::Config;
|
use crate::core::config::{validate_package_name, Config};
|
||||||
use crate::utils::fs::check_dir;
|
use crate::utils::fs::check_dir;
|
||||||
use crate::utils::log::{error, warn};
|
use crate::utils::log::{error, warn};
|
||||||
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, colored, printc};
|
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, colored, printc};
|
||||||
@@ -41,6 +41,15 @@ pub fn init(args: &[String]) -> i32 {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Err(e) = validate_package_name(&project_name) {
|
||||||
|
error(&format!(
|
||||||
|
"Invalid project name `{}`: {}",
|
||||||
|
colored(&project_name, BOLD_CYAN),
|
||||||
|
e
|
||||||
|
));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
let cwd = std::env::current_dir()
|
let cwd = std::env::current_dir()
|
||||||
.map(|v| v.to_string_lossy().to_string())
|
.map(|v| v.to_string_lossy().to_string())
|
||||||
.unwrap_or_else(|_| ".".to_string());
|
.unwrap_or_else(|_| ".".to_string());
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::config::FILE_MAIN_C;
|
use crate::config::FILE_MAIN_C;
|
||||||
use crate::core::config::Config;
|
use crate::core::config::{validate_package_name, Config};
|
||||||
use crate::utils::fs::check_dir;
|
use crate::utils::fs::check_dir;
|
||||||
use crate::utils::log::{error, warn};
|
use crate::utils::log::{error, warn};
|
||||||
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, colored, printc};
|
use crate::utils::text::{BOLD_CYAN, BOLD_GREEN, colored, printc};
|
||||||
@@ -42,6 +42,15 @@ pub fn new(args: &[String]) -> i32 {
|
|||||||
colored(project_name, BOLD_CYAN)
|
colored(project_name, BOLD_CYAN)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if let Err(e) = validate_package_name(project_name) {
|
||||||
|
error(&format!(
|
||||||
|
"Invalid project name `{}`: {}",
|
||||||
|
colored(project_name, BOLD_CYAN),
|
||||||
|
e
|
||||||
|
));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if items.contains(project_name) {
|
if items.contains(project_name) {
|
||||||
error(&format!(
|
error(&format!(
|
||||||
"Directory `{}` already exists\n",
|
"Directory `{}` already exists\n",
|
||||||
|
|||||||
@@ -329,17 +329,16 @@ pub fn needs_link(objects: &[String], output_path: &str) -> bool {
|
|||||||
|
|
||||||
fn parse_d_file(content: &str) -> Vec<String> {
|
fn parse_d_file(content: &str) -> Vec<String> {
|
||||||
let mut deps = Vec::new();
|
let mut deps = Vec::new();
|
||||||
let text = content.replace("\\\n", " ").replace("\\\r\n", " ");
|
|
||||||
let mut target_end = 0;
|
let mut target_end = 0;
|
||||||
let chars: Vec<char> = text.chars().collect();
|
let bytes = content.as_bytes();
|
||||||
for i in 0..chars.len() {
|
for (i, &b) in bytes.iter().enumerate() {
|
||||||
if chars[i] == ':' {
|
if b == b':' {
|
||||||
if i == 1
|
if i == 1
|
||||||
&& chars[0].is_ascii_alphabetic()
|
&& bytes[0].is_ascii_alphabetic()
|
||||||
&& i + 1 < chars.len()
|
&& i + 1 < bytes.len()
|
||||||
&& (chars[i + 1] == '\\' || chars[i + 1] == '/')
|
&& (bytes[i + 1] == b'\\' || bytes[i + 1] == b'/')
|
||||||
{
|
{
|
||||||
continue; // Windows drive letter
|
continue;
|
||||||
}
|
}
|
||||||
target_end = i + 1;
|
target_end = i + 1;
|
||||||
break;
|
break;
|
||||||
@@ -347,17 +346,23 @@ fn parse_d_file(content: &str) -> Vec<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let deps_str = if target_end > 0 {
|
let deps_str = if target_end > 0 {
|
||||||
&text[target_end..]
|
&content[target_end..]
|
||||||
} else {
|
} else {
|
||||||
&text
|
content
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut current_path = String::new();
|
let mut current_path = String::new();
|
||||||
let mut in_escape = false;
|
let mut in_escape = false;
|
||||||
|
let mut chars = deps_str.chars().peekable();
|
||||||
|
|
||||||
for c in deps_str.chars() {
|
while let Some(c) = chars.next() {
|
||||||
if in_escape {
|
if in_escape {
|
||||||
if c != '\n' && c != '\r' {
|
if c == '\n' {
|
||||||
|
} else if c == '\r' {
|
||||||
|
if chars.peek() == Some(&'\n') {
|
||||||
|
chars.next();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
current_path.push(c);
|
current_path.push(c);
|
||||||
}
|
}
|
||||||
in_escape = false;
|
in_escape = false;
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ fn parse_typed_config(value: &Value) -> Result<DcrConfig, ConfigError> {
|
|||||||
value.clone().try_into().map_err(ConfigError::TomlDe)
|
value.clone().try_into().map_err(ConfigError::TomlDe)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate_package_name(name: &str) -> Result<(), ConfigError> {
|
pub fn validate_package_name(name: &str) -> Result<(), ConfigError> {
|
||||||
let trimmed = name.trim();
|
let trimmed = name.trim();
|
||||||
if trimmed != name {
|
if trimmed != name {
|
||||||
return Err(ConfigError::Invalid(
|
return Err(ConfigError::Invalid(
|
||||||
|
|||||||
Reference in New Issue
Block a user