public void ProcessParameterDeserializer_ConvertsExportedBuildSettings()
 {
     var buildSettings = new BuildSettings
     {
         PlatformConfigurations = PlatformConfigurationList.Default,
         ProjectsToBuild = new StringList("projectA,projectB")
     };
     var expBuildDef = this.Serialize(new { ProjectsToBuild = buildSettings.ProjectsToBuild, ConfigurationsToBuild = buildSettings.PlatformConfigurations });
     var procParam = new[] { "BuildSettings", expBuildDef };
     ExportedProcessParameterTransformer.ProcessParameterDeserializer(procParam).ShouldBeEquivalentTo(buildSettings);
 }
Beispiel #2
0
        public async Task Stamp_Test_StampV2XMLV4WithAddenda307Async()
        {
            var     build    = new BuildSettings();
            StampV2 stamp    = new StampV2(build.Url, build.Token);
            var     xml      = GetXml(build);
            var     response = (StampResponseV4)await stamp.TimbrarV4Async(xml);

            Assert.True(response.data != null, "El resultado data viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.cfdi), "El resultado data.cfdi viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.cadenaOriginalSAT), "El resultado data.cadenaOriginalSAT viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.noCertificadoSAT), "El resultado data.noCertificadoSAT viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.noCertificadoCFDI), "El resultado data.noCertificadoCFDI viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.uuid), "El resultado data.uuid viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.selloSAT), "El resultado data.selloSAT viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.selloCFDI), "El resultado data.selloCFDI viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.fechaTimbrado), "El resultado data.fechaTimbrado viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.qrCode), "El resultado data.qrCode viene vacio.");
            response = (StampResponseV4)await stamp.TimbrarV4Async(xml);

            Assert.True(response.status == "error" && response.message == "307. El comprobante contiene un timbre previo.");
            Assert.Contains("cfdi:Addenda", response.data.cfdi);
        }
        /// <summary>
        /// Gets the build config.
        /// </summary>
        /// <param name="repository">The repository.</param>
        /// <param name="scope">The scope.</param>
        /// <param name="documentType">Type of the document.</param>
        /// <returns></returns>
        private BuildSettings GetBuildConfig(IBuildSettingsRepository repository, string scope, string documentType)
        {
            Contract.Requires(repository != null);
            Contract.Requires(!String.IsNullOrEmpty(documentType));
            Contract.Requires(!String.IsNullOrEmpty(scope));

            var key = String.Format("build_{0}_{1}", scope, documentType);

            var buildConfig = repository.BuildSettings.Where(x => (x.Scope.Equals(scope, StringComparison.OrdinalIgnoreCase) && x.DocumentType.Equals(documentType, StringComparison.OrdinalIgnoreCase))).FirstOrDefault();

            if (buildConfig == null)
            {
                buildConfig = new BuildSettings(scope, documentType)
                {
                    BuildSettingId = key,
                    Status         = BuildStatus.NeverStarted.GetHashCode()
                };
                repository.Add(buildConfig);
            }

            return(buildConfig);
        }
Beispiel #4
0
        public void MultipleStampXMLV1byToken()
        {
            var   build        = new BuildSettings();
            var   resultExpect = false;
            int   iterations   = 10;
            Stamp stamp        = new Stamp(build.Url, build.Token);
            List <StampResponseV1> listXmlResult = new List <StampResponseV1>();

            for (int i = 0; i < iterations; i++)
            {
                string xml = Encoding.UTF8.GetString(File.ReadAllBytes("Resources/file.xml"));
                xml = SignTools.SigXml(xml, Convert.FromBase64String(build.Pfx), build.CerPassword);
                var response = (StampResponseV1)stamp.TimbrarV1(xml);
                listXmlResult.Add(response);
            }
            if (listXmlResult != null)
            {
                resultExpect = listXmlResult.FindAll(w => w.status == ResponseType.success.ToString() || w.message.Contains("72 horas")).Count == iterations;
            }

            Assert.IsTrue((bool)resultExpect);
        }
Beispiel #5
0
    private static void PrepareBuild(BuildSettings settings)
    {
        NukeBuild();
        Directory.CreateDirectory(OutputPath);

        var defines = "USES_NOTIFICATION_SERVICE;";

        // Do not include Google Play Games on iOS.

        if (settings.Target == BuildTarget.iOS)
        {
            defines += "NO_GPGS;";
            PlayerSettings.iOS.buildNumber = BuildNumber;
        }

        switch (settings.Environment)
        {
        case BuildSettingsEnvironment.Dev:
            defines += "DEBUG;";
            break;

        case BuildSettingsEnvironment.Prod:
            defines += "LIVE;RELEASE;";
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        Debug.Log("Defines for " + settings.TargetGroup + ": " + defines);

        PlayerSettings.SetScriptingDefineSymbolsForGroup(settings.TargetGroup, defines);

        // Build with Gradle.
        if (settings.Target == BuildTarget.Android)
        {
            EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
        }
    }
Beispiel #6
0
        public override RunStepResult Start(BuildSettings settings)
        {
            var artifact = BuildArtifacts.GetBuildArtifact <BuildArtifactDesktop>(settings);
            var process  = new Process();

#if UNITY_EDITOR_OSX
            process.StartInfo.FileName  = "open";
            process.StartInfo.Arguments = '\"' + artifact.OutputTargetFile.FullName.Trim('\"') + '\"';
#else
            process.StartInfo.FileName = artifact.OutputTargetFile.FullName;
#endif
            process.StartInfo.WorkingDirectory = artifact.OutputTargetFile.Directory?.FullName ?? string.Empty;
            process.StartInfo.CreateNoWindow   = true;
            process.StartInfo.UseShellExecute  = true;

            if (!process.Start())
            {
                return(Failure(settings, $"Failed to start process at '{process.StartInfo.FileName}'."));
            }

            return(Success(settings, new RunInstanceDesktop(process)));
        }
Beispiel #7
0
        public async Task Issue_Test_StampXMLV4byTokenAsync()
        {
            var build = new BuildSettings();

            SW.Services.Issue.IssueV2 issue = new SW.Services.Issue.IssueV2(build.Url, build.Token);
            var xml      = GetXml(build);
            var response = (StampResponseV4)await issue.TimbrarV4Async(xml);

            Assert.True(response.data != null, "El resultado data viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.cfdi), "El resultado data.cfdi viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.cadenaOriginalSAT), "El resultado data.cadenaOriginalSAT viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.noCertificadoSAT), "El resultado data.noCertificadoSAT viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.noCertificadoCFDI), "El resultado data.noCertificadoCFDI viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.uuid), "El resultado data.uuid viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.selloSAT), "El resultado data.selloSAT viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.selloCFDI), "El resultado data.selloCFDI viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.fechaTimbrado), "El resultado data.fechaTimbrado viene vacio.");
            Assert.True(!string.IsNullOrEmpty(response.data.qrCode), "El resultado data.qrCode viene vacio.");
            response = (StampResponseV4)await issue.TimbrarV4Async(xml);

            Assert.True(response.status == "error" && response.message == "307. El comprobante contiene un timbre previo.");
        }
