Skip to content

Commit

Permalink
Support ios command line arguments (BrainiumLLC#71)
Browse files Browse the repository at this point in the history
* Add back missing closing delimiter to `app_dependencies_platform`

* Add support for command line arguments

* Fix whitespace

* remove hard-coded "-"

* use unwrap_or_default
  • Loading branch information
ArthurKValladares committed Feb 24, 2022
1 parent 4a3d2e4 commit aaea3b1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/apple/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub struct Platform {
pre_build_scripts: Option<Vec<BuildScript>>,
post_compile_scripts: Option<Vec<BuildScript>>,
post_build_scripts: Option<Vec<BuildScript>>,
command_line_arguments: Option<Vec<String>>,
}

impl Platform {
Expand Down Expand Up @@ -108,6 +109,10 @@ impl Platform {
pub fn post_build_scripts(&self) -> Option<&[BuildScript]> {
self.post_build_scripts.as_deref()
}

pub fn command_line_arguments(&self) -> &[String] {
self.command_line_arguments.as_deref().unwrap_or_default()
}
}

const fn default_true() -> bool {
Expand Down
8 changes: 8 additions & 0 deletions src/apple/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ pub fn gen(
"macos-post-build-scripts",
metadata.macos().post_build_scripts(),
);
map.insert(
"ios-command-line-arguments",
metadata.ios().command_line_arguments(),
);
map.insert(
"macos-command-line-arguments",
metadata.macos().command_line_arguments(),
);
},
filter.fun(),
)
Expand Down
10 changes: 10 additions & 0 deletions templates/platforms/xcode/project.yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ targets:
environmentVariables:
RUST_BACKTRACE: full
RUST_LOG: info
{{~#if ios-command-line-arguments}}
commandLineArguments:
{{~#each ios-command-line-arguments}}
"{{this}}": true
{{/each}}{{~/if}}
settings:
base:
ENABLE_BITCODE: false
Expand Down Expand Up @@ -164,6 +169,11 @@ targets:
environmentVariables:
RUST_BACKTRACE: full
RUST_LOG: info
{{~#if ios-command-line-arguments}}
commandLineArguments:
{{~#each ios-command-line-arguments}}
"{{this}}": true
{{/each}}{{~/if}}
settings:
base:
LIBRARY_SEARCH_PATHS: $(inherited) "{{prefix-path "target/x86_64-apple-darwin/$(CONFIGURATION)"}}"
Expand Down

0 comments on commit aaea3b1

Please sign in to comment.