Skip to content

Build warning fixes #353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
9 changes: 7 additions & 2 deletions GitVersionCore.Tests/ConfigProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public void CanReadDefaultDocument()
public void VerifyInit()
{
var config = typeof(Config);
var aliases = config.GetProperties().Where(p => p.GetCustomAttribute<ObsoleteAttribute>() == null).Select(p => ((YamlAliasAttribute) p.GetCustomAttribute(typeof(YamlAliasAttribute))).Alias);
var aliases = config.GetProperties()
.Where(p => p.GetCustomAttribute<ObsoleteAttribute>() == null)
.Select(p => ((YamlMemberAttribute) p.GetCustomAttribute(typeof(YamlMemberAttribute))).Alias);
var writer = new StringWriter();

ConfigReader.WriteSample(writer);
Expand All @@ -99,7 +101,10 @@ public void VerifyInit()
public void VerifyAliases()
{
var config = typeof(Config);
var propertiesMissingAlias = config.GetProperties().Where(p => p.GetCustomAttribute<ObsoleteAttribute>() == null).Where(p => p.GetCustomAttribute(typeof(YamlAliasAttribute)) == null).Select(p => p.Name);
var propertiesMissingAlias = config.GetProperties()
.Where(p => p.GetCustomAttribute<ObsoleteAttribute>() == null)
.Where(p => p.GetCustomAttribute(typeof(YamlMemberAttribute)) == null)
.Select(p => p.Name);

propertiesMissingAlias.ShouldBeEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void SetupRepo(Action<IRepository> initialMasterAction)
{
var randomFile = Path.Combine(Repository.Info.WorkingDirectory, Guid.NewGuid().ToString());
File.WriteAllText(randomFile, string.Empty);
Repository.Index.Stage(randomFile);
Repository.Stage(randomFile);

initialMasterAction(Repository);

Expand Down
6 changes: 3 additions & 3 deletions GitVersionCore/Configuration/BranchConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public BranchConfig(BranchConfig branchConfiguration)
Increment = branchConfiguration.Increment;
}

[YamlAlias("mode")]
[YamlMember(Alias = "mode")]
public VersioningMode? VersioningMode { get; set; }

/// <summary>
/// Special value 'useBranchName' will extract the tag from the branch name
/// </summary>
[YamlAlias("tag")]
[YamlMember(Alias = "tag")]
public string Tag { get; set; }

[YamlAlias("increment")]
[YamlMember(Alias = "increment")]
public IncrementStrategy? Increment { get; set; }
}
}
18 changes: 9 additions & 9 deletions GitVersionCore/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ public Config()
};
}

[YamlAlias("assembly-versioning-scheme")]
[YamlMember(Alias = "assembly-versioning-scheme")]
public AssemblyVersioningScheme AssemblyVersioningScheme { get; set; }

[YamlAlias("mode")]
[YamlMember(Alias = "mode")]
public VersioningMode? VersioningMode { get; set; }

[YamlAlias("branches")]
[YamlMember(Alias = "tag-prefix")]
public string TagPrefix { get; set; }

[YamlMember(Alias = "next-version")]
public string NextVersion { get; set; }

[YamlMember(Alias = "branches")]
public Dictionary<string, BranchConfig> Branches
{
get
Expand All @@ -57,11 +63,5 @@ private T MergeObjects<T>(T target, T source)
.ForEach(_ => _.prop.SetValue(target, _.value, null));
return target;
}

[YamlAlias("tag-prefix")]
public string TagPrefix { get; set; }

[YamlAlias("next-version")]
public string NextVersion { get; set; }
}
}
4 changes: 2 additions & 2 deletions GitVersionCore/Configuration/LegacyConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public class LegacyConfig
{
public string assemblyVersioningScheme { get; set; }

[YamlAlias("develop-branch-tag")]
[YamlMember(Alias = "develop-branch-tag")]
public string DevelopBranchTag { get; set; }

[YamlAlias("release-branch-tag")]
[YamlMember(Alias = "release-branch-tag")]
public string ReleaseBranchTag { get; set; }
}
}
2 changes: 1 addition & 1 deletion GitVersionTask.Tests/GitFlow/GitFlowVersionFinderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void AReleaseBranchIsRequiredToBranchOffOfDevelopBranch()
var path = Path.Combine(repo.Info.WorkingDirectory, "README");
File.AppendAllText(path, "Release\n");

