Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • willsalmon/buildstream
  • CumHoleZH/buildstream
  • tchaik/buildstream
  • DCotyPortfolio/buildstream
  • jesusoctavioas/buildstream
  • patrickmmartin/buildstream
  • franred/buildstream
  • tintou/buildstream
  • alatiera/buildstream
  • martinblanchard/buildstream
  • neverdie22042524/buildstream
  • Mattlk13/buildstream
  • PServers/buildstream
  • phamnghia610909/buildstream
  • chiaratolentino/buildstream
  • eysz7-x-x/buildstream
  • kerrick1/buildstream
  • matthew-yates/buildstream
  • twofeathers/buildstream
  • mhadjimichael/buildstream
  • pointswaves/buildstream
  • Mr.JackWilson/buildstream
  • Tw3akG33k/buildstream
  • AlexFazakas/buildstream
  • eruidfkiy/buildstream
  • clamotion2/buildstream
  • nanonyme/buildstream
  • wickyjaaa/buildstream
  • nmanchev/buildstream
  • bojorquez.ja/buildstream
  • mostynb/buildstream
  • highpit74/buildstream
  • Demo112/buildstream
  • ba2014sheer/buildstream
  • tonimadrino/buildstream
  • usuario2o/buildstream
  • Angelika123456/buildstream
  • neo355/buildstream
  • corentin-ferlay/buildstream
  • coldtom/buildstream
  • wifitvbox81/buildstream
  • 358253885/buildstream
  • seanborg/buildstream
  • SotK/buildstream
  • DouglasWinship/buildstream
  • karansthr97/buildstream
  • louib/buildstream
  • bwh-ct/buildstream
  • robjh/buildstream
  • we88c0de/buildstream
  • zhengxian5555/buildstream
