Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Deprecated

- [SIL.BuildTasks] Deprecated `AbandondedSuites` in favor of correctly spelled `AbandonedSuites`.

## [3.1.1] - 2025-03-18

### Changed

- [SIL.BuildTasks] Upgraded dependency on Markdig.Signed to version 0.37.0 (to be consistent with SIL.ReleaseTasks)
Expand Down
10 changes: 4 additions & 6 deletions SIL.BuildTasks.AWS/AwsTaskBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
/*
* Original code from https://code.google.com/archive/p/snowcode/
Expand All @@ -9,16 +9,15 @@
*/

using System;
using System.Diagnostics.CodeAnalysis;
using Amazon.Runtime;
using Amazon.Runtime.CredentialManagement;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace SIL.BuildTasks.AWS
{
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
[PublicAPI]
public abstract class AwsTaskBase : Task
{
/// <summary>
Expand All @@ -33,8 +32,7 @@ public abstract class AwsTaskBase : Task
/// <returns></returns>
protected AWSCredentials GetAwsCredentials()
{
AWSCredentials awsCredentials;
if (!new CredentialProfileStoreChain().TryGetAWSCredentials(CredentialStoreProfileName, out awsCredentials))
if (!new CredentialProfileStoreChain().TryGetAWSCredentials(CredentialStoreProfileName, out var awsCredentials))
throw new ApplicationException("Unable to get AWS credentials from the credential profile store");

Log.LogMessage(MessageImportance.Normal, "Connecting to AWS using AwsAccessKeyId: {0}",
Expand Down
12 changes: 5 additions & 7 deletions SIL.BuildTasks.AWS/S3/S3BuildPublisher.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
/*
* Original code from https://code.google.com/archive/p/snowcode/
Expand All @@ -9,8 +9,8 @@
*/

using System;
using System.Diagnostics.CodeAnalysis;
using Amazon.Runtime;
using JetBrains.Annotations;
using Microsoft.Build.Framework;

namespace SIL.BuildTasks.AWS.S3
Expand All @@ -19,9 +19,7 @@ namespace SIL.BuildTasks.AWS.S3
/// MSBuild task to publish a set of files to a S3 bucket.
/// </summary>
/// <remarks>If made public the files will be available at https://s3.amazonaws.com/bucket_name/folder/file_name</remarks>
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
[PublicAPI]
public class S3BuildPublisher : AwsTaskBase
{
#region Properties
Expand Down Expand Up @@ -51,7 +49,7 @@ public class S3BuildPublisher : AwsTaskBase
public string DestinationBucket { get; set; }

/// <summary>
/// Gets or sets if the files should be publically readable
/// Gets or sets if the files should be publicly readable
/// </summary>
public bool IsPublicRead { get; set; }

Expand Down Expand Up @@ -83,7 +81,7 @@ public override bool Execute()

private bool ProcessFiles()
{
Log.LogMessage(MessageImportance.Normal, "Publishing Sourcefiles={0} to {1}", Join(SourceFiles), DestinationBucket);
Log.LogMessage(MessageImportance.Normal, "Publishing SourceFiles={0} to {1}", Join(SourceFiles), DestinationBucket);

ShowAclWarnings();

Expand Down
5 changes: 4 additions & 1 deletion SIL.BuildTasks.AWS/SIL.BuildTasks.AWS.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472</TargetFrameworks>
<RootNamespace>SIL.BuildTasks</RootNamespace>
<RootNamespace>SIL.BuildTasks.AWS</RootNamespace>
<Description>SIL.BuildTasks.AWS defines a S3BuildPublisher msbuild task to publish a set of files to a S3 bucket.</Description>
<AssemblyTitle>SIL.BuildTasks.AWS</AssemblyTitle>
<IsTool>true</IsTool>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.3.110.50" IncludeAssets="All" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Markdig.Signed" Version="0.41.1" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.8" />
<PackageReference Include="SIL.ReleaseTasks.Dogfood" Version="[2.3.3-*,)" PrivateAssets="All" />
Expand Down
3 changes: 3 additions & 0 deletions SIL.BuildTasks.Tests/SIL.BuildTasks.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<Reference Include="Microsoft.Build.Utilities.v4.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.8" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.14.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
Expand Down
7 changes: 3 additions & 4 deletions SIL.BuildTasks/Archive/Archive.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)

using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace SIL.BuildTasks.Archive
{
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
[PublicAPI]
public class Archive : Task
{
[Required]
Expand Down
6 changes: 3 additions & 3 deletions SIL.BuildTasks/CpuArchitecture.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

Expand All @@ -11,7 +11,7 @@ namespace SIL.BuildTasks
/// <summary>
/// Return the CPU architecture of the current system.
/// </summary>
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[PublicAPI]
public class CpuArchitecture : Task
{
public override bool Execute()
Expand Down
17 changes: 7 additions & 10 deletions SIL.BuildTasks/DownloadFile.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

Expand All @@ -16,9 +16,7 @@ namespace SIL.BuildTasks
/// may be sent in clear.
/// Adapted from http://stackoverflow.com/questions/1089452/how-can-i-use-msbuild-to-download-a-file
/// </summary>
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
[PublicAPI]
public class DownloadFile : Task
{
/// <summary>
Expand All @@ -45,9 +43,9 @@ public class DownloadFile : Task

public override bool Execute()
{
// This doesn't seem to work reliably..can return true even when only network cable is unplugged.
// Left in in case it works in some cases. But the main way of dealing with disconnect is the
// same algorithm in the WebException handler.
// This doesn't seem to work reliably. It can return true even when only network cable
// is unplugged. Left it in just in case it works in some cases. But the main way of
// dealing with disconnect is the same algorithm in the WebException handler.
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
if (File.Exists(LocalFilename))
Expand All @@ -60,8 +58,7 @@ public override bool Execute()
return false; // Presumably can't continue
}

bool success;
var read = DoDownloadFile(Address, LocalFilename, Username, Password, out success);
var read = DoDownloadFile(Address, LocalFilename, Username, Password, out var success);

if (success)
Log.LogMessage(MessageImportance.Low, "{0} bytes written", read);
Expand Down
2 changes: 2 additions & 0 deletions SIL.BuildTasks/FileUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
using System;
using System.Diagnostics;
using System.Text.RegularExpressions;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace SIL.BuildTasks
{
[PublicAPI]
public class FileUpdate : Task
{
private string _dateFormat;
Expand Down
17 changes: 8 additions & 9 deletions SIL.BuildTasks/MakePot/MakePot.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace SIL.BuildTasks.MakePot
{
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
[PublicAPI]
public class MakePot: Task
{
private readonly Dictionary<string, List<string>> _entries = new Dictionary<string, List<string>>();
Expand Down Expand Up @@ -182,7 +181,7 @@ internal void ProcessSrcFile(string filePath)
}
var comments = "#: " + filePath;

//catch the second parameter from calls like this:
// Catch the second parameter from calls like this:
// StringCataGet("~Note", "The label for the field showing a note.");

if (!string.IsNullOrEmpty(match.Groups["note"].Value))
Expand Down Expand Up @@ -214,16 +213,16 @@ private static void WriteEntry(string key, IEnumerable<string> comments, TextWri

public static string EscapeString(string s)
{
var result = s.Replace("\\", "\\\\"); // This must be first
var result = s.Replace(@"\", @"\\"); // This must be first
result = result.Replace("\"", "\\\"");
return result;
}

public static string UnescapeString(string s)
{
var result = s.Replace("\\'", "'");
result = result.Replace("\\\"", "\"");
result = result.Replace("\\\\", "\\");
var result = s.Replace(@"\'", "'");
result = result.Replace(@"\""", "\"");
result = result.Replace(@"\\", @"\");
return result;
}
}
Expand Down
38 changes: 18 additions & 20 deletions SIL.BuildTasks/MakeWixForDirTree/MakeWixForDirTree.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018 SIL Global
// Copyright (c) 2018-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)
/*
* A custom task that walks a directory tree and creates a WiX fragment containing
Expand All @@ -13,20 +13,18 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;


namespace SIL.BuildTasks.MakeWixForDirTree
{
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
[PublicAPI]
public class MakeWixForDirTree : Task, ILogger
{
private const string FileNameOfGuidDatabase = ".guidsForInstaller.xml";
Expand Down Expand Up @@ -84,7 +82,7 @@ public string IgnoreRegExPattern
}

/// <summary>
/// Whether to just check that all the metadata is uptodate or not. If this is true then no file is output.
/// Whether to just check that all the metadata is up-to-date or not. If this is true then no file is output.
/// </summary>
public bool CheckOnly { get; set; }

Expand Down Expand Up @@ -112,7 +110,7 @@ public override bool Execute()
if (!string.IsNullOrEmpty(InstallerSourceDirectory))
InstallerSourceDirectory = Path.GetFullPath(InstallerSourceDirectory);

/* hatton removed this... it would leave deleted files referenced in the wxs file
/* Hatton removed this... it would leave deleted files referenced in the wxs file
if (File.Exists(_outputFilePath))
{
DateTime curFileDate = File.GetLastWriteTime(_outputFilePath);
Expand Down Expand Up @@ -190,7 +188,7 @@ private static void InsertFileDeletionInstruction(XmlNode elemFrag)

private void WriteDomToFile(XmlNode doc)
{
// write the XML out onlystringles have been modified
// write the XML out only if modified
if (CheckOnly || !_filesChanged)
return;

Expand Down Expand Up @@ -342,11 +340,11 @@ private void SetupDirectoryPermissions(XmlNode parent, string parentDirectoryId,
private string GetSafeDirectoryId(string directoryPath, string parentDirectoryId)
{
var id = parentDirectoryId;
//bit of a hack... we don't want our id to have this prefix.dir form fo the top level,
//where it is going to be referenced by other wix files, that will just be expecting the id
//the msbuild target gave for the id of this directory
// This is a bit of a hack... we don't want our id to have this prefix.dir form for the
// top level, where it is going to be referenced by other WIX files; that will just be
// expecting the id the MSBuild target gave for the id of this directory.

//I don't have it quite right, though. See the test file, where you get
// I don't have it quite right, though. See the test file, where you get
// <Component Id="common.bin.bin" (the last bin is undesirable)

if (Path.GetFullPath(RootDirectory) != directoryPath)
Expand All @@ -361,14 +359,14 @@ private string GetSafeDirectoryId(string directoryPath, string parentDirectoryId
private void ProcessFile(XmlNode parent, string path, XmlDocument doc, IdToGuidDatabase guidDatabase, bool isFirst, string directoryId)
{
var name = Path.GetFileName(path);
var id = directoryId+"."+name; //includ the parent directory id so that files with the same name (e.g. "index.html") found twice in the system will get different ids.
var id = directoryId+"."+name; // Include the parent directory id so that files with the same name (e.g. "index.html") found twice in the system will get different ids.

const int kMaxLength = 50; //I have so far not found out what the max really is
const int kMaxLength = 50; // I have so far not found out what the max really is.
if (id.Length > kMaxLength)
{
id = id.Substring(id.Length - kMaxLength, kMaxLength); //get the last chunk of it
id = id.Substring(id.Length - kMaxLength, kMaxLength); // Get the last chunk of it.
}
if (!char.IsLetter(id[0]) && id[0] != '_')//probably not needed now that we're prepending the parent directory id, accept maybe at the root?
if (!char.IsLetter(id[0]) && id[0] != '_') // Probably not needed now that we're prepending the parent directory id, except maybe at the root?
id = '_' + id;
id = Regex.Replace(id, @"[^\p{Lu}\p{Ll}\p{Nd}._]", "_");

Expand Down Expand Up @@ -423,10 +421,10 @@ private void ProcessFile(XmlNode parent, string path, XmlDocument doc, IdToGuidD

private static void AddPermissionElement(XmlDocument doc, XmlNode elementToAddPermissionTo)
{
var persmission = doc.CreateElement("Permission", Xmlns);
persmission.SetAttribute("GenericAll", "yes");
persmission.SetAttribute("User", "Everyone");
elementToAddPermissionTo.AppendChild(persmission);
var permission = doc.CreateElement("Permission", Xmlns);
permission.SetAttribute("GenericAll", "yes");
permission.SetAttribute("User", "Everyone");
elementToAddPermissionTo.AppendChild(permission);
}

public void LogMessage(MessageImportance importance, string message)
Expand Down
4 changes: 3 additions & 1 deletion SIL.BuildTasks/NormalizeLocales.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (c) 2020 SIL Global
// Copyright (c) 2020-2025 SIL Global
// This software is licensed under the MIT License (http://opensource.org/licenses/MIT)

using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

Expand All @@ -12,6 +13,7 @@ namespace SIL.BuildTasks
/// Crowdin includes country codes either always or never. Country codes are required for Chinese, but mostly get in the way for other languages.
/// This task removes country codes from all locales except Chinese. It expects to work with paths in the form of /%locale%/filename.%locale.extension
/// </summary>
[PublicAPI]
public class NormalizeLocales : Task
{
/// <summary>The directory whose subdirectories are locale names and contain localizations</summary>
Expand Down
Loading
Loading