Beispiel #8
0
        /// <summary>
        /// Do a build configured for the HoloLens, returns the error from BuildPipeline.BuildPlayer
        /// </summary>
        public static string BuildForHololens()
        {
            // Cache the current settings
            BuildSettings oldBuildSettings = BuildSettings.Current;

            // Define and apply the desired settings
            BuildSettings newBuildSettings = oldBuildSettings;

            newBuildSettings.BuildTarget     = BuildTarget.WSAPlayer;
            newBuildSettings.WSASDK          = WSASDK.UWP;
            newBuildSettings.WSAUWPBuildType = WSAUWPBuildType.D3D;
            newBuildSettings.Apply();

            // Capture the active scenes, and build
            var    scenes = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path);
            string error  = BuildPipeline.BuildPlayer(scenes.ToArray(), BuildLocation, newBuildSettings.BuildTarget, BuildOptions.None);

            // Restore old build settings
            oldBuildSettings.Apply();

            return(error);
        }
Beispiel #9
0
        private void makeReleaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var curr = Application.StartupPath + "/";
            var loc  = Application.StartupPath + "/DMTv" + BuildSettings.GetVersion() + "/";

            Directory.CreateDirectory(loc);

            BuildFile(curr, loc, "DMTViewer.exe");
            BuildFile(curr, loc, "DMTViewer.exe.config");
            BuildFile(curr, loc, "UpdateMover.exe");

            foreach (var f in Directory.GetFiles(curr))
            {
                if (f.ToLower().EndsWith(".dll"))
                {
                    var name = Path.GetFileName(f);
                    BuildFile(curr, loc, name);
                }
            }

            Helper.CopyFolder(curr + "UnityResources", loc + "UnityResources", true);
        }
Beispiel #10
0
        public void CreateBuilderProfile(string name, BuildSettings settings)
        {
            var xmlDoc = XDocument.Load("settings.xml", LoadOptions.None);

            if (xmlDoc.Root.Elements().FirstOrDefault(e => e.Name == "BuilderProfiles") == null)
            {
                var rootElem = new XElement("BuilderProfiles");
                var profile  =
                    new XElement("Profile",
                                 new XAttribute("Name", name),
                                 new XElement("Hostname", settings.Hostname),
                                 new XElement("Port", settings.Port.ToString()),
                                 new XElement("ReconnectDelay", settings.ReconnectDelay.ToString()),
                                 new XElement("InstallationPath", ((int)settings.InstallationPath).ToString()),
                                 new XElement("Filename", settings.Filename),
                                 new XElement("MergeDependencies", settings.MergeDependencies ? "True" : "False")
                                 );

                rootElem.Add(profile);
                xmlDoc.Root.Add(rootElem);
            }
            else
            {
                var profile =
                    new XElement("Profile",
                                 new XAttribute("Name", name),
                                 new XElement("Hostname", settings.Hostname),
                                 new XElement("Port", settings.Port.ToString()),
                                 new XElement("ReconnectDelay", settings.ReconnectDelay.ToString()),
                                 new XElement("InstallationPath", ((int)settings.InstallationPath).ToString()),
                                 new XElement("Filename", settings.Filename),
                                 new XElement("MergeDependencies", settings.MergeDependencies ? "True" : "False")
                                 );
                xmlDoc.Root.Element("BuilderProfiles").Add(profile);
            }

            xmlDoc.Save("settings.xml");
        }
Beispiel #11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Icon = Resources.HAL9000;
            LoadModsUI();
            Helper.ClearTempFolder();
            if (!Directory.Exists(BuildSettings.Instance.ModFolder))
            {
                this.BeginInvoke((MethodInvoker)this.ShowSettings);
            }

            this.Text += " " + BuildSettings.GetVersion();

            if (BuildSettings.Instance.AutoCheckForUpdates)
            {
                new Thread(() => { UpdateCheckThread(true); }).Start();
            }

            if (Helper.IsDevBuild == false)
            {
                makeReleaseToolStripMenuItem.Visible = false;
            }
            frmMain_Resize(null, null);
        }
Beispiel #12
0
        public override IList <SharedItem> PrepareShared(BuildContext context)
        {
            IList <SharedItem> listShared = base.PrepareShared(context);

            if (listShared == null)
            {
                listShared = new List <SharedItem>();
            }

            if (_changeHistory == ConceptualChangeHistory.ShowFreshnessDate)
            {
                if (_freshnessDate != DateTime.MinValue &&
                    _freshnessDate != DateTime.MaxValue)
                {
                    BuildSettings settings = context.Settings;

                    listShared.Add(new SharedItem("defaultFreshnessDate",
                                                  _freshnessDate.ToString(_freshnessFormat, settings.CultureInfo)));
                }
            }

            return(listShared);
        }
