Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Build/Installer.legacy.targets
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@
<!-- Installed in Program Files\Common Files -->
<BinFiles Remove="@(CustomInstallFiles)" />
<!-- Files used to customize the generic patchable installer -->
<OverrideFiles Include="$(fwrt)\FLExInstaller\*.wxi" />
<OverrideFiles Include="$(fwrt)\FLExInstaller\*.wxi" Exclude="$(fwrt)\FLExInstaller\CustomComponents.wxi" />
</ItemGroup>
<PropertyGroup>
<_CustomComponentsTemplate>$(fwrt)\FLExInstaller\CustomComponents.wxi</_CustomComponentsTemplate>
<_RenderedCustomComponentsPath>$(OverridesDestDir)\CustomComponents.wxi</_RenderedCustomComponentsPath>
</PropertyGroup>
<Copy
SourceFiles="@(FontFiles)"
OverwriteReadonlyFiles="true"
Expand Down Expand Up @@ -365,6 +369,21 @@
OverwriteReadonlyFiles="true"
DestinationFolder="$(OverridesDestDir)"
/>
<ReadLinesFromFile
Condition="Exists('$(_CustomComponentsTemplate)')"
File="$(_CustomComponentsTemplate)">
<Output TaskParameter="Lines" ItemName="_CustomComponentsTemplateLines" />
</ReadLinesFromFile>
<PropertyGroup Condition="'@(_CustomComponentsTemplateLines)' != ''">
<_CustomComponentsTemplateContent>@(_CustomComponentsTemplateLines, '%0A')</_CustomComponentsTemplateContent>
<_CustomComponentsRenderedContent>$(_CustomComponentsTemplateContent.Replace('__EncodingConvertersCoreVersion__', '$(EncodingConvertersCoreVersion)'))</_CustomComponentsRenderedContent>
</PropertyGroup>
<WriteLinesToFile
Condition="'$(_CustomComponentsRenderedContent)' != ''"
File="$(_RenderedCustomComponentsPath)"
Lines="$(_CustomComponentsRenderedContent)"
Overwrite="true"
/>
<CallTarget Targets="HarvestL10n;ConvertHarvestsToWxi;WriteFilesMetadata" />
</Target>
<Target Name="ValidateInstallerAddons" Condition="'$(BuildAdditionalApps)'=='true'">
Expand Down
1 change: 1 addition & 0 deletions Build/SilVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<SilMachineVersion>3.8.2</SilMachineVersion>
<SilIPCFrameworkVersion>1.1.1-beta0001</SilIPCFrameworkVersion>
<L10NSharpVersion>10.0.0-beta0004</L10NSharpVersion>
<EncodingConvertersCoreVersion>0.9.8</EncodingConvertersCoreVersion>
<IcuNugetVersion>70.1.152</IcuNugetVersion>
<GeckoNugetVersion>60.0.56</GeckoNugetVersion>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Build/Src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<!-- Use Update for root-pinned packages and Include for build-only packages absent from the root CPM file. -->
<ItemGroup Label="Build Tool Package Versions">
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="18.4.0" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="18.6.3" />
<PackageVersion Update="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageVersion Update="NUnit3TestAdapter" Version="5.2.0" />
<PackageVersion Include="SIL.BuildTasks" Version="3.2.0" />
Expand Down
2 changes: 1 addition & 1 deletion Build/Windows.targets
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</Target>
<!-- Define Encoding Converters files needed for building and running tests (x64 only) -->
<PropertyGroup>
<ECNugetVersion>0.9.7</ECNugetVersion>
<ECNugetVersion Condition="'$(ECNugetVersion)'==''">$(EncodingConvertersCoreVersion)</ECNugetVersion>
</PropertyGroup>
<ItemGroup>
<ECWindowsFiles Include="CcEC.dll" />
Expand Down
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- DependencyModel: other current-line pins in this block move to 9.0.16,
but this package stays at 9.0.14. icu.net wants 2.0.4, ParatextData wants
>= 9.0.9, and 9.0.16 breaks ICU initialization in the .NET Framework test host. -->
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="9.0.14" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="9.0.16" />
<!-- System.Memory: ParatextData requires 4.6.3; other packages want 4.5.0–4.6.0. -->
<PackageVersion Include="System.Memory" Version="4.6.3" />
<!-- Microsoft.Bcl.HashCode: System.Resources.Extensions requires HashCode. -->
Expand Down Expand Up @@ -131,7 +131,7 @@
<PackageVersion Include="CsvHelper" Version="33.1.0" />
<PackageVersion Include="DialogAdapters" Version="0.1.11" />
<PackageVersion Include="DocumentFormat.OpenXml" Version="2.20.0" />
<PackageVersion Include="encoding-converters-core" Version="0.9.7" />
<PackageVersion Include="encoding-converters-core" Version="$(EncodingConvertersCoreVersion)" />
<PackageVersion Include="Geckofx60.64" Version="$(GeckoNugetVersion)" />
<PackageVersion Include="Geckofx60.64.Windows" Version="0.19.0" />
<PackageVersion Include="ibusdotnet" Version="2.0.3" />
Expand Down
4 changes: 2 additions & 2 deletions FLExInstaller/CustomComponents.wxi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<?if $(sys.BUILDARCH) = x64 ?>
<?define EncodingConvertersPath = "..\..\packages\encoding-converters-core\0.9.7\runtimes\EcDistFiles\MergeModules\x64\Release" ?>
<?define EncodingConvertersPath = "..\..\packages\encoding-converters-core\__EncodingConvertersCoreVersion__\runtimes\EcDistFiles\MergeModules\x64\Release" ?>
<?else?>
<?define EncodingConvertersPath = "..\..\packages\encoding-converters-core\0.9.7\runtimes\EcDistFiles\MergeModules\x86\Release" ?>
<?define EncodingConvertersPath = "..\..\packages\encoding-converters-core\__EncodingConvertersCoreVersion__\runtimes\EcDistFiles\MergeModules\x86\Release" ?>
<?endif?>
<!-- REVIEW (Hasso) 2018.07: if this file gets too long, it can be split into separate files for MergeModules, L10n, and possibly others. -->
<Include>
Expand Down
27 changes: 27 additions & 0 deletions Obj/FwBuildTasks/FwBuildTasks.csproj.nuget.g.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/dependabot/dependabot-updater/repo/packages</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/dependabot/dependabot-updater/repo/packages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/dependabot/dependabot-updater/repo/packages/" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)/nunit/3.14.0/build/NUnit.props" Condition="Exists('$(NuGetPackageRoot)/nunit/3.14.0/build/NUnit.props')" />
<Import Project="$(NuGetPackageRoot)/sil.buildtasks/3.2.0/build/SIL.BuildTasks.props" Condition="Exists('$(NuGetPackageRoot)/sil.buildtasks/3.2.0/build/SIL.BuildTasks.props')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.props" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.props')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.props')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.extensions.telemetry/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.extensions.telemetry/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Extensions.Telemetry.props')" />
<Import Project="$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.props" Condition="Exists('$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<PkgMicrosoft_Build_Framework Condition=" '$(PkgMicrosoft_Build_Framework)' == '' ">/home/dependabot/dependabot-updater/repo/packages/microsoft.build.framework/18.6.3</PkgMicrosoft_Build_Framework>
<PkgSIL_BuildTasks Condition=" '$(PkgSIL_BuildTasks)' == '' ">/home/dependabot/dependabot-updater/repo/packages/sil.buildtasks/3.2.0</PkgSIL_BuildTasks>
</PropertyGroup>
</Project>
12 changes: 12 additions & 0 deletions Obj/FwBuildTasks/FwBuildTasks.csproj.nuget.g.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)/system.valuetuple/4.6.1/buildTransitive/net471/System.ValueTuple.targets" Condition="Exists('$(NuGetPackageRoot)/system.valuetuple/4.6.1/buildTransitive/net471/System.ValueTuple.targets')" />
<Import Project="$(NuGetPackageRoot)/system.text.json/10.0.3/buildTransitive/net462/System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)/system.text.json/10.0.3/buildTransitive/net462/System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)/system.resources.extensions/9.0.16/buildTransitive/net462/System.Resources.Extensions.targets" Condition="Exists('$(NuGetPackageRoot)/system.resources.extensions/9.0.16/buildTransitive/net462/System.Resources.Extensions.targets')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.targets" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform/1.9.0/buildTransitive/netstandard2.0/Microsoft.Testing.Platform.targets')" />
<Import Project="$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('$(NuGetPackageRoot)/microsoft.testing.platform.msbuild/1.9.0/buildTransitive/Microsoft.Testing.Platform.MSBuild.targets')" />
<Import Project="$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.targets" Condition="Exists('$(NuGetPackageRoot)/nunit3testadapter/5.2.0/build/net462/NUnit3TestAdapter.targets')" />
<Import Project="$(NuGetPackageRoot)/microsoft.netframework.referenceassemblies.net48/1.0.3/build/Microsoft.NETFramework.ReferenceAssemblies.net48.targets" Condition="Exists('$(NuGetPackageRoot)/microsoft.netframework.referenceassemblies.net48/1.0.3/build/Microsoft.NETFramework.ReferenceAssemblies.net48.targets')" />
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using NUnit.Framework;

