コード例 #1
0
        public string Bootstrap(SolutionConfiguration configuration)
        {
            var bootstrapper = _bootstrappers.Single(i => i.Version == configuration.NServiceBusVersion);

            var solutionSaver = new SolutionSaver(savePath: HttpContext.Server.MapPath("~/GeneratedSolutions/"), nugetExePath: HttpContext.Server.MapPath("~/NuGet.exe"));

            var zipFile = solutionSaver.CreateSolution(bootstrapper, configuration);

            var parts = zipFile.Split('\\');

            var guid = parts[parts.Length - 2];

            return guid;
        }
コード例 #2
0
 public void ProjectFinishedGenerating(Project project)
 {
     foreach (SolutionConfiguration solConfig in solution.SolutionBuild.SolutionConfigurations)
     {
         foreach (SolutionContext solutionContext in solConfig.SolutionContexts)
         {
             if (solutionContext.ProjectName.Contains(project.Name + "." + projectFileExtension) &&
                 solutionContext.PlatformName == buildPlatformName &&
                 solConfig.Name == buildConfigName)
             {
                 projSolutionContext = solutionContext;
                 solutionConfig = solConfig;
             }
         }
     }
 }
コード例 #3
0
 private static void CheckConfigAndGenCode(MappingConfiguration config, string pathSuffix, bool allPropertiesAndFieldsShouldBeMapped = true)
 {
     string missingMaps;
     var areAllMapsComplete = config.AreAllMapsComplete(out missingMaps, allPropertiesAndFieldsShouldBeMapped);
     Console.WriteLine("Is complete = " + areAllMapsComplete);
     if (!areAllMapsComplete)
     {
         Console.WriteLine("Missing maps = " + missingMaps);
     }
     else
     {
         var solutionConfiguration = new SolutionConfiguration(@"C:\src\temp\Generated\"+pathSuffix, "temp");
         var codeGenerationConfiguration = new CodeGenerationConfiguration();
         codeGenerationConfiguration.AddNullChecksForNestedPropertiesAndFields = false;
         codeGenerationConfiguration.DefineAMethodForEachPropertyOrFieldBeingMappedByAMapper = false;
         SolutionGenerator.GenerateOnlyMappers(solutionConfiguration, config, codeGenerationConfiguration);
     }
 }
コード例 #4
0
        private static SolutionConfiguration CreateBasicConfiguration()
        {
            var configuration = new SolutionConfiguration()
            {
                NServiceBusVersion = NServiceBusVersion.Five,
                Transport = Transport.Msmq,
                Serializer = Serializer.Json,
                EndpointConfigurations = new List<EndpointConfiguration>()
            };

            configuration.EndpointConfigurations.Add(new EndpointConfiguration()
            {
                NServiceBusVersion = configuration.NServiceBusVersion,
                Transport = configuration.Transport,
                Serializer = configuration.Serializer,
                Persistence = Persistence.InMemory,
                EndpointName = "SomeEndpoint",
                MessageHandlers = new List<MessageHandlerConfiguration>()
                {
                    new MessageHandlerConfiguration() {MessageTypeName = "SomeMessage"},
                    new MessageHandlerConfiguration() {MessageTypeName = "SomeEvent"},
                    new MessageHandlerConfiguration() {MessageTypeName = "BlahBlahMessage"},
                }
            });

            configuration.EndpointConfigurations.Add(new EndpointConfiguration()
            {
                NServiceBusVersion = configuration.NServiceBusVersion,
                Transport = configuration.Transport,
                Serializer = configuration.Serializer,
                Persistence = Persistence.InMemory,
                EndpointName = "SomeOtherEndpoint",
                MessageHandlers = new List<MessageHandlerConfiguration>()
                {
                    new MessageHandlerConfiguration() {MessageTypeName = "SomeEvent"},
                }
            });
            return configuration;
        }
        private static DataGridColumn CreateColumn(SolutionConfiguration solutionConfiguration)
        {
            Contract.Requires(solutionConfiguration != null);
            Contract.Ensures(Contract.Result<DataGridColumn>() != null);

            var path = @"ShouldBuild[" + solutionConfiguration.UniqueName + @"]";
            var binding = new Binding(path)
            {
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.TwoWay
            };

            var visualTree = new FrameworkElementFactory(typeof(CheckBox));
            visualTree.SetValue(ToggleButton.IsThreeStateProperty, true);
            visualTree.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);
            visualTree.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Center);
            visualTree.SetBinding(ToggleButton.IsCheckedProperty, binding);

            var column = new DataGridTemplateColumn
            {
                IsReadOnly = true,
                SortMemberPath = path,
                Header = new TextBlock
                {
                    Text = solutionConfiguration.UniqueName,
                    LayoutTransform = new RotateTransform(-90),
                },
                CellTemplate = new DataTemplate(typeof(ProjectConfiguration))
                {
                    VisualTree = visualTree
                }
            };

            column.SetValue(_solutionConfigurationProperty, solutionConfiguration);

            return column;
        }
