Skip to content

Commit

Permalink
Merge pull request #3156 from noc0lour/make_cmake_renderable
Browse files Browse the repository at this point in the history
cmake: allow renderables in definition/options
  • Loading branch information
tardyp committed Apr 30, 2017
2 parents fb26e17 + bfd1e44 commit d1ba73c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions master/buildbot/newsfragments/cmake_renderable.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow renderables in options and definitions of step ``CMake``. Currently only dicts and lists with renderables inside are allowed.
11 changes: 7 additions & 4 deletions master/buildbot/steps/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from twisted.internet import defer

from buildbot import config
from buildbot.interfaces import IRenderable
from buildbot.process.buildstep import BuildStep
from buildbot.process.buildstep import ShellMixin

Expand Down Expand Up @@ -47,12 +48,14 @@ def __init__(self, path=None, generator=None, definitions=None,
self.path = path
self.generator = generator

if not (definitions is None or isinstance(definitions, dict)):
config.error('definitions must be a dictionary')
if not (definitions is None or isinstance(definitions, dict)
or IRenderable.providedBy(definitions)):
config.error('definitions must be a dictionary or implement IRenderable')
self.definitions = definitions

if not (options is None or isinstance(options, (list, tuple))):
config.error('options must be a list or a tuple')
if not (options is None or isinstance(options, (list, tuple))
or IRenderable.providedBy(options)):
config.error('options must be a list, a tuple or implement IRenderable')
self.options = options

self.cmake = cmake
Expand Down
8 changes: 8 additions & 0 deletions master/buildbot/test/unit/test_steps_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ def test_definitions_interpolation(self):
self.properties.setProperty('b', b_value, source='test')
self.expect_and_run_command('-D%s=%s' % ('a', b_value))

def test_definitions_renderable(self):
b_value = 'real_b'

definitions = Property('b')
self.setupStep(CMake(definitions=definitions))
self.properties.setProperty('b', {'a': b_value}, source='test')
self.expect_and_run_command('-D%s=%s' % ('a', b_value))

def test_generator(self):
generator = 'Ninja'

Expand Down

0 comments on commit d1ba73c

Please sign in to comment.