BobBuildTool/basement

override plugin hooks by higher layers don't work

Closed this issue · 8 comments

from os.path import join
from bob.errors import ParseError
from bob.input import PluginState, PluginProperty
def commonFormatter(step, states):
if step.isCheckoutStep():
ret = step.getPackage().getRecipe().getName()
else:
base = step.getPackage().getName()
ext = step.getEnv().get('AUTOCONF_HOST')
ret = join(base, ext) if ext else base
return ret.replace('::', "/")
def releaseFormatter(step, states):
return join("work", commonFormatter(step, states), step.getLabel())
def developFormatter(step, states):
return join("dev", step.getLabel(), commonFormatter(step, states))
def jenkinsFormatter(step, states):
return join(commonFormatter(step, states), step.getLabel())
manifest = {
'apiVersion' : "0.3",
'hooks' : {
'releaseNameFormatter' : releaseFormatter,
'developNameFormatter' : developFormatter,
'jenkinsNameFormatter' : jenkinsFormatter
},
}

because of basement uses the NameFormatter hooks, it isn't possible to do this as "user" e.g. in the main layer.
so we could remove the hooks, and make this behavior to bob's default, or we could add the short-path feature here, e.g. by an variable...?!

e.g. bob dev -DBOB_SHORT_PATH="D:" <...>

note: every single character can't be paid by money in windows os! ;-)

what do u think?

I would actually call this a bug in the Bob layer implementation. Conceptually higher layers have higher precedence and should be able to override lower layers. This is working already for default.yaml settings. Obviously the plugins are loaded the other way around. 😕

as a second topic, if i check this: https://github.com/BobBuildTool/bob/tree/30b1fdfc9dca9e40f46a102f06ac7217365c93c1/test/plugin-settings and this: https://bob-build-tool.readthedocs.io/en/latest/manual/extending.html#bob.input.PluginSetting

is there a good way, to implement a configurable short-path feature?

someting like:

  • BSP="D:" bob dev <...>
  • bob dev -DBSP="D:" <...>
  • bit more complex: creating a cfg file with the path and use bob dev -c <...>

or should that implemented inside the bob tool?!

Plugins must always be configured with the PluginSetting method as described here. This way Bob will recognize changes and recalculate things. This is required because plugins are assumed to be deterministic and Bob cannot see if the plugin reads an environment variable. It's also convenient for the user because he can use the usual default.yaml / user.yaml / bob dev -c ... methods...

ahhh, right, the user.yaml is also a good thing, to configure a short path on e.g. jenkins server. thx. so just the override-bug still remains.

thx. so just the override-bug still remains.

Yes, unfortunately. Technically speaking this is a backwards incompatible change. I'm just not sure if it's worth a policy to optionally retain the old behaviour...

I'm just not sure if it's worth a policy to optionally retain the old behaviour...

IMO: nope. i guess that makes no sense.

Let's properly track the plugin issue in BobBuildTool/bob#428...

Fixed in Bob.