Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SetupLinkerArgumentAttribute.cs « Metadata « Mono.Linker.Tests.Cases.Expectations « test - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2eb5a7f496fd13377e3e4a0796d7d65f1d5312bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;

namespace Mono.Linker.Tests.Cases.Expectations.Metadata {

	/// <summary>
	/// Used to define arguments to pass to the linker.
	/// 
	/// Don't use this attribute to setup single character flags.  These flags do a poor job of communicating their purpose
	/// and although we need to continue to support the usages that exist today, that doesn't mean we need to make our tests harder to read
	/// </summary>
	[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
	public class SetupLinkerArgumentAttribute : BaseMetadataAttribute {
		public SetupLinkerArgumentAttribute (string flag, params string [] values)
		{
			if (string.IsNullOrEmpty (flag))
				throw new ArgumentNullException (nameof (flag));

			if (flag[0] == '-' && flag.Length == 2) {
				string errorMessage = "Flag `" + flag + "` is short.";
				errorMessage += "  Avoid using this attribute with command line flags that are to short to communicate their meaning.  Support a more descriptive flag or create a new attribute for tests to use similar to " + nameof (SetupLinkerCoreActionAttribute);
				throw new ArgumentException (errorMessage);
			}
		}
	}
}