Beispiel #1
0
        public override bool Execute()
        {
            Log.LogMessage(MessageImportance.Low, "Starting deploy task.");
            Log.LogMessage(MessageImportance.Low, "Additional deploy options value: \"" + AdditionalOptions + "\"");

            string buildType = Configuration.StartsWith("Debug") ? "Debug" : "Release";
            string target    = Configuration.Substring(buildType.Length);

            IEnumerable <string> options = new[] { "-p", ProjectDirectory };

            if (!target.Contains("all Targets"))
            {
                options = options.Append("-t");
                options = options.Append($"\"{ target.Trim()}\"");
            }

            options = options.Append("-b");
            options = options.Append(buildType);


            if (SourceFolders.Any())
            {
                options = options.Append("--sources").Append(string.Join(",", SourceFolders)).ToArray();
            }

            options = options.Append(AdditionalOptions);

            try
            {
                Communication.ExecuteWithoutResult("deploy", new TaskLogger(Log), options.ToArray());
            }
            catch (PlcncliException ex)
            {
                if (!Log.HasLoggedErrors)
                {
                    Log.LogErrorFromException(ex, false, true, "-");
                }
                return(false);
            }
            Log.LogMessage(MessageImportance.Low, "deploy task finished.");
            return(true);
        }
Beispiel #2
0
        public override bool Execute()
        {
            Log.LogMessage(MessageImportance.Low, "Starting generate task.");
            Log.LogMessage(MessageImportance.Low, "Plcncli location: \"" + PlcncliLocation + "\"");
            Log.LogMessage(MessageImportance.Low, "Additional generate options value: \"" + AdditionalOptions + "\"");

            string[] args = new string[]
            {
                "-p",
                ProjectDirectory
            };

            if (GenerateDatatypesWorksheet == false)
            {
                args = args.Append("--no-datatypes-worksheet").ToArray();
            }

            if (SourceFolders.Any())
            {
                args = args.Append("--sources").Append(string.Join(",", SourceFolders)).ToArray();
            }

            args = args.Append(AdditionalOptions).ToArray();

            try
            {
                Communication.ExecuteWithoutResult("generate all", new TaskLogger(Log), args);
            }
            catch (PlcncliException ex)
            {
                if (!Log.HasLoggedErrors)
                {
                    Log.LogErrorFromException(ex, false, true, "-");
                }
                return(false);
            }

            Log.LogMessage(MessageImportance.Low, "generate task finished.");

            return(true);
        }