コード例 #1
0
        public void OnBuildCreated(NukeBuild build, IReadOnlyCollection <ExecutableTarget> executableTargets)
        {
            if (IsLegacy(NukeBuild.RootDirectory))
            {
                WriteCompletionFile(build);
            }
            else
            {
                SchemaUtility.WriteBuildSchemaFile(build);
                SchemaUtility.WriteDefaultParametersFile();
            }

            if (EnvironmentInfo.GetParameter <bool>(CompletionParameterName))
            {
                Environment.Exit(exitCode: 0);
            }
        }
コード例 #2
0
        public void OnBuildCreated(NukeBuild build, IReadOnlyCollection <ExecutableTarget> executableTargets)
        {
            if (BuildServerConfigurationGeneration.IsActive)
            {
                return;
            }

            if (IsLegacy(NukeBuild.RootDirectory))
            {
                WriteCompletionFile(build);
            }
            else if (NukeBuild.BuildProjectFile != null)
            {
                SchemaUtility.WriteBuildSchemaFile(build);
                SchemaUtility.WriteDefaultParametersFile();
            }
            else if (EnvironmentInfo.GetPositionalArgument <string>(0) == ":complete")
            {
                var schema          = SchemaUtility.GetBuildSchema(build);
                var profileNames    = GetProfileNames(NukeBuild.RootDirectory);
                var completionItems = SchemaUtility.GetCompletionItems(schema, profileNames);

                var words = EnvironmentInfo.CommandLineArguments.Skip(2).JoinSpace();
                var relevantCompletionItems = CompletionUtility.GetRelevantCompletionItems(words, completionItems);
                foreach (var item in relevantCompletionItems)
                {
                    Console.WriteLine(item);
                }

                Environment.Exit(exitCode: 0);
            }

            if (EnvironmentInfo.GetParameter <bool>(CompletionParameterName))
            {
                Environment.Exit(exitCode: 0);
            }
        }