mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Add missing file
[SVN r83790]
This commit is contained in:
63
src/build/config-cache.jam
Normal file
63
src/build/config-cache.jam
Normal file
@@ -0,0 +1,63 @@
|
||||
# Copyright 2012 Steven Watanabe
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import modules ;
|
||||
import errors ;
|
||||
import regex ;
|
||||
import path ;
|
||||
import project ;
|
||||
|
||||
rule get ( name )
|
||||
{
|
||||
return $(.vars.$(name)) ;
|
||||
}
|
||||
|
||||
rule set ( name : value * )
|
||||
{
|
||||
.all-vars += $(name) ;
|
||||
.vars.$(name) = $(value) ;
|
||||
}
|
||||
|
||||
rule save ( )
|
||||
{
|
||||
if $(.cache-file)
|
||||
{
|
||||
local target = <new-cache-file>$(.cache-file) ;
|
||||
local contents = "# Automatically generated by Boost.Build.\n# Do not edit.\n\nmodule config-cache {\n" ;
|
||||
for local var in $(.all-vars)
|
||||
{
|
||||
local transformed ;
|
||||
for local value in $(.vars.$(var))
|
||||
{
|
||||
transformed += [ regex.escape $(value) : \"\\ : \\ ] ;
|
||||
}
|
||||
local quoted = \"$(transformed)\" ;
|
||||
contents += " set \"$(var)\" : $(quoted:J= ) ;\n" ;
|
||||
}
|
||||
contents += "}\n" ;
|
||||
FILE_CONTENTS on $(target) = $(contents) ;
|
||||
ALWAYS $(target) ;
|
||||
config-cache.write $(target) ;
|
||||
UPDATE_NOW $(target) : [ modules.peek configure : .log-fd ] : ignore-minus-n ;
|
||||
}
|
||||
}
|
||||
|
||||
actions write
|
||||
{
|
||||
@($(STDOUT):E=$(FILE_CONTENTS:J=)) > "$(<)"
|
||||
}
|
||||
|
||||
rule load ( cache-file )
|
||||
{
|
||||
if $(.cache-file)
|
||||
{
|
||||
errors.error duplicate load of cache file ;
|
||||
}
|
||||
cache-file = $(cache-file) ;
|
||||
if [ path.exists $(cache-file) ] && ! ( --reconfigure in [ modules.peek : ARGV ] )
|
||||
{
|
||||
include <old-cache-file>$(cache-file) ;
|
||||
}
|
||||
.cache-file = $(cache-file) ;
|
||||
}
|
||||
Reference in New Issue
Block a user