51 results
Show changes
Commits on Source (2)
Showing
with 203 additions and 3 deletions
......@@ -170,6 +170,32 @@ original_main = click.BaseCommand.main
click.BaseCommand.main = override_main
def get_elements(app):
directory = app._main_options.get("directory")
project = app.project
project_conf = project._project_conf
output = []
# The project is not required to have an element-path
element_directory = project_conf.get('element-path')
# The project may have a default element defined
default_element = project_conf.get("defaults", {}).get("target-element", None)
if default_element:
return (default_element,)
directory = os.path.abspath(directory)
for root, _, files in os.walk(directory):
for file in files:
if file.endswith(".bst"):
rel_dir = os.path.relpath(root, directory)
rel_file = os.path.join(rel_dir, file).lstrip("./")
rel_file = rel_file.lstrip(element_directory).lstrip('/')
output.append(rel_file)
return tuple(output)
##################################################################
# Main Options #
##################################################################
......@@ -313,9 +339,12 @@ def init(app, project_name, format_version, element_path, force):
help="Deprecated: This is ignored")
@click.argument('elements', nargs=-1,
type=click.Path(readable=False))
@click.pass_obj
def build(app, elements, all_, track_, track_save, track_all, track_except, track_cross_junctions):
"""Build elements in a pipeline"""
"""Build elements in a pipeline\n
Declaring no elements with result in building a default element if one is declared.\n
If no default is declared, all elements in the project will be built"""
if (track_except or track_cross_junctions) and not (track_ or track_all):
click.echo("ERROR: The --track-except and --track-cross-junctions options "
......@@ -329,6 +358,8 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac
track_ = elements
with app.initialized(session_name="Build"):
if not elements:
elements = get_elements(app)
app.stream.build(elements,
track_targets=track_,
track_except=track_except,
......
......@@ -226,7 +226,7 @@ class Project():
'element-path', 'variables',
'environment', 'environment-nocache',
'split-rules', 'elements', 'plugins',
'aliases', 'name',
'aliases', 'name', 'defaults',
'artifacts', 'options',
'fail-on-overlap', 'shell', 'fatal-warnings',
'ref-storage', 'sandbox', 'mirrors', 'remote-execution',
......
......@@ -196,4 +196,11 @@ shell:
# Command to run when `bst shell` does not provide a command
#
command: [ 'sh', '-i' ]
\ No newline at end of file
command: [ 'sh', '-i' ]
# Default Targets
#
defaults:
# Set a Default element to build when none are defined
target-element: None
......@@ -60,6 +60,64 @@ def test_build_checkout(datafiles, cli, strict, hardlinks):
assert os.path.exists(filename)
@pytest.mark.datafiles(os.path.join(os.path.dirname(
os.path.realpath(__file__)),
"project_world",
))
@pytest.mark.parametrize("strict,hardlinks", [
("strict", "copies"),
("strict", "hardlinks"),
("non-strict", "copies"),
("non-strict", "hardlinks"),
])
def test_build_default_all_checkout(datafiles, cli, strict, hardlinks):
project = os.path.join(datafiles.dirname, datafiles.basename)
checkout = os.path.join(cli.directory, 'checkout')
# First build it
result = cli.run(project=project, args=strict_args(['build'], strict))
result.assert_success()
# Assert that after a successful build, the builddir is empty
builddir = os.path.join(cli.directory, 'build')
assert os.path.isdir(builddir)
assert not os.listdir(builddir)
# Prepare checkout args
checkout_args = strict_args(['checkout'], strict)
if hardlinks == "hardlinks":
checkout_args += ['--hardlinks']
checkout_args += ['target.bst', checkout]
# Now check it out
result = cli.run(project=project, args=checkout_args)
result.assert_success()
# Check that the executable hello file is found in the checkout
filename = os.path.join(checkout, 'usr', 'bin', 'hello')
assert os.path.exists(filename)
filename = os.path.join(checkout, 'usr', 'include', 'pony.h')
assert os.path.exists(filename)
@pytest.mark.datafiles(DATA_DIR + "_default")
def test_show_default(cli, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
prev_dir = os.getcwd()
os.chdir(project)
result = cli.run(project=project, silent=True, args=[
'build'])
os.chdir(prev_dir)
result.assert_success()
results = cli.get_element_state(project, "target2.bst")
expected = "cached"
if results != expected:
raise AssertionError("Expected output:\n{}\nInstead received output:\n{}"
.format(expected, result))
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("strict,hardlinks", [
("non-strict", "hardlinks"),
......
kind: stack
description: |
Main stack target for the bst build test
kind: stack
description: |
Main stack target for the bst build test
# Project config for frontend build test
name: test
element-path: elements
fatal-warnings:
- bad-element-suffix
defaults:
target-element: target2.bst
kind: compose
depends:
- filename: import-bin.bst
type: build
- filename: import-dev.bst
type: build
config:
# Dont try running the sandbox, we dont have a
# runtime to run anything in this context.
integrate: False
kind: compose
depends:
- filename: import-bin.bst
type: build
- filename: import-dev.bst
type: build
config:
# Dont try running the sandbox, we dont have a
# runtime to run anything in this context.
integrate: False
# Exclude the dev domain
exclude:
- devel
kind: compose
depends:
- filename: import-bin.bst
type: build
- filename: import-dev.bst
type: build
config:
# Dont try running the sandbox, we dont have a
# runtime to run anything in this context.
integrate: False
# Only include the runtim
include:
- runtime
kind: import
sources:
- kind: local
path: files/bin-files
kind: import
sources:
- kind: local
path: files/dev-files
kind: compose
build-depends:
- target.bst
kind: import
description: the kind of this element must implement generate_script() method
sources:
- kind: local
path: files/source-bundle
kind: stack
description: |
Main stack target for the bst build test
depends:
- import-bin.bst
- compose-all.bst
#!/bin/bash
echo "Hello !"
#ifndef __PONY_H__
#define __PONY_H__
#define PONY_BEGIN "Once upon a time, there was a pony."
#define PONY_END "And they lived happily ever after, the end."
#define MAKE_PONY(story) \
PONY_BEGIN \
story \
PONY_END
#endif /* __PONY_H__ */