Commit Graph

16 Commits

Author SHA1 Message Date
Jeroen van Rijn 63331ef731 Revert "Merge pull request #1702 from Kelimion/filename_generation"
This reverts commit a40a53b104, reversing
changes made to 5422a3b17e.
2022-04-24 19:53:36 +02:00
Jeroen van Rijn 3cab2592c3 Compiler: Add early error for output path being a directory.
- 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.
2022-04-24 13:37:26 +02:00
Jeroen van Rijn ad0a413b40 Give build/run/check/test/doc a -file flag.
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.
```
2022-04-05 20:26:18 +02:00
Colin Davidson 8605833781 core out Makefile, add freebsd building 2022-03-14 05:23:48 -07:00
Colin Davidson 2652c2d7a5 normalize version parser 2022-03-09 07:42:38 -08:00
Colin Davidson a2250a5d49 lower minimum llvm version 2022-03-09 07:24:49 -08:00
Colin Davidson 1306c53fb1 more build tweaks? 2022-03-09 07:21:19 -08:00
Colin Davidson 7adaa4dc2b refix make, adjust build for CI weirdness 2022-03-09 07:15:08 -08:00
Colin Davidson c543ecd64c Try to find llvm-config-11 on goofy misconfigured CI box 2022-03-09 06:57:59 -08:00
Colin Davidson 9aea990184 clean up osx semver handling in build 2022-03-09 06:49:52 -08:00
Colin Davidson d5b0632e4f add handling for too many args 2022-03-09 06:27:52 -08:00
Colin Davidson db169a4334 Cleanup build mode selection 2022-03-09 06:26:25 -08:00
Colin Davidson f5cc8bd7bf only build odin for report when necessary 2022-03-09 06:14:30 -08:00
Colin Davidson 005d52cab7 more spacing issues 2022-03-09 06:08:48 -08:00
Colin Davidson d1477bcfa7 Fix wonky copied space issues 2022-03-09 06:07:19 -08:00
Colin Davidson 3092fb2ff3 Add initial cut of build script 2022-03-09 06:01:40 -08:00