public ProtobuildPackage (ProtobuildModuleInfo moduleInfo, ProtobuildPackageRef reference, IProtobuildModule parentModule) { module = moduleInfo; package = reference; parentModuleRef = parentModule; Packages = new ProtobuildPackages(this); Definitions = new ItemCollection<IProtobuildDefinition>(); Submodules = new ItemCollection<ProtobuildSubmodule>(); IsBinary = File.Exists(Path.Combine(FullPath, ".pkg")) && !File.Exists(Path.Combine(FullPath, ".git")) && !Directory.Exists(Path.Combine(FullPath, ".git")); }
public ProtobuildModuleInfo LoadModule(string rootPath) { var moduleInfoType = internalAssembly.GetType("Protobuild.ModuleInfo"); var moduleInfoLoad = moduleInfoType.GetMethod("Load"); dynamic moduleRef = moduleInfoLoad.Invoke(null, new object[] { Path.Combine(rootPath, "Build", "Module.xml") }); /*if (monitor != null) { monitor.BeginStepTask ("Loading " + moduleRef.Name + "...", 1, 5); }*/ var moduleInfo = new ProtobuildModuleInfo(); moduleInfo.Name = moduleRef.Name; moduleInfo.Path = moduleRef.Path; moduleInfo.DefaultAction = moduleRef.DefaultAction; moduleInfo.DefaultLinuxPlatforms = moduleRef.DefaultLinuxPlatforms; moduleInfo.DefaultWindowsPlatforms = moduleRef.DefaultWindowsPlatforms; moduleInfo.DefaultMacOSPlatforms = moduleRef.DefaultMacOSPlatforms; moduleInfo.DisableSynchronisation = moduleRef.DisableSynchronisation; moduleInfo.GenerateNuGetRepositories = moduleRef.GenerateNuGetRepositories; moduleInfo.SupportedPlatforms = moduleRef.SupportedPlatforms; moduleInfo.DefaultStartupProject = moduleRef.DefaultStartupProject; moduleInfo.LoadedDefinitions = new List<ProtobuildDefinitionInfo> (); foreach (var definition in moduleRef.GetDefinitions ()) { var definitionInfo = new ProtobuildDefinitionInfo (); definitionInfo.Name = definition.Name; try { // Newer versions of Protobuild name this property RelativePath. definitionInfo.Path = definition.RelativePath; } catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException ex) { definitionInfo.Path = definition.Path; } definitionInfo.Type = definition.Type; definitionInfo.DefinitionPath = definition.DefinitionPath; definitionInfo.ModulePath = definition.ModulePath; definitionInfo.SkipAutopackage = definition.SkipAutopackage; moduleInfo.LoadedDefinitions.Add (definitionInfo); } moduleInfo.Packages = new List<ProtobuildPackageRef>(); foreach (var package in moduleRef.Packages) { var packageInfo = new ProtobuildPackageRef(); packageInfo.Uri = package.Uri; packageInfo.GitRef = package.GitRef; packageInfo.Folder = package.Folder; moduleInfo.Packages.Add(packageInfo); } moduleInfo.LoadedSubmodules = new List<ProtobuildModuleInfo> (); foreach (var submodule in moduleRef.GetSubmodules ()) { moduleInfo.LoadedSubmodules.Add (LoadModule (submodule.Path)); } return moduleInfo; }