Beispiel #13
0
        public async Task Account_Test_45_ConsultaDeSaldoByUserAsync()
        {
            var             build    = new BuildSettings();
            BalanceAccount  account  = new BalanceAccount("http://services.test.sw.com.mx", "demo", "123456789");
            AccountResponse response = await account.ConsultarSaldoAsync();

            if (response.status != "error")
            {
                //saldo timbres
                Console.WriteLine(response.data.saldoTimbres);
                //timbres utilizados
                Console.WriteLine(response.data.timbresUtilizados);
                //En caso de tener timbres infinitos (para cuentas hijo)
                Console.WriteLine(response.data.unlimited);
            }
            else
            {
                //errores
                Console.WriteLine(response.message);
                Console.WriteLine(response.messageDetail);
            }
            Assert.True(response.status == "success", response.messageDetail);
        }
        public override void Initialize(BuildContext context)
        {
            base.Initialize(context);

            if (this.IsInitialized)
            {
                if (_format == null)
                {
                    this.IsInitialized = false;
                    return;
                }

                _settings = context.Settings;
                Debug.Assert(_settings != null);
                if (_settings == null)
                {
                    this.IsInitialized = false;
                    return;
                }

                _context = context;
            }
        }
        public override BuildPipelineCodes Convert(BuildCommandSet commandSet, BuildSettings settings, out List <WriteResult> output)
        {
            StartProgressBar("Writing Resource Files", commandSet.commands.Count);
            CacheDataForCommandSet(commandSet);

            output = new List <WriteResult>();
            foreach (var command in commandSet.commands)
            {
                if (!UpdateProgressBar(string.Format("Bundle: {0}", command.assetBundleName)))
                {
                    EndProgressBar();
                    return(BuildPipelineCodes.Canceled);
                }

                BuildOutput result;
                Hash128     hash = CalculateInputHash(command, settings);
                if (UseCache && BuildCache.TryLoadCachedResults(hash, out result))
                {
                    output.AddRange(result.results);
                    continue;
                }

                result = BundleBuildInterface.WriteResourceFilesForBundle(commandSet, command.assetBundleName, settings, GetBuildPath(hash));
                output.AddRange(result.results);

                if (UseCache && !BuildCache.SaveCachedResults(hash, result))
                {
                    BuildLogger.LogWarning("Unable to cache CommandSetWriter results for command '{0}'.", command.assetBundleName);
                }
            }

            if (!EndProgressBar())
            {
                return(BuildPipelineCodes.Canceled);
            }
            return(BuildPipelineCodes.Success);
        }
        public override bool CanRun(BuildSettings settings, out string reason)
        {
            var artifact = BuildArtifacts.GetBuildArtifact <DotsRuntimeBuildArtifact>(settings);

            if (artifact == null)
            {
                reason = $"Could not retrieve build artifact '{nameof(DotsRuntimeBuildArtifact)}'.";
                return(false);
            }

            if (artifact.OutputTargetFile == null)
            {
                reason = $"{nameof(DotsRuntimeBuildArtifact.OutputTargetFile)} is null.";
                return(false);
            }

            if (!File.Exists(artifact.OutputTargetFile.FullName))
            {
                reason = $"Output target file '{artifact.OutputTargetFile.FullName}' not found.";
                return(false);
            }

            if (!settings.TryGetComponent <DotsRuntimeBuildProfile>(out var profile))
            {
                reason = $"Could not retrieve component '{nameof(DotsRuntimeBuildProfile)}'.";
                return(false);
            }

            if (profile.Target == null)
            {
                reason = $"{nameof(DotsRuntimeBuildProfile)} target is null.";
                return(false);
            }

            reason = null;
            return(true);
        }
Beispiel #17
0
        public static BuildPipelineCodes Build(BuildInput input, BuildSettings settings, out BuildDependencyInfo buildInfo, bool useCache = false, BuildProgressTracker progressTracker = null)
        {
            buildInfo = null;

            // Rebuild sprite atlas cache for correct dependency calculation & writing
            var spriteCacher = new SpriteAtlasCacher(useCache, progressTracker);
            var exitCode     = spriteCacher.Convert(settings.target);

            if (exitCode < BuildPipelineCodes.Success)
            {
                return(exitCode);
            }

            // Generate dependency information for all assets in BuildInput
            var buildInputDependency = new BuildInputDependency(useCache, progressTracker);

            exitCode = buildInputDependency.Convert(input, settings, out buildInfo);
            if (exitCode < BuildPipelineCodes.Success)
            {
                return(exitCode);
            }

            return(exitCode);
        }
Beispiel #18
0
            public override void Initialize(ConceptualGroup group,
                                            BuildContext context)
            {
                _group   = group;
                _context = context;

                string workingDir = context.WorkingDirectory;

                BuildSettings settings = context.Settings;

                BuildGroupContext groupContext = context.GroupContexts[group.Id];

                string manifestFile = Path.Combine(workingDir,
                                                   groupContext["$ManifestFile"]);

                XmlWriterSettings xmlSettings = new XmlWriterSettings();

                xmlSettings.Indent   = true;
                xmlSettings.Encoding = Encoding.UTF8;

                _manifestWriter = XmlWriter.Create(manifestFile, xmlSettings);
                _manifestWriter.WriteStartDocument();
                _manifestWriter.WriteStartElement("topics"); // start - topics
            }
        public virtual void Initialize(BuildContext context,
                                       BuildEngineType engineType)
        {
            BuildExceptions.NotNull(context, "context");
            base.Initialize(context.Logger);

            BuildSettings settings = context.Settings;

            if (settings == null)
            {
                this.IsInitialized = false;
                return;
            }

            _nsmgr      = null;
            _context    = context;
            _settings   = settings;
            _style      = Settings.Style;
            _engineType = engineType;

            this.IsInitialized    = true;
            this.WarnIfNotFound   = true;
            this.DeleteIfNotFound = true;
        }
Beispiel #20
0
        public async Task Cancelation_Test_CancelationByCSDAsync()
        {
            var         build       = new BuildSettings();
            Cancelation cancelation = new Cancelation("http://services.test.sw.com.mx", "demo", "123456789");
            //Al igual que el objeto de stamp, se indica url del ambiente al cual apuntara y credenciales de acceso o token.
            string csdBase64 = build.Cer;         //.Cer en Base64
            string keyBase64 = build.Key;         //.Key en Base64
            string password  = build.CerPassword; //password del CSD
            string rfc       = "LAN8507268IA";
            string uuid      = "7028573d-5a18-4331-8285-cd97b156c901";
            var    response  = await cancelation.CancelarByCSDAsync(csdBase64, keyBase64, rfc, password, uuid);

            if (response.status != "error")
            {
                //acuse de cancelación
                Console.WriteLine(response.data.acuse);
            }
            else
            {
                Console.WriteLine(response.message);
                Console.WriteLine(response.messageDetail);
            }
            Assert.True(response.data.acuse != null && response.status == "success");
        }
        public override void Initialize(BuildContext context)
        {
            base.Initialize(context);

            if (base.IsInitialized)
            {
                _context = context;

                BuildSettings settings = context.Settings;
                Debug.Assert(settings != null);
                if (settings == null || settings.Style == null)
                {
                    this.IsInitialized = false;
                    return;
                }
                _style = settings.Style;
                Debug.Assert(_style != null);
                if (_style == null)
                {
                    this.IsInitialized = false;
                    return;
                }
            }
        }
        protected override async Task <int> BuildInternal(BuildSettings settings)
        {
            var filesToCreate = EntityHelper.EntityTypes.Where(e => Roots.Contains(e.Name) && !Enums.Contains(e.Name));

            BuilderFileCountUpdate(filesToCreate.Count());

            await Pause.WaitWhilePausedAsync();

            foreach (var file in filesToCreate)
            {
                var filePath = string.Concat(settings.ServicePath, file.Name, "Service", settings.FileExtension);

                await BuildFile <eBuildSectionService>(filePath, file, settings);

                await Pause.WaitWhilePausedAsync();

                if (Cancellation.IsCancellationRequested)
                {
                    break;
                }
            }

            return(filesToCreate.Count());
        }
