| 5009 | } |
| 5010 | |
| 5011 | void cmVisualStudio10TargetGenerator::WriteEvent( |
| 5012 | Elem& e1, std::string const& name, |
| 5013 | std::vector<cmCustomCommand> const& commands, std::string const& configName) |
| 5014 | { |
| 5015 | if (commands.empty()) { |
| 5016 | return; |
| 5017 | } |
| 5018 | cmLocalVisualStudio7Generator* lg = this->LocalGenerator; |
| 5019 | std::string script; |
| 5020 | char const* pre = ""; |
| 5021 | std::string comment; |
| 5022 | bool stdPipesUTF8 = false; |
| 5023 | for (cmCustomCommand const& cc : commands) { |
| 5024 | cmCustomCommandGenerator ccg(cc, configName, lg); |
| 5025 | if (!ccg.HasOnlyEmptyCommandLines()) { |
| 5026 | comment += pre; |
| 5027 | comment += lg->ConstructComment(ccg); |
| 5028 | script += pre; |
| 5029 | pre = "\n"; |
| 5030 | script += lg->ConstructScript(ccg); |
| 5031 | |
| 5032 | stdPipesUTF8 = stdPipesUTF8 || cc.GetStdPipesUTF8(); |
| 5033 | } |
| 5034 | } |
| 5035 | if (!script.empty()) { |
| 5036 | script += lg->FinishConstructScript(this->ProjectType); |
| 5037 | } |
| 5038 | comment = cmVS10EscapeComment(comment); |
| 5039 | if (this->ProjectType != VsProjectType::csproj) { |
| 5040 | Elem e2(e1, name); |
| 5041 | if (stdPipesUTF8) { |
| 5042 | this->WriteStdOutEncodingUtf8(e2); |
| 5043 | } |
| 5044 | e2.Element("Message", comment); |
| 5045 | e2.Element("Command", script); |
| 5046 | } else { |
| 5047 | std::string strippedComment = comment; |
| 5048 | strippedComment.erase( |
| 5049 | std::remove(strippedComment.begin(), strippedComment.end(), '\t'), |
| 5050 | strippedComment.end()); |
| 5051 | std::ostringstream oss; |
| 5052 | if (!comment.empty() && !strippedComment.empty()) { |
| 5053 | oss << "echo " << comment << "\n"; |
| 5054 | } |
| 5055 | oss << script << "\n"; |
| 5056 | e1.Element(name, oss.str()); |
| 5057 | } |
| 5058 | } |
| 5059 | |
| 5060 | void cmVisualStudio10TargetGenerator::WriteSdkStyleEvents( |
| 5061 | Elem& e0, std::string const& configName) |
no test coverage detected