camptocamp / c2cgeoportal

c2cgeoportal application
http://geomapfish.org
Other
64 stars 46 forks source link

Introducing variables in mobile.js.make is giving a build error #2457

Closed eleu closed 8 years ago

eleu commented 8 years ago

When GMF is used as different instances, one wants to set the center coordinates of the ngeo-mobile application depending on the vars of the build.

The variable cannot be introduced "normally" but needs the following in the CONST_Makefile (addition marked with +):

 .build/%.js: .build/%.json $(OL_JS_FILES) $(NGEO_JS_FILES) $(APP_JS_FILES) \
 +      rudaz/static-ngeo/js/%.js \

see also https://github.com/camptocamp/rudaz_geomapfish/commit/be96e005dbf1e016e90e8766a01ecdf0eaab6da3.

Version: GMF 2.0

pgiraud commented 8 years ago

Here's what I understand:

In some cases, there may be files in the static-ngeo/js folder (or elsewhere) that need to be interpreted as templates. For example when they contain instance specific variables. In the case of Rudaz, the file is static-ngeo/js/mobile.js.mako.

In my opinion, instead of making sure that the .js is generated beforehand for this specific file, it's safer to make sure that any template file (.mako, .jinja, .in) is generated.

Pull request to come.

sbrunner commented 8 years ago

Isn't better to add

 .build/%.js: rudaz/static-ngeo/js/%.js

in the project makefile, I think that's should works ...

pgiraud commented 8 years ago

@sbrunner do you mean that what's been done in the project is already doing the job? https://github.com/camptocamp/rudaz_geomapfish/commit/be96e005dbf1e016e90e8766a01ecdf0eaab6da3

In my opinion, it's difficult for an integrator to know that this can be done this way. What about a safer and easier way? https://github.com/camptocamp/c2cgeoportal/compare/master...pgiraud:templated_js_app_files?expand=1

sbrunner commented 8 years ago

This is a hack that introduce too many dependencies...

And the administrator should know that he create a javascript generate by mako and he should add a dependency to manage that.

A middle way can be do make something like that: https://github.com/pgiraud/c2cgeoportal/blob/f6b5429c3700ad4b954d25f378d6093672f0b77d/c2cgeoportal/scaffolds/update/CONST_Makefile_tmpl#L246-L248