feat(stub): 以 viperbuild.vpnci 替换 project_build.vpnci
viperbuild 是编译器内建宏库(与 t / c / ctraits 同级),存根仅供 Vipeye 解析; 文件名与 import 名保持一致,注释改为英文,并移除旧的 project_build.vpnci。
This commit is contained in:
1 parent
7384d9a57c
commit
1566df068f
2 files changed
+56
-2
No files matched your search
@@ -1,2 +0,0 @@
|
||||
def make():
|
||||
pass
|
||||
@@ -0,0 +1,56 @@
|
||||
"""viperbuild — Compile-time build configuration library
|
||||
|
||||
viperbuild is a compiler built-in macro library that emits no runtime code.
|
||||
The compiler recognizes ``import viperbuild as vb`` inside the dependency
|
||||
closure of the entry file and extracts the build configuration from it
|
||||
(source dir / build root / compiler / linker / target triple, ...).
|
||||
|
||||
This file is a ``.vpnci`` stub: it exists solely for Vipeye (the pyright-based
|
||||
VSCode Viper LSP) to provide static inference and completion. The compiler does
|
||||
not read it at all; the real macro semantics are implemented inside TransPyV.
|
||||
|
||||
Constraints:
|
||||
- Only ONE Project object is allowed per dependency closure.
|
||||
- Project is a macro type: field assignments happen at compile time and
|
||||
reading it (using it as an rvalue) is forbidden.
|
||||
- ``source`` defaults to the directory containing the entry file; when set
|
||||
explicitly, the entry file must reside under it, otherwise it is fatal.
|
||||
"""
|
||||
|
||||
|
||||
class Project:
|
||||
"""Compile-time project object (macro type)."""
|
||||
|
||||
name: str
|
||||
version: str
|
||||
source: str
|
||||
buildroot: str
|
||||
includes: list[str]
|
||||
compiler: list[str]
|
||||
linker: list[str]
|
||||
static_libs: list[str]
|
||||
dynamic_libs: list[str]
|
||||
output: str
|
||||
|
||||
def __init__(self, name: str, version: str = "") -> None:
|
||||
"""Construct a project object."""
|
||||
pass
|
||||
|
||||
def config(self, source: str = "", buildroot: str = "",
|
||||
includes: list[str] = [], compiler: list[str] = [],
|
||||
linker: list[str] = [], static_libs: list[str] = [],
|
||||
dynamic_libs: list[str] = [], output: str = "") -> None:
|
||||
"""Set multiple fields at once (equivalent to individual assignments)."""
|
||||
pass
|
||||
|
||||
def build(self, triple: str = "", datalayout: str = "",
|
||||
selfmachine: bool = False) -> None:
|
||||
"""Commit and trigger the build of this project.
|
||||
|
||||
triple + datalayout: explicit target platform (must be given as a pair).
|
||||
selfmachine=True : use the recommended values for the local machine
|
||||
(mutually exclusive with explicit triple/datalayout;
|
||||
giving both is fatal).
|
||||
When neither is given, selfmachine defaults to True.
|
||||
"""
|
||||
pass
|
||||
Reference in new issue
Block a user