Beispiel #23
0
        protected override async Task <int> BuildInternal(BuildSettings settings)
        {
            var filesToCreate = EntityHelper.EntityTypes.Where(i => !settings.EntityExclusions.Any(e => i.Name.StartsWith(e, StringComparison.CurrentCultureIgnoreCase)));

            BuilderFileCountUpdate(filesToCreate.Count());

            await Pause.WaitWhilePausedAsync();

            foreach (var file in filesToCreate)
            {
                var filePath = string.Concat(settings.ContractPath, file.Name, settings.ContractName, settings.FileExtension);

                await BuildFile <eBuildSectionContract>(filePath, file, settings);

                await Pause.WaitWhilePausedAsync();

                if (Cancellation.IsCancellationRequested)
                {
                    break;
                }
            }

            return(filesToCreate.Count());
        }
Beispiel #24
0
        protected StringBuilder <T> CreateStringBuilder <T>(EntityType entityType, EntityHelper entityHelper, BuildSettings settings, IBuilder builder,
                                                            List <string> roots, List <string> enumerations, PauseToken pause, CancellationToken cancellation)
            where T : struct, IConvertible
        {
            var returnValue = new StringBuilder <T>(entityType, entityHelper, settings, builder, roots, enumerations, pause, cancellation);

            returnValue.OnBuilderPassComplete += BuilderPassComplete;
            return(returnValue);
        }
 public bool Build(string[] targetNames, System.Collections.IDictionary targetOutputs, BuildSettings buildFlags)
 {
 }
 public virtual WriteResult Write(string outputFolder, List <WriteCommand> dependencies, BuildSettings settings, BuildUsageTagGlobal globalUsage, BuildUsageTagSet buildUsage)
 {
     return(BundleBuildInterface.WriteSerializedFile(outputFolder, command, dependencies, settings, globalUsage, buildUsage));
 }
Beispiel #27
0
 public CachedBuildSetting(string path, BuildSettings asset)
 {
     Path  = path;
     Asset = asset;
 }
 public override RunStepResult Start(BuildSettings settings)
 {
     return(Success(settings, null));
 }
Beispiel #29
0
        bool BuildProjectFileInternal(string projectFile,
					      string[] targetNames,
					      BuildPropertyGroup globalProperties,
					      IDictionary targetOutputs,
					      BuildSettings buildFlags, string toolsVersion)
        {
            if ((buildFlags & BuildSettings.DoNotResetPreviouslyBuiltTargets) != BuildSettings.DoNotResetPreviouslyBuiltTargets)
                builtTargetsOutputByName.Clear ();

            Project project;

            bool newProject = false;
            if (!projects.TryGetValue (projectFile, out project)) {
                project = CreateNewProject ();
                newProject = true;
            }

            BuildPropertyGroup engine_old_grp = null;
            BuildPropertyGroup project_old_grp = null;
            if (globalProperties != null) {
                engine_old_grp = GlobalProperties.Clone (true);
                project_old_grp = project.GlobalProperties.Clone (true);

                // Override project's global properties with the
                // ones explicitlcur_y specified here
                foreach (BuildProperty bp in globalProperties)
                    project.GlobalProperties.AddProperty (bp);

                if (!newProject)
                    project.NeedToReevaluate ();
            }

            if (newProject)
                project.Load (projectFile);

            try {
                string oldProjectToolsVersion = project.ToolsVersion;
                if (String.IsNullOrEmpty (toolsVersion) && defaultToolsVersion != null)
                    // no tv specified, let the project inherit it from the
                    // engine. 'defaultToolsVersion' will be effective only
                    // it has been overridden. Otherwise, the project's own
                    // tv will be used.
                    project.ToolsVersion = defaultToolsVersion;
                else
                    project.ToolsVersion = toolsVersion;

                try {
                    return project.Build (targetNames, targetOutputs, buildFlags);
                } finally {
                    project.ToolsVersion = oldProjectToolsVersion;
                }
            } finally {
                if (globalProperties != null) {
                    GlobalProperties = engine_old_grp;
                    project.GlobalProperties = project_old_grp;
                }
            }
        }
Beispiel #30
0
        public bool BuildProjectFile(string projectFile,
					      string[] targetNames,
					      BuildPropertyGroup globalProperties,
					      IDictionary targetOutputs,
					      BuildSettings buildFlags)
        {
            return BuildProjectFile (projectFile, targetNames, globalProperties, targetOutputs, buildFlags, null);
        }
    /**
     * Private post-export method
     * --------------------------
     *
     * This is being executed in two separate fashions as seen above,
     * based on whether or not the build is occurring in the Cloud.
     *
     * - Path parameter points to root XCode project directory
     *     where xcodeproj file is located
     * - Uses XCode Manipulation API to:
     *   - Force Debug configuration before XCode build step is executed
     *   - Disable ENABLE_BITCODE to prevent large app filesizes
     **/
    private static void ProcessPostBuild(BuildTarget buildTarget, string path)
    {
        // Restricting post-export behavior to only builds where specific Scene is active
        if (buildTarget == BuildTarget.iOS && IsSceneActive ("Assets/Scenes/CounterScene.unity"))
        {
            // Initialize build settings
            var buildSettings = new BuildSettings {
                configuration = "Debug"
            };

            /**
             * Manual manipulation of .xcscheme file
             * -------------------------------------
             *
             * .xcscheme file contains all information related to build schemes as seen
             * in Project -> Schemes -> Edit Schemes dialog in XCode. In this case, we
             * are forcing Debug configuration.
             **/

            // Access xcscheme file and ingest xml
            string schemePath = path + "/Unity-iPhone.xcodeproj/xcshareddata/xcschemes/Unity-iPhone.xcscheme";
            var schemeReader = new StreamReader (schemePath);
            var xDoc = XDocument.Load(schemeReader);
            schemeReader.Close();

            Debug.Log(string.Format("Loaded scheme file: {0}", schemePath));

            // Set debug configuration for launch action
            foreach (XElement element in xDoc.Descendants("LaunchAction")) {
                element.SetAttributeValue("buildConfiguration", buildSettings.configuration);
                Debug.Log(string.Format("Set launch configuration to {0}", buildSettings.configuration));
            }

            // Write file back out
            xDoc.Save(schemePath);
            Debug.Log(string.Format("Saved scheme file: {0}", schemePath));

            /**
             * XCode Project manipulation examples
             * -----------------------------------
             *
             * .pbxproj file contains information related to frameworks, build properties
             * and other settings within an XCode project. See the Manipulation API docs:
             *
             * http://docs.unity3d.com/ScriptReference/iOS.Xcode.PBXProject.html
             **/

            // Access pbxproj file to add frameworks and build properties
            string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";

            PBXProject proj = new PBXProject();
            proj.ReadFromString(File.ReadAllText(projPath));
            string target = proj.TargetGuidByName("Unity-iPhone");

            // Add user packages to project. Most other source or resource files and packages
            // can be added the same way.
              //CopyAndReplaceDirectory ("NativeAssets/TestLib.bundle", Path.Combine (path, "Frameworks/TestLib.bundle"));
              //proj.AddFileToBuild (target, proj.AddFile ("Frameworks/TestLib.bundle",
              //                                       "Frameworks/TestLib.bundle", PBXSourceTree.Source));

              //CopyAndReplaceDirectory ("NativeAssets/TestLib.framework", Path.Combine (path, "Frameworks/TestLib.framework"));
              //proj.AddFileToBuild (target, proj.AddFile ("Frameworks/TestLib.framework",
              //                                       "Frameworks/TestLib.framework", PBXSourceTree.Source));

            // Add custom system frameworks. Duplicate frameworks are ignored.
            // needed by our native plugin in Assets/Plugins/iOS
              //proj.AddFrameworkToProject (target, "AssetsLibrary.framework", false /*not weak*/);

            // Add our framework directory to the framework include path
              //proj.SetBuildProperty (target, "FRAMEWORK_SEARCH_PATHS", "$(inherited)");
              //proj.AddBuildProperty (target, "FRAMEWORK_SEARCH_PATHS", "$(PROJECT_DIR)/Frameworks");

            // Set a custom link flag
              //proj.AddBuildProperty (target, "OTHER_LDFLAGS", "-ObjC");

            // Write changes back to file
            File.WriteAllText(projPath, proj.WriteToString());
        }
    }
