@devaloop/devalang 0.0.1-alpha.15 → 0.0.1-alpha.16-hotfix.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devalang +2 -0
- package/.github/workflows/ci.yml +92 -0
- package/Cargo.toml +60 -58
- package/README.md +1 -1
- package/docs/CHANGELOG.md +34 -1
- package/docs/CONTRIBUTING.md +101 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/TODO.md +1 -1
- package/examples/automation.deva +1 -3
- package/examples/bank.deva +4 -4
- package/examples/events.deva +12 -0
- package/examples/function.deva +4 -4
- package/examples/index.deva +3 -5
- package/examples/loop.deva +5 -11
- package/examples/pattern.deva +8 -0
- package/examples/plugin.deva +12 -11
- package/examples/variables.deva +1 -1
- package/out-tsc/bin/index.js +51 -7
- package/out-tsc/index.js +3 -1
- package/out-tsc/scripts/postbuild.js +9 -10
- package/out-tsc/scripts/postinstall.js +49 -0
- package/package.json +12 -4
- package/project-version.json +3 -3
- package/rust/cli/bank.rs +462 -455
- package/rust/cli/build.rs +252 -199
- package/rust/cli/check.rs +221 -180
- package/rust/cli/driver.rs +297 -292
- package/rust/cli/generator.rs +1 -0
- package/rust/cli/init.rs +87 -79
- package/rust/cli/install.rs +35 -32
- package/rust/cli/login.rs +127 -134
- package/rust/cli/mod.rs +13 -11
- package/rust/cli/play.rs +1123 -218
- package/rust/cli/telemetry.rs +19 -0
- package/rust/cli/template.rs +69 -57
- package/rust/cli/update.rs +6 -4
- package/rust/common/api.rs +5 -5
- package/rust/common/mod.rs +3 -3
- package/rust/config/driver.rs +118 -94
- package/rust/config/loader.rs +165 -156
- package/rust/config/mod.rs +4 -2
- package/rust/config/settings.rs +91 -0
- package/rust/config/stats.rs +257 -0
- package/rust/core/audio/engine.rs +696 -659
- package/rust/core/audio/evaluator.rs +263 -132
- package/rust/core/audio/interpreter/arrow_call.rs +198 -187
- package/rust/core/audio/interpreter/call.rs +98 -95
- package/rust/core/audio/interpreter/condition.rs +70 -71
- package/rust/core/audio/interpreter/driver.rs +487 -231
- package/rust/core/audio/interpreter/function.rs +26 -21
- package/rust/core/audio/interpreter/let_.rs +38 -26
- package/rust/core/audio/interpreter/load.rs +18 -18
- package/rust/core/audio/interpreter/loop_.rs +113 -106
- package/rust/core/audio/interpreter/mod.rs +14 -14
- package/rust/core/audio/interpreter/sleep.rs +27 -28
- package/rust/core/audio/interpreter/spawn.rs +105 -102
- package/rust/core/audio/interpreter/tempo.rs +19 -16
- package/rust/core/audio/interpreter/trigger.rs +239 -210
- package/rust/core/audio/loader/mod.rs +1 -1
- package/rust/core/audio/loader/trigger.rs +100 -94
- package/rust/core/audio/mod.rs +7 -7
- package/rust/core/audio/player.rs +64 -64
- package/rust/core/audio/renderer.rs +56 -53
- package/rust/core/audio/special/easing.rs +189 -120
- package/rust/core/audio/special/env.rs +43 -41
- package/rust/core/audio/special/math.rs +102 -92
- package/rust/core/audio/special/mod.rs +9 -9
- package/rust/core/audio/special/modulator.rs +143 -120
- package/rust/core/builder/mod.rs +80 -85
- package/rust/core/debugger/lexer.rs +27 -27
- package/rust/core/debugger/mod.rs +24 -23
- package/rust/core/debugger/module.rs +55 -47
- package/rust/core/debugger/preprocessor.rs +27 -27
- package/rust/core/debugger/store.rs +40 -39
- package/rust/core/error/mod.rs +80 -69
- package/rust/core/lexer/handler/arrow.rs +82 -82
- package/rust/core/lexer/handler/at.rs +21 -21
- package/rust/core/lexer/handler/brace.rs +41 -41
- package/rust/core/lexer/handler/colon.rs +21 -21
- package/rust/core/lexer/handler/comment.rs +30 -30
- package/rust/core/lexer/handler/dot.rs +21 -21
- package/rust/core/lexer/handler/driver.rs +337 -292
- package/rust/core/lexer/handler/identifier.rs +46 -43
- package/rust/core/lexer/handler/indent.rs +66 -66
- package/rust/core/lexer/handler/mod.rs +16 -16
- package/rust/core/lexer/handler/newline.rs +23 -23
- package/rust/core/lexer/handler/number.rs +31 -31
- package/rust/core/lexer/handler/operator.rs +46 -46
- package/rust/core/lexer/handler/parenthesis.rs +41 -41
- package/rust/core/lexer/handler/slash.rs +21 -21
- package/rust/core/lexer/handler/string.rs +63 -63
- package/rust/core/lexer/mod.rs +54 -51
- package/rust/core/lexer/token.rs +97 -94
- package/rust/core/mod.rs +11 -11
- package/rust/core/parser/driver.rs +513 -490
- package/rust/core/parser/handler/arrow_call.rs +233 -227
- package/rust/core/parser/handler/at.rs +245 -162
- package/rust/core/parser/handler/bank.rs +94 -69
- package/rust/core/parser/handler/condition.rs +80 -74
- package/rust/core/parser/handler/dot.rs +143 -135
- package/rust/core/parser/handler/identifier/automate.rs +257 -194
- package/rust/core/parser/handler/identifier/call.rs +91 -88
- package/rust/core/parser/handler/identifier/emit.rs +66 -0
- package/rust/core/parser/handler/identifier/function.rs +100 -91
- package/rust/core/parser/handler/identifier/group.rs +85 -75
- package/rust/core/parser/handler/identifier/let_.rs +158 -143
- package/rust/core/parser/handler/identifier/mod.rs +54 -56
- package/rust/core/parser/handler/identifier/on.rs +98 -0
- package/rust/core/parser/handler/identifier/print.rs +52 -29
- package/rust/core/parser/handler/identifier/sleep.rs +36 -33
- package/rust/core/parser/handler/identifier/spawn.rs +91 -88
- package/rust/core/parser/handler/identifier/synth.rs +65 -63
- package/rust/core/parser/handler/loop_.rs +170 -89
- package/rust/core/parser/handler/mod.rs +8 -8
- package/rust/core/parser/handler/tempo.rs +53 -47
- package/rust/core/parser/mod.rs +4 -4
- package/rust/core/parser/statement.rs +142 -113
- package/rust/core/plugin/loader.rs +123 -48
- package/rust/core/plugin/mod.rs +2 -1
- package/rust/core/plugin/runner.rs +296 -0
- package/rust/core/preprocessor/loader.rs +515 -326
- package/rust/core/preprocessor/mod.rs +4 -4
- package/rust/core/preprocessor/module.rs +60 -58
- package/rust/core/preprocessor/processor.rs +99 -101
- package/rust/core/preprocessor/resolver/bank.rs +51 -48
- package/rust/core/preprocessor/resolver/call.rs +100 -101
- package/rust/core/preprocessor/resolver/condition.rs +97 -97
- package/rust/core/preprocessor/resolver/driver.rs +310 -280
- package/rust/core/preprocessor/resolver/function.rs +69 -68
- package/rust/core/preprocessor/resolver/group.rs +96 -91
- package/rust/core/preprocessor/resolver/let_.rs +32 -28
- package/rust/core/preprocessor/resolver/loop_.rs +320 -121
- package/rust/core/preprocessor/resolver/mod.rs +15 -15
- package/rust/core/preprocessor/resolver/spawn.rs +76 -73
- package/rust/core/preprocessor/resolver/synth.rs +56 -50
- package/rust/core/preprocessor/resolver/tempo.rs +50 -49
- package/rust/core/preprocessor/resolver/trigger.rs +113 -115
- package/rust/core/preprocessor/resolver/value.rs +81 -81
- package/rust/core/shared/duration.rs +9 -9
- package/rust/core/shared/mod.rs +3 -3
- package/rust/core/shared/value.rs +35 -32
- package/rust/core/store/function.rs +34 -34
- package/rust/core/store/global.rs +55 -38
- package/rust/core/store/mod.rs +5 -5
- package/rust/core/store/variable.rs +37 -34
- package/rust/core/utils/mod.rs +2 -2
- package/rust/core/utils/path.rs +37 -31
- package/rust/core/utils/validation.rs +35 -36
- package/rust/installer/addon.rs +84 -80
- package/rust/installer/bank.rs +62 -65
- package/rust/installer/mod.rs +5 -5
- package/rust/installer/plugin.rs +54 -55
- package/rust/installer/utils.rs +56 -56
- package/rust/lib.rs +156 -164
- package/rust/main.rs +250 -144
- package/rust/utils/error.rs +200 -51
- package/rust/utils/file.rs +38 -35
- package/rust/utils/first_usage.rs +76 -0
- package/rust/utils/logger.rs +195 -143
- package/rust/utils/mod.rs +9 -7
- package/rust/utils/signature.rs +19 -17
- package/rust/utils/spinner.rs +22 -19
- package/rust/utils/telemetry.rs +292 -0
- package/rust/utils/watcher.rs +34 -33
- package/templates/minimal/README.md +97 -121
- package/templates/welcome/README.md +97 -121
- package/typescript/bin/index.ts +19 -5
- package/typescript/index.ts +3 -1
- package/typescript/scripts/postbuild.ts +10 -6
- package/typescript/scripts/postinstall.ts +56 -0
- package/typescript/scripts/version/bump.ts +0 -1
- package/typescript/scripts/version/index.ts +0 -1
- package/out-tsc/bin/devalang.exe +0 -0
package/rust/cli/build.rs
CHANGED
|
@@ -1,199 +1,252 @@
|
|
|
1
|
-
use crate::{
|
|
2
|
-
config::driver::
|
|
3
|
-
core::{
|
|
4
|
-
builder::Builder,
|
|
5
|
-
debugger::{
|
|
6
|
-
lexer::write_lexer_log_file,
|
|
7
|
-
module::{
|
|
8
|
-
preprocessor::write_preprocessor_log_file,
|
|
9
|
-
store::{
|
|
10
|
-
},
|
|
11
|
-
preprocessor::loader::ModuleLoader,
|
|
12
|
-
store::global::GlobalStore,
|
|
13
|
-
utils::path::{
|
|
14
|
-
},
|
|
15
|
-
utils::{
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
&
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
1
|
+
use crate::{
|
|
2
|
+
config::driver::ProjectConfig,
|
|
3
|
+
core::{
|
|
4
|
+
builder::Builder,
|
|
5
|
+
debugger::{
|
|
6
|
+
lexer::write_lexer_log_file,
|
|
7
|
+
module::{write_module_function_log_file, write_module_variable_log_file},
|
|
8
|
+
preprocessor::write_preprocessor_log_file,
|
|
9
|
+
store::{write_function_log_file, write_variables_log_file},
|
|
10
|
+
},
|
|
11
|
+
preprocessor::loader::ModuleLoader,
|
|
12
|
+
store::global::GlobalStore,
|
|
13
|
+
utils::path::{find_entry_file, normalize_path},
|
|
14
|
+
},
|
|
15
|
+
utils::{
|
|
16
|
+
logger::{LogLevel, Logger},
|
|
17
|
+
spinner::with_spinner,
|
|
18
|
+
watcher::watch_directory,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
use std::{thread, time::Duration};
|
|
22
|
+
|
|
23
|
+
#[cfg(feature = "cli")]
|
|
24
|
+
pub fn handle_build_command(
|
|
25
|
+
config: Option<ProjectConfig>,
|
|
26
|
+
entry: Option<String>,
|
|
27
|
+
output: Option<String>,
|
|
28
|
+
watch: bool,
|
|
29
|
+
debug: bool,
|
|
30
|
+
compress: bool,
|
|
31
|
+
) -> Result<(), String> {
|
|
32
|
+
let fetched_entry = if entry.is_none() {
|
|
33
|
+
config
|
|
34
|
+
.as_ref()
|
|
35
|
+
.and_then(|c| c.defaults.entry.clone())
|
|
36
|
+
.unwrap_or_else(|| "".to_string())
|
|
37
|
+
} else {
|
|
38
|
+
entry.clone().unwrap_or_else(|| "".to_string())
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
let fetched_output = if output.is_none() {
|
|
42
|
+
config
|
|
43
|
+
.as_ref()
|
|
44
|
+
.and_then(|c| c.defaults.output.clone())
|
|
45
|
+
.unwrap_or_else(|| "".to_string())
|
|
46
|
+
} else {
|
|
47
|
+
output.clone().unwrap_or_else(|| "".to_string())
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
let fetched_watch = if watch {
|
|
51
|
+
watch
|
|
52
|
+
} else {
|
|
53
|
+
config
|
|
54
|
+
.as_ref()
|
|
55
|
+
.and_then(|c| c.defaults.watch)
|
|
56
|
+
.unwrap_or(false)
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let logger = Logger::new();
|
|
60
|
+
|
|
61
|
+
if fetched_entry.is_empty() {
|
|
62
|
+
logger.log_message(
|
|
63
|
+
LogLevel::Error,
|
|
64
|
+
"Entry path is not specified. Please provide a valid entry path.",
|
|
65
|
+
);
|
|
66
|
+
return Err("missing entry path".to_string());
|
|
67
|
+
}
|
|
68
|
+
if fetched_output.is_empty() {
|
|
69
|
+
logger.log_message(
|
|
70
|
+
LogLevel::Error,
|
|
71
|
+
"Output directory is not specified. Please provide a valid output directory.",
|
|
72
|
+
);
|
|
73
|
+
return Err("missing output directory".to_string());
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let entry_file = match find_entry_file(&fetched_entry) {
|
|
77
|
+
Some(p) => p,
|
|
78
|
+
None => {
|
|
79
|
+
logger.log_message(
|
|
80
|
+
LogLevel::Error,
|
|
81
|
+
&format!("❌ index.deva not found in directory: {}", fetched_entry),
|
|
82
|
+
);
|
|
83
|
+
return Err("index.deva not found".to_string());
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// SECTION Begin build
|
|
88
|
+
if fetched_watch {
|
|
89
|
+
let _ = begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
90
|
+
|
|
91
|
+
logger.log_message(
|
|
92
|
+
LogLevel::Watcher,
|
|
93
|
+
&format!("Watching for changes in '{}'...", fetched_entry),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
watch_directory(entry_file.clone(), move || {
|
|
97
|
+
logger.log_message(LogLevel::Watcher, "Detected changes, re-building...");
|
|
98
|
+
|
|
99
|
+
let _ = begin_build(entry_file.clone(), fetched_output.clone(), debug, compress);
|
|
100
|
+
})
|
|
101
|
+
.unwrap();
|
|
102
|
+
} else {
|
|
103
|
+
let stats_input = begin_build(entry_file.clone(), fetched_output.clone(), debug, compress)?;
|
|
104
|
+
let stats = crate::config::stats::compute_from(
|
|
105
|
+
&stats_input.statements_by_module,
|
|
106
|
+
&stats_input.global_store,
|
|
107
|
+
&config,
|
|
108
|
+
Some(&fetched_output),
|
|
109
|
+
);
|
|
110
|
+
crate::config::stats::set_memory_stats(stats.clone());
|
|
111
|
+
if let Err(e) = crate::config::stats::save_to_file(&stats) {
|
|
112
|
+
eprintln!("[stats] failed to save: {}", e);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
Ok(())
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
struct BuildStatsInput {
|
|
119
|
+
pub statements_by_module:
|
|
120
|
+
std::collections::HashMap<String, Vec<crate::core::parser::statement::Statement>>,
|
|
121
|
+
pub global_store: crate::core::store::global::GlobalStore,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
fn begin_build(
|
|
125
|
+
entry: String,
|
|
126
|
+
output: String,
|
|
127
|
+
debug: bool,
|
|
128
|
+
compress: bool,
|
|
129
|
+
) -> Result<BuildStatsInput, String> {
|
|
130
|
+
let spinner = with_spinner("Building...", || {
|
|
131
|
+
thread::sleep(Duration::from_millis(800));
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
let duration = std::time::Instant::now();
|
|
135
|
+
|
|
136
|
+
let normalized_entry_file = normalize_path(&entry);
|
|
137
|
+
let normalized_output_dir = normalize_path(&output);
|
|
138
|
+
|
|
139
|
+
let mut global_store = GlobalStore::new();
|
|
140
|
+
let module_loader = ModuleLoader::new(&normalized_entry_file, &normalized_output_dir);
|
|
141
|
+
|
|
142
|
+
// SECTION Load
|
|
143
|
+
// NOTE: We use modules in the build command, so we need to load them
|
|
144
|
+
let (modules_tokens, modules_statements) = module_loader.load_all_modules(&mut global_store);
|
|
145
|
+
|
|
146
|
+
// SECTION Write logs
|
|
147
|
+
if debug {
|
|
148
|
+
for (module_path, module) in global_store.modules.clone() {
|
|
149
|
+
write_module_variable_log_file(
|
|
150
|
+
&normalized_output_dir,
|
|
151
|
+
&module_path,
|
|
152
|
+
&module.variable_table,
|
|
153
|
+
);
|
|
154
|
+
write_module_function_log_file(
|
|
155
|
+
&normalized_output_dir,
|
|
156
|
+
&module_path,
|
|
157
|
+
&module.function_table,
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
write_lexer_log_file(
|
|
162
|
+
&normalized_output_dir,
|
|
163
|
+
"lexer_tokens.log",
|
|
164
|
+
modules_tokens.clone(),
|
|
165
|
+
);
|
|
166
|
+
write_preprocessor_log_file(
|
|
167
|
+
&normalized_output_dir,
|
|
168
|
+
"resolved_statements.log",
|
|
169
|
+
modules_statements.clone(),
|
|
170
|
+
);
|
|
171
|
+
write_variables_log_file(
|
|
172
|
+
&normalized_output_dir,
|
|
173
|
+
"global_variables.log",
|
|
174
|
+
global_store.variables.clone(),
|
|
175
|
+
);
|
|
176
|
+
write_function_log_file(
|
|
177
|
+
&normalized_output_dir,
|
|
178
|
+
"global_functions.log",
|
|
179
|
+
global_store.functions.clone(),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// SECTION Detect build-time errors prior to building
|
|
184
|
+
let all_errors = crate::utils::error::collect_all_errors_with_modules(&modules_statements);
|
|
185
|
+
let (warnings, criticals) = crate::utils::error::partition_errors(all_errors);
|
|
186
|
+
crate::utils::error::log_errors_with_stack("Build", &warnings, &criticals);
|
|
187
|
+
if !criticals.is_empty() {
|
|
188
|
+
spinner.finish_and_clear();
|
|
189
|
+
return Err(format!(
|
|
190
|
+
"build failed with {} critical error(s): {}",
|
|
191
|
+
criticals.len(),
|
|
192
|
+
criticals[0].message
|
|
193
|
+
));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// SECTION Building AST and Audio
|
|
197
|
+
let builder = Builder::new();
|
|
198
|
+
builder.build_ast(&modules_statements, &normalized_output_dir, compress);
|
|
199
|
+
builder.build_audio(
|
|
200
|
+
&modules_statements,
|
|
201
|
+
&normalized_output_dir,
|
|
202
|
+
&mut global_store,
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
// SECTION Logging
|
|
206
|
+
let logger = Logger::new();
|
|
207
|
+
|
|
208
|
+
if debug {
|
|
209
|
+
let modules_loaded = global_store
|
|
210
|
+
.modules
|
|
211
|
+
.iter()
|
|
212
|
+
.map(|(k, _)| k)
|
|
213
|
+
.collect::<Vec<_>>();
|
|
214
|
+
let global_variables_loaded = global_store.variables.variables.keys().collect::<Vec<_>>();
|
|
215
|
+
let global_functions_loaded = global_store.functions.functions.keys().collect::<Vec<_>>();
|
|
216
|
+
|
|
217
|
+
logger.log_message_with_trace(
|
|
218
|
+
LogLevel::Debug,
|
|
219
|
+
&format!("Modules loaded: {}", global_store.modules.len()),
|
|
220
|
+
modules_loaded.iter().map(|s| s.as_str()).collect(),
|
|
221
|
+
);
|
|
222
|
+
logger.log_message_with_trace(
|
|
223
|
+
LogLevel::Debug,
|
|
224
|
+
&format!(
|
|
225
|
+
"Global variables: {}",
|
|
226
|
+
global_store.variables.variables.len()
|
|
227
|
+
),
|
|
228
|
+
global_variables_loaded.iter().map(|s| s.as_str()).collect(),
|
|
229
|
+
);
|
|
230
|
+
logger.log_message_with_trace(
|
|
231
|
+
LogLevel::Debug,
|
|
232
|
+
&format!(
|
|
233
|
+
"Global functions: {}",
|
|
234
|
+
global_store.functions.functions.len()
|
|
235
|
+
),
|
|
236
|
+
global_functions_loaded.iter().map(|s| s.as_str()).collect(),
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
let success_message = format!(
|
|
241
|
+
"Build completed successfully in {:.2?}. Output files written to: '{}'",
|
|
242
|
+
duration.elapsed(),
|
|
243
|
+
normalized_output_dir
|
|
244
|
+
);
|
|
245
|
+
|
|
246
|
+
spinner.finish_and_clear();
|
|
247
|
+
logger.log_message(LogLevel::Success, &success_message);
|
|
248
|
+
Ok(BuildStatsInput {
|
|
249
|
+
statements_by_module: modules_statements,
|
|
250
|
+
global_store,
|
|
251
|
+
})
|
|
252
|
+
}
|