repo.Index.Stage(path);
repo.Stage(path);
var sign = SignatureBuilder.SignatureNow();
repo.Commit("release unborn", sign, sign);

Expand Down
2 changes: 0 additions & 2 deletions GitVersionTask.Tests/GitVersionTask.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
<Compile Include="GitFlow\GitFlowVersionFinderTests.cs" />
<Compile Include="GitHelperTests.cs" />
<Compile Include="GetVersionTaskTests.cs" />
<Compile Include="Helpers\Constants.cs" />
<Compile Include="Helpers\DirectoryHelper.cs" />
<Compile Include="Helpers\FindersHelper.cs" />
<Compile Include="Helpers\IPostTestDirectoryRemover.cs" />
<Compile Include="Helpers\LibGit2SharpExtensions.cs" />
Expand Down
6 changes: 0 additions & 6 deletions GitVersionTask.Tests/Helpers/Constants.cs

This file was deleted.

16 changes: 11 additions & 5 deletions GitVersionTask.Tests/Helpers/Lg2sHelperBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public abstract class Lg2sHelperBase : IPostTestDirectoryRemover
{
public const string TemporaryReposPath = "TestRepos";
List<string> directories;

[TestFixtureSetUp]
Expand All @@ -30,9 +31,9 @@ static Lg2sHelperBase()
// Do the set up in the static ctor so it only happens once
SetUpTestEnvironment();

if (Directory.Exists(Constants.TemporaryReposPath))
if (Directory.Exists(TemporaryReposPath))
{
DirectoryHelper.DeleteSubDirectories(Constants.TemporaryReposPath);
DirectoryHelper.DeleteSubDirectories(TemporaryReposPath);
}
}

Expand All @@ -58,14 +59,19 @@ static void SetUpTestEnvironment()

protected SelfCleaningDirectory BuildSelfCleaningDirectory()
{
return new SelfCleaningDirectory(this);
return new SelfCleaningDirectory(this, BuildTempPath());
}

protected SelfCleaningDirectory BuildSelfCleaningDirectory(string path)
{
return new SelfCleaningDirectory(this, path);
}

protected static string BuildTempPath()
{
return Path.Combine(TemporaryReposPath, Guid.NewGuid().ToString().Substring(0, 8));
}

protected string Clone(string sourceDirectoryPath, params string[] additionalSourcePaths)
{
var scd = BuildSelfCleaningDirectory();
Expand Down Expand Up @@ -101,7 +107,7 @@ protected static Commit AddOneCommitToHead(Repository repo, string type)
{
var randomFile = Path.Combine(repo.Info.WorkingDirectory, Guid.NewGuid().ToString());
File.WriteAllText(randomFile, string.Empty);
repo.Index.Stage(randomFile);
repo.Stage(randomFile);
var sign = SignatureBuilder.SignatureNow();
return repo.Commit(type + " commit", sign, sign);
}
Expand All @@ -110,7 +116,7 @@ protected static void AddTag(Repository repo, string tagName)
{
var randomFile = Path.Combine(repo.Info.WorkingDirectory, Guid.NewGuid().ToString());
File.WriteAllText(randomFile, string.Empty);
repo.Index.Stage(randomFile);
repo.Stage(randomFile);
var sign = SignatureBuilder.SignatureNow();
repo.ApplyTag(tagName, repo.Head.Tip.Id.Sha, sign, "foo");
}
Expand Down
10 changes: 0 additions & 10 deletions GitVersionTask.Tests/Helpers/SelfCleaningDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

public class SelfCleaningDirectory
{
public SelfCleaningDirectory(IPostTestDirectoryRemover directoryRemover)
: this(directoryRemover, BuildTempPath())
{
}

public SelfCleaningDirectory(IPostTestDirectoryRemover directoryRemover, string path)
{
if (Directory.Exists(path))
Expand All @@ -20,9 +15,4 @@ public SelfCleaningDirectory(IPostTestDirectoryRemover directoryRemover, string
}

public string DirectoryPath;

protected static string BuildTempPath()
{
return Path.Combine(Constants.TemporaryReposPath, Guid.NewGuid().ToString().Substring(0, 8));
}
}