Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] How do you get a flag value ? #329

Open
pitoneux opened this issue Jan 28, 2023 · 1 comment
Open

[FEAT] How do you get a flag value ? #329

pitoneux opened this issue Jan 28, 2023 · 1 comment

Comments

@pitoneux
Copy link

thanks for this package!

Question: I want to change the minimum version of the project only if it is different from a given value. The idea is I don't want to mess with the project file if I don't have to.

  1. read the current value
  2. compare to another value
  3. if different change it and save the new project file.

so something like

minimumVersion = project.get_flag(IPHONEOS_DEPLOYMENT_TARGET)

with the standard options to get it from a given target...

is there a way to do this ?

May be the "set_flag" method could return how many flags got changed ? we could decide to save or not then...

Also, would be nice to have a single page with all the methods...

thanks in advance for your help!

@kronenthaler
Copy link
Owner

There are some reasons why this API does not exist. The following snippet will probably solve your issue and will help to explain why is not practical.

for conf in project.objects.get_project_configurations('Debug'): # returns a generator
    print(conf.buildSettings['IPHONEOS_DEPLOYMENT_TARGET'])

or in a one-liner

next(project.objects.get_project_configurations('Debug')).buildSettings['IPHONEOS_DEPLOYMENT_TARGET']

As you can see, the main problem is that the flags (for projects and/or targets) are bound to a configuration. You need to specify the configuration you want to add them to or read them from.

In most methods, a configuration_name parameter is provided, which can be ignored (defaults to None), in which case the action takes place in ALL configurations available. There already exist a set_flags method for the targets and add_project_flags for projects, but they do not return anything because it can be applied to multiple configurations.

I'm trying to not add too many wrapper methods as it will become harder and harder to maintain, but if it makes sense i will include it. But no promises.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants