| 67 | } |
| 68 | |
| 69 | json ProjectBuild::serialize( const ProjectBuild::Map& builds ) { |
| 70 | json j; |
| 71 | |
| 72 | for ( const auto& buildCfg : builds ) { |
| 73 | const auto& curBuild = buildCfg.second; |
| 74 | auto& bj = j[buildCfg.first]; |
| 75 | |
| 76 | bj["build"] = json::array(); |
| 77 | auto& jbuild = bj["build"]; |
| 78 | for ( const auto& build : curBuild.buildSteps() ) { |
| 79 | json step; |
| 80 | step["working_dir"] = build->workingDir; |
| 81 | step["args"] = build->args; |
| 82 | step["command"] = build->cmd; |
| 83 | if ( !build->enabled ) |
| 84 | step["enabled"] = build->enabled; |
| 85 | jbuild.push_back( step ); |
| 86 | } |
| 87 | |
| 88 | bj["clean"] = json::array(); |
| 89 | auto& jclean = bj["clean"]; |
| 90 | for ( const auto& build : curBuild.cleanSteps() ) { |
| 91 | json step; |
| 92 | step["working_dir"] = build->workingDir; |
| 93 | step["args"] = build->args; |
| 94 | step["command"] = build->cmd; |
| 95 | if ( !build->enabled ) |
| 96 | step["enabled"] = build->enabled; |
| 97 | jclean.push_back( step ); |
| 98 | } |
| 99 | |
| 100 | if ( curBuild.hasRun() ) { |
| 101 | bj["run"] = json::array(); |
| 102 | auto& jrun = bj["run"]; |
| 103 | for ( auto& run : curBuild.mRun ) { |
| 104 | json step; |
| 105 | step["name"] = run->name; |
| 106 | step["working_dir"] = run->workingDir; |
| 107 | step["args"] = run->args; |
| 108 | step["command"] = run->cmd; |
| 109 | if ( !run->enabled ) |
| 110 | step["enabled"] = run->enabled; |
| 111 | if ( run->runInTerminal ) |
| 112 | step["run_in_terminal"] = run->runInTerminal; |
| 113 | if ( run->reusePreviousTerminal ) |
| 114 | step["reuse_previous_terminal"] = run->reusePreviousTerminal; |
| 115 | if ( run->useStatusBarTerminal ) |
| 116 | step["use_statusbar_terminal"] = run->useStatusBarTerminal; |
| 117 | if ( run->stripAnsiCodes ) |
| 118 | step["strip_ansi_codes"] = run->stripAnsiCodes; |
| 119 | jrun.push_back( step ); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | bj["build_types"] = curBuild.buildTypes(); |
| 124 | bj["config"]["clear_sys_env"] = curBuild.getConfig().clearSysEnv; |
| 125 | bj["config"]["strip_ansi_codes"] = curBuild.getConfig().stripAnsiCodes; |
| 126 | bj["os"] = curBuild.os(); |
nothing calls this directly
no test coverage detected