Esempio n. 1
0
        public override void Initialize(BuildContext context)
        {
            if (this.IsInitialized)
            {
                return;
            }

            base.Initialize(context);
            if (!this.IsInitialized)
            {
                return;
            }

            if (_listGroups == null || _listGroups.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            BuildSettings settings = this.Settings;

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

            int itemCount = _listGroups.Count;

            for (int i = 0; i < itemCount; i++)
            {
                ReferenceGroup group = _listGroups[i];

                BuildGroupContext groupContext = context.GroupContexts[group.Id];
                if (groupContext == null)
                {
                    throw new BuildException(
                              "The group context is not provided, and it is required by the build system.");
                }

                string indexText = String.Empty;
                if (itemCount > 1)
                {
                    indexText = (i + 1).ToString();
                }

                // Create the build dynamic properties...
                groupContext.CreateProperties(indexText);

                group.BeginSources(context);
            }

            // Turn the link sources to dynamic groups...
            this.CreateLinkGroups(context);

            // Cache the list of applicable formats...
            _listFormats = new BuildFormatList();

            BuildFormatList listFormats = this.Settings.Formats;

            if (listFormats == null || listFormats.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }
            itemCount = listFormats.Count;
            for (int i = 0; i < itemCount; i++)
            {
                BuildFormat format = listFormats[i];
                if (format != null && format.Enabled)
                {
                    _listFormats.Add(format);
                }
            }
            if (_listFormats == null || _listFormats.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            // Finally, initialize the build groups...
            itemCount = _listGroups.Count;
            for (int i = 0; i < itemCount; i++)
            {
                ReferenceGroup group = _listGroups[i];

                group.Initialize(context);
                if (!group.IsInitialized)
                {
                    this.IsInitialized = false;
                    break;
                }
            }
        }
Esempio n. 2
0
        public override void Initialize(BuildContext context)
        {
            if (this.IsInitialized)
            {
                return;
            }

            base.Initialize(context);
            if (!this.IsInitialized)
            {
                return;
            }

            if (_listGroups == null || _listGroups.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            int itemCount = _listGroups.Count;

            for (int i = 0; i < itemCount; i++)
            {
                ConceptualGroup group = _listGroups[i];

                BuildGroupContext groupContext = context.GroupContexts[group.Id];
                if (groupContext == null)
                {
                    throw new BuildException(
                              "The group context is not provided, and it is required by the build system.");
                }

                string indexText = String.Empty;
                if (itemCount > 1)
                {
                    indexText = (i + 1).ToString();
                }

                // Create the build dynamic properties...
                groupContext.CreateProperties(indexText);

                group.BeginSources(context);
            }

            _listFormats = new BuildFormatList();
            BuildFormatList listFormats = this.Settings.Formats;

            if (listFormats == null || listFormats.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            itemCount = listFormats.Count;
            for (int i = 0; i < itemCount; i++)
            {
                BuildFormat format = listFormats[i];
                if (format != null && format.Enabled)
                {
                    _listFormats.Add(format);
                }
            }
            if (_listFormats == null || _listFormats.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            itemCount = _listGroups.Count;
            for (int i = 0; i < itemCount; i++)
            {
                ConceptualGroup group = _listGroups[i];

                group.Initialize(context);
                if (!group.IsInitialized)
                {
                    this.IsInitialized = false;
                    break;
                }
            }
        }