<commit_before>﻿<Project>
  <PropertyGroup>
    <PackageDependsOn>$(PackageDependsOn);GenerateMPack</PackageDependsOn>
    <GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);GetMPackArtifactInfo</GetArtifactInfoDependsOn>
    <AddinName>Microsoft.VisualStudio.Mac.RazorAddin</AddinName>
    <AddinDirectory>$(RepositoryRoot)tooling\$(AddinName)\</AddinDirectory>
    <MPackArtifactCategory>shipoob</MPackArtifactCategory>

    <MPackIntermediateOutputPath>$(IntermediateDir)mpack\</MPackIntermediateOutputPath>
    <AddinOutputPath>$(AddinDirectory)bin\$(Configuration)\net461\</AddinOutputPath>
    <LanguageServiceName>Microsoft.VisualStudio.Mac.LanguageServices.Razor</LanguageServiceName>
    <LanguageServiceOutputPath>$(RepositoryRoot)src\$(LanguageServiceName)\bin\$(Configuration)\net461\</LanguageServiceOutputPath>
    <MPackName>$(AddinName)_$(AddinVersion)</MPackName>
    <MPackFileName>$(MPackName).mpack</MPackFileName>
    <MPackOutputPath>$(BuildDir)$(MPackFileName)</MPackOutputPath>
    <MPackZipFile>$(BuildDir)$(MPackName).zip</MPackZipFile>
    <MPackManifest>$(AddinDirectory)Properties\_Manifest.addin.xml</MPackManifest>
    <AddinInfoFilePath>$(MPackIntermediateOutputPath)addin.info</AddinInfoFilePath>
  </PropertyGroup>

  <Import Project="$(AddinDirectory)AddinMetadata.props" />

  <!-- This target is required so KoreBuild can generate a bill of materials with relevant information about the .mpack files. -->
  <Target Name="GetMPackArtifactInfo">
    <ItemGroup>
      <ArtifactInfo Include="$(MPackOutputPath)">
        <ArtifactType>MPackFile</ArtifactType>
        <PackageId>$(AddinName)</PackageId>
        <Version>$(AddinVersion)</Version>
        <Category>$(MPackArtifactCategory)</Category>
      </ArtifactInfo>

      <FilesToExcludeFromSigning Include="$(MPackOutputPath)" />
    </ItemGroup>
  </Target>

  <Target Name="GenerateMPack">
    <!--
      In our case the mpack archive requires the following:
      1. An addin.info
      2. An addin binary (Microsoft.VisualStudio.Mac.RazorAddin.dll)
        a. _Manifest.addin.xml embedded
        b. Addin assembly attributes for metadata 
      3. All language service binaries
    -->

    <MakeDir Directories="$(MPackIntermediateOutputPath)" Condition="!Exists('$(MPackIntermediateOutputPath)')" />
    <Delete Files="$(MPackOutputPath)" Condition="Exists('$(MPackOutputPath)')" />

    <!-- We need to resolve the language service assemblies to generate an addin.info for the mpack -->
    <XmlPeek XmlInputPath="$(MPackManifest)" Query="/ExtensionModel/Runtime/Import/@assembly">
      <Output TaskParameter="Result" ItemName="LanguageServiceAssemblyNames" />
    </XmlPeek>

    <!-- We need to resolve the addin dependencies to generate an addin.info for the mpack -->
    <XmlPeek XmlInputPath="$(MPackManifest)" Query="/ExtensionModel/Dependencies/Addin">
      <Output TaskParameter="Result" ItemName="AddinDependencies" />
    </XmlPeek>

    <ItemGroup>
      <AddinInfoLines Include="&lt;Addin id=&quot;$(AddinId)&quot; namespace=&quot;$(AddinNamespace)&quot; version=&quot;$(AddinVersion)&quot; name=&quot;$(AddinDetailedName)&quot; author=&quot;$(Authors)&quot; description=&quot;$(Description)&quot; category=&quot;$(AddinCategory)&quot;&gt;" />
      <AddinInfoLines Include="  &lt;Runtime&gt;" />
      <AddinInfoLines Include="    &lt;Import assembly=&quot;%(LanguageServiceAssemblyNames.Identity)&quot; /&gt;" />
      <AddinInfoLines Include="    &lt;Import assembly=&quot;$(AddinName).dll&quot; /&gt;" />
      <AddinInfoLines Include="  &lt;/Runtime&gt;" />
      <AddinInfoLines Include="  &lt;Dependencies&gt;" />
      <AddinInfoLines Include="    %(AddinDependencies.Identity)" />
      <AddinInfoLines Include="  &lt;/Dependencies&gt;" />
      <AddinInfoLines Include="&lt;/Addin&gt;" />
    </ItemGroup>

    <ItemGroup>
      <LanguageServiceAssemblies Include="$(LanguageServiceOutputPath)%(LanguageServiceAssemblyNames.Identity)" />
      <LanguageServicePDBs Include="%(LanguageServiceAssemblies.RootDir)%(Directory)%(FileName).pdb" Condition="Exists('%(LanguageServiceAssemblies.RootDir)%(Directory)%(FileName).pdb')" />
    </ItemGroup>

    <!-- Generate the addin.info and gather sources for mpack zipping-->
    <WriteLinesToFile File="$(AddinInfoFilePath)" Lines="@(AddinInfoLines)" Overwrite="true" />
    <Copy SourceFiles="%(LanguageServiceAssemblies.Identity)" DestinationFolder="$(MPackIntermediateOutputPath)" />
    <Copy SourceFiles="%(LanguageServicePDBs.Identity)" DestinationFolder="$(MPackIntermediateOutputPath)" />
    <Copy SourceFiles="$(AddinOutputPath)$(AddinName).dll" DestinationFolder="$(MPackIntermediateOutputPath)" />
    <Copy SourceFiles="$(AddinOutputPath)$(AddinName).pdb" DestinationFolder="$(MPackIntermediateOutputPath)" />

    <ItemGroup>
      <MPackFiles Include="$(MPackIntermediateOutputPath)\*" />
    </ItemGroup>

    <ZipArchive
      File="$(MPackOutputPath)"
      SourceFiles="@(MPackFiles)"
      WorkingDirectory="$(MPackIntermediateOutputPath)" />
  </Target>