namespace SIL.InstallValidator
{
[TestFixture]
public sealed class DependencyVersionConsistencyTests
{
[Test]
public void EncodingConvertersPathsStayAlignedWithCentralPackageVersion()
{
var repoRoot = FindRepoRoot();
Assert.That(repoRoot, Is.Not.Null, "Could not locate repo root (FieldWorks.sln).");

var silVersionsPath = Path.Combine(repoRoot, "Build", "SilVersions.props");
var expectedVersion = ReadSingleMatch(
silVersionsPath,
@"<EncodingConvertersCoreVersion>(?<version>[^<]+)</EncodingConvertersCoreVersion>",
"EncodingConvertersCoreVersion");

var packageVersionExpression = ReadCentralPackageVersion(repoRoot, "encoding-converters-core");
Assert.That(
packageVersionExpression,
Is.EqualTo("$(EncodingConvertersCoreVersion)"),
"Directory.Packages.props should reference the shared EncodingConvertersCoreVersion property.");

var windowsTargetsPath = Path.Combine(repoRoot, "Build", "Windows.targets");
var windowsTargetsVersion = ReadSingleMatch(
windowsTargetsPath,
@"<ECNugetVersion[^>]*>(?<version>[^<]+)</ECNugetVersion>",
"ECNugetVersion");

Assert.That(
windowsTargetsVersion,
Is.EqualTo("$(EncodingConvertersCoreVersion)"),
$"{windowsTargetsPath} should reference the shared EncodingConvertersCoreVersion property.");

var customComponentsPath = Path.Combine(repoRoot, "FLExInstaller", "CustomComponents.wxi");
var customComponentsContent = File.ReadAllText(customComponentsPath);

Assert.That(
Regex.IsMatch(customComponentsContent, @"encoding-converters-core\\__EncodingConvertersCoreVersion__\\runtimes\\EcDistFiles", RegexOptions.IgnoreCase),
Is.True,
$"{customComponentsPath} should use the shared EncodingConvertersCoreVersion placeholder instead of a hardcoded version.");

Assert.That(
customComponentsContent.Contains(expectedVersion),
Is.False,
$"{customComponentsPath} should not hardcode version {expectedVersion}.");

var installerLegacyTargetsPath = Path.Combine(repoRoot, "Build", "Installer.legacy.targets");
var installerLegacyTargetsContent = File.ReadAllText(installerLegacyTargetsPath);

Assert.That(
installerLegacyTargetsContent.Contains("__EncodingConvertersCoreVersion__") && installerLegacyTargetsContent.Contains("$(EncodingConvertersCoreVersion)"),
Is.True,
$"{installerLegacyTargetsPath} should materialize the legacy installer CustomComponents.wxi from the shared EncodingConvertersCoreVersion property.");
}

private static string FindRepoRoot()
{
var dir = new DirectoryInfo(TestContext.CurrentContext.TestDirectory);
while (dir != null)
{
if (File.Exists(Path.Combine(dir.FullName, "FieldWorks.sln")))
return dir.FullName;

dir = dir.Parent;
}

return null;
}

private static string ReadCentralPackageVersion(string repoRoot, string packageId)
{
var document = XDocument.Load(Path.Combine(repoRoot, "Directory.Packages.props"));
var package = document
.Descendants("PackageVersion")
.FirstOrDefault(element => string.Equals((string) element.Attribute("Include"), packageId, StringComparison.OrdinalIgnoreCase));

return package == null ? null : (string) package.Attribute("Version");
}

private static string ReadSingleMatch(string path, string pattern, string label)
{
var content = File.ReadAllText(path);
var match = Regex.Match(content, pattern, RegexOptions.IgnoreCase);
Assert.That(match.Success, Is.True, $"Could not find {label} in {path}.");

return match.Groups["version"].Value;
}
}
}
Loading