Skip to content

Commit a462838

Browse files
committed
Implement support multi projet for the csharp parser
1 parent f2ac4ae commit a462838

4 files changed

Lines changed: 391 additions & 16 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ build/
1414
build_*/
1515
install/
1616
install_*/
17+
18+
# Mac OS specific files
19+
.DS_Store

plugins/csharp/parser/src/csharpparser.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ bool CsharpParser::parse()
4242
bool success = true;
4343

4444
std::vector<std::string> paths = _ctx.options["input"].as<std::vector<std::string>>();
45+
if (paths.empty())
46+
{
47+
LOG(error) << "No input path specified for C# parser!";
48+
return false;
49+
}
4550
std::string buildPath = _ctx.options["build-dir"].as<std::string>();
4651

4752
if (acceptProjectBuildPath(buildPath))
@@ -86,14 +91,11 @@ bool CsharpParser::parseProjectBuildPath(
8691
command.append("' ");
8792
command.append(std::to_string(_ctx.options["jobs"].as<int>()));
8893

89-
for (auto p : paths_)
94+
for (const auto& inputPath : paths_)
9095
{
91-
if (fs::is_directory(p))
92-
{
93-
command.append(" '");
94-
command.append(p);
95-
command.append("' ");
96-
}
96+
command.append(" '");
97+
command.append(inputPath);
98+
command.append("'");
9799
}
98100

99101
LOG(debug) << "CSharpParser command: " << command;
@@ -113,7 +115,7 @@ bool CsharpParser::parseProjectBuildPath(
113115

114116
while(std::getline(log_str, line, '\n'))
115117
{
116-
if (line[0] == '+' || line[0] == '-')
118+
if (!line.empty() && (line[0] == '+' || line[0] == '-'))
117119
{
118120
addSource(line.substr(1), line[0] == '-');
119121
if (line[0] == '+')
@@ -125,6 +127,10 @@ bool CsharpParser::parseProjectBuildPath(
125127
countPart++;
126128
}
127129
}
130+
else if (!line.empty())
131+
{
132+
LOG(debug) << "[CSharpParser] " << line;
133+
}
128134
}
129135

130136
ch::steady_clock::time_point after = ch::steady_clock::now();

plugins/csharp/parser/src_csharp/CSharpParser.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.14.0" />
1616
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" />
1717
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
18+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.14.0" />
1819
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" />
1920
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.20">
2021
<PrivateAssets>all</PrivateAssets>

0 commit comments

Comments
 (0)