Beispiel #32
0
        /// <summary>
        /// Loads a set of project files from disk, and builds the given list of targets for each one. This overload
        /// takes a set of global properties for each project to use for the build, returns the target outputs, 
        /// and also allows the caller to specify additional build flags.
        /// </summary>
        /// <param name="projectFiles">Array of project files to build (can't be null)</param>
        /// <param name="targetNamesPerProject">Array of targets for each project(can't be null)</param>
        /// <param name="globalPropertiesPerProject">Array of properties for each project (can't be null)</param>
        /// <param name="targetOutputsPerProject">Array of tables for target outputs (can't be null)</param>
        /// <param name="buildFlags"></param>
        /// <param name="toolsVersions">Tools version to impose on the project in this build</param>
        /// <returns>True if all given project build successfully</returns>
        public bool BuildProjectFiles
        (
            string[] projectFiles,
            string[][] targetNamesPerProject,
            BuildPropertyGroup[] globalPropertiesPerProject,
            IDictionary[] targetOutputsPerProject,
            BuildSettings buildFlags,
            string [] toolsVersions
        )
        {
            // Verify the arguments to the API
            error.VerifyThrowArgumentArraysSameLength(projectFiles, targetNamesPerProject, "projectFiles", "targetNamesPerProject");
            error.VerifyThrowArgument(projectFiles.Length > 0, "projectFilesEmpty");
            error.VerifyThrowArgumentArraysSameLength(projectFiles, globalPropertiesPerProject, "projectFiles", "globalPropertiesPerProject");
            error.VerifyThrowArgumentArraysSameLength(projectFiles, targetOutputsPerProject, "projectFiles", "targetOutputsPerProject");
            error.VerifyThrowArgumentArraysSameLength(projectFiles, toolsVersions, "projectFiles", "toolsVersions");

            // Verify the entries in the project file array
            for (int i = 0; i < projectFiles.Length; i++)
            {
                error.VerifyThrowArgumentNull(projectFiles[i], "projectFiles[" + i +"]");
                error.VerifyThrowArgument(projectFiles[i].Length > 0, "projectFilesEmptyElement", i);
            }

            return PostProjectEvaluationRequests
                (null, projectFiles, targetNamesPerProject, globalPropertiesPerProject, targetOutputsPerProject, 
                 buildFlags, toolsVersions);
        }
