Skip to content

Commit 8249305

Browse files
authored
Merge pull request #228 from pulp-platform/sources_defs
Add target defines to sources output
2 parents 5e2fd1f + f647dec commit 8249305

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/cmd/sources.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use std;
77

88
use clap::{value_parser, Arg, ArgAction, ArgMatches, Command};
9-
use indexmap::IndexSet;
9+
use indexmap::{IndexMap, IndexSet};
1010
use serde_json;
1111
use tokio::runtime::Runtime;
1212

@@ -147,6 +147,21 @@ pub fn run(sess: &Session, matches: &ArgMatches) -> Result<()> {
147147
});
148148
}
149149

150+
let mut target_defines: IndexMap<String, Option<String>> = IndexMap::new();
151+
target_defines.extend(
152+
targets
153+
.iter()
154+
.map(|t| (format!("TARGET_{}", t.to_uppercase()), None)),
155+
);
156+
target_defines.sort_keys();
157+
158+
let _ = target_defines
159+
.iter()
160+
.map(|(k, v)| {
161+
srcs.defines.insert(k, v.as_deref());
162+
})
163+
.collect::<Vec<_>>();
164+
150165
let result = {
151166
let stdout = std::io::stdout();
152167
let handle = stdout.lock();

0 commit comments

Comments
 (0)