-
Notifications
You must be signed in to change notification settings - Fork 270
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
webhelper: remove generated files from version control #163
Conversation
I have them in |
At least it's compiling with waf and autotools on recent geany with Debian stable. I think it's fine to get merged (as it's annoying me also :) ) |
I agree those should be removed (especially as webhelper has an hard-dependency on glib-mkenums anyway), but please wait before merging, I need to check the implications on out-of-tree builds that lack the files. The problem being they are currently generated in the source directory, which is not correct if always generated.
Do you use Waf? I ever only seen the problem with Waf, which uses different paths as Autotools. BTW @codebrainz, devhelp also has those generated files checked in, devhelp/devhelp/dh-enum-types.[ch] |
Hum, so it's not that simple. The problem is that the generated file (webhelper/src/gwh-enum-types.c) contains translations, so we need it to build the translation catalog. I must say that right now I don't really see much solutions but keeping it under version control :/ |
Well, a dirty solution could be to generate them outside of WebHelper as we only need glib-mkenums which is a reasonable dependency anyway, but… that's real dirty and I'd rather not do that. |
|
Would it be possible to move the translatable strings? |
Not really, because they actually are generated. This file contains auto-generated matadata for enumerations, based on the enumeration name and value, and the translatable part is the normalized value name. For example, the enumeration below: typedef enum {
GWH_BROWSER_POSITION_MESSAGE_WINDOW,
GWH_BROWSER_POSITION_SIDEBAR,
GWH_BROWSER_POSITION_SEPARATE_WINDOW
} GwhBrowserPosition; Generates automatically the "nicknames" of the values: "message-window", "sidebar" and "separate-window" -- and those are the ones translated (for displaying the option to the user). |
@eht16 would it be possible to make Waf generate the files in the build directory, so they wouldn't override the ones in the source directory? This may be (also) doable with Autotools, so the version in Git would only be used when doing an in-tree build or when cloning the repo but not building WebHelper. |
An alternative is to just not auto-generate the files. It's a bit more maintenance but it's quite trivial and not so much boilerplate with the current number of enumerations. On the plus side the strings could be made more meaningful for use in the GUI, for example Personally I don't care much either way, I copied this for Devhelp from WebHelper, and I'm fine copying any changes needed (or not). |
@b4n it is possible, yet a bit hacky: diff --git a/webhelper/wscript_build b/webhelper/wscript_build
index 8f5cded..24bb6db 100644
--- a/webhelper/wscript_build
+++ b/webhelper/wscript_build
@@ -22,7 +22,7 @@
from build.wafutils import build_plugin
-
+import os
name = 'WebHelper'
sources = [
@@ -41,7 +41,7 @@ generated_sources = [
'src/gwh-enum-types.c',
'src/gwh-enum-types.h']
-includes = ['src']
+includes = ['src', 'generated/src']
libraries = ['GTK', 'GLIB', 'GIO', 'GDK_PIXBUF', 'WEBKIT']
features = ['glib2']
@@ -55,4 +55,5 @@ task = build_plugin(bld, name,
# add generation of enums
for generated_source in generated_sources:
template_filename = '%s.tpl' % generated_source
+ generated_source = os.path.join('generated', generated_source)
task.add_enums_from_template(template=template_filename, source=header, target=generated_source) I couldn't find a cleaner way. It would be nicer to tell Waf to put the generated files to build/webhelper/src directly but when trying to define bld.out_dir/webhelper/src as the target path, Waf seems to try to resolve it to an absolute path and then we get build/webhelper/build/webhelper/src which is nonsense. So I used the "generated" prefix to trick Waf into a non-existent directory which causes it to put the results into the build dir. Not really nice but would work. @codebrainz the Waf build system doesn't (re-)generate the enums for devhelp at build time. I didn't really read the Makefile.am but IIUC it should regenerate it like in webhelper? If so, and dependent on the outcome of this issue, I would add the missing bits to devhelp if you want. |
I found a simpler fix: just don't put full paths in the generated output. It's not perfect in theory, but in practice it should fix all possible issues arising from this (but if glib-mkenums' output changes, but it's quite unlikely). |
gwh-enum-types.[ch] are automatically generated, but are also checked into version control, so we need to avoid any unwanted changes. To achieve this, use basenames instead of full names in the generated files. This requires glib-mkenums >= 2.22, but it should be old enough not to cause dependencies concerns. If this dependency appear to be a problem, another solution could be to simply remove reference to the source files in the generated output. These files need to stay checked in even if they are auto-generated because they contain translatable strings that the translation system has to be able to extract, whether the plugin is built or not. Close geany#163.
These two get always regenerated on build on my machine with changes in the comments and are marked as modified by git, which is annoying.
Unless I miss anything, as they are regenerated, they don't have to be tracked by VCS.