Beispiel #33
0
        internal bool PostProjectEvaluationRequests
        (
            Project project,
            string[] projectFiles,
            string[][] targetNames,
            BuildPropertyGroup[] globalPropertiesPerProject,
            IDictionary[] targetOutputsPerProject,
            BuildSettings buildFlags,
            string [] toolVersions
        )
        {
            string currentDirectory = Environment.CurrentDirectory;
            string currentPerThreadProjectDirectory = Project.PerThreadProjectDirectory;
            fatalErrorContext = null;

            BuildEventContext buildEventContext;
               
            // Already have an instantiated project in the OM and it has not fired a project started event for itself yet
            if (project != null && !project.HaveUsedInitialProjectContextId)
            {
                buildEventContext = project.ProjectBuildEventContext;
            }

            else // Dont have an already instantiated project, need to make a new context
            {
                buildEventContext = new BuildEventContext(
                                                this.nodeId,
                                                BuildEventContext.InvalidTargetId,
                                                BuildEventContext.InvalidProjectContextId,
                                                BuildEventContext.InvalidTaskId
                                                );
            }
            
            // Currently, MSBuild requires that the calling thread be marked "STA" -- single
            // threaded apartment.  This is because today we are calling the tasks' Execute()
            // method on this main thread, and there are tasks out there that create unmarshallable
            // COM objects that require the "Apartment" threading model.  Once the engine supports
            // multi-threaded builds, and is spinning up its own threads to call the tasks, then
            // we don't care so much about the STA vs. MTA designation on the main thread.  But for
            // now, we do.
            if (Environment.GetEnvironmentVariable("MSBUILDOLDOM") != "1" && Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
            {
                // Bug VSWhidbey 126031.  Really, we would like to,
                //
                //   error.VerifyThrowInvalidOperation((Thread.CurrentThread.ApartmentState == ApartmentState.STA),"STARequired");
                //
                // But NUnit-console.exe is not in the STA and so we would get some assert dialogs
                // and build failures.  If we ever upgrade to NUnit 2.1 or later, there is an option
                // to tell NUnit to run in STA mode, and then maybe we can be more strict here.
                primaryLoggingServices.LogWarning(buildEventContext, new BuildEventFileInfo(/* there is truly no file associated with this warning */ String.Empty),
                   "STARequired", Thread.CurrentThread.GetApartmentState());
            }

            BuildRequest[] buildRequests = new BuildRequest[projectFiles.Length];
            Hashtable[] targetOutputsWorkingCopy = new Hashtable[buildRequests.Length];
            for (int i = 0; i < buildRequests.Length; i++)
            {
                // if the caller wants to retrieve target outputs, create a working copy to avoid clobbering 
                // other data in the hashtable
                if (targetOutputsPerProject[i] != null)
                {
                    targetOutputsWorkingCopy[i] = new Hashtable(StringComparer.OrdinalIgnoreCase);
                }

                buildRequests[i] = 
                    CreateLocalBuildRequest(buildEventContext, project, projectFiles[i], targetNames[i],
                                            globalPropertiesPerProject[i], targetOutputsWorkingCopy[i], buildFlags,
                                            toolVersions[i]);
            }

            bool overallResult = true;
            bool exitedDueToError = true;
            try
            {
                // Reset the current directory stored in the per thread variable for the current thread
                Project.PerThreadProjectDirectory = null;
                // Initialize the scheduler with the current information
                Scheduler.Initialize(NodeManager.GetNodeDescriptions());
                // Fire the event that says the overall build is beginning.
                LoggingServices.LogBuildStarted();
                LoggingServices.ProcessPostedLoggingEvents();
                // Post all the build requests into the engine queue
                PostBuildRequests(buildRequests);
                // Trigger the actual build (this call will not return until build is complete)
                EngineBuildLoop(null);

                for (int i = 0; i < buildRequests.Length; i++)
                {
                    // Collect the outputs
                    BuildResult buildResult = buildRequests[i].GetBuildResult();
                    if (buildResult.OutputsByTarget != null && targetOutputsPerProject[i] != null)
                    {
                        buildResult.ConvertToTaskItems();
                        foreach (DictionaryEntry de in buildResult.OutputsByTarget)
                        {
                            targetOutputsPerProject[i][de.Key] = de.Value;
                        }
                    }
                    overallResult = overallResult && buildRequests[i].BuildSucceeded;
                }

                exitedDueToError = false;
            }
            catch (Exception e)
            {
                // Only log the error once at the root of the recursion for unhandled exceptions, instead of
                // logging the error multiple times for each level of project-to-project
                // recursion until we get to the top of the stack.
                if (fatalErrorContext != null)
                {
                    primaryLoggingServices.LogFatalBuildError(fatalErrorContext, e, new BuildEventFileInfo(fatalErrorProjectName));
                }
                else
                {
                    primaryLoggingServices.LogFatalBuildError(buildEventContext, e, new BuildEventFileInfo(String.Empty));
                }

                // Rethrow so that the host can catch it and possibly rethrow it again
                // so that Watson can give the user the option to send us an error report.
                throw;
            }
            finally
            {
                // Post build finished event if the finally is not being executed due to an exception
                EndingEngineExecution(overallResult, exitedDueToError);
                // Reset the current directory to the value before this 
                // project built
                Environment.CurrentDirectory = currentDirectory;
                // We reset the path back to the original value in case the 
                // host is depending on the current directory to find projects
                Project.PerThreadProjectDirectory = currentPerThreadProjectDirectory;
            }

            return overallResult;
        }
Beispiel #34
0
        /// <summary>
        /// Create a build request which will be posted to the local engine queue, having a HandleId of -1 meaning it came from the local 
        /// engine rather than an engine call back 
        /// </summary>
        /// <returns></returns>
        private BuildRequest CreateLocalBuildRequest(BuildEventContext buildEventContext, Project project, string projectFile, string[] targetNames, BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, string toolsVersion)
        {
            // Global Properties should not be null as this will cause a crash when we try and cache the build result of the project.
            // Whidby also set global properties to empty if they were null.
            if (globalProperties == null)
            {
                globalProperties = new BuildPropertyGroup();
            }

            BuildRequest buildRequest =  new BuildRequest(EngineCallback.invalidEngineHandle, projectFile, targetNames, globalProperties, toolsVersion, -1, true, false);
            buildRequest.ParentBuildEventContext = buildEventContext;
            // Set the project object to the passed in project
            buildRequest.ProjectToBuild = project;
            // Set the request build flags
            buildRequest.BuildSettings = buildFlags;
            // Set the boolean requesting the project start/finish events 
            buildRequest.FireProjectStartedFinishedEvents = true;
            // Set the dictionary to return target outputs in, if any
            buildRequest.OutputsByTarget = targetOutputs;
            // If the tools version is null and we have a project object then use the project's tools version
            // If we do not have a project and we have a null tools version then the build request's tools version will be null, which will later be set in BuildProjectFileInternal
            if (String.IsNullOrEmpty(toolsVersion) && project != null)
            {
                buildRequest.ToolsetVersion = project.ToolsVersion;
            }
            // Set project filename correctly if only the project object is passed in
            if (buildRequest.ProjectFileName == null)
            {
                buildRequest.ProjectFileName = project.FullFileName;
            }
            return buildRequest;
        }
	public bool BuildProjectFile(string projectFile, string[] targetNames, BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, BuildSettings buildFlags) {}
		public bool BuildProject (Project project,
					  string[] targetNames,
					  IDictionary targetOutputs,
					  BuildSettings buildFlags)
		{
			if (project == null)
				throw new ArgumentException ("project");
			if (targetNames == null)
				return false;

			return project.Build (targetNames, targetOutputs, buildFlags);
		}
Beispiel #37
0
 /// <summary>
 /// Builds the specified list of targets in this project using the specified
 /// flags, and returns the target outputs.
 /// </summary>
 /// <remarks>
 /// This is the public method that host IDEs can call to build a project.
 /// It just turns around and calls "BuildProject" on the engine object.
 /// All builds must go through the engine object, because it needs to
 /// keep track of the projects that are currently in progress, so that
 /// we don't end up in infinite loops when we have circular project-to-
 /// project dependencies.
 /// </remarks>
 /// <param name="targetNames"></param>
 /// <param name="targetOutputs"></param>
 /// <param name="buildFlags"></param>
 /// <returns></returns>
 /// <owner>RGoel</owner>
 public bool Build
     (
     string[] targetNames,    // can be null to build the default targets
     IDictionary targetOutputs,      // can be null if outputs are not needed
     BuildSettings buildFlags
     )
 {
     return this.ParentEngine.BuildProject(this, targetNames, targetOutputs, buildFlags);
 }
Beispiel #38
0
        public static void ParseOptionsAndFindScenes(
            string[] args,
            out BuildPlayerOptions player_options,
            out BuildSettings settings)
        {
            try
            {
                ConfigurationType configuration_type;
                string            main_scene;
                string[]          scene_paths;
                {
                    var path     = GetArgumentValueOrDefault(args, "-config", "configurations.json");
                    var file     = ParseConfigurationsFile(path);
                    var type_str = GetArgumentValue(args, "-configuration");
                    configuration_type = (ConfigurationType)Enum.Parse(typeof(ConfigurationType), type_str);
                    //var configuration_options = file.Configurations[configuration_type];
                    var configuration_options = file.GetConfiguration(configuration_type);
                    main_scene  = configuration_options.MainScene;
                    scene_paths = configuration_options.Scenes;
                }

                var platform           = GetArgumentValue(args, "-platform");
                var target             = GetPrimaryBuildTarget(platform);
                var product_file_name  = GetProductFileName(target);
                var build_path         = "Build/" + platform + "/" + configuration_type;
                var location_path_name =
                    GetArgumentValueOrDefault(args, "-buildPath", build_path) +
                    "/" +
                    product_file_name;

                // Locate the scenes to be used for this build configuration
                string[] configuration_scenes;
                try
                {
                    configuration_scenes =
                        FindScenes(main_scene)
                        .Concat(FindScenes(scene_paths)).
                        ToArray();
                }
                catch (FileNotFoundException ex)
                {
                    throw new Exception("Scene file or directory not found: " + ex.FileName);
                }

                player_options = new BuildPlayerOptions()
                {
                    locationPathName = location_path_name,
                    target           = target,
                    scenes           = configuration_scenes,
                };

                settings = new BuildSettings()
                {
                    ConfigurationType = configuration_type,
                };
            }
            catch (ArgumentException ex)
            {
                throw new Exception("Missing required build argument: " + ex.ParamName, ex);
            }
        }
Beispiel #39
0
        public bool BuildProject(Project project,
					  string[] targetNames,
					  IDictionary targetOutputs,
					  BuildSettings buildFlags)
        {
            if (project == null)
                throw new ArgumentException ("project");
            if (targetNames == null)
                return false;

            if ((buildFlags & BuildSettings.DoNotResetPreviouslyBuiltTargets) != BuildSettings.DoNotResetPreviouslyBuiltTargets)
                builtTargetsOutputByName.Clear ();

            if (defaultToolsVersion != null)
                // it has been explicitly set, xbuild does this..
                project.ToolsVersion = defaultToolsVersion;
            return project.Build (targetNames, targetOutputs, buildFlags);
        }
Beispiel #40
0
 /// <summary>
 /// Loads a project file from disk, and builds the specified list of targets.  This overload
 /// takes a set of global properties to use for the build, returns the target outputs, and also
 /// allows the caller to specify additional build flags.
 /// </summary>
 /// <remarks>
 /// If this project file is already in our list of in-progress projects, we use the
 /// existing Project object instead of instantiating a new one. Always use this method to 
 /// build projects within projects, otherwise the build won't be optimized.
 /// </remarks>
 /// <param name="projectFile"></param>
 /// <param name="targetNames">Can be null, if caller wants to build the default targets for the project.</param>
 /// <param name="globalProperties">Can be null if no global properties are needed.</param>
 /// <param name="targetOutputs">Can be null if outputs are not needed.</param>
 /// <param name="buildFlags">Specifies additional options to alter the behavior of the build.</param>
 /// <param name="toolsVersion">Tools version to impose on the project in this build</param>
 /// <returns>true, if build succeeds</returns>
 public bool BuildProjectFile
     (
     string projectFile,
     string[] targetNames,
     BuildPropertyGroup globalProperties,
     IDictionary targetOutputs,
     BuildSettings buildFlags,
     string toolsVersion
     )
 {
     return PostProjectEvaluationRequests
         (null, new string[] { projectFile }, new string[][] { targetNames },
          new BuildPropertyGroup[] { globalProperties }, new IDictionary[] { targetOutputs }, buildFlags,
          new string[] {toolsVersion});
 }
Beispiel #41
0
        //FIXME: add a test for null @toolsVersion
        public bool BuildProjectFile(string projectFile,
					      string[] targetNames,
					      BuildPropertyGroup globalProperties,
					      IDictionary targetOutputs,
					      BuildSettings buildFlags, string toolsVersion)
        {
            bool result = false;
            try {
                StartEngineBuild ();
                result = BuildProjectFileInternal (projectFile, targetNames, globalProperties, targetOutputs, buildFlags, toolsVersion);
                return result;
            } catch (InvalidProjectFileException ie) {
                this.LogErrorWithFilename (projectFile, ie.Message);
                this.LogMessage (MessageImportance.Low, String.Format ("{0}: {1}", projectFile, ie.ToString ()));
                return false;
            } catch (Exception e) {
                if (buildStarted) {
                    this.LogErrorWithFilename (projectFile, e.Message);
                    this.LogMessage (MessageImportance.Low, String.Format ("{0}: {1}", projectFile, e.ToString ()));
                }
                throw;
            } finally {
                EndEngineBuild (result);
            }
        }
Beispiel #42
0
        /// <summary>
        /// Loads a project file from disk, and builds the specified list of targets.  This overload
        /// takes a set of global properties to use for the build, returns the target outputs, and also
        /// allows the caller to specify additional build flags.
        /// </summary>
        /// <remarks>
        /// If this project file is already in our list of in-progress projects, we use the
        /// existing Project object instead of instantiating a new one. Always use this method to 
        /// build projects within projects, otherwise the build won't be optimized.
        /// </remarks>
        /// <param name="projectFile"></param>
        /// <param name="targetNames">Can be null, if caller wants to build the default targets for the project.</param>
        /// <param name="globalProperties">Can be null if no global properties are needed.</param>
        /// <param name="targetOutputs">Can be null if outputs are not needed.</param>
        /// <param name="buildFlags">Specifies additional options to alter the behavior of the build.</param>
        /// <returns>true, if build succeeds</returns>
        public bool BuildProjectFile
        (
            string projectFile,
            string[] targetNames,
            BuildPropertyGroup globalProperties,
            IDictionary targetOutputs,
            BuildSettings buildFlags
        )
        {
            error.VerifyThrowArgumentNull(projectFile, "projectFileName");
            error.VerifyThrowArgument(projectFile.Length > 0, "EmptyProjectFileName");

            return BuildProjectFile(projectFile, targetNames, globalProperties, targetOutputs, buildFlags, null);
        }
 public override bool CanRun(BuildSettings settings, out string reason)
 {
     reason = null;
     return(true);
 }
Beispiel #44
0
		//FIXME: add a test for null @toolsVersion
		public bool BuildProjectFile (string projectFile,
					      string[] targetNames,
					      BuildPropertyGroup globalProperties,
					      IDictionary targetOutputs,
					      BuildSettings buildFlags, string toolsVersion)
		{
			Project project;

			if (projects.ContainsKey (projectFile)) {
				project = (Project) projects [projectFile];
			} else {
				project = CreateNewProject ();
				project.Load (projectFile);
			}

			BuildPropertyGroup engine_old_grp = null;
			BuildPropertyGroup project_old_grp = null;
			if (globalProperties != null) {
				engine_old_grp = GlobalProperties.Clone (true);
				project_old_grp = project.GlobalProperties.Clone (true);

				// Override project's global properties with the
				// ones explicitlcur_y specified here
				foreach (BuildProperty bp in globalProperties)
					project.GlobalProperties.AddProperty (bp);
				project.NeedToReevaluate ();
			}

			try {
				string oldProjectToolsVersion = project.ToolsVersion;
				if (String.IsNullOrEmpty (toolsVersion) && defaultToolsVersion != null)
					// no tv specified, let the project inherit it from the
					// engine. 'defaultToolsVersion' will be effective only
					// it has been overridden. Otherwise, the project's own
					// tv will be used.
					project.ToolsVersion = defaultToolsVersion;
				else
					project.ToolsVersion = toolsVersion;

				try {
					return project.Build (targetNames, targetOutputs, buildFlags);
				} finally {
					project.ToolsVersion = oldProjectToolsVersion;
				}
			} finally {
				if (globalProperties != null) {
					GlobalProperties = engine_old_grp;
					project.GlobalProperties = project_old_grp;
				}
			}
		}
        public void Initialize(BuildContext context, string defaultAttrFile)
        {
            BuildExceptions.NotNull(context, "context");

            base.Initialize(context.Logger);

            BuildSettings settings = context.Settings;

            if (settings == null)
            {
                this.IsInitialized = false;
                return;
            }
            _engineSettings = (ReferenceEngineSettings)settings.EngineSettings[
                BuildEngineType.Reference];
            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                return;
            }

            _settings        = settings;
            _context         = context;
            _defaultAttrFile = defaultAttrFile;

            if (!String.IsNullOrEmpty(_defaultAttrFile) &&
                File.Exists(_defaultAttrFile))
            {
                string configDir     = Path.GetDirectoryName(_defaultAttrFile);
                string apiFilterFile = Path.Combine(configDir, DefaultApiFilterFile);
                if (File.Exists(apiFilterFile))
                {
                    _compilerRootFilter = new ReferenceRootFilter();
                    _compilerRootFilter.Load(apiFilterFile);
                }
            }

            _assistComponents = null;
            if (_context.IsDirectSandcastle)
            {
                string sandcastleAssist = _settings.SandAssistDirectory;
                if (!String.IsNullOrEmpty(sandcastleAssist) &&
                    Directory.Exists(sandcastleAssist))
                {
                    // If the Sandcastle Assist component assembly is in the same
                    // directory as the Sandcastle Helpers...
                    string tempText = Path.Combine(sandcastleAssist,
                                                   "Sandcastle.Reflection.dll");
                    if (File.Exists(tempText))
                    {
                        _assistComponents = tempText;
                    }
                }
            }

            // 1. The reference ...
            this.RegisterItem(KeywordNamer,
                              new Action <string, XPathNavigator>(OnNamerItem));
            // 2. The reference ...
            this.RegisterItem(KeywordAddins,
                              new Action <string, XPathNavigator>(OnAddinsItem));
            // 3. The reference ...
            this.RegisterItem(KeywordPlatform,
                              new Action <string, XPathNavigator>(OnPlatformItem));
            // 4. The reference ...
            this.RegisterItem(KeywordResolver,
                              new Action <string, XPathNavigator>(OnResolverItem));
            // 5. The reference ...
            this.RegisterItem(KeywordOptions,
                              new Action <string, XPathNavigator>(OnOptionsItem));
            // 6. The reference ...
            this.RegisterItem(KeywordApiFilter,
                              new Action <string, XPathNavigator>(OnApiFilterItem));
            // 7. The reference ...
            this.RegisterItem(KeywordAttributeFilter,
                              new Action <string, XPathNavigator>(OnAttributeFilterItem));

            this.IsInitialized = true;
        }
