-
-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathmod.rs
More file actions
43 lines (36 loc) · 999 Bytes
/
mod.rs
File metadata and controls
43 lines (36 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
use crate::{codegen::generate_single_version_file, env::Env, version::Version};
use std::collections::BTreeMap;
mod build;
mod cargo_toml;
pub mod ffi_type;
mod fields;
mod functions;
mod lib_;
mod statics;
mod tests;
pub fn generate(env: &Env) {
generate_single_version_file(env);
lib_::generate(env);
if !env.config.self_linking {
build::generate(env);
let crate_name = cargo_toml::generate(env);
tests::generate(env, &crate_name);
}
}
pub fn collect_versions(env: &Env) -> BTreeMap<Version, Version> {
let mut versions: BTreeMap<Version, Version> = env
.namespaces
.main()
.versions
.iter()
.filter(|v| **v > env.config.min_cfg_version)
.map(|v| (*v, *v))
.collect();
for v in &env.config.extra_versions {
versions.insert(*v, *v);
}
for (version, lib_version) in &env.config.lib_version_overrides {
versions.insert(*version, *lib_version);
}
versions
}