name: sakurac
gpid: malunal
semv: 1.0.0

options:
  level: 2
  debug: false

requires:
- https://git.malunal.studio/sakura/std@v1.0.0
# Required by its folder beside this one until it's released with its resources,
# which --icon, --title, --semv, and --windowed write: then by its tag again.
- https://git.malunal.studio/sakura/binary@v1.0.0
# `system`, the layer beneath std that talks to the operating system, which
# the compiler reads too: by its folder beside this one until it's released,
# then by its tag, the one std requires.
- https://git.malunal.studio/sakura/system@v1.0.0

targets:
- name:  sakurac
  type:  program
  level: ${level}
  petal: ${debug}
  deps:
  - binary.elf
  - binary.dwarf
  - binary.pe
  - binary.pdb
  - binary.amd64
  - sakura.analyzer
  - sakura.compiler
  - sakura.machine
  - sakura.native
  - sakura.server
  - std.args
  - std.io
  - std.json
  - std.process
  - std.thread
  - system
  srcs:
  - entry.sakura

# The compiler's parts, each a library of its own in the folder of its name.
- name: sakura.analyzer
  type: library
  root: ./analyzer
  deps: [std.containers, std.io, std.thread, system]

- name: sakura.compiler
  type: library
  root: ./compiler
  deps: [std.allocators, std.containers, std.thread, sakura.analyzer]

- name: sakura.machine
  type: library
  root: ./machine
  deps:
  - std.containers
  - std.io
  - std.thread
  - std.time
  - system
  - sakura.analyzer
  - sakura.compiler

- name: sakura.native
  type: library
  root: ./native
  deps:
  - std.containers
  - std.io
  - std.thread
  - system
  - sakura.analyzer
  - sakura.compiler
  - binary.amd64
  - binary.elf
  - binary.dwarf
  - binary.pe
  - binary.pdb

- name: sakura.server
  type: library
  root: ./server
  deps:
  - std.io
  - std.json
  - std.net
  - std.process
  - std.serial
  - system
  - sakura.analyzer
  - sakura.machine

tests:
- name: sakurac.tests
  type: program
  runs: native
  deps: [sakura.analyzer, std.io, std.process, std.testing, system]
  srcs: [tests/main.sakura, tests/libraries.sakura]

# Each part's tests, in the folder of its name. Those of the analyzer and the
# native backend evaluate constants on the machine, as `sakurac build` does,
# and the native backend's find `core` and `runtime` as the language server
# does, and `system` in its repository beside this one.
- name: sakura.analyzer.tests
  type: program
  runs: native
  deps: [sakura.analyzer, sakura.compiler, sakura.machine, std.testing, system]
  srcs: [tests/main.sakura, tests/analyzer/*.sakura]

- name: sakura.compiler.tests
  type: program
  runs: native
  deps:
  - sakura.analyzer
  - sakura.compiler
  - std.containers
  - std.io
  - std.testing
  - system
  srcs: [tests/main.sakura, tests/compiler/*.sakura]

- name: sakura.machine.tests
  type: program
  runs: native
  deps: [sakura.analyzer, sakura.compiler, sakura.machine, std.io, std.testing]
  srcs: [tests/main.sakura, tests/machine/*.sakura]

# The machine's tests again, built and run as an executable, where the machine
# compiles the functions it runs to the processor's code, as on Windows.
- name: sakura.machine.native
  type: program
  runs: native
  deps: [sakura.analyzer, sakura.compiler, sakura.machine, std.io, std.testing]
  srcs: [tests/main.sakura, tests/machine/*.sakura]

- name: sakura.native.tests
  type: program
  runs: native
  deps:
  - sakura.analyzer
  - sakura.compiler
  - sakura.machine
  - sakura.server
  - binary.amd64
  - binary.elf
  - binary.pe
  - sakura.native
  - std.io
  - std.process
  - std.testing
  - system
  srcs: [tests/main.sakura, tests/native/*.sakura]

- name: sakura.server.tests
  type: program
  deps: [sakura.analyzer, sakura.server, std.io, std.testing, system]
  srcs: [tests/main.sakura, tests/server/*.sakura]

# The tests of `core`, which ships with the compiler, built and run as
# executables. Those of `system` are in its repository.
- name: sakurac.core
  type: program
  runs: native
  deps:
  - std.containers
  - std.io
  - std.math
  - std.process
  - std.serial
  - std.testing
  - std.thread
  - system
  srcs: [tests/core/*.sakura]

# The corpus, each program run by the compiler just built, over the standard
# library's repository and `system`'s beside this one.

- name: sakurac.corpus
  type: program
  checks: false
  srcs: [tools/corpus.sakura]
  deps: [std.io, std.process, system]
  args:
  - "${bin}/sakurac"
  - run
  - --lib
  - std=../std
  - --lib
  - system=../system/system

- name: sakurac.checked
  type: program
  checks: false
  srcs: [tools/corpus.sakura]
  deps: [std.io, std.process, system]
  args:
  - --dir
  - tests/checked
  - "${bin}/sakurac"
  - run
  - --lib
  - std=../std
  - --lib
  - system=../system/system

- name: sakurac.memory
  type: program
  checks: false
  srcs: [tools/corpus.sakura]
  deps: [std.io, std.process, system]
  args:
  - --dir
  - tests/memory
  - "${bin}/sakurac"
  - run
  - --lib
  - std=../std
  - --lib
  - system=../system/system
  - --checks

exports:
- sakura.analyzer
- sakura.compiler
- sakura.machine
- sakura.native
- sakura.server

install:
- !include ./core
- !include ./runtime

package:
  lic: MIT
  desc: The Sakura programming language compiler.
  auth: John Christman <sorakatadzuma@gmail.com>
  url:  https://git.malunal.studio/sakura/sakurac