Beispiel #46
0
 /// <summary>
 /// Builds a list of targets in an already-loaded project using the specified
 /// flags, and returns the target outputs.
 /// </summary>
 /// <owner>RGoel</owner>
 /// <param name="project"></param>
 /// <param name="targetNames"></param>
 /// <param name="targetOutputs"></param>
 /// <param name="buildFlags">whether previously built targets should be reset or not</param>
 /// <returns>true, if build succeeds</returns>
 public bool BuildProject
 (
     Project project,
     string[] targetNames,
     IDictionary targetOutputs,   // can be null if outputs are not needed
     BuildSettings buildFlags
 )
 {
     return PostProjectEvaluationRequests(project, new string[] { null }, new string[1][] { targetNames },
                                          new BuildPropertyGroup[] { null }, new IDictionary[] { targetOutputs }, buildFlags, new string[] { null });
 }
 public virtual void Uninitialize()
 {
     _group    = null;
     _format   = null;
     _settings = null;
 }
		public bool BuildProjectFile (string projectFile,
					      string[] targetNames,
					      BuildPropertyGroup globalProperties,
					      IDictionary targetOutputs,
					      BuildSettings buildFlags)
		{
			Project project;

			if (projects.ContainsKey (projectFile)) {
				project = (Project) projects [projectFile];
			} else {
				project = CreateNewProject ();
				project.Load (projectFile);
			}

			BuildPropertyGroup engine_old_grp = null;
			BuildPropertyGroup project_old_grp = null;
			if (globalProperties != null) {
				engine_old_grp = GlobalProperties.Clone (true);
				project_old_grp = project.GlobalProperties.Clone (true);

				// Override project's global properties with the
				// ones explicitlcur_y specified here
				foreach (BuildProperty bp in globalProperties)
					project.GlobalProperties.AddProperty (bp);
				project.NeedToReevaluate ();
			}

			try {
				return project.Build (targetNames, targetOutputs, buildFlags);
			} finally {
				if (globalProperties != null) {
					GlobalProperties = engine_old_grp;
					project.GlobalProperties = project_old_grp;
				}
			}
		}
