Ejemplo n.º 1
0
        public bool Execute(string modulePackagesConfig, string propsFile, string targetsFile, string[] inputs, string[] modulePaths)
        {
            try
            {
                BuildEngine = new CBTBuildEngine();

                Log.LogMessage(MessageImportance.Low, "Generate module build package imports:");
                Log.LogMessage(MessageImportance.Low, $"  ModulePackagesConfig = {modulePackagesConfig}");
                Log.LogMessage(MessageImportance.Low, $"  PropsFile = {propsFile}");
                Log.LogMessage(MessageImportance.Low, $"  TargetsFile = {targetsFile}");
                Log.LogMessage(MessageImportance.Low, $"  Inputs = {String.Join(";", inputs)}");
                Log.LogMessage(MessageImportance.Low, $"  ModulePaths = {String.Join(";", modulePaths)}");

                if (NuGetRestore.IsFileUpToDate(Log, propsFile, inputs) && NuGetRestore.IsFileUpToDate(Log, targetsFile, inputs))
                {
                    Log.LogMessage(MessageImportance.Low, $"Module build package import files '{propsFile}' and '{targetsFile}' are up-to-date");
                    return(true);
                }

                ModulePackagesConfig = modulePackagesConfig;
                PropsFile            = propsFile;
                TargetsFile          = targetsFile;
                ModulePaths          = modulePaths;

                return(Execute());
            }
            catch (Exception e)
            {
                Log.LogError(e.ToString());
                return(false);
            }
        }
        public bool Execute(string packageRestoreFile, string[] inputs, string propsFile, string propertyVersionNamePrefix, string propertyPathNamePrefix, string restoreInfoFile = "")
        {
            try
            {
                BuildEngine = new CBTBuildEngine();
                Log.LogMessage(MessageImportance.Low, "Generate NuGet packages properties:");
                Log.LogMessage(MessageImportance.Low, $"  Inputs = {String.Join(";", inputs)}");
                Log.LogMessage(MessageImportance.Low, $"  PackageRestoreFile = {packageRestoreFile}");
                Log.LogMessage(MessageImportance.Low, $"  PropertyPathNamePrefix = {propertyPathNamePrefix}");
                Log.LogMessage(MessageImportance.Low, $"  PropertyVersionNamePrefix = {propertyVersionNamePrefix}");
                Log.LogMessage(MessageImportance.Low, $"  PropsFile = {propsFile}");
                Log.LogMessage(MessageImportance.Low, $"  RestoreInfoFile = {restoreInfoFile}");

                if (NuGetRestore.IsFileUpToDate(Log, propsFile, inputs))
                {
                    Log.LogMessage(MessageImportance.Low, $"NuGet package properties file '{propsFile}' is up-to-date");
                    return(true);
                }

                if (Directory.Exists(packageRestoreFile))
                {
                    Log.LogMessage(MessageImportance.Low, $"A directory with the name '{packageRestoreFile}' exist.  Please consider renaming this directory to avoid breaking NuGet convention.");
                    return(true);
                }

                PackageRestoreFile        = packageRestoreFile;
                Inputs                    = inputs;
                PropsFile                 = propsFile;
                PropertyVersionNamePrefix = propertyVersionNamePrefix;
                PropertyPathNamePrefix    = propertyPathNamePrefix;
                RestoreInfoFile           = restoreInfoFile;

                return(Execute());
            }
            catch (Exception e)
            {
                Log.LogError(e.ToString());
                return(false);
            }
        }