static LibraryDependencyTypeKeyword()
        {
            var emptyFlags = Enumerable.Empty <LibraryDependencyTypeFlag>();

            Default = Declare(
                "default",
                flagsToAdd: new[]
            {
                LibraryDependencyTypeFlag.MainReference,
                LibraryDependencyTypeFlag.MainSource,
                LibraryDependencyTypeFlag.MainExport,
                LibraryDependencyTypeFlag.RuntimeComponent,
                LibraryDependencyTypeFlag.BecomesNupkgDependency,
            },
                flagsToRemove: emptyFlags);

            Private = Declare(
                "private",
                flagsToAdd: new[]
            {
                LibraryDependencyTypeFlag.MainReference,
                LibraryDependencyTypeFlag.MainSource,
                LibraryDependencyTypeFlag.RuntimeComponent,
                LibraryDependencyTypeFlag.BecomesNupkgDependency,
            },
                flagsToRemove: emptyFlags);

            Dev = Declare(
                "dev",
                flagsToAdd: new[]
            {
                LibraryDependencyTypeFlag.DevComponent,
            },
                flagsToRemove: emptyFlags);

            Build = Declare(
                "build",
                flagsToAdd: new[]
            {
                LibraryDependencyTypeFlag.MainSource,
                LibraryDependencyTypeFlag.PreprocessComponent,
            },
                flagsToRemove: emptyFlags);

            Preprocess = Declare(
                "preprocess",
                flagsToAdd: new[]
            {
                LibraryDependencyTypeFlag.PreprocessReference,
            },
                flagsToRemove: emptyFlags);

            foreach (var fieldInfo in typeof(LibraryDependencyTypeFlag).GetTypeInfo().DeclaredFields)
            {
                if (fieldInfo.FieldType == typeof(LibraryDependencyTypeFlag))
                {
                    var flag = (LibraryDependencyTypeFlag)fieldInfo.GetValue(null);
                    Declare(
                        fieldInfo.Name,
                        flagsToAdd: new[] { flag },
                        flagsToRemove: emptyFlags);
                    Declare(
                        fieldInfo.Name + "-off",
                        flagsToAdd: emptyFlags,
                        flagsToRemove: new[] { flag });
                }
            }
        }
Ejemplo n.º 2
0
        static LibraryDependencyTypeKeyword()
        {
            var emptyFlags = Enumerable.Empty<LibraryDependencyTypeFlag>();

            Default = Declare(
                "default",
                flagsToAdd: new[]
                {
                    LibraryDependencyTypeFlag.MainReference,
                    LibraryDependencyTypeFlag.MainSource,
                    LibraryDependencyTypeFlag.MainExport,
                    LibraryDependencyTypeFlag.RuntimeComponent,
                    LibraryDependencyTypeFlag.BecomesNupkgDependency,
                },
                flagsToRemove: emptyFlags);

            Private = Declare(
                "private",
                flagsToAdd: new[]
                {
                    LibraryDependencyTypeFlag.MainReference,
                    LibraryDependencyTypeFlag.MainSource,
                    LibraryDependencyTypeFlag.RuntimeComponent,
                    LibraryDependencyTypeFlag.BecomesNupkgDependency,
                },
                flagsToRemove: emptyFlags);

            Dev = Declare(
                "dev",
                flagsToAdd: new[]
                {
                    LibraryDependencyTypeFlag.DevComponent,
                },
                flagsToRemove: emptyFlags);

            Build = Declare(
                "build",
                flagsToAdd: new[]
                {
                    LibraryDependencyTypeFlag.MainSource,
                    LibraryDependencyTypeFlag.PreprocessComponent,
                },
                flagsToRemove: emptyFlags);

            Preprocess = Declare(
                "preprocess",
                flagsToAdd: new[]
                {
                    LibraryDependencyTypeFlag.PreprocessReference,
                },
                flagsToRemove: emptyFlags);

            foreach (var fieldInfo in typeof(LibraryDependencyTypeFlag).GetTypeInfo().DeclaredFields)
            {
                if (fieldInfo.FieldType == typeof(LibraryDependencyTypeFlag))
                {
                    var flag = (LibraryDependencyTypeFlag)fieldInfo.GetValue(null);
                    Declare(
                        fieldInfo.Name,
                        flagsToAdd: new[] { flag },
                        flagsToRemove: emptyFlags);
                    Declare(
                        fieldInfo.Name + "-off",
                        flagsToAdd: emptyFlags,
                        flagsToRemove: new[] { flag });
                }
            }
        }