makefile
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
.PHONY: build install
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
odin build . -out:build/brolang
|
||||
|
||||
install: build
|
||||
install -d "$(HOME)/.brolang/bin"
|
||||
install -m 755 build/brolang "$(HOME)/.brolang/bin/bro"
|
||||
@@ -165,7 +165,7 @@ backend failures return status `2`.
|
||||
Top-level function bodies are semantically checked lazily when a concrete
|
||||
specialization is demanded.
|
||||
|
||||
Every immediate `.bro` file in the input directory belongs to the root
|
||||
Every immediate `.bro` or `.hon` file in the input directory belongs to the root
|
||||
package. Imports are relative directory paths and are local to the file that
|
||||
declares them. Imports beginning with `@` resolve from the project root:
|
||||
|
||||
|
||||
@@ -87,7 +87,8 @@ read_package_files :: proc(state: ^State, path: string) -> ([]os.File_Info, bool
|
||||
files: [dynamic]os.File_Info
|
||||
files.allocator = state.allocator
|
||||
for entry in entries {
|
||||
if !entry.is_dir && filepath.ext(entry.name) == ".bro" {
|
||||
extension := filepath.ext(entry.name)
|
||||
if !entry.is_dir && (extension == ".bro" || extension == ".hon") {
|
||||
append(&files, entry)
|
||||
} else {
|
||||
os.file_info_delete(entry, state.allocator)
|
||||
@@ -1170,7 +1171,7 @@ load_package :: proc(state: ^State, path: string, import_span: source.Span, is_r
|
||||
if is_root {
|
||||
state.root_failed = true
|
||||
} else {
|
||||
source.addf(state.diagnostics, import_span, "package '%s' contains no readable .bro files", canonical)
|
||||
source.addf(state.diagnostics, import_span, "package '%s' contains no readable .bro or .hon files", canonical)
|
||||
state.module.packages[pkg_id].available = false
|
||||
}
|
||||
os.file_info_slice_delete(files, state.allocator)
|
||||
|
||||
+2
-2
@@ -855,7 +855,7 @@ lexer_diagnoses_invalid_import_strings :: proc(t: ^testing.T) {
|
||||
}
|
||||
|
||||
@(test)
|
||||
package_loader_discovers_lexical_immediate_bro_files :: proc(t: ^testing.T) {
|
||||
package_loader_discovers_lexical_immediate_source_files :: proc(t: ^testing.T) {
|
||||
sources := source.init_store()
|
||||
defer source.destroy_store(&sources)
|
||||
diagnostics := source.init_store_diagnostics(&sources)
|
||||
@@ -870,7 +870,7 @@ package_loader_discovers_lexical_immediate_bro_files :: proc(t: ^testing.T) {
|
||||
testing.expect_value(t, len(module.packages), 2)
|
||||
testing.expect_value(t, len(module.files), 3)
|
||||
testing.expect(t, strings.has_suffix(sources.items[module.files[0].source].path, "/main.bro"))
|
||||
testing.expect(t, strings.has_suffix(sources.items[module.files[1].source].path, "/value.bro"))
|
||||
testing.expect(t, strings.has_suffix(sources.items[module.files[1].source].path, "/value.hon"))
|
||||
testing.expect(t, strings.has_suffix(sources.items[module.files[2].source].path, "/math.bro"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user