spudplate
Template scaffolding compiler for spudlang .spud files
Loading...
Searching...
No Matches
bundler.h
1#ifndef SPUDPLATE_BUNDLER_H
2#define SPUDPLATE_BUNDLER_H
3
4#include <filesystem>
5#include <stdexcept>
6#include <string>
7#include <unordered_set>
8#include <vector>
9
10#include "spudplate/ast.h"
11#include "spudplate/spudpack.h"
12
13namespace spudplate {
14
30 std::vector<SpudpackAsset> assets;
31 std::vector<SpudpackDep> deps;
32};
33
40class BundleError : public std::runtime_error {
41 public:
43 BundleError(std::string message, int line, int column);
45 int line() const noexcept { return line_; }
47 int column() const noexcept { return column_; }
48
49 private:
50 int line_;
51 int column_;
52};
53
71 const Spudpack* existing_parent = nullptr;
74 const std::unordered_set<std::string>* update_deps = nullptr;
75};
76
87 std::vector<std::string> ignored_update_pins;
88};
89
131BundleResult bundle_assets(const Program& program,
132 const std::filesystem::path& source_root,
133 const std::filesystem::path& install_root = {},
134 const BundleOptions& options = {},
135 BundleNotes* notes = nullptr);
136
137} // namespace spudplate
138
139#endif // SPUDPLATE_BUNDLER_H
Raised when a from/copy source path cannot be bundled.
Definition bundler.h:40
int line() const noexcept
Source line of the offending statement (1-based).
Definition bundler.h:45
int column() const noexcept
Source column of the offending statement (1-based).
Definition bundler.h:47
Notes the bundler emits as side outputs during a run.
Definition bundler.h:84
std::vector< std::string > ignored_update_pins
Names of deps that were listed in --update-deps but are pinned in source; the bundler honoured the pi...
Definition bundler.h:87
Optional inputs shaping how bundle_assets resolves include deps.
Definition bundler.h:68
const std::unordered_set< std::string > * update_deps
Names of unpinned deps the caller wants refreshed from the install root despite the sticky default.
Definition bundler.h:74
const Spudpack * existing_parent
Previously-installed parent whose bundled deps the bundler should reuse by default ("sticky" mode).
Definition bundler.h:71
The set of assets and dependencies a parsed program references.
Definition bundler.h:29
std::vector< SpudpackDep > deps
Deduped, name-keyed dependencies ready to embed in a spudpack.
Definition bundler.h:31
std::vector< SpudpackAsset > assets
Deduped, normalised assets ready to embed in a spudpack.
Definition bundler.h:30
The top-level AST node representing a complete .spud program.
Definition ast.h:374
A decoded spudpack - the source text, the opaque compiled program, every bundled asset,...
Definition spudpack.h:57