Beispiel #49
0
		//FIXME: add a test for null @toolsVersion
		public bool BuildProjectFile (string projectFile,
					      string[] targetNames,
					      BuildPropertyGroup globalProperties,
					      IDictionary targetOutputs,
					      BuildSettings buildFlags, string toolsVersion)
		{
			Project project;

			if (projects.ContainsKey (projectFile)) {
				project = (Project) projects [projectFile];
			} else {
				project = CreateNewProject ();
				project.Load (projectFile);
			}

			BuildPropertyGroup engine_old_grp = null;
			BuildPropertyGroup project_old_grp = null;
			if (globalProperties != null) {
				engine_old_grp = GlobalProperties.Clone (true);
				project_old_grp = project.GlobalProperties.Clone (true);

				// Override project's global properties with the
				// ones explicitlcur_y specified here
				foreach (BuildProperty bp in globalProperties)
					project.GlobalProperties.AddProperty (bp);
				project.NeedToReevaluate ();
			}

			try {
				if (String.IsNullOrEmpty (toolsVersion) && defaultToolsVersion != null)
					// it has been explicitly set, xbuild does this..
					//FIXME: should this be cleared after building?
					project.ToolsVersion = defaultToolsVersion;
				else
					project.ToolsVersion = toolsVersion;

				return project.Build (targetNames, targetOutputs, buildFlags);
			} finally {
				if (globalProperties != null) {
					GlobalProperties = engine_old_grp;
					project.GlobalProperties = project_old_grp;
				}
			}
		}
	// Methods
	public virtual BuildResults Build(BuildSettings settings) {}