File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ projects:
129129 root_directory : src/tools
130130 files : cl_generator.cpp
131131 dependencies :
132- - name : pvt.egorpugin.primitives.sw. main
132+ - name : pvt.egorpugin.primitives.main
133133 version : master
134134 local : primitives.sw.main
135135 - name : pvt.egorpugin.primitives.context
Original file line number Diff line number Diff line change @@ -22,17 +22,18 @@ DECLARE_STATIC_LOGGER(logger, "cpp.command");
2222namespace sw ::driver::cpp
2323{
2424
25- Command::Command ()
25+ namespace detail
2626{
27- }
2827
2928Command::Command (::sw::FileStorage &fs)
3029 : Base::Command(fs)
3130{
31+ }
3232
3333}
3434
35- Command::~Command ()
35+ Command::Command (::sw::FileStorage &fs)
36+ : Base::Command(fs)
3637{
3738}
3839
Original file line number Diff line number Diff line change @@ -280,17 +280,32 @@ inline tag_env env(const String &k, const String &v)
280280namespace driver ::cpp
281281{
282282
283+ namespace detail
284+ {
285+
283286struct SW_DRIVER_CPP_API Command : ::sw::builder::Command
284287{
285288 using Base = ::sw::builder::Command;
289+
290+ bool ignore_deps_generated_commands = false ;
291+
292+ Command () = default ;
293+ Command (::sw::FileStorage &fs);
294+ };
295+
296+ }
297+
298+ struct SW_DRIVER_CPP_API Command : detail::Command
299+ {
300+ using Base = detail::Command;
286301 using LazyCallback = std::function<String(void )>;
287302 using LazyAction = std::function<void (void )>;
288303
289304 bool program_set = false ;
290305
291- Command ();
306+ Command () = default ;
292307 Command (::sw::FileStorage &fs);
293- virtual ~Command ();
308+ virtual ~Command () = default ;
294309
295310 virtual std::shared_ptr<Command> clone () const ;
296311 path getProgram () const override ;
@@ -310,7 +325,7 @@ struct SW_DRIVER_CPP_API Command : ::sw::builder::Command
310325 bool dependency_set = false ;
311326};
312327
313- struct SW_DRIVER_CPP_API ExecuteBuiltinCommand : builder ::Command
328+ struct SW_DRIVER_CPP_API ExecuteBuiltinCommand : detail ::Command
314329{
315330 using F = std::function<void (void )>;
316331
Original file line number Diff line number Diff line change @@ -1407,7 +1407,7 @@ SharedLibraryTarget &Build::createTarget(const Files &files)
14071407static void addDeps (NativeExecutedTarget &lib, Solution &solution)
14081408{
14091409 lib += solution.getTarget <NativeTarget>(" pub.egorpugin.primitives.version" );
1410- lib += solution.getTarget <NativeTarget>(" pub.egorpugin.primitives.filesystem" );
1410+ // lib += solution.getTarget<NativeTarget>("pub.egorpugin.primitives.filesystem");
14111411
14121412 auto &drv = solution.getTarget <NativeTarget>(" org.sw.sw.client.driver.cpp" );
14131413 auto d = lib + drv;
Original file line number Diff line number Diff line change @@ -862,11 +862,6 @@ Commands NativeExecutedTarget::getCommands() const
862862 }
863863 cmds.insert (generated.begin (), generated.end ());
864864
865- // LOG_DEBUG(logger, "Building target: " + pkg.ppath.toString());
866- // move this somewhere
867-
868- // DEBUG_BREAK_IF_STRING_HAS(pkg.ppath.toString(), "self_builder");
869-
870865 // add install commands
871866 for (auto &[p, f] : *this )
872867 {
@@ -921,10 +916,15 @@ Commands NativeExecutedTarget::getCommands() const
921916 // add dependencies on generated commands from dependent targets
922917 for (auto &l : get_tgts ())
923918 {
924- for (auto &c2 : ((NativeExecutedTarget*)l)-> getGeneratedCommands () )
919+ if (auto nt = l-> as <NativeExecutedTarget>(); nt )
925920 {
921+ auto cmds2 = nt->getGeneratedCommands ();
926922 for (auto &c : cmds)
927- c->dependencies .insert (c2);
923+ {
924+ if (auto c2 = c->as <driver::cpp::detail::Command>(); c2 && c2->ignore_deps_generated_commands )
925+ continue ;
926+ c->dependencies .insert (cmds2.begin (), cmds2.end ());
927+ }
928928 }
929929 }
930930
Original file line number Diff line number Diff line change 1- #include < primitives/context.h>
1+ #include < primitives/context.h>
2+ #include < primitives/main.h>
23#include < primitives/yaml.h>
3- #include < primitives/sw/main.h>
4- #include < primitives/sw/settings.h>
54
65template <class ... Args>
76void both (primitives::CppContext &hctx, primitives::CppContext &cctx, Args && ... args)
@@ -176,14 +175,18 @@ void read_flags(const yaml &root, Flags &flags)
176175
177176int main (int argc, char **argv)
178177{
179- cl::opt<path> in (cl::Positional, cl::Required);
180- cl::opt<path> out1 (cl::Positional, cl::Required);
181- cl::opt<path> out2 (cl::Positional, cl::Required);
178+ if (argc != 4 )
179+ {
180+ printf (" usage: in.yml out.h out.cpp\n " );
181+ return 1 ;
182+ }
182183
183- cl::ParseCommandLineOptions (argc, argv);
184+ path in = argv[1 ];
185+ path out1 = argv[2 ];
186+ path out2 = argv[3 ];
184187
185- auto h = out1.getValue (). extension () == " .h" ? out1. getValue () : out2. getValue () ;
186- auto cpp = out1.getValue (). extension () == " .cpp" ? out1. getValue () : out2. getValue () ;
188+ auto h = out1.extension () == " .h" ? out1 : out2;
189+ auto cpp = out1.extension () == " .cpp" ? out1 : out2;
187190
188191 auto root = YAML::Load (read_file (in));
189192
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ void build(Solution &s)
102102 cl_generator +=
103103 " pub.egorpugin.primitives.context-master" _dep,
104104 " pub.egorpugin.primitives.yaml-master" _dep,
105- " pub.egorpugin.primitives.sw. main-master" _dep;
105+ " pub.egorpugin.primitives.main-master" _dep;
106106
107107 auto &builder = p.addTarget <LibraryTarget>(" builder" );
108108 builder.ApiName = " SW_BUILDER_API" ;
@@ -156,6 +156,7 @@ void build(Solution &s)
156156 << cmd::out (" options_cl.generated.h" )
157157 << cmd::out (" options_cl.generated.cpp" , cmd::Skip)
158158 ;
159+ c.c ->ignore_deps_generated_commands = true ;
159160 }
160161 if (!s.Variables [" SW_SELF_BUILD" ])
161162 {
You can’t perform that action at this time.
0 commit comments