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

vala: Custom header and vapi name (fix #892) #912

Merged

Conversation

arteymix
Copy link
Contributor

@arteymix arteymix commented Oct 15, 2016

The same is done for the --gir flag in #634.

@nirbheek
Copy link
Member

This should go in after #908 since it touches that code.

@arteymix
Copy link
Contributor Author

@nirbheek If you can cherry-pick and make it suitable for 0.36 that would be really nice.

Otherwise I think it's good to keep this open if Jussi decide to release before you're done.

@nirbheek
Copy link
Member

Yes, of course we should keep this open. :)

The patch needs some more work too; just that it's a bit pointless to do that right now because it's based on a branch that doesn't have necessary fixes yet. Will do that once that's done.

@arteymix
Copy link
Contributor Author

@nirbheek what's the state of this with #908 merged?

@arteymix arteymix force-pushed the wip/vala-custom-header-and-vapi branch 3 times, most recently from 3a2cf3e to e500efe Compare October 24, 2016 20:48
@arteymix
Copy link
Contributor Author

@nirbheek Ok, I just rebased upon your changes

Thanks for moving the VAPI out of Executable target, it's much cleaner now.

@arteymix arteymix force-pushed the wip/vala-custom-header-and-vapi branch from e500efe to d79e47e Compare October 24, 2016 20:53
@@ -449,6 +451,9 @@ def process_kwargs(self, kwargs, environment):
if not isinstance(valalist, list):
valalist = [valalist]
self.add_compiler_args('vala', valalist)
if not isinstance(self, Executable):
self.vala_header = kwargs.get('vala_header', None)
self.vala_vapi = kwargs.get('vala_vapi', None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use kwargs.get('vala_header', self.name + '.h'), etc here? Simplifies the code a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, that would put less burden on the backend.

Copy link
Member

@nirbheek nirbheek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch itself LGTM, but I will note that the tests don't test that the kwargs actually work right now. We should edit this in after we have the ability to install the header and vapi.

... actually, could you merge those two tests into one? Seems a bit overkill to have two separate ones. :)

With that change, I think this can go in.

Move the fallback logic into 'BuildTarget.process_kwargs' to use the
target name instead.
@arteymix arteymix force-pushed the wip/vala-custom-header-and-vapi branch from 9c6bb7b to 114b5b0 Compare October 24, 2016 22:01
@arteymix
Copy link
Contributor Author

I just merged the two test cases into one.

I'm not against introducing install_vala_vapi and install_vala_header options, although I feel like it's more appropriate to reuse existing concepts here (e.g install_headers and install_data).

# Force valac to write the vapi file in the target build dir.
# Without this, it will write it inside c_out_dir
args += ['--vapi=../' + base_vapi]
args += ['--vapi=../' + target.vala_vapi]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirbheek what's wrong with get_target_dir at this point? Isin't the C header generated in the same folder already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should use os.path.join anyway for portability.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand your question. We could use os.path.join here, sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's two different strategy used to generate a file in what appears to be the same directory (get_target_dir vs ..). It seems to me that the former is more correct, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's equivalent, I can patch it to consistently use os.path.join with get_target_dir.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two are not the same. get_target_dir() will return the subdir relative to the build root where the target is being built (the "target build dir"), which is not ...

For some reason, valac does not put the generated .h and the .vapi in the same directory. The .h file is placed in the directory as specified by the path, but the .vapi is placed alongside the generated C files in the 'target private directory' (see c_out_dir above) which is a subdir of the target build dir. The .. is a hack to make it output the .vapi in the target build dir.

Try it out and see. You can make it os.path.join('..', target.vala_vapi) if you wish. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I need to check if the same apply for vala_gir.

@jpakkane jpakkane merged commit 2d058bd into mesonbuild:master Oct 25, 2016
@arteymix arteymix deleted the wip/vala-custom-header-and-vapi branch October 25, 2016 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants