Comments (6)
You are using OS shell and observing OS command parsing differences, that's obviously not SHELL
fault.
I guess you are looking for a cross-platform way to create a file with some content, but unfortunately I don't think B2 provides such an function currently.
from b2.
import print ;
make a.txt : : @write ;
rule write ( target : srcs * : props : ) {
print.output $(target) ;
print.text "line1" "line2" : overwrite ;
}
from b2.
import print ; make a.txt : : @write ; rule write ( target : srcs * : props : ) { print.output $(target) ; print.text "line1" "line2" : overwrite ; }
Thanks I tried. But I can't execute your script as it said args error. And it seems that make rule can not pass variables to actions except file names.
And it is weird that the print.text only works if the target is console, not works on output file.
from b2.
My snippet had a typo (a didn't test it when I posted it). The correct jam script that creates a project-config.jam
in current directory is
make project-config.jam : : @write : <location>. ;
rule write ( target : srcs * : props * : ) {
if "$(var2)" {
echo "var2 is $(var2)" ;
} else {
print.output $(target) ;
print.text
"constant var2 : $(var) ;"
""
: overwrite
;
}
}
I did't understand your remarks about passing variables to rules and print.text
not working on files, though.
from b2.
My snippet had a typo (a didn't test it when I posted it). The correct jam script that creates a
project-config.jam
in current directory ismake project-config.jam : : @write : <location>. ; rule write ( target : srcs * : props * : ) { if "$(var2)" { echo "var2 is $(var2)" ; } else { print.output $(target) ; print.text "constant var2 : $(var) ;" "" : overwrite ; } }
I did't understand your remarks about passing variables to rules and
print.text
not working on files, though.
I try it again this time, your jamfile script has no errors, and the print.text works on files too.
The passing variables to rules I mean, the rule or actions take variables from the arguments (just like function parameters), not take variables from global scope.
from b2.
The passing variables to rules I mean, the rule or actions take variables from the arguments (just like function parameters), not take variables from global scope.
@fasxmut target actions, which is what the print utility module is using for the file output, only take inputs through variables. They can be either global or bound (https://www.bfgroup.xyz/b2/manual/main/index.html#jam.language.rules.action_modifiers). What @grisumbras demonstrated accepting rule arguments like your original example. Can you explain in more details what you are trying to accomplish.
from b2.
Related Issues (20)
- bootstrap fails on gcc-8.3 HOT 8
- version mismatch message HOT 2
- `--abbreviate-paths` leads to build config clashes HOT 2
- Building boost to web assembly fails HOT 1
- Enhanced `dll-path` & `hardcode-dll-paths` documentation HOT 1
- boost fail to be detected / No 'bootstrap.jam' was found by searching for / file STRINGS file "/usr/include/boost/version.hpp" cannot be read. HOT 2
- Bootstrap procedure writes to source directory HOT 1
- OSPLAT is not defined for riscv HOT 1
- breaking change with rsp file when migrating from boost 1.78 to boost 1.83 under windows/mingw64 HOT 8
- Cannot run bootstrap.bat with VC141 HOT 3
- commented modified rebuild HOT 2
- How to build Boost arm64 on MSVC using b2? HOT 1
- `ar` response files under MinGW contain paths with backslashes, which fails
- b2 fails to build for clang 3.6 HOT 1
- FreeBSD builds in CI HOT 2
- Manifest-related problems with b2 building in msvc-14.0 HOT 2
- Can't compile and install b2 with b2 HOT 1
- How to build clangw .lib HOT 2
- `b2` build fails on gcc 4.8 HOT 1
- b2 can't find MSVC toolset for Visual Studio 2022 v17.9.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from b2.