</Project><commit_msg>Change GenerateMPACK ItemGroup names to be non-plural.<commit_after>﻿<Project>
  <PropertyGroup>
    <PackageDependsOn>$(PackageDependsOn);GenerateMPack</PackageDependsOn>
    <GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);GetMPackArtifactInfo</GetArtifactInfoDependsOn>
    <AddinName>Microsoft.VisualStudio.Mac.RazorAddin</AddinName>
    <AddinDirectory>$(RepositoryRoot)tooling\$(AddinName)\</AddinDirectory>
    <MPackArtifactCategory>shipoob</MPackArtifactCategory>

    <MPackIntermediateOutputPath>$(IntermediateDir)mpack\</MPackIntermediateOutputPath>
    <AddinOutputPath>$(AddinDirectory)bin\$(Configuration)\net461\</AddinOutputPath>
    <LanguageServiceName>Microsoft.VisualStudio.Mac.LanguageServices.Razor</LanguageServiceName>
    <LanguageServiceOutputPath>$(RepositoryRoot)src\$(LanguageServiceName)\bin\$(Configuration)\net461\</LanguageServiceOutputPath>
    <MPackName>$(AddinName)_$(AddinVersion)</MPackName>
    <MPackFileName>$(MPackName).mpack</MPackFileName>
    <MPackOutputPath>$(BuildDir)$(MPackFileName)</MPackOutputPath>
    <MPackZipFile>$(BuildDir)$(MPackName).zip</MPackZipFile>
    <MPackManifest>$(AddinDirectory)Properties\_Manifest.addin.xml</MPackManifest>
    <AddinInfoFilePath>$(MPackIntermediateOutputPath)addin.info</AddinInfoFilePath>
  </PropertyGroup>

  <Import Project="$(AddinDirectory)AddinMetadata.props" />

  <!-- This target is required so KoreBuild can generate a bill of materials with relevant information about the .mpack files. -->
  <Target Name="GetMPackArtifactInfo">
    <ItemGroup>
      <ArtifactInfo Include="$(MPackOutputPath)">
        <ArtifactType>MPackFile</ArtifactType>
        <PackageId>$(AddinName)</PackageId>
        <Version>$(AddinVersion)</Version>
        <Category>$(MPackArtifactCategory)</Category>
      </ArtifactInfo>

      <FilesToExcludeFromSigning Include="$(MPackOutputPath)" />
    </ItemGroup>
  </Target>

  <Target Name="GenerateMPack">
    <!--
      In our case the mpack archive requires the following:
      1. An addin.info
      2. An addin binary (Microsoft.VisualStudio.Mac.RazorAddin.dll)
        a. _Manifest.addin.xml embedded
        b. Addin assembly attributes for metadata 
      3. All language service binaries
    -->

    <MakeDir Directories="$(MPackIntermediateOutputPath)" Condition="!Exists('$(MPackIntermediateOutputPath)')" />
    <Delete Files="$(MPackOutputPath)" Condition="Exists('$(MPackOutputPath)')" />

    <!-- We need to resolve the language service assemblies to generate an addin.info for the mpack -->
    <XmlPeek XmlInputPath="$(MPackManifest)" Query="/ExtensionModel/Runtime/Import/@assembly">
      <Output TaskParameter="Result" ItemName="LanguageServiceAssemblyNames" />
    </XmlPeek>

    <!-- We need to resolve the addin dependencies to generate an addin.info for the mpack -->
    <XmlPeek XmlInputPath="$(MPackManifest)" Query="/ExtensionModel/Dependencies/Addin">
      <Output TaskParameter="Result" ItemName="AddinDependencies" />
    </XmlPeek>

    <ItemGroup>
      <AddinInfoLine Include="&lt;Addin id=&quot;$(AddinId)&quot; namespace=&quot;$(AddinNamespace)&quot; version=&quot;$(AddinVersion)&quot; name=&quot;$(AddinDetailedName)&quot; author=&quot;$(Authors)&quot; description=&quot;$(Description)&quot; category=&quot;$(AddinCategory)&quot;&gt;" />
      <AddinInfoLine Include="  &lt;Runtime&gt;" />
      <AddinInfoLine Include="    &lt;Import assembly=&quot;%(LanguageServiceAssemblyNames.Identity)&quot; /&gt;" />
      <AddinInfoLine Include="    &lt;Import assembly=&quot;$(AddinName).dll&quot; /&gt;" />
      <AddinInfoLine Include="  &lt;/Runtime&gt;" />
      <AddinInfoLine Include="  &lt;Dependencies&gt;" />
      <AddinInfoLine Include="    %(AddinDependencies.Identity)" />
      <AddinInfoLine Include="  &lt;/Dependencies&gt;" />
      <AddinInfoLine Include="&lt;/Addin&gt;" />
    </ItemGroup>

    <ItemGroup>
      <LanguageServiceAssembly Include="$(LanguageServiceOutputPath)%(LanguageServiceAssemblyNames.Identity)" />
      <LanguageServicePDB Include="%(LanguageServiceAssembly.RootDir)%(Directory)%(FileName).pdb" Condition="Exists('%(LanguageServiceAssembly.RootDir)%(Directory)%(FileName).pdb')" />
    </ItemGroup>

    <!-- Generate the addin.info and gather sources for mpack zipping-->
    <WriteLinesToFile File="$(AddinInfoFilePath)" Lines="@(AddinInfoLine)" Overwrite="true" />
    <Copy SourceFiles="%(LanguageServiceAssembly.Identity)" DestinationFolder="$(MPackIntermediateOutputPath)" />
    <Copy SourceFiles="%(LanguageServicePDB.Identity)" DestinationFolder="$(MPackIntermediateOutputPath)" />
    <Copy SourceFiles="$(AddinOutputPath)$(AddinName).dll" DestinationFolder="$(MPackIntermediateOutputPath)" />
    <Copy SourceFiles="$(AddinOutputPath)$(AddinName).pdb" DestinationFolder="$(MPackIntermediateOutputPath)" />

    <ItemGroup>
      <MPackFile Include="$(MPackIntermediateOutputPath)\*" />
    </ItemGroup>

    <ZipArchive
      File="$(MPackOutputPath)"
      SourceFiles="@(MPackFile)"
      WorkingDirectory="$(MPackIntermediateOutputPath)" />
  </Target>

</Project>
{'fraction_non_alphanumeric': 0.14821375848833776, 'fraction_numerical': 0.001771479185119575, 'mean_word_length': 5.443880786303107, 'pattern_counts': {'":': 0, '<': 181, '<?xml version=': 0, '>': 181, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3905105', 'n_tokens_mistral': 3108, 'n_tokens_neox': 2917, 'n_words': 435}