Skip to content

Commit

Permalink
tools(vs): fix CompileBops not running
Browse files Browse the repository at this point in the history
fixes #332
  • Loading branch information
andrewmd5 committed Jul 16, 2024
1 parent d2a0b0c commit 917761a
Showing 1 changed file with 31 additions and 30 deletions.
61 changes: 31 additions & 30 deletions Tools/vs/build/bebop-tools.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" InitialTargets="CompileBops" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Map RuntimeIdentifier e.g. converts from win10-x64 to win-x64 -->
<_BebopOsArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLower())</_BebopOsArch>
Expand All @@ -23,34 +23,28 @@
</Bebop>
</ItemDefinitionGroup>

<Target Name="DefineBebopProperties">
<PropertyGroup>
<_BebopSchemas>@(Bebop -> '"%(FullPath)"', ' ')</_BebopSchemas>
<_BebopOutputDir>%(Bebop.OutputDir)</_BebopOutputDir>
<_BebopOutputDir Condition="'$(_BebopOutputDir)' == '' " >$(MSBuildProjectDirectory)</_BebopOutputDir>
<_BebopOutputDir>$([System.IO.Path]::GetFullPath('$([MSBuild]::EnsureTrailingSlash('$(_BebopOutputDir)'))'))</_BebopOutputDir>
<_BebopOutput>$([System.IO.Path]::GetFullPath('$(_BebopOutputDir)%(Bebop.OutputFile)'))</_BebopOutput>
</PropertyGroup>
</Target>
<Target Name="DefineBebopProperties">
<PropertyGroup>
<_BebopSchemas>@(Bebop -> '"%(FullPath)"', ' ')</_BebopSchemas>
<_BebopOutputDir>%(Bebop.OutputDir)</_BebopOutputDir>
<_BebopOutputDir Condition="'$(_BebopOutputDir)' == '' " >$(MSBuildProjectDirectory)</_BebopOutputDir>
<_BebopOutputDir>$([System.IO.Path]::GetFullPath('$([MSBuild]::EnsureTrailingSlash('$(_BebopOutputDir)'))'))</_BebopOutputDir>
<_BebopOutput>$([System.IO.Path]::GetFullPath('$(_BebopOutputDir)%(Bebop.OutputFile)'))</_BebopOutput>
</PropertyGroup>
</Target>

<!--
Add to project file for debuggint purposes
<Target Name="BebopPrepareForBuildDebug" AfterTargets="PrepareForBuild">
<CallTarget Targets="BebopPrepareForBuildDiagnostic"/>
</Target>
-->
<Target Name="BebopPrepareForBuildDiagnostic" DependsOnTargets="ValidateBebopcCommandLine">
<Message Importance="high" Text="Bebop Prepare For Build Diagnostic" />
<Message Importance="high" Text="Bebop Compiler Path = $(_Bebopc)" />
<Message Importance="high" Text="Bebop Output Directory = %(Bebop.OutputDir)" />
<Message Importance="high" Text="Bebop Output File = %(Bebop.OutputFile)" />
<Message Importance="high" Text="Bebop Target Language = %(Bebop.Language)" />
<Message Importance="high" Text="Bebop LangVersion = %(Bebop.LangVersion)" />
<Message Importance="high" Text="Bebop Log Format = %(Bebop.Logformat)" />
<Message Importance="high" Text="Bebop Namespace = %(Bebop.Namespace)" Condition="'%(Bebop.Namespace)' != '' "/>
<Message Importance="high" Text="Input Schemas = $(_BebopSchemas)" Condition="'$(_BebopSchemas)' != '' "/>
<Message Importance="high" Text="Bebop Output = $(_BebopOutput)" />
</Target>
<Target Name="BebopPrepareForBuildDiagnostic" DependsOnTargets="ValidateBebopcCommandLine">
<Message Importance="high" Text="Bebop Prepare For Build Diagnostic" />
<Message Importance="high" Text="Bebop Compiler Path = $(_Bebopc)" />
<Message Importance="high" Text="Bebop Output Directory = %(Bebop.OutputDir)" />
<Message Importance="high" Text="Bebop Output File = %(Bebop.OutputFile)" />
<Message Importance="high" Text="Bebop Target Language = %(Bebop.Language)" />
<Message Importance="high" Text="Bebop LangVersion = %(Bebop.LangVersion)" />
<Message Importance="high" Text="Bebop Log Format = %(Bebop.Logformat)" />
<Message Importance="high" Text="Bebop Namespace = %(Bebop.Namespace)" Condition="'%(Bebop.Namespace)' != '' "/>
<Message Importance="high" Text="Input Schemas = $(_BebopSchemas)" Condition="'$(_BebopSchemas)' != '' "/>
<Message Importance="high" Text="Bebop Output = $(_BebopOutput)" />
</Target>

<Target Name="ValidateBebopcCommandLine" DependsOnTargets="DefineBebopProperties">
<Error
Expand All @@ -61,8 +55,7 @@
Condition="!Exists($(_Bebopc))" />
</Target>

<Target Name="CompileBops" BeforeTargets="CoreCompile" DependsOnTargets="PrepareForBuild;ValidateBebopcCommandLine" Condition="'$(_BebopSchemas)' != '' " >

<Target Name="CompileBops" BeforeTargets="CoreCompile" DependsOnTargets="PrepareForBuild;ValidateBebopcCommandLine" Inputs="@(Bebop)" Outputs="$(_BebopOutput)">
<Exec
Command="&quot;$(_Bebopc)&quot; --include $(_BebopSchemas) -df %(Bebop.LogFormat) build --generator &quot;%(Bebop.Language):$(_BebopOutput),namespace=%(Bebop.Namespace),langVersion=%(Bebop.LangVersion)&quot;"
EchoOff='true'
Expand All @@ -75,4 +68,12 @@
<Output TaskParameter="ExitCode" PropertyName="MSBuildLastExitCode" />
</Exec>
</Target>

<!-- This ensures CompileBops is called during the build process -->
<PropertyGroup>
<CoreCompileDependsOn>
CompileBops;
$(CoreCompileDependsOn)
</CoreCompileDependsOn>
</PropertyGroup>
</Project>

0 comments on commit 917761a

Please sign in to comment.