Skip to content

Commit

Permalink
make repeated 'using X ;' a no-op (#374)
Browse files Browse the repository at this point in the history
This change allows putting `using X ;` into build scripts (as opposed to
user configs) without creating a conflicting or wrong setup for module
X. This is so that build scripts could rely on toolset modules having
been configured (at least with default values).

The commit only updates toolset modules which allow `using` without
arguments in the first place. It also does not change toolset modules
for C++ compilers, as nobody does e.g. `using gcc ;` in their build
scripts anyway.
  • Loading branch information
grisumbras authored Apr 23, 2024
1 parent 56d0293 commit fb743b7
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/tools/asciidoctor.jam
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ rule init ( command * )
# TODO: Design and implement a mechanism to resolve generator conflicts.
generators.override asciidoctor.convert : boostbook.docbook-to-onehtml ;
}
else
{
if ! $(command)
{
return ;
}
}

# The command.. Default is bare asciidoctor.
command ?= asciidoctor ;
Expand Down
12 changes: 12 additions & 0 deletions src/tools/fop.jam
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ generators.register-standard fop.render.ps : FO : PS ;
#
rule init ( fop-command ? : java-home ? : java ? )
{
if ! $(.initialized)
{
.initialized = true ;
}
else
{
if ! ( $(1) && $(2) && $(3) )
{
return ;
}
}

local has-command = $(.has-command) ;

if $(fop-command)
Expand Down
10 changes: 8 additions & 2 deletions src/tools/gettext.jam
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ rule init ( path ? # Path where all tools are located. If not specified,
# they should be in PATH.
)
{
if $(.initialized) && $(.path) != $(path)
if $(.initialized) && ! $(path)
{
errors.error "Attempt to reconfigure with different path" ;
return ;
}

.initialized = true ;
if $(.path) != $(path)
{
errors.error "Attempt to reconfigure with different path" ;
}

if $(path)
{
.path = $(path)/ ;
Expand Down
10 changes: 9 additions & 1 deletion src/tools/pkg-config.jam
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,15 @@ using pkg-config : [config] : [command] ... : [ options ] ... ;

rule init ( config ? : command * : options * )
{
config ?= [ default-config ] ;
if ! $(config)
{
config = [ default-config ] ;
if ( $(config) in [ $(.configs).all ] )
&& ! ( $(command) && $(options) )
{
return ;
}
}

local tool = [ os.environ PKG_CONFIG ] ;
tool ?= pkg-config ;
Expand Down
12 changes: 12 additions & 0 deletions src/tools/python.jam
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ py3-version = ;
rule init ( version ? : cmd-or-prefix ? : includes * : libraries ?
: condition * : extension-suffix ? )
{
if ! $(.initialized)
{
.initialized = true ;
}
else
{
if ! ( $(1) && $(2) && $(3) && $(4) && $(5) && $(6) )
{
return ;
}
}

project.push-current $(.project) ;

debug-message Configuring python... ;
Expand Down
7 changes: 7 additions & 0 deletions src/tools/sass.jam
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ rule init ( command * )
# Register generators
generators.register [ new sass-generator sass.convert : SASS : CSS ] ;
}
else
{
if ! $(command)
{
return ;
}
}

# Setting up command
if ! $(command)
Expand Down
12 changes: 12 additions & 0 deletions src/tools/saxonhe.jam
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ import os ;

rule init ( saxonhe_jar ? : java_exe ? )
{
if ! $(.initialized)
{
.initialized = true ;
}
else
{
if ! ( $(1) && $(2) )
{
return ;
}
}

.java_exe = [ common.get-invocation-command saxonhe : java : $(java_exe) : ] ;
if $(saxonhe_jar)
{
Expand Down

0 comments on commit fb743b7

Please sign in to comment.