Skip to content

Commit

Permalink
Generate a friendly error if a project contains no source files.
Browse files Browse the repository at this point in the history
Closes #86.
  • Loading branch information
alexrp committed Dec 29, 2023
1 parent d848835 commit 0365b0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/sdk/build/Vezel.Zig.Sdk.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<CallTarget Targets="$(_FormatTarget)"
Condition="'$(_FormatTarget)' != ''" />

<Error Text="No source files in project."
Condition="@(Compile->Count()) == 0" />

<ZigCompile AccessControl="$(AccessControl)"
BlockExtensions="$(BlockExtensions)"
CommandFragmentsDirectory="$(_CommandFragmentsPath)"
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/build/Vezel.Zig.Sdk.Format.targets
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project>
<Target Name="_CheckFormat"
Condition="'$(CompilerMode)' == 'Zig'">
Condition="'$(CompilerMode)' == 'Zig' and @(ZigSource->Count()) != 0">
<ZigFormat FormatterMode="Check"
Sources="@(ZigSource)"
StandardOutputImportance="high"
ToolExe="$(ZigExePath)" />
</Target>

<Target Name="Format"
Condition="'$(CompilerMode)' == 'Zig'">
Condition="'$(CompilerMode)' == 'Zig' and @(ZigSource->Count()) != 0">
<ZigFormat FormatterMode="Execute"
Sources="@(ZigSource)"
ToolExe="$(ZigExePath)" />
Expand Down

0 comments on commit 0365b0e

Please sign in to comment.