コード例 #6
0
 public ShellSolutionConfiguration(SolutionConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #7
0
 internal TranspilationSolution(SolutionConfiguration configuration, params ITranslator[] translators)
 {
     Translators   = translators;
     Configuration = configuration;
 }
コード例 #8
0
        /// <summary>
        /// Helper to check the properties of a project and determine whether it can be run in VS.
        /// Projects that return true can be run in the debugger by pressing the usual Start Debugging (F5) command.
        /// </summary>
        public static bool IsProjectSuitable(Project Project)
        {
            try
            {
                Logging.WriteLine("IsProjectExecutable: Attempting to determine if project " + Project.Name + " is executable");

                var ConfigManager = Project.ConfigurationManager;
                if (ConfigManager == null)
                {
                    return(false);
                }

                var ActiveProjectConfig = Project.ConfigurationManager.ActiveConfiguration;
                if (ActiveProjectConfig != null)
                {
                    Logging.WriteLine(
                        "IsProjectExecutable: ActiveProjectConfig=\"" + ActiveProjectConfig.ConfigurationName + "|" + ActiveProjectConfig.PlatformName + "\"");
                }
                else
                {
                    Logging.WriteLine("IsProjectExecutable: Warning - ActiveProjectConfig is null!");
                }

                bool IsSuitable = false;

                if (Project.Kind.Equals(GuidList.VCSharpProjectKindGuidString, StringComparison.OrdinalIgnoreCase))
                {
                    // C# project

                    // Chris.Wood
                    //Property StartActionProp = GetProjectConfigProperty(Project, null, "StartAction");
                    //if (StartActionProp != null)
                    //{
                    //	prjStartAction StartAction = (prjStartAction)StartActionProp.Value;
                    //	if (StartAction == prjStartAction.prjStartActionProject)
                    //	{
                    //		// Project starts the project's output file when run
                    //		Property OutputTypeProp = GetProjectProperty(Project, "OutputType");
                    //		if (OutputTypeProp != null)
                    //		{
                    //			prjOutputType OutputType = (prjOutputType)OutputTypeProp.Value;
                    //			if (OutputType == prjOutputType.prjOutputTypeWinExe ||
                    //				OutputType == prjOutputType.prjOutputTypeExe)
                    //			{
                    //				IsSuitable = true;
                    //			}
                    //		}
                    //	}
                    //	else if (StartAction == prjStartAction.prjStartActionProgram ||
                    //			 StartAction == prjStartAction.prjStartActionURL)
                    //	{
                    //		// Project starts an external program or a URL when run - assume it has been set deliberately to something executable
                    //		IsSuitable = true;
                    //	}
                    //}

                    IsSuitable = true;
                }
                else if (Project.Kind.Equals(GuidList.VCProjectKindGuidString, StringComparison.OrdinalIgnoreCase))
                {
                    // C++ project

                    SolutionConfiguration SolutionConfig      = UnrealVSPackage.Instance.DTE.Solution.SolutionBuild.ActiveConfiguration;
                    SolutionContext       ProjectSolutionCtxt = SolutionConfig.SolutionContexts.Item(Project.UniqueName);

                    // Get the correct config object from the VCProject
                    string ActiveConfigName = string.Format(
                        "{0}|{1}",
                        ProjectSolutionCtxt.ConfigurationName,
                        ProjectSolutionCtxt.PlatformName);

                    // Get the VS version-specific VC project object.
                    VCProject VCProject = new VCProject(Project, ActiveConfigName);

                    if (VCProject != null)
                    {
                        // Sometimes the configurations is null.
                        if (VCProject.Configurations != null)
                        {
                            var VCConfigMatch = VCProject.Configurations.FirstOrDefault(VCConfig => VCConfig.Name == ActiveConfigName);

                            if (VCConfigMatch != null)
                            {
                                if (VCConfigMatch.DebugAttach)
                                {
                                    // Project attaches to a running process
                                    IsSuitable = true;
                                }
                                else
                                {
                                    // Project runs its own process

                                    if (VCConfigMatch.DebugFlavor == DebuggerFlavor.Remote)
                                    {
                                        // Project debugs remotely
                                        if (VCConfigMatch.DebugRemoteCommand.Length != 0)
                                        {
                                            // An remote program is specified to run
                                            IsSuitable = true;
                                        }
                                    }
                                    else
                                    {
                                        // Local debugger

                                        if (VCConfigMatch.DebugCommand.Length != 0 && VCConfigMatch.DebugCommand != "$(TargetPath)")
                                        {
                                            // An external program is specified to run
                                            IsSuitable = true;
                                        }
                                        else
                                        {
                                            // No command so the project runs the target file

                                            if (VCConfigMatch.ConfigType == ConfigType.Application)
                                            {
                                                IsSuitable = true;
                                            }
                                            else if (VCConfigMatch.ConfigType == ConfigType.Generic)
                                            {
                                                // Makefile

                                                if (VCConfigMatch.NMakeToolOutput.Length != 0)
                                                {
                                                    string Ext = Path.GetExtension(VCConfigMatch.NMakeToolOutput);
                                                    if (!IsLibraryFileExtension(Ext))
                                                    {
                                                        IsSuitable = true;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    // @todo: support other project types
                    Logging.WriteLine("IsProjectExecutable: Unrecognised 'Kind' in project " + Project.Name + " guid=" + Project.Kind);
                }

                return(IsSuitable);
            }
            catch (Exception ex)
            {
                Exception AppEx = new ApplicationException("IsProjectExecutable() failed", ex);
                Logging.WriteLine(AppEx.ToString());
                throw AppEx;
            }
        }
コード例 #9
0
        /// <summary>
        /// Registers the solution platforms supported by Xenko.
        /// </summary>
        internal static void RegisterSolutionPlatforms()
        {
            var solutionPlatforms = new List <SolutionPlatform>();

            // Define CoreCLR configurations
            var coreClrRelease = new SolutionConfiguration("CoreCLR_Release");
            var coreClrDebug   = new SolutionConfiguration("CoreCLR_Debug");

            coreClrDebug.IsDebug = true;
            // Add CoreCLR specific properties
            coreClrDebug.Properties.AddRange(new[]
            {
                "<XenkoRuntime Condition=\"'$(XenkoProjectType)' == 'Executable'\">CoreCLR</XenkoRuntime>",
                "<XenkoBuildDirExtension Condition=\"'$(XenkoBuildDirExtension)' == ''\">CoreCLR</XenkoBuildDirExtension>",
                "<DefineConstants>XENKO_RUNTIME_CORECLR;$(DefineConstants)</DefineConstants>"
            });
            coreClrRelease.Properties.AddRange(new[]
            {
                "<XenkoRuntime Condition=\"'$(XenkoProjectType)' == 'Executable'\">CoreCLR</XenkoRuntime>",
                "<XenkoBuildDirExtension Condition=\"'$(XenkoBuildDirExtension)' == ''\">CoreCLR</XenkoBuildDirExtension>",
                "<DefineConstants>XENKO_RUNTIME_CORECLR;$(DefineConstants)</DefineConstants>"
            });

            // Windows
            var windowsPlatform = new SolutionPlatform()
            {
                Name            = PlatformType.Windows.ToString(),
                IsAvailable     = true,
                Alias           = "Any CPU",
                TargetFramework = "net461",
                Type            = PlatformType.Windows
            };

            windowsPlatform.PlatformsPart.Add(new SolutionPlatformPart("Any CPU"));
            windowsPlatform.PlatformsPart.Add(new SolutionPlatformPart("Mixed Platforms")
            {
                Alias = "Any CPU"
            });
            windowsPlatform.DefineConstants.Add("XENKO_PLATFORM_WINDOWS");
            windowsPlatform.DefineConstants.Add("XENKO_PLATFORM_WINDOWS_DESKTOP");
            windowsPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            windowsPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));

            // Currently disabled
            //windowsPlatform.Configurations.Add(coreClrDebug);
            //windowsPlatform.Configurations.Add(coreClrRelease);
            foreach (var part in windowsPlatform.PlatformsPart)
            {
                part.Configurations.Clear();
                part.Configurations.AddRange(windowsPlatform.Configurations);
            }
            solutionPlatforms.Add(windowsPlatform);

            // Universal Windows Platform (UWP)
            var uwpPlatform = new SolutionPlatform()
            {
                Name            = PlatformType.UWP.ToString(),
                Type            = PlatformType.UWP,
                TargetFramework = "uap10.0",
                Templates       =
                {
                    //new SolutionPlatformTemplate("ProjectExecutable.UWP/CoreWindow/ProjectExecutable.UWP.ttproj", "Core Window"),
                    new SolutionPlatformTemplate("ProjectExecutable.UWP/Xaml/ProjectExecutable.UWP.ttproj", "Xaml")
                },
                IsAvailable        = IsVSComponentAvailableAnyVersion(UniversalWindowsPlatformComponents),
                UseWithExecutables = false,
                IncludeInSolution  = false,
            };

            uwpPlatform.DefineConstants.Add("XENKO_PLATFORM_WINDOWS");
            uwpPlatform.DefineConstants.Add("XENKO_PLATFORM_UWP");
            uwpPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            uwpPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            uwpPlatform.Configurations["Release"].Properties.Add("<NoWarn>;2008</NoWarn>");
            uwpPlatform.Configurations["Debug"].Properties.Add("<NoWarn>;2008</NoWarn>");
            uwpPlatform.Configurations["Testing"].Properties.Add("<NoWarn>;2008</NoWarn>");
            uwpPlatform.Configurations["AppStore"].Properties.Add("<NoWarn>;2008</NoWarn>");

            uwpPlatform.Configurations["Release"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
            uwpPlatform.Configurations["Testing"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
            uwpPlatform.Configurations["AppStore"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");

            foreach (var cpu in new[] { "x86", "x64", "ARM" })
            {
                var uwpPlatformCpu = new SolutionPlatformPart(uwpPlatform.Name + "-" + cpu)
                {
                    LibraryProjectName    = uwpPlatform.Name,
                    ExecutableProjectName = cpu,
                    Cpu = cpu,
                    InheritConfigurations = true,
                    UseWithLibraries      = false,
                    UseWithExecutables    = true,
                };
                uwpPlatformCpu.Configurations.Clear();
                uwpPlatformCpu.Configurations.AddRange(uwpPlatform.Configurations);

                uwpPlatform.PlatformsPart.Add(uwpPlatformCpu);
            }

            solutionPlatforms.Add(uwpPlatform);

            // Disabling Linux until we figure out what to do with Windows & Linux cross targeting the same framework
            if (false)
            {
                // Linux
                var linuxPlatform = new SolutionPlatform()
                {
                    Name            = PlatformType.Linux.ToString(),
                    IsAvailable     = true,
                    TargetFramework = "net461",
                    Type            = PlatformType.Linux,
                };
                linuxPlatform.DefineConstants.Add("XENKO_PLATFORM_UNIX");
                linuxPlatform.DefineConstants.Add("XENKO_PLATFORM_LINUX");
                linuxPlatform.Configurations.Add(coreClrRelease);
                linuxPlatform.Configurations.Add(coreClrDebug);
                solutionPlatforms.Add(linuxPlatform);
            }

            // Disabling macOS for time being
            if (false)
            {
                // macOS
                var macOSPlatform = new SolutionPlatform()
                {
                    Name            = PlatformType.macOS.ToString(),
                    IsAvailable     = true,
                    TargetFramework = "net461",
                    Type            = PlatformType.macOS,
                };
                macOSPlatform.DefineConstants.Add("XENKO_PLATFORM_UNIX");
                macOSPlatform.DefineConstants.Add("XENKO_PLATFORM_MACOS");
                macOSPlatform.Configurations.Add(coreClrRelease);
                macOSPlatform.Configurations.Add(coreClrDebug);
                solutionPlatforms.Add(macOSPlatform);
            }

            // Android
            var androidPlatform = new SolutionPlatform()
            {
                Name            = PlatformType.Android.ToString(),
                Type            = PlatformType.Android,
                TargetFramework = "monoandroid50",
                IsAvailable     = IsVSComponentAvailableAnyVersion(XamarinAndroidComponents)
            };

            androidPlatform.DefineConstants.Add("XENKO_PLATFORM_MONO_MOBILE");
            androidPlatform.DefineConstants.Add("XENKO_PLATFORM_ANDROID");
            androidPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            androidPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            androidPlatform.Configurations["Debug"].Properties.AddRange(new[]
            {
                "<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>",
                "<AndroidLinkMode>None</AndroidLinkMode>",
            });
            androidPlatform.Configurations["Release"].Properties.AddRange(new[]
            {
                "<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>",
                "<AndroidLinkMode>SdkOnly</AndroidLinkMode>",
            });
            androidPlatform.Configurations["Testing"].Properties.AddRange(androidPlatform.Configurations["Release"].Properties);
            androidPlatform.Configurations["AppStore"].Properties.AddRange(androidPlatform.Configurations["Release"].Properties);
            solutionPlatforms.Add(androidPlatform);

            // iOS: iPhone
            var iphonePlatform = new SolutionPlatform()
            {
                Name            = PlatformType.iOS.ToString(),
                SolutionName    = "iPhone", // For iOS, we need to use iPhone as a solution name
                Type            = PlatformType.iOS,
                TargetFramework = "xamarinios10",
                IsAvailable     = IsVSComponentAvailableAnyVersion(XamariniOSComponents)
            };

            iphonePlatform.PlatformsPart.Add(new SolutionPlatformPart("iPhoneSimulator"));
            iphonePlatform.DefineConstants.Add("XENKO_PLATFORM_MONO_MOBILE");
            iphonePlatform.DefineConstants.Add("XENKO_PLATFORM_IOS");
            iphonePlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            iphonePlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            var iPhoneCommonProperties = new List <string>
            {
                "<ConsolePause>false</ConsolePause>",
                "<MtouchUseSGen>True</MtouchUseSGen>",
                "<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>"
            };

            iphonePlatform.Configurations["Debug"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Debug"].Properties.AddRange(new []
            {
                "<MtouchDebug>True</MtouchDebug>",
                "<CodesignKey>iPhone Developer</CodesignKey>",
                "<MtouchUseSGen>True</MtouchUseSGen>",
            });
            iphonePlatform.Configurations["Release"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Release"].Properties.AddRange(new[]
            {
                "<CodesignKey>iPhone Developer</CodesignKey>",
            });
            iphonePlatform.Configurations["Testing"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Testing"].Properties.AddRange(new[]
            {
                "<MtouchDebug>True</MtouchDebug>",
                "<CodesignKey>iPhone Distribution</CodesignKey>",
                "<BuildIpa>True</BuildIpa>",
            });
            iphonePlatform.Configurations["AppStore"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["AppStore"].Properties.AddRange(new[]
            {
                "<CodesignKey>iPhone Distribution</CodesignKey>",
            });
            solutionPlatforms.Add(iphonePlatform);

            // iOS: iPhoneSimulator
            var iPhoneSimulatorPlatform = iphonePlatform.PlatformsPart["iPhoneSimulator"];

            iPhoneSimulatorPlatform.Configurations["Debug"].Properties.AddRange(new[]
            {
                "<MtouchDebug>True</MtouchDebug>",
                "<MtouchLink>None</MtouchLink>",
                "<MtouchArch>i386, x86_64</MtouchArch>"
            });
            iPhoneSimulatorPlatform.Configurations["Release"].Properties.AddRange(new[]
            {
                "<MtouchLink>None</MtouchLink>",
                "<MtouchArch>i386, x86_64</MtouchArch>"
            });

            AssetRegistry.RegisterSupportedPlatforms(solutionPlatforms);
        }
コード例 #10
0
        public object ReadFile(FilePath fileName, bool hasParentSolution, ProgressMonitor monitor)
        {
            FilePath     basePath = fileName.ParentDirectory;
            MonoMakefile mkfile   = new MonoMakefile(fileName);
            string       aname    = mkfile.GetVariable("LIBRARY");

            if (aname == null)
            {
                aname = mkfile.GetVariable("PROGRAM");
            }

            if (!string.IsNullOrEmpty(aname))
            {
                monitor.BeginTask("Loading '" + fileName + "'", 0);
                var project = Services.ProjectService.CreateProject("C#");
                project.FileName = fileName;

                var ext = new MonoMakefileProjectExtension();
                project.AttachExtension(ext);
                ext.Read(mkfile);

                monitor.EndTask();
                return(project);
            }

            string        subdirs;
            StringBuilder subdirsBuilder = new StringBuilder();

            subdirsBuilder.Append(mkfile.GetVariable("common_dirs"));
            if (subdirsBuilder.Length != 0)
            {
                subdirsBuilder.Append("\t");
                subdirsBuilder.Append(mkfile.GetVariable("net_2_0_dirs"));
            }
            if (subdirsBuilder.Length == 0)
            {
                subdirsBuilder.Append(mkfile.GetVariable("SUBDIRS"));
            }

            subdirs = subdirsBuilder.ToString();
            if (subdirs != null && (subdirs = subdirs.Trim(' ', '\t')) != "")
            {
                object         retObject;
                SolutionFolder folder;
                if (!hasParentSolution)
                {
                    Solution sol = new Solution();
                    sol.AttachExtension(new MonoMakefileSolutionExtension());
                    sol.FileName = fileName;
                    folder       = sol.RootFolder;
                    retObject    = sol;

                    foreach (string conf in MonoMakefile.MonoConfigurations)
                    {
                        SolutionConfiguration sc = new SolutionConfiguration(conf);
                        sol.Configurations.Add(sc);
                    }
                }
                else
                {
                    folder      = new SolutionFolder();
                    folder.Name = Path.GetFileName(Path.GetDirectoryName(fileName));
                    retObject   = folder;
                }

                subdirs = subdirs.Replace('\t', ' ');
                string[] dirs = subdirs.Split(' ');

                monitor.BeginTask("Loading '" + fileName + "'", dirs.Length);
                HashSet <string> added = new HashSet <string> ();
                foreach (string dir in dirs)
                {
                    if (!added.Add(dir))
                    {
                        continue;
                    }
                    monitor.Step(1);
                    if (dir == null)
                    {
                        continue;
                    }
                    string tdir = dir.Trim();
                    if (tdir == "")
                    {
                        continue;
                    }
                    string mfile = Path.Combine(Path.Combine(basePath, tdir), "Makefile");
                    if (File.Exists(mfile) && CanRead(mfile, typeof(SolutionItem)))
                    {
                        SolutionFolderItem it = (SolutionFolderItem)ReadFile(mfile, true, monitor);
                        folder.Items.Add(it);
                    }
                }
                monitor.EndTask();
                return(retObject);
            }
            return(null);
        }
コード例 #11
0
 public SolutionConfigurationNodeFactory(SolutionConfiguration configuration)
 {
     _configuration = configuration;
 }
コード例 #12
0
 public void PublishLayer_ComplexSolution_LayersGenerated(string framework, string sdkImage)
 {
     var root = NukeBuild.RootDirectory;
     var projects = new SolutionConfiguration
     {
         NugetConfig = new NugetConfiguration().Add("artifacts", "artifacts"),
         Projects =
         {
             new Project
             {
                 Name = "app1",
                 // SlnRelativeDir = ".",
                 Sdk = Sdks.Microsoft_NET_Sdk,
                 PropertyGroup = {OutputType = "exe", TargetFramework = framework},
             },
             new Project()
             {
                 Name = "classlib",
                 // SlnRelativeDir = ".",
                 Sdk = Sdks.Microsoft_NET_Sdk,
                 PropertyGroup = {TargetFramework = framework},
             }
         }
     }.Generate(_testDir);
     using var container = new Builder()
         .UseContainer()
         .UseImage(sdkImage)
         .Mount(_testDir, "/app", MountType.ReadWrite)
         .Build()
         .Start();
     
     var projectFile = projects
         .Where(x => x.Value.Name == "app1")
         .Select(x => x.Key)
         .First();
     DotNet($@"add {projectFile} reference ..{Path.DirectorySeparatorChar}classlib{Path.DirectorySeparatorChar}classlib.csproj", projectFile.Parent);
     DotNet($@"add {projectFile} package NMica -v {TestsSetup.NMicaVersion.NuGetPackageVersion} ");
     DotNet($@"add {projectFile} package Serilog -v 2.9.1-dev-01154 ");
     DotNet($@"add {projectFile} package Newtonsoft.Json -v 12.0.1 ");
     DotNetRestore(_ => _
         .SetProjectFile(projectFile));
     
     var cliPublishDir = _testDir / "cli-layers";
     DotNet($"msbuild /t:PublishLayer /p:PublishDir={cliPublishDir} /p:DockerLayer=All {projectFile} /p:GenerateDockerfile=False");
     AssertLayers(cliPublishDir);
     
     var msbuildPublishDir = _testDir / "msbuild-layers";
     MSBuildTasks.MSBuild(_ => _
         .SetProjectFile(projectFile)
         .SetTargets("PublishLayer")
         .AddProperty("PublishDir", msbuildPublishDir)
         .AddProperty("DockerLayer", "All")
         .AddProperty("GenerateDockerfile", false));
     AssertLayers(msbuildPublishDir);
     
     void AssertLayers(AbsolutePath publishDir)
     {
         FileExists(publishDir / "package" / "Newtonsoft.Json.dll").Should().BeTrue();
         FileExists(publishDir / "earlypackage" / "Serilog.dll").Should().BeTrue();
         FileExists(publishDir / "project" / "classlib.dll").Should().BeTrue();
         FileExists(publishDir / "app" / "app1.dll").Should().BeTrue();
     }
 }
コード例 #13
0
	    private void EnsureConfigurationPresent (string platform, ProtobuildStandardDefinition item)
	    {
	        var solutionConfig = Configurations[platform];
	        if (solutionConfig == null) {
                solutionConfig = new SolutionConfiguration(platform);
                Configurations.Add(solutionConfig);
	        }

	        var conf = solutionConfig.GetEntryForItem (item);
	        if (conf == null) {
	            solutionConfig.AddItem (item, true, platform);
	        }
	    }
コード例 #14
0
 public SolutionController(SolutionService <Solution> service, IHostingEnvironment environment, SolutionConfiguration configuration)
 {
     SolutionService    = service;
     HostingEnvironment = environment;
     Configuration      = configuration;
 }
コード例 #15
0
        public void Exec(string commandName,
                         EnvDTE.vsCommandExecOption executeOption,
                         ref object varIn,
                         ref object varOut,
                         ref bool handled)
        {
            try
            {
                handled = false;
                if (executeOption == EnvDTE.vsCommandExecOption.vsCommandExecOptionDoDefault)
                {
                    switch (commandName)
                    {
                    case Res.LaunchDesignerFullCommand:
                        handled = true;
                        extLoader.loadDesigner(null);
                        break;

                    case Res.LaunchLinguistFullCommand:
                        handled = true;
                        ExtLoader.loadLinguist(null);
                        break;

                    case Res.LaunchAssistantFullCommand:
                        handled = true;
                        ExtLoader.loadAssistant();
                        break;

                    case Res.ImportProFileFullCommand:
                        handled = true;
                        ExtLoader.ImportProFile();
                        break;

                    case Res.ImportPriFileFullCommand:
                        handled = true;
                        ExtLoader.ImportPriFile(HelperFunctions.GetSelectedQtProject(_applicationObject));
                        break;

                    case Res.ExportPriFileFullCommand:
                        handled = true;
                        ExtLoader.ExportPriFile();
                        break;

                    case Res.ExportProFileFullCommand:
                        handled = true;
                        ExtLoader.ExportProFile();
                        break;

                    case Res.ChangeSolutionQtVersionFullCommand:
                        QtVersionManager vManager = QtVersionManager.The();
                        if (formChangeQtVersion == null)
                        {
                            formChangeQtVersion = new FormChangeQtVersion();
                        }
                        formChangeQtVersion.UpdateContent(ChangeFor.Solution);
                        if (formChangeQtVersion.ShowDialog() == DialogResult.OK)
                        {
                            string newQtVersion = formChangeQtVersion.GetSelectedQtVersion();
                            if (newQtVersion != null)
                            {
                                string currentPlatform = null;
                                try
                                {
                                    SolutionConfiguration  config  = _applicationObject.Solution.SolutionBuild.ActiveConfiguration;
                                    SolutionConfiguration2 config2 = config as SolutionConfiguration2;
                                    currentPlatform = config2.PlatformName;
                                }
                                catch
                                {
                                }
                                if (string.IsNullOrEmpty(currentPlatform))
                                {
                                    return;
                                }

                                vManager.SetPlatform(currentPlatform);

                                foreach (Project project in HelperFunctions.ProjectsInSolution(_applicationObject))
                                {
                                    if (HelperFunctions.IsQt4Project(project))
                                    {
                                        string OldQtVersion = vManager.GetProjectQtVersion(project, currentPlatform);
                                        if (OldQtVersion == null)
                                        {
                                            OldQtVersion = vManager.GetDefaultVersion();
                                        }

                                        QtProject qtProject         = QtProject.Create(project);
                                        bool      newProjectCreated = false;
                                        qtProject.ChangeQtVersion(OldQtVersion, newQtVersion, ref newProjectCreated);
                                    }
                                }
                                vManager.SaveSolutionQtVersion(_applicationObject.Solution, newQtVersion);
                            }
                        }
                        break;

                    case Res.ProjectQtSettingsFullCommand:
                        handled = true;
                        EnvDTE.DTE dte = _applicationObject;
                        Project    pro = HelperFunctions.GetSelectedQtProject(dte);
                        if (pro != null)
                        {
                            if (formProjectQtSettings == null)
                            {
                                formProjectQtSettings = new FormProjectQtSettings();
                            }
                            formProjectQtSettings.SetProject(pro);
                            formProjectQtSettings.StartPosition = FormStartPosition.CenterParent;
                            MainWinWrapper ww = new MainWinWrapper(dte);
                            formProjectQtSettings.ShowDialog(ww);
                        }
                        else
                        {
                            MessageBox.Show(SR.GetString("NoProjectOpened"));
                        }
                        break;

                    case Res.ChangeProjectQtVersionFullCommand:
                        handled = true;
                        dte     = _applicationObject;
                        pro     = HelperFunctions.GetSelectedProject(dte);
                        if (pro != null && HelperFunctions.IsQMakeProject(pro))
                        {
                            if (formChangeQtVersion == null)
                            {
                                formChangeQtVersion = new FormChangeQtVersion();
                            }
                            formChangeQtVersion.UpdateContent(ChangeFor.Project);
                            MainWinWrapper ww = new MainWinWrapper(dte);
                            if (formChangeQtVersion.ShowDialog(ww) == DialogResult.OK)
                            {
                                string           qtVersion = formChangeQtVersion.GetSelectedQtVersion();
                                QtVersionManager vm        = QtVersionManager.The();
                                string           qtPath    = vm.GetInstallPath(qtVersion);
                                HelperFunctions.SetDebuggingEnvironment(pro, "PATH=" + qtPath + "\\bin;$(PATH)", true);
                            }
                        }
                        break;

                    case Res.VSQtOptionsFullCommand:
                        handled = true;
                        if (formQtVersions == null)
                        {
                            formQtVersions = new FormVSQtSettings();
                            formQtVersions.LoadSettings();
                        }
                        formQtVersions.StartPosition = FormStartPosition.CenterParent;
                        MainWinWrapper mww = new MainWinWrapper(_applicationObject);
                        if (formQtVersions.ShowDialog(mww) == DialogResult.OK)
                        {
                            formQtVersions.SaveSettings();
                        }
                        break;

                    case Res.CreateNewTranslationFileFullCommand:
                        handled = true;
                        pro     = HelperFunctions.GetSelectedQtProject(_applicationObject);
                        Translation.CreateNewTranslationFile(pro);
                        break;

                    case Res.CommandBarName + ".Connect.lupdate":
                        handled = true;
                        Translation.RunlUpdate(HelperFunctions.GetSelectedFiles(_applicationObject),
                                               HelperFunctions.GetSelectedQtProject(_applicationObject));
                        break;

                    case Res.CommandBarName + ".Connect.lrelease":
                        handled = true;
                        Translation.RunlRelease(HelperFunctions.GetSelectedFiles(_applicationObject));
                        break;

                    case Res.lupdateProjectFullCommand:
                        handled = true;
                        pro     = HelperFunctions.GetSelectedQtProject(Connect._applicationObject);
                        Translation.RunlUpdate(pro);
                        break;

                    case Res.lreleaseProjectFullCommand:
                        handled = true;
                        pro     = HelperFunctions.GetSelectedQtProject(Connect._applicationObject);
                        Translation.RunlRelease(pro);
                        break;

                    case Res.lupdateSolutionFullCommand:
                        handled = true;
                        Translation.RunlUpdate(Connect._applicationObject.Solution);
                        break;

                    case Res.lreleaseSolutionFullCommand:
                        handled = true;
                        Translation.RunlRelease(Connect._applicationObject.Solution);
                        break;

                    case Res.ConvertToQtFullCommand:
                    case Res.ConvertToQMakeFullCommand:
                        if (MessageBox.Show(SR.GetString("ConvertConfirmation"), SR.GetString("ConvertTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            handled = true;
                            dte     = _applicationObject;
                            pro     = HelperFunctions.GetSelectedProject(dte);
                            HelperFunctions.ToggleProjectKind(pro);
                        }
                        break;
                    }
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
            }
        }
コード例 #16
0
        // utility function for finding the correct order to process directories
        List <SolutionItem> CalculateSubDirOrder(AutotoolsContext ctx, SolutionFolder folder, SolutionConfiguration config)
        {
            List <SolutionItem> resultOrder     = new List <SolutionItem>();
            Set <SolutionItem>  dependenciesMet = new Set <SolutionItem>();
            Set <SolutionItem>  inResult        = new Set <SolutionItem>();

            // We don't have to worry about projects built in parent combines
            dependenciesMet.Union(ctx.GetBuiltProjects());

            bool   added;
            string notMet;

            do
            {
                added  = false;
                notMet = null;

                List <SolutionItem> items = new List <SolutionItem> ();
                GetSubItems(items, folder);

                foreach (SolutionItem item in items)
                {
                    Set <SolutionItem> references, provides;

                    if (inResult.Contains(item))
                    {
                        continue;
                    }

                    if (item is SolutionEntityItem)
                    {
                        SolutionEntityItem entry = (SolutionEntityItem)item;
                        if (!config.BuildEnabledForItem(entry))
                        {
                            continue;
                        }

                        references = new Set <SolutionItem> ();
                        provides   = new Set <SolutionItem>();
                        references.Union(entry.GetReferencedItems(config.Selector));
                        provides.Add(entry);
                    }
                    else if (item is SolutionFolder)
                    {
                        GetAllProjects((SolutionFolder)item, config, out provides, out references);
                    }
                    else
                    {
                        continue;
                    }

                    if (dependenciesMet.ContainsSet(references))
                    {
                        resultOrder.Add(item);
                        dependenciesMet.Union(provides);
                        inResult.Add(item);
                        added = true;
                    }
                    else
                    {
                        notMet = item.Name;
                    }
                }
            }while (added);

            if (notMet != null)
            {
                throw new Exception("Impossible to find a solution order that satisfies project references for '" + notMet + "'");
            }

            return(resultOrder);
        }
コード例 #17
0
        public int Run(string [] arguments)
        {
            Console.WriteLine("MonoDevelop Makefile generator");
            if (arguments.Length == 0)
            {
                ShowUsage();
                return(0);
            }

            // Parse arguments
            foreach (string s in arguments)
            {
                if (s == "--simple-makefiles" || s == "-s")
                {
                    generateAutotools = false;
                }
                else if (s.StartsWith("-d:"))
                {
                    if (s.Length > 3)
                    {
                        defaultConfig = s.Substring(3);
                    }
                }
                else if (s [0] == '-')
                {
                    Console.WriteLine(GettextCatalog.GetString("Error: Unknown option {0}", s));
                    return(1);
                }
                else
                {
                    if (filename != null)
                    {
                        Console.WriteLine(GettextCatalog.GetString("Error: Filename already specified - {0}, another filename '{1}' cannot be specified.", filename, s));
                        return(1);
                    }

                    filename = s;
                }
            }

            if (filename == null)
            {
                Console.WriteLine(GettextCatalog.GetString("Error: Solution file not specified."));
                ShowUsage();
                return(1);
            }

            Console.WriteLine(GettextCatalog.GetString("Loading solution file {0}", filename));
            ConsoleProgressMonitor monitor = new ConsoleProgressMonitor();

            Solution solution = Services.ProjectService.ReadWorkspaceItem(monitor, filename) as Solution;

            if (solution == null)
            {
                Console.WriteLine(GettextCatalog.GetString("Error: Makefile generation supported only for solutions.\n"));
                return(1);
            }

            if (defaultConfig == null || !CheckValidConfig(solution, defaultConfig))
            {
                Console.WriteLine(GettextCatalog.GetString("\nInvalid configuration {0}. Valid configurations : ", defaultConfig));
                for (int i = 0; i < solution.Configurations.Count; i++)
                {
                    SolutionConfiguration cc = (SolutionConfiguration)solution.Configurations [i];
                    Console.WriteLine("\t{0}. {1}", i + 1, cc.Id);
                }

                int configCount = solution.Configurations.Count;
                int op          = 0;
                do
                {
                    Console.Write(GettextCatalog.GetString("Select configuration : "));
                    string s = Console.ReadLine();
                    if (s.Length == 0)
                    {
                        return(1);
                    }
                    if (int.TryParse(s, out op))
                    {
                        if (op > 0 && op <= configCount)
                        {
                            break;
                        }
                    }
                } while (true);

                defaultConfig = solution.Configurations [op - 1].Id;
            }

            SolutionDeployer deployer = new SolutionDeployer(generateAutotools);

            if (deployer.HasGeneratedFiles(solution))
            {
                string msg = GettextCatalog.GetString("{0} already exist for this solution.  Would you like to overwrite them? (Y/N)",
                                                      generateAutotools ? "Autotools files" : "Makefiles");
                bool op = false;
                do
                {
                    Console.Write(msg);
                    string line = Console.ReadLine();
                    if (line.Length == 0)
                    {
                        return(1);
                    }

                    if (line.Length == 1)
                    {
                        if (line [0] == 'Y' || line [0] == 'y')
                        {
                            op = true;
                        }
                        else if (line [0] == 'N' || line [0] == 'n')
                        {
                            op = false;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (String.Compare(line, "YES", true) == 0)
                        {
                            op = true;
                        }
                        else if (String.Compare(line, "NO", true) == 0)
                        {
                            op = false;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    break;
                } while (true);
                if (!op)
                {
                    return(0);
                }
            }

            DeployContext ctx = new DeployContext(new TarballDeployTarget(), "Linux", null);

            try {
                deployer.GenerateFiles(ctx, solution, defaultConfig, monitor);
            }
            finally {
                ctx.Dispose();
                monitor.Dispose();
            }

            return(0);
        }
コード例 #18
0
ファイル: UnitTestBrowser.cs プロジェクト: powerumc/vutpp
        private void SetRunning(bool bRun)
        {
            if (bRun == true)
            {
                ActiveConfiguration = m_dte.Solution.SolutionBuild.ActiveConfiguration;
                if( WatchThread != null )
                    WatchThread.Interrupt();
                if( ParseThread != null )
                    ParseThread.Interrupt();
                progressBar.StartColor = progressBar.EndColor = Color.LimeGreen;
                progressBar.Value = 0;
                progressBar.Animate = true;
            }
            else
            {
                BuildList.Clear();
                RunList.Clear();

                RunningThread = null;

                CheckActivate();
                progressBar.Animate = false;
            }

            EnableControl(RefreshTestList, !bRun);
            EnableControl(RunAll, !bRun);
            EnableControl(RunSelected, !bRun);
            EnableControl(Stop, bRun);
            bRunning = bRun;
        }
コード例 #19
0
        /// <summary>
        /// Registers the solution platforms supported by Xenko.
        /// </summary>
        internal static void RegisterSolutionPlatforms()
        {
            var solutionPlatforms = new List <SolutionPlatform>();

            // Define CoreCLR configurations
            var coreClrRelease = new SolutionConfiguration("CoreCLR_Release");
            var coreClrDebug   = new SolutionConfiguration("CoreCLR_Debug");

            coreClrDebug.IsDebug = true;
            // Add CoreCLR specific properties
            coreClrDebug.Properties.AddRange(new[]
            {
                "<SiliconStudioRuntime Condition=\"'$(SiliconStudioProjectType)' == 'Executable'\">CoreCLR</SiliconStudioRuntime>",
                "<SiliconStudioBuildDirExtension Condition=\"'$(SiliconStudioBuildDirExtension)' == ''\">CoreCLR</SiliconStudioBuildDirExtension>",
                "<DefineConstants>SILICONSTUDIO_RUNTIME_CORECLR;$(DefineConstants)</DefineConstants>"
            });
            coreClrRelease.Properties.AddRange(new[]
            {
                "<SiliconStudioRuntime Condition=\"'$(SiliconStudioProjectType)' == 'Executable'\">CoreCLR</SiliconStudioRuntime>",
                "<SiliconStudioBuildDirExtension Condition=\"'$(SiliconStudioBuildDirExtension)' == ''\">CoreCLR</SiliconStudioBuildDirExtension>",
                "<DefineConstants>SILICONSTUDIO_RUNTIME_CORECLR;$(DefineConstants)</DefineConstants>"
            });

            // Windows
            var windowsPlatform = new SolutionPlatform()
            {
                Name        = PlatformType.Windows.ToString(),
                IsAvailable = true,
                Alias       = "Any CPU",
                Type        = PlatformType.Windows
            };

            windowsPlatform.PlatformsPart.Add(new SolutionPlatformPart("Any CPU"));
            windowsPlatform.PlatformsPart.Add(new SolutionPlatformPart("Mixed Platforms")
            {
                Alias = "Any CPU"
            });
            windowsPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS");
            windowsPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP");
            windowsPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            windowsPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            windowsPlatform.Configurations.Add(coreClrDebug);
            windowsPlatform.Configurations.Add(coreClrRelease);
            foreach (var part in windowsPlatform.PlatformsPart)
            {
                part.Configurations.Clear();
                part.Configurations.AddRange(windowsPlatform.Configurations);
            }
            solutionPlatforms.Add(windowsPlatform);

            // Windows Store
            var windowsStorePlatform = new SolutionPlatform()
            {
                Name               = PlatformType.WindowsStore.ToString(),
                DisplayName        = "Windows Store",
                Type               = PlatformType.WindowsStore,
                IsAvailable        = WindowsRuntimeBuild.Any(IsFileInProgramFilesx86Exist),
                UseWithExecutables = false,
                IncludeInSolution  = false,
            };

            windowsStorePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS");
            windowsStorePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME");
            windowsStorePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_STORE");
            windowsStorePlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            windowsStorePlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            windowsStorePlatform.Configurations["Release"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windowsStorePlatform.Configurations["Debug"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windowsStorePlatform.Configurations["Testing"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windowsStorePlatform.Configurations["AppStore"].Properties.Add("<NoWarn>;2008</NoWarn>");

            foreach (var cpu in new[] { "x86", "x64", "ARM" })
            {
                var windowsStorePlatformCpu = new SolutionPlatformPart(windowsStorePlatform.Name + "-" + cpu)
                {
                    LibraryProjectName    = windowsStorePlatform.Name,
                    ExecutableProjectName = cpu,
                    Cpu = cpu,
                    InheritConfigurations = true,
                    UseWithLibraries      = false,
                    UseWithExecutables    = true,
                };
                windowsStorePlatformCpu.Configurations.Clear();
                windowsStorePlatformCpu.Configurations.AddRange(windowsStorePlatform.Configurations);

                windowsStorePlatform.PlatformsPart.Add(windowsStorePlatformCpu);
            }

            solutionPlatforms.Add(windowsStorePlatform);

            // Windows 10
            var windows10Platform = new SolutionPlatform()
            {
                Name               = PlatformType.Windows10.ToString(),
                DisplayName        = "Windows 10",
                Type               = PlatformType.Windows10,
                IsAvailable        = IsFileInProgramFilesx86Exist(Windows10UniversalRuntimeBuild),
                UseWithExecutables = false,
                IncludeInSolution  = false,
            };

            windows10Platform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS");
            windows10Platform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME");
            windows10Platform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_10");
            windows10Platform.Configurations.Add(new SolutionConfiguration("Testing"));
            windows10Platform.Configurations.Add(new SolutionConfiguration("AppStore"));
            windows10Platform.Configurations["Release"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windows10Platform.Configurations["Debug"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windows10Platform.Configurations["Testing"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windows10Platform.Configurations["AppStore"].Properties.Add("<NoWarn>;2008</NoWarn>");

            windows10Platform.Configurations["Release"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
            windows10Platform.Configurations["Testing"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
            windows10Platform.Configurations["AppStore"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");

            foreach (var cpu in new[] { "x86", "x64", "ARM" })
            {
                var windows10PlatformCpu = new SolutionPlatformPart(windows10Platform.Name + "-" + cpu)
                {
                    LibraryProjectName    = windows10Platform.Name,
                    ExecutableProjectName = cpu,
                    Cpu = cpu,
                    InheritConfigurations = true,
                    UseWithLibraries      = false,
                    UseWithExecutables    = true,
                };
                windows10PlatformCpu.Configurations.Clear();
                windows10PlatformCpu.Configurations.AddRange(windows10Platform.Configurations);

                windows10Platform.PlatformsPart.Add(windows10PlatformCpu);
            }

            solutionPlatforms.Add(windows10Platform);

            // Windows Phone
            var windowsPhonePlatform = new SolutionPlatform()
            {
                Name               = PlatformType.WindowsPhone.ToString(),
                DisplayName        = "Windows Phone",
                Type               = PlatformType.WindowsPhone,
                IsAvailable        = WindowsRuntimeBuild.Any(IsFileInProgramFilesx86Exist),
                UseWithExecutables = false,
                IncludeInSolution  = false,
            };

            windowsPhonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS");
            windowsPhonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME");
            windowsPhonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_PHONE");
            windowsPhonePlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            windowsPhonePlatform.Configurations.Add(new SolutionConfiguration("AppStore"));

            windowsPhonePlatform.Configurations["Release"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windowsPhonePlatform.Configurations["Debug"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windowsPhonePlatform.Configurations["Testing"].Properties.Add("<NoWarn>;2008</NoWarn>");
            windowsPhonePlatform.Configurations["AppStore"].Properties.Add("<NoWarn>;2008</NoWarn>");

            foreach (var cpu in new[] { "x86", "ARM" })
            {
                var windowsPhonePlatformCpu = new SolutionPlatformPart(windowsPhonePlatform.Name + "-" + cpu)
                {
                    LibraryProjectName    = windowsPhonePlatform.Name,
                    ExecutableProjectName = cpu,
                    Cpu = cpu,
                    InheritConfigurations = true,
                    UseWithLibraries      = false,
                    UseWithExecutables    = true
                };
                windowsPhonePlatformCpu.Configurations.Clear();
                windowsPhonePlatformCpu.Configurations.AddRange(windowsPhonePlatform.Configurations);

                windowsPhonePlatform.PlatformsPart.Add(windowsPhonePlatformCpu);
            }

            solutionPlatforms.Add(windowsPhonePlatform);

            // Linux
            var linuxPlatform = new SolutionPlatform()
            {
                Name        = PlatformType.Linux.ToString(),
                IsAvailable = true,
                Type        = PlatformType.Linux,
            };

            linuxPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_UNIX");
            linuxPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_LINUX");
            linuxPlatform.Configurations.Add(coreClrRelease);
            linuxPlatform.Configurations.Add(coreClrDebug);
            solutionPlatforms.Add(linuxPlatform);

            // Disabling macOS for time being
            if (false)
            {
                // macOS
                var macOSPlatform = new SolutionPlatform()
                {
                    Name        = PlatformType.macOS.ToString(),
                    IsAvailable = true,
                    Type        = PlatformType.macOS,
                };
                macOSPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_UNIX");
                macOSPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_MACOS");
                macOSPlatform.Configurations.Add(coreClrRelease);
                macOSPlatform.Configurations.Add(coreClrDebug);
                solutionPlatforms.Add(macOSPlatform);
            }

            // Android
            var androidPlatform = new SolutionPlatform()
            {
                Name        = PlatformType.Android.ToString(),
                Type        = PlatformType.Android,
                IsAvailable = IsFileInProgramFilesx86Exist(XamarinAndroidBuild)
            };

            androidPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_MONO_MOBILE");
            androidPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_ANDROID");
            androidPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            androidPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            androidPlatform.Configurations["Debug"].Properties.AddRange(new[]
            {
                "<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>",
                "<AndroidLinkMode>None</AndroidLinkMode>",
            });
            androidPlatform.Configurations["Release"].Properties.AddRange(new[]
            {
                "<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>",
                "<AndroidLinkMode>SdkOnly</AndroidLinkMode>",
            });
            androidPlatform.Configurations["Testing"].Properties.AddRange(androidPlatform.Configurations["Release"].Properties);
            androidPlatform.Configurations["AppStore"].Properties.AddRange(androidPlatform.Configurations["Release"].Properties);
            solutionPlatforms.Add(androidPlatform);

            // iOS: iPhone
            var iphonePlatform = new SolutionPlatform()
            {
                Name         = PlatformType.iOS.ToString(),
                SolutionName = "iPhone", // For iOS, we need to use iPhone as a solution name
                Type         = PlatformType.iOS,
                IsAvailable  = IsFileInProgramFilesx86Exist(XamariniOSBuild)
            };

            iphonePlatform.PlatformsPart.Add(new SolutionPlatformPart("iPhoneSimulator"));
            iphonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_MONO_MOBILE");
            iphonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_IOS");
            iphonePlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            iphonePlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            var iPhoneCommonProperties = new List <string>
            {
                "<ConsolePause>false</ConsolePause>",
                "<MtouchUseSGen>True</MtouchUseSGen>",
                "<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>"
            };

            iphonePlatform.Configurations["Debug"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Debug"].Properties.AddRange(new []
            {
                "<MtouchDebug>True</MtouchDebug>",
                "<CodesignKey>iPhone Developer</CodesignKey>",
                "<MtouchUseSGen>True</MtouchUseSGen>",
            });
            iphonePlatform.Configurations["Release"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Release"].Properties.AddRange(new[]
            {
                "<CodesignKey>iPhone Developer</CodesignKey>",
            });
            iphonePlatform.Configurations["Testing"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Testing"].Properties.AddRange(new[]
            {
                "<MtouchDebug>True</MtouchDebug>",
                "<CodesignKey>iPhone Distribution</CodesignKey>",
                "<BuildIpa>True</BuildIpa>",
            });
            iphonePlatform.Configurations["AppStore"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["AppStore"].Properties.AddRange(new[]
            {
                "<CodesignKey>iPhone Distribution</CodesignKey>",
            });
            solutionPlatforms.Add(iphonePlatform);

            // iOS: iPhoneSimulator
            var iPhoneSimulatorPlatform = iphonePlatform.PlatformsPart["iPhoneSimulator"];

            iPhoneSimulatorPlatform.Configurations["Debug"].Properties.AddRange(new[]
            {
                "<MtouchDebug>True</MtouchDebug>",
                "<MtouchLink>None</MtouchLink>",
                "<MtouchArch>i386, x86_64</MtouchArch>"
            });
            iPhoneSimulatorPlatform.Configurations["Release"].Properties.AddRange(new[]
            {
                "<MtouchLink>None</MtouchLink>",
                "<MtouchArch>i386, x86_64</MtouchArch>"
            });

            AssetRegistry.RegisterSupportedPlatforms(solutionPlatforms);
        }
コード例 #20
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        internal static int Edit(SolutionConfiguration model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SolutionConfiguration set ");

            strSql.Append(" CreateTime = @CreateTime , ");
            strSql.Append(" CreateBy = @CreateBy , ");
            strSql.Append(" ModifyTime = @ModifyTime , ");
            strSql.Append(" ModifyBy = @ModifyBy , ");
            strSql.Append(" IsDelete = @IsDelete , ");
            strSql.Append(" SolutionId = @SolutionId , ");
            strSql.Append(" SolutionName = @SolutionName , ");
            strSql.Append(" Version = @Version , ");
            strSql.Append(" IsFile = @IsFile , ");
            strSql.Append(" Content = @Content , ");
            strSql.Append(" Enable = @Enable , ");
            strSql.Append(" Environment = @Environment , ");
            strSql.Append(" IsRemote = @IsRemote  ");
            strSql.Append(" where ID=@ID ");

            List <DbParameter> parameters = new List <DbParameter>();

            parameters.Add(new MdsDbParameter("@ID", DbType.Int32, 11));

            parameters.Add(new MdsDbParameter("@CreateTime", DbType.DateTime));

            parameters.Add(new MdsDbParameter("@CreateBy", DbType.Int32, 11));

            parameters.Add(new MdsDbParameter("@ModifyTime", DbType.DateTime));

            parameters.Add(new MdsDbParameter("@ModifyBy", DbType.Int32, 11));

            parameters.Add(new MdsDbParameter("@IsDelete", DbType.Boolean));

            parameters.Add(new MdsDbParameter("@SolutionId", DbType.String, 64));

            parameters.Add(new MdsDbParameter("@SolutionName", DbType.String, 200));

            parameters.Add(new MdsDbParameter("@Version", DbType.Int32, 11));

            parameters.Add(new MdsDbParameter("@IsFile", DbType.Boolean));

            parameters.Add(new MdsDbParameter("@Content", DbType.String));

            parameters.Add(new MdsDbParameter("@Enable", DbType.Boolean));

            parameters.Add(new MdsDbParameter("@Environment", DbType.Int32, 11));

            parameters.Add(new MdsDbParameter("@IsRemote", DbType.Boolean));



            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.CreateTime;
            parameters[2].Value  = model.CreateBy;
            parameters[3].Value  = model.ModifyTime;
            parameters[4].Value  = model.ModifyBy;
            parameters[5].Value  = model.IsDelete;
            parameters[6].Value  = model.SolutionId;
            parameters[7].Value  = model.SolutionName;
            parameters[8].Value  = model.Version;
            parameters[9].Value  = model.IsFile;
            parameters[10].Value = model.Content;
            parameters[11].Value = model.Enable;
            parameters[12].Value = model.Environment;
            parameters[13].Value = model.IsRemote;
            return(_dalService.ExecuteNonQuery(parameters, strSql.ToString()));
        }
コード例 #21
0
        /// <inheritdoc />
        public override void GenerateSolution(Solution solution)
        {
            // Try to extract info from the existing solution file to make random IDs stable
            var solutionId = Guid.NewGuid();
            var folderIds  = new Dictionary <string, Guid>();

            if (File.Exists(solution.Path))
            {
                try
                {
                    var contents = File.ReadAllText(solution.Path);

                    var solutionIdMatch = Regex.Match(contents, "SolutionGuid = \\{(.*?)\\}");
                    if (solutionIdMatch.Success)
                    {
                        var value = solutionIdMatch.Value;
                        solutionId = Guid.ParseExact(value.Substring(15), "B");
                    }

                    var folderIdsMatch = Regex.Match(contents, "Project\\(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\"\\) = \"(.*?)\", \"(.*?)\", \"{(.*?)}\"");
                    if (folderIdsMatch.Success)
                    {
                        foreach (Capture capture in folderIdsMatch.Captures)
                        {
                            var value    = capture.Value.Substring("Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"".Length);
                            var folder   = value.Substring(0, value.IndexOf('\"'));
                            var folderId = Guid.ParseExact(value.Substring(folder.Length * 2 + "\", \"".Length + "\", \"".Length, 38), "B");
                            folderIds["Source\\" + folder] = folderId;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Warning("Failed to restore solution and solution folders identifiers from existing file.");
                    Log.Exception(ex);
                }
            }

            StringBuilder vcSolutionFileContent = new StringBuilder();
            var           solutionDirectory     = Path.GetDirectoryName(solution.Path);
            var           projects = solution.Projects.Cast <VisualStudioProject>().ToArray();

            // Header
            if (Version == VisualStudioVersion.VisualStudio2022)
            {
                vcSolutionFileContent.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
                vcSolutionFileContent.AppendLine("# Visual Studio Version 17");
                vcSolutionFileContent.AppendLine("VisualStudioVersion = 17.0.31314.256");
                vcSolutionFileContent.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");
            }
            else if (Version == VisualStudioVersion.VisualStudio2019)
            {
                vcSolutionFileContent.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
                vcSolutionFileContent.AppendLine("# Visual Studio Version 16");
                vcSolutionFileContent.AppendLine("VisualStudioVersion = 16.0.28315.86");
                vcSolutionFileContent.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");
            }
            else if (Version == VisualStudioVersion.VisualStudio2017)
            {
                vcSolutionFileContent.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
                vcSolutionFileContent.AppendLine("# Visual Studio 15");
                vcSolutionFileContent.AppendLine("VisualStudioVersion = 15.0.25807.0");
                vcSolutionFileContent.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");
            }
            else if (Version == VisualStudioVersion.VisualStudio2015)
            {
                vcSolutionFileContent.AppendLine("Microsoft Visual Studio Solution File, Format Version 12.00");
                vcSolutionFileContent.AppendLine("# Visual Studio 14");
                vcSolutionFileContent.AppendLine("VisualStudioVersion = 14.0.22310.1");
                vcSolutionFileContent.AppendLine("MinimumVisualStudioVersion = 10.0.40219.1");
            }
            else
            {
                throw new Exception("Unsupported solution file format.");
            }

            // Solution folders
            var folderNames = new HashSet <string>();

            {
                // Move projects to subfolders based on group names including subfolders to match the location of the source in the workspace
                foreach (var project in projects)
                {
                    var folder = project.GroupName;

                    if (project.SourceDirectories != null && project.SourceDirectories.Count == 1)
                    {
                        var subFolder = Utilities.MakePathRelativeTo(Path.GetDirectoryName(project.SourceDirectories[0]), project.WorkspaceRootPath);
                        if (subFolder.StartsWith("Source\\"))
                        {
                            subFolder = subFolder.Substring(7);
                        }
                        if (subFolder.Length != 0)
                        {
                            if (folder.Length != 0)
                            {
                                folder += '\\';
                            }
                            folder += subFolder;
                        }
                    }

                    if (string.IsNullOrEmpty(folder))
                    {
                        continue;
                    }

                    var folderParents = folder.Split('\\');
                    for (int i = 0; i < folderParents.Length; i++)
                    {
                        var folderPath = folderParents[0];
                        for (int j = 1; j <= i; j++)
                        {
                            folderPath += '\\' + folderParents[j];
                        }

                        if (folderNames.Contains(folderPath))
                        {
                            project.FolderGuid = folderIds[folderPath];
                        }
                        else
                        {
                            if (!folderIds.TryGetValue(folderPath, out project.FolderGuid))
                            {
                                project.FolderGuid = Guid.NewGuid();
                                folderIds.Add(folderPath, project.FolderGuid);
                            }
                            folderNames.Add(folderPath);
                        }
                    }
                }

                foreach (var folder in folderNames)
                {
                    var folderGuid = folderIds[folder].ToString("B").ToUpperInvariant();
                    var typeGuid   = ProjectTypeGuids.ToOption(ProjectTypeGuids.SolutionFolder);
                    var lastSplit  = folder.LastIndexOf('\\');
                    var name       = lastSplit != -1 ? folder.Substring(lastSplit + 1) : folder;

                    vcSolutionFileContent.AppendLine(string.Format("Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"", typeGuid, name, name, folderGuid));
                    vcSolutionFileContent.AppendLine("EndProject");
                }
            }

            // Solution projects
            foreach (var project in projects)
            {
                var projectId = project.ProjectGuid.ToString("B").ToUpperInvariant();
                var typeGuid  = ProjectTypeGuids.ToOption(project.ProjectTypeGuid);

                vcSolutionFileContent.AppendLine(string.Format("Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"", typeGuid, project.Name, Utilities.MakePathRelativeTo(project.Path, solutionDirectory), projectId));

                if (project.Dependencies.Count > 0)
                {
                    vcSolutionFileContent.AppendLine("\tProjectSection(ProjectDependencies) = postProject");
                    foreach (var dependency in project.Dependencies.Cast <VisualStudioProject>())
                    {
                        string dependencyId = dependency.ProjectGuid.ToString("B").ToUpperInvariant();
                        vcSolutionFileContent.AppendLine("\t\t" + dependencyId + " = " + dependencyId);
                    }

                    vcSolutionFileContent.AppendLine("\tEndProjectSection");
                }

                vcSolutionFileContent.AppendLine("EndProject");
            }

            // Global configuration
            {
                vcSolutionFileContent.AppendLine("Global");

                // Collect all unique configurations
                var configurations = new HashSet <SolutionConfiguration>();
                foreach (var project in projects)
                {
                    if (project.Configurations == null || project.Configurations.Count == 0)
                    {
                        throw new Exception("Missing configurations for project " + project.Name);
                    }

                    foreach (var configuration in project.Configurations)
                    {
                        configurations.Add(new SolutionConfiguration(configuration));
                    }
                }

                // Add missing configurations (Visual Studio needs all permutations of configuration/platform pair)
                var configurationNames = configurations.Select(x => x.Configuration).Distinct().ToArray();
                var platformNames      = configurations.Select(x => x.Platform).Distinct().ToArray();
                foreach (var configurationName in configurationNames)
                {
                    foreach (var platformName in platformNames)
                    {
                        configurations.Add(new SolutionConfiguration(configurationName, platformName));
                    }
                }

                // Sort configurations
                var configurationsSorted = new List <SolutionConfiguration>(configurations);
                configurationsSorted.Sort();

                // Global configurations
                {
                    vcSolutionFileContent.AppendLine("	GlobalSection(SolutionConfigurationPlatforms) = preSolution");

                    foreach (var configuration in configurationsSorted)
                    {
                        vcSolutionFileContent.AppendLine("		"+ configuration.Name + " = " + configuration.Name);
                    }

                    vcSolutionFileContent.AppendLine("	EndGlobalSection");
                }

                // Per-project configurations mapping
                {
                    vcSolutionFileContent.AppendLine("	GlobalSection(ProjectConfigurationPlatforms) = postSolution");

                    foreach (var project in projects)
                    {
                        string projectId = project.ProjectGuid.ToString("B").ToUpperInvariant();

                        foreach (var configuration in configurationsSorted)
                        {
                            SolutionConfiguration projectConfiguration;
                            bool build = false;
                            int  firstFullMatch = -1, firstPlatformMatch = -1;
                            for (int i = 0; i < project.Configurations.Count; i++)
                            {
                                var e = new SolutionConfiguration(project.Configurations[i]);
                                if (e.Name == configuration.Name)
                                {
                                    firstFullMatch = i;
                                    break;
                                }
                                if (firstPlatformMatch == -1 && e.Platform == configuration.Platform)
                                {
                                    firstPlatformMatch = i;
                                }
                            }
                            if (firstFullMatch != -1)
                            {
                                projectConfiguration = configuration;
                                build = solution.MainProject == project || (solution.MainProject == null && project.Name == solution.Name);
                            }
                            else if (firstPlatformMatch != -1)
                            {
                                projectConfiguration = new SolutionConfiguration(project.Configurations[firstPlatformMatch]);
                            }
                            else
                            {
                                projectConfiguration = new SolutionConfiguration(project.Configurations[0]);
                            }

                            vcSolutionFileContent.AppendLine(string.Format("		{0}.{1}.ActiveCfg = {2}", projectId, configuration.Name, projectConfiguration.OriginalName));
                            if (build)
                            {
                                vcSolutionFileContent.AppendLine(string.Format("		{0}.{1}.Build.0 = {2}", projectId, configuration.Name, projectConfiguration.OriginalName));
                            }
                        }
                    }

                    vcSolutionFileContent.AppendLine("	EndGlobalSection");
                }

                // Always show solution root node
                {
                    vcSolutionFileContent.AppendLine("	GlobalSection(SolutionProperties) = preSolution");
                    vcSolutionFileContent.AppendLine("		HideSolutionNode = FALSE");
                    vcSolutionFileContent.AppendLine("	EndGlobalSection");
                }

                // Solution directory hierarchy
                {
                    vcSolutionFileContent.AppendLine("	GlobalSection(NestedProjects) = preSolution");

                    // Write nested folders hierarchy
                    foreach (var folder in folderNames)
                    {
                        var lastSplit = folder.LastIndexOf('\\');
                        if (lastSplit != -1)
                        {
                            var folderGuid       = folderIds[folder].ToString("B").ToUpperInvariant();
                            var parentFolder     = folder.Substring(0, lastSplit);
                            var parentFolderGuid = folderIds[parentFolder].ToString("B").ToUpperInvariant();
                            vcSolutionFileContent.AppendLine(string.Format("		{0} = {1}", folderGuid, parentFolderGuid));
                        }
                    }

                    // Write mapping for projectId - folderId
                    foreach (var project in projects)
                    {
                        if (project.FolderGuid != Guid.Empty)
                        {
                            var projectGuidString = project.ProjectGuid.ToString("B").ToUpperInvariant();
                            var folderGuidString  = project.FolderGuid.ToString("B").ToUpperInvariant();
                            vcSolutionFileContent.AppendLine(string.Format("		{0} = {1}", projectGuidString, folderGuidString));
                        }
                    }

                    vcSolutionFileContent.AppendLine("	EndGlobalSection");
                }

                // Solution identifier
                {
                    vcSolutionFileContent.AppendLine("	GlobalSection(ExtensibilityGlobals) = postSolution");
                    vcSolutionFileContent.AppendLine(string.Format("		SolutionGuid = {0}", solutionId.ToString("B").ToUpperInvariant()));
                    vcSolutionFileContent.AppendLine("	EndGlobalSection");
                }

                vcSolutionFileContent.AppendLine("EndGlobal");
            }

            // Save the file
            Utilities.WriteFileIfChanged(solution.Path, vcSolutionFileContent.ToString());
        }
コード例 #22
0
 private string CreateIdentifier(SolutionConfiguration solutionConfiguration)
 {
     return(!string.IsNullOrWhiteSpace(solutionConfiguration?.StorageIdentifier)
         ? $"{solutionConfiguration.StorageIdentifier}_{ CreateDateIdentifier()}_{(int)solutionConfiguration.AreaTags}{_buildId}"
         : null);
 }
コード例 #23
0
        public object ReadFile(FilePath fileName, bool hasParentSolution, IProgressMonitor monitor)
        {
            FilePath     basePath = fileName.ParentDirectory;
            MonoMakefile mkfile   = new MonoMakefile(fileName);
            string       aname    = mkfile.GetVariable("LIBRARY");

            if (aname == null)
            {
                aname = mkfile.GetVariable("PROGRAM");
            }

            try
            {
                ProjectExtensionUtil.BeginLoadOperation();
                if (aname != null)
                {
                    // It is a project
                    monitor.BeginTask("Loading '" + fileName + "'", 0);
                    DotNetAssemblyProject   project = new DotNetAssemblyProject("C#");
                    MonoSolutionItemHandler handler = new MonoSolutionItemHandler(project);
                    ProjectExtensionUtil.InstallHandler(handler, project);
                    project.Name = Path.GetFileName(basePath);
                    handler.Read(mkfile);
                    monitor.EndTask();
                    return(project);
                }
                else
                {
                    string        subdirs;
                    StringBuilder subdirsBuilder = new StringBuilder();
                    subdirsBuilder.Append(mkfile.GetVariable("common_dirs"));
                    if (subdirsBuilder.Length != 0)
                    {
                        subdirsBuilder.Append("\t");
                        subdirsBuilder.Append(mkfile.GetVariable("net_2_0_dirs"));
                    }
                    if (subdirsBuilder.Length == 0)
                    {
                        subdirsBuilder.Append(mkfile.GetVariable("SUBDIRS"));
                    }

                    subdirs = subdirsBuilder.ToString();
                    if (subdirs != null && (subdirs = subdirs.Trim(' ', '\t')) != "")
                    {
                        object         retObject;
                        SolutionFolder folder;
                        if (!hasParentSolution)
                        {
                            Solution sol = new Solution();
                            sol.ConvertToFormat(Services.ProjectService.FileFormats.GetFileFormat("MonoMakefile"), false);
                            sol.FileName = fileName;
                            folder       = sol.RootFolder;
                            retObject    = sol;

                            foreach (string conf in MonoMakefileFormat.Configurations)
                            {
                                SolutionConfiguration sc = new SolutionConfiguration(conf);
                                sol.Configurations.Add(sc);
                            }
                        }
                        else
                        {
                            folder      = new SolutionFolder();
                            folder.Name = Path.GetFileName(Path.GetDirectoryName(fileName));
                            retObject   = folder;
                        }

                        subdirs = subdirs.Replace('\t', ' ');
                        string[] dirs = subdirs.Split(' ');

                        monitor.BeginTask("Loading '" + fileName + "'", dirs.Length);
                        Hashtable added = new Hashtable();
                        foreach (string dir in dirs)
                        {
                            if (added.Contains(dir))
                            {
                                continue;
                            }
                            added.Add(dir, dir);
                            monitor.Step(1);
                            if (dir == null)
                            {
                                continue;
                            }
                            string tdir = dir.Trim();
                            if (tdir == "")
                            {
                                continue;
                            }
                            string mfile = Path.Combine(Path.Combine(basePath, tdir), "Makefile");
                            if (File.Exists(mfile) && CanReadFile(mfile, typeof(SolutionItem)))
                            {
                                SolutionItem it = (SolutionItem)ReadFile(mfile, true, monitor);
                                folder.Items.Add(it);
                            }
                        }
                        monitor.EndTask();
                        return(retObject);
                    }
                }
            }
            finally
            {
                ProjectExtensionUtil.EndLoadOperation();
            }
            return(null);
        }
コード例 #24
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            base.BuildNode(treeBuilder, dataObject, nodeInfo);

            Project p = dataObject as Project;

            string escapedProjectName = GLib.Markup.EscapeText(p.Name);

            if (p is DotNetProject && ((DotNetProject)p).LanguageBinding == null)
            {
                nodeInfo.Icon           = Context.GetIcon(Stock.Project);
                nodeInfo.Label          = escapedProjectName;
                nodeInfo.StatusSeverity = TaskSeverity.Error;
                nodeInfo.StatusMessage  = GettextCatalog.GetString("Unknown language '{0}'", ((DotNetProject)p).LanguageName);
                nodeInfo.DisabledStyle  = true;
                return;
            }
            else if (p is UnknownProject)
            {
                var up = (UnknownProject)p;
                nodeInfo.StatusSeverity = TaskSeverity.Warning;
                nodeInfo.StatusMessage  = up.UnsupportedProjectMessage.TrimEnd('.');
                nodeInfo.Label          = escapedProjectName;
                nodeInfo.DisabledStyle  = true;
                nodeInfo.Icon           = Context.GetIcon(p.StockIcon);
                return;
            }

            nodeInfo.Icon = Context.GetIcon(p.StockIcon);
            var sc = p.ParentSolution?.StartupConfiguration;

            if (sc != null && IsStartupProject(p, sc))
            {
                nodeInfo.Label = "<b>" + escapedProjectName + "</b>";
            }
            else
            {
                nodeInfo.Label = escapedProjectName;
            }

            // Gray out the project name if it is not selected in the current build configuration

            SolutionConfiguration      conf = p.ParentSolution.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
            SolutionConfigurationEntry ce   = null;
            bool noMapping     = conf == null || (ce = conf.GetEntryForItem(p)) == null;
            bool missingConfig = false;

            if (p.SupportsBuild() && (noMapping || !ce.Build || (missingConfig = p.Configurations [ce.ItemConfiguration] == null)))
            {
                nodeInfo.DisabledStyle = true;
                if (missingConfig)
                {
                    nodeInfo.StatusSeverity = TaskSeverity.Error;
                    nodeInfo.StatusMessage  = GettextCatalog.GetString("Invalid configuration mapping");
                }
                else
                {
                    nodeInfo.StatusSeverity = TaskSeverity.Information;
                    nodeInfo.StatusMessage  = GettextCatalog.GetString("Project not built in active configuration");
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// Registers the solution platforms supported by Xenko.
        /// </summary>
        internal static void RegisterSolutionPlatforms()
        {
            var solutionPlatforms = new List<SolutionPlatform>();

            // Define CoreCLR configurations
            var coreClrRelease = new SolutionConfiguration("CoreCLR_Release");
            var coreClrDebug = new SolutionConfiguration("CoreCLR_Debug");
            coreClrDebug.IsDebug = true;
            // Add CoreCLR specific properties
            coreClrDebug.Properties.AddRange(new[]
            {
                "<SiliconStudioRuntime Condition=\"'$(SiliconStudioProjectType)' == 'Executable'\">CoreCLR</SiliconStudioRuntime>",
                "<SiliconStudioBuildDirExtension Condition=\"'$(SiliconStudioBuildDirExtension)' == ''\">CoreCLR</SiliconStudioBuildDirExtension>",
                "<DefineConstants>SILICONSTUDIO_RUNTIME_CORECLR;$(DefineConstants)</DefineConstants>"
            });
            coreClrRelease.Properties.AddRange(new[]
            {
                "<SiliconStudioRuntime Condition=\"'$(SiliconStudioProjectType)' == 'Executable'\">CoreCLR</SiliconStudioRuntime>",
                "<SiliconStudioBuildDirExtension Condition=\"'$(SiliconStudioBuildDirExtension)' == ''\">CoreCLR</SiliconStudioBuildDirExtension>",
                "<DefineConstants>SILICONSTUDIO_RUNTIME_CORECLR;$(DefineConstants)</DefineConstants>"
            });

            // Windows
            var windowsPlatform = new SolutionPlatform()
                {
                    Name = PlatformType.Windows.ToString(),
                    IsAvailable = true,
                    Alias = "Any CPU",
                    Type = PlatformType.Windows
                };
            windowsPlatform.PlatformsPart.Add(new SolutionPlatformPart("Any CPU"));
            windowsPlatform.PlatformsPart.Add(new SolutionPlatformPart("Mixed Platforms") { Alias = "Any CPU"});
            windowsPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS");
            windowsPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP");
            windowsPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            windowsPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            windowsPlatform.Configurations.Add(coreClrDebug);
            windowsPlatform.Configurations.Add(coreClrRelease);
            foreach (var part in windowsPlatform.PlatformsPart)
            {
                part.Configurations.Clear();
                part.Configurations.AddRange(windowsPlatform.Configurations);
            }
            solutionPlatforms.Add(windowsPlatform);

            // Universal Windows Platform (UWP)
            var uwpPlatform = new SolutionPlatform()
            {
                Name = PlatformType.UWP.ToString(),
                Type = PlatformType.UWP,
                IsAvailable = IsFileInProgramFilesx86Exist(UniversalWindowsPlatformRuntimeBuild),
                UseWithExecutables = false,
                IncludeInSolution = false,
            };

            uwpPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_WINDOWS");
            uwpPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_UWP");
            uwpPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            uwpPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            uwpPlatform.Configurations["Release"].Properties.Add("<NoWarn>;2008</NoWarn>");
            uwpPlatform.Configurations["Debug"].Properties.Add("<NoWarn>;2008</NoWarn>");
            uwpPlatform.Configurations["Testing"].Properties.Add("<NoWarn>;2008</NoWarn>");
            uwpPlatform.Configurations["AppStore"].Properties.Add("<NoWarn>;2008</NoWarn>");

            uwpPlatform.Configurations["Release"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
            uwpPlatform.Configurations["Testing"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");
            uwpPlatform.Configurations["AppStore"].Properties.Add("<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>");

            foreach (var cpu in new[] { "x86", "x64", "ARM" })
            {
                var uwpPlatformCpu = new SolutionPlatformPart(uwpPlatform.Name + "-" + cpu)
                {
                    LibraryProjectName = uwpPlatform.Name,
                    ExecutableProjectName = cpu,
                    Cpu = cpu,
                    InheritConfigurations = true,
                    UseWithLibraries = false,
                    UseWithExecutables = true,
                };
                uwpPlatformCpu.Configurations.Clear();
                uwpPlatformCpu.Configurations.AddRange(uwpPlatform.Configurations);

                uwpPlatform.PlatformsPart.Add(uwpPlatformCpu);
            }

            solutionPlatforms.Add(uwpPlatform);

            // Linux
            var linuxPlatform = new SolutionPlatform()
            {
                Name = PlatformType.Linux.ToString(),
                IsAvailable = true,
                Type = PlatformType.Linux,
            };
            linuxPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_UNIX");
            linuxPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_LINUX");
            linuxPlatform.Configurations.Add(coreClrRelease);
            linuxPlatform.Configurations.Add(coreClrDebug);
            solutionPlatforms.Add(linuxPlatform);

            // Disabling macOS for time being
            if (false)
            {
                // macOS
                var macOSPlatform = new SolutionPlatform()
                {
                    Name = PlatformType.macOS.ToString(),
                    IsAvailable = true,
                    Type = PlatformType.macOS,
                };
                macOSPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_UNIX");
                macOSPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_MACOS");
                macOSPlatform.Configurations.Add(coreClrRelease);
                macOSPlatform.Configurations.Add(coreClrDebug);
                solutionPlatforms.Add(macOSPlatform);
            }

            // Android
            var androidPlatform = new SolutionPlatform()
            {
                Name = PlatformType.Android.ToString(),
                Type = PlatformType.Android,
                IsAvailable = IsFileInProgramFilesx86Exist(XamarinAndroidBuild)
            };
            androidPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_MONO_MOBILE");
            androidPlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_ANDROID");
            androidPlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            androidPlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            androidPlatform.Configurations["Debug"].Properties.AddRange(new[]
                {
                    "<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>",
                    "<AndroidLinkMode>None</AndroidLinkMode>",
                });
            androidPlatform.Configurations["Release"].Properties.AddRange(new[]
                {
                    "<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>",
                    "<AndroidLinkMode>SdkOnly</AndroidLinkMode>",
                });
            androidPlatform.Configurations["Testing"].Properties.AddRange(androidPlatform.Configurations["Release"].Properties);
            androidPlatform.Configurations["AppStore"].Properties.AddRange(androidPlatform.Configurations["Release"].Properties);
            solutionPlatforms.Add(androidPlatform);

            // iOS: iPhone
            var iphonePlatform = new SolutionPlatform()
            {
                Name = PlatformType.iOS.ToString(),
                SolutionName = "iPhone", // For iOS, we need to use iPhone as a solution name
                Type = PlatformType.iOS,
                IsAvailable = IsFileInProgramFilesx86Exist(XamariniOSBuild)
            };
            iphonePlatform.PlatformsPart.Add(new SolutionPlatformPart("iPhoneSimulator"));
            iphonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_MONO_MOBILE");
            iphonePlatform.DefineConstants.Add("SILICONSTUDIO_PLATFORM_IOS");
            iphonePlatform.Configurations.Add(new SolutionConfiguration("Testing"));
            iphonePlatform.Configurations.Add(new SolutionConfiguration("AppStore"));
            var iPhoneCommonProperties = new List<string>
                {
                    "<ConsolePause>false</ConsolePause>",
                    "<MtouchUseSGen>True</MtouchUseSGen>",
                    "<MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch>"
                };

            iphonePlatform.Configurations["Debug"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Debug"].Properties.AddRange(new []
                {
                    "<MtouchDebug>True</MtouchDebug>",
                    "<CodesignKey>iPhone Developer</CodesignKey>",
                    "<MtouchUseSGen>True</MtouchUseSGen>",
                });
            iphonePlatform.Configurations["Release"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Release"].Properties.AddRange(new[]
                {
                    "<CodesignKey>iPhone Developer</CodesignKey>",
                });
            iphonePlatform.Configurations["Testing"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["Testing"].Properties.AddRange(new[]
                {
                    "<MtouchDebug>True</MtouchDebug>",
                    "<CodesignKey>iPhone Distribution</CodesignKey>",
                    "<BuildIpa>True</BuildIpa>",
                });
            iphonePlatform.Configurations["AppStore"].Properties.AddRange(iPhoneCommonProperties);
            iphonePlatform.Configurations["AppStore"].Properties.AddRange(new[]
                {
                    "<CodesignKey>iPhone Distribution</CodesignKey>",
                });
            solutionPlatforms.Add(iphonePlatform);

            // iOS: iPhoneSimulator
            var iPhoneSimulatorPlatform = iphonePlatform.PlatformsPart["iPhoneSimulator"];
            iPhoneSimulatorPlatform.Configurations["Debug"].Properties.AddRange(new[]
                {
                    "<MtouchDebug>True</MtouchDebug>",
                    "<MtouchLink>None</MtouchLink>",
                    "<MtouchArch>i386, x86_64</MtouchArch>"
                });
            iPhoneSimulatorPlatform.Configurations["Release"].Properties.AddRange(new[]
                {
                    "<MtouchLink>None</MtouchLink>",
                    "<MtouchArch>i386, x86_64</MtouchArch>"
                });

            AssetRegistry.RegisterSupportedPlatforms(solutionPlatforms);
        }
コード例 #26
0
 public SolutionData(Solution solution, MSBuildWorkspace buildWorkspace, SolutionConfiguration configuration)
 {
     Configuration = configuration;
     Workspace     = buildWorkspace;
     Solution      = solution;
 }