Initial Dever 0.0.1

This commit is contained in:
Codex committed 2026-11-03 03:32:07 +00:00
commit 81233d098c
1479 files changed
+163782

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
#!/bin/sh
# 干净容器验收;先上传归档、checksum、项目夹具和 test/dever-tests/fixtures/tls。
set -eu
cd /work
for tool in rustc cargo rustup gcc cc ld; do
if command -v "$tool"; then
echo "unexpected preinstalled compiler: $tool" >&2
exit 1
fi
done
test ! -f /usr/include/stdio.h
cat /etc/os-release
if [ "${1:-}" = --installed ]; then
mv "$2" /work/dever
else
archive=${1:-dever-0.0.1-linux-x86_64-development.tar.xz}
sha256sum -c "$archive.sha256"
python3 -m tarfile -e "$archive" --filter=data
fi
validation_path=$PATH
export PATH="/work/dever/bin:$PATH"
dever new hello
dever check hello
dever fmt hello --check
dever test hello
dever run hello -- hello.greeting.greet '{"name":"Dever"}' > hello.json
grep -F '"data":"Hello, Dever"' hello.json
dever build hello --output /work/hello-app
mv dever 'dever moved'
export PATH="/work/dever moved/bin:$validation_path"
dever build hello --output /work/hello-moved
./hello-moved hello.greeting.greet '{"name":"moved"}' > moved.json
grep -F '"data":"Hello, moved"' moved.json
mkdir http database
dever build fixtures/http-application --output /work/http/app
dever build fixtures/database --output /work/database/app
mkdir database/config
cat > database/config/setting.json <<'JSON'
{"database":{"default":{"type":"sqlite","path":"data/account.db","max_connections":1,"max_page_size":20}}}
JSON
./database/app demo.account.create '{"name":"offline"}' > created.json
grep -F '"name":"offline"' created.json
./database/app demo.account.get '{"id":1}' > fetched.json
cmp created.json fetched.json
if ./database/app demo.account.explode '{"name":"rollback","value":9223372036854775807}' > rollback.json 2> rollback.log; then
echo 'transaction fault unexpectedly succeeded' >&2
exit 1
fi
grep -F 'integer arithmetic fault' rollback.log
./database/app demo.account.count '{}' > count.json
grep -F '"data":1' count.json
# 全部运行库特性须在裁剪后的 vendor 中仍能离线解析和编译,包括 PostgreSQL、Job、Worker。
toolchain_root=$(dirname "$(dever skill path)")
python3 - "$toolchain_root" <<'PY'
import json
from pathlib import Path
import sys
import tomllib
runtime = Path(sys.argv[1]) / 'rust/src/runtime'
features = sorted(tomllib.loads((runtime / 'Cargo.toml').read_text())['features'])
project = Path('/work/runtime-all')
(project / 'src').mkdir(parents=True)
(project / 'src/main.rs').write_text('fn main() {}\n')
(project / 'Cargo.toml').write_text(
'[package]\nname = "all-runtime-features"\nversion = "0.0.0"\nedition = "2024"\n'
'[workspace]\n[dependencies]\n'
f'dever-runtime = {{ path = {json.dumps(str(runtime))}, features = {json.dumps(features)} }}\n'
)
PY
"$toolchain_root/toolchain/bin/cargo" build --offline --release \
--manifest-path /work/runtime-all/Cargo.toml --target-dir "$toolchain_root/rust/target"
"$toolchain_root/rust/target/release/all-runtime-features"
echo 'ALL_RUNTIME_FEATURES_PASS'
# 隐藏整个开发包后,正式二进制依然必须正常执行。
mv 'dever moved' hidden-toolchain
./hello-app hello.greeting.greet '{"name":"standalone"}' > standalone.json
grep -F '"data":"Hello, standalone"' standalone.json
echo 'BUILD_AND_DATABASE_PASS'
python3 /work/transport.py
wc -c /work/hello-app /work/http/app /work/database/app
echo 'CLEAN_DEVELOPMENT_PASS'