46 lines
No EOL
1.6 KiB
C#
46 lines
No EOL
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using Sharpmake;
|
|
|
|
namespace JustDance.Tools.Helpers
|
|
{
|
|
/// <summary>
|
|
/// Adds the JetBrains settings for each solution generated.
|
|
/// </summary>
|
|
public class JetBrainsSettingsDeployer
|
|
{
|
|
public static void Deploy(List<Solution> solutions)
|
|
{
|
|
var sourceSettings = Path.Combine(Globals.BranchRoot, @"build\sharpmake\DefaultSettings.DotSettings");
|
|
var sourceDate = File.GetLastWriteTime(sourceSettings);
|
|
|
|
foreach (var solution in solutions.OfType<BaseSolution>())
|
|
{
|
|
foreach (var solutionFile in solution.SolutionFilesMapping.Keys)
|
|
{
|
|
var solutionSettings = solutionFile + ".sln.DotSettings";
|
|
|
|
try
|
|
{
|
|
FileInfo fileInfo = new FileInfo(solutionSettings);
|
|
if (fileInfo.Exists)
|
|
{
|
|
fileInfo.IsReadOnly = false;
|
|
}
|
|
|
|
if (fileInfo.LastWriteTime < sourceDate)
|
|
{
|
|
File.Copy(sourceSettings, solutionSettings, overwrite: true);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("warning: was not able to override jetbrains settings file {0}. Details: {1}", solutionSettings, ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |