- Introduce new `Path` type and an array of build paths on the build context.
- Resolve input and output paths/files early (before parsing).
- Error early if inputs are missing or outputs are directories.
- Plumb new file path generation into linker stage instead of its adhoc method.
TODO:
- Remove more adhoc file path generation in parser and linker stage.
- Make intermediate object file generation use new path system.
- Round out and robustify Path helper functions.
A package has canonically always been a directory, but odin allowing you to build a single-file package confused newcomers who didn't understand why they could then not access variables and procedures from another file in the same directory.
This change disallows building single-file packages by default, requiring the `-file` flag to acknowledge you understand the nuance.
`-help` for these commands also clarifies the difference.
```
W:\Odin>odin build -help
odin is a tool for managing Odin source code
Usage:
odin build [arguments]
build Compile directory of .odin files as an executable.
One must contain the program's entry point, all must be in the same package.
Use `-file` to build a single file instead.
Examples:
odin build . # Build package in current directory
odin build <dir> # Build package in <dir>
odin build filename.odin -file # Build single-file package, must contain entry point.
Flags
-file
Tells `odin build` to treat the given file as a self-contained package.
This means that `<dir>/a.odin` won't have access to `<dir>/b.odin`'s contents.
```
```
W:\Odin>odin run examples\demo\demo.odin
ERROR: `odin run` takes a package as its first argument.
Did you mean `odin run examples\demo\demo.odin -file`?
The `-file` flag tells it to treat a file as a self-contained package.
```
it tries to get executable path from argv[0]. it is unreliable and unsecure, but should be fine enough for the considered use-case. it still doesn't address all possible cases.
Add new Odin command, `odin report`, which prints information helpful to resolving or reporting a bug.
```
W:\Odin> odin report
Where to find more information and get into contact when you encounter a bug:
Website: https://odin-lang.org
GitHub: https://github.com/odin-lang/Odin/issues
Useful information to add to a bug report:
Odin: dev-2021-10:256bebfe
OS: Windows 10 Professional (version: 20H2), build 19042.1266
CPU: AMD Ryzen 7 1800X Eight-Core Processor
RAM: 65469 MiB
W:\Odin>
TODO:
- CPU name on ARM/ARM64
```