Beispiel #1
0
 appendConfigurationList(
     ConfigurationList configList)
 {
     lock (this.ConfigurationLists)
     {
         this.ConfigurationLists.Add(configList);
     }
 }
Beispiel #2
0
        public Target(
            Bam.Core.Module module,
            Project project)
        {
            this.IsA     = "PBXNativeTarget";
            this.Name    = module.GetType().Name;
            this.Module  = module;
            this.Project = project;
            this.Type    = EProductType.NA;

            var configList = new ConfigurationList(this);

            this.ConfigurationList = configList;
            project.ConfigurationLists.Add(configList);

            this.TargetDependencies = new Bam.Core.Array <TargetDependency>();
        }
Beispiel #3
0
        public Target(
            Bam.Core.Module module,
            Project project)
            :
            base(project, module.GetType().Name, "PBXNativeTarget", project.GUID)
        {
            this.Module = module;
            this.Type   = EProductType.NA;

            var configList = new ConfigurationList(this);

            this.ConfigurationList = configList;
            project.ConfigurationLists.Add(configList);

            this.TargetDependencies         = new Bam.Core.Array <TargetDependency>();
            this.ProposedTargetDependencies = new Bam.Core.Array <Target>();
        }
Beispiel #4
0
        EnsureTargetConfigurationExists(
            Bam.Core.Module module,
            ConfigurationList configList)
        {
            lock (configList)
            {
                var config         = module.BuildEnvironment.Configuration;
                var existingConfig = configList.Where(item => item.Config == config).FirstOrDefault();
                if (null != existingConfig)
                {
                    return(existingConfig);
                }

                // if a new target config is needed, then a new project config is needed too
                this.EnsureProjectConfigurationExists(module);

                var newConfig = new Configuration(module.BuildEnvironment.Configuration);
                this.AllConfigurations.Add(newConfig);
                configList.AddConfiguration(newConfig);

                var clangMeta = Bam.Core.Graph.Instance.PackageMetaData <Clang.MetaData>("Clang");

                // set which SDK to build against
                newConfig["SDKROOT"] = new UniqueConfigurationValue(clangMeta.SDK);

                // set the minimum version of OSX/iPhone to run against
                var minVersionRegEx = new System.Text.RegularExpressions.Regex("^(?<Type>[a-z]+)(?<Version>[0-9.]+)$");
                var match           = minVersionRegEx.Match(clangMeta.MinimumVersionSupported);
                if (!match.Groups["Type"].Success)
                {
                    throw new Bam.Core.Exception("Unable to extract SDK type from: '{0}'", clangMeta.MinimumVersionSupported);
                }
                if (!match.Groups["Version"].Success)
                {
                    throw new Bam.Core.Exception("Unable to extract SDK version from: '{0}'", clangMeta.MinimumVersionSupported);
                }

                var optionName = System.String.Format("{0}_DEPLOYMENT_TARGET", match.Groups["Type"].Value.ToUpper());
                newConfig[optionName] = new UniqueConfigurationValue(match.Groups["Version"].Value);

                return(newConfig);
            }
        }
Beispiel #5
0
        public Project(
            Bam.Core.Module module,
            string name)
            :
            base(null, name, "PBXProject")
        {
            this.ProjectDir = module.CreateTokenizedString("$(buildroot)/$(packagename).xcodeproj");
            module.Macros.Add("xcodeprojectdir", this.ProjectDir);

            var projectPath = module.CreateTokenizedString("$(xcodeprojectdir)/project.pbxproj");

            this.ProjectPath = projectPath.Parse();

            this.SourceRoot = module.CreateTokenizedString("$(packagedir)/").Parse();
            this.BuildRoot  = module.CreateTokenizedString("$(buildroot)").Parse();

            this.Module                  = module;
            this.Targets                 = new System.Collections.Generic.Dictionary <System.Type, Target>();
            this.FileReferences          = new System.Collections.Generic.List <FileReference>();
            this.BuildFiles              = new System.Collections.Generic.List <BuildFile>();
            this.Groups                  = new System.Collections.Generic.List <Group>();
            this.GroupMap                = new System.Collections.Generic.Dictionary <string, Group>();
            this.AllConfigurations       = new System.Collections.Generic.List <Configuration>();
            this.ProjectConfigurations   = new System.Collections.Generic.Dictionary <Bam.Core.EConfiguration, Configuration>();
            this.ConfigurationLists      = new System.Collections.Generic.List <ConfigurationList>();
            this.SourcesBuildPhases      = new System.Collections.Generic.List <SourcesBuildPhase>();
            this.FrameworksBuildPhases   = new System.Collections.Generic.List <FrameworksBuildPhase>();
            this.ShellScriptsBuildPhases = new Bam.Core.Array <ShellScriptBuildPhase>();
            this.CopyFilesBuildPhases    = new Bam.Core.Array <CopyFilesBuildPhase>();
            this.ContainerItemProxies    = new Bam.Core.Array <ContainerItemProxy>();
            this.ReferenceProxies        = new Bam.Core.Array <ReferenceProxy>();
            this.TargetDependencies      = new Bam.Core.Array <TargetDependency>();
            this.ProjectReferences       = new System.Collections.Generic.Dictionary <Group, FileReference>();

            this.Groups.Add(new Group(this, null));       // main group
            this.Groups.Add(new Group(this, "Products")); // product ref group
            this.MainGroup.AddChild(this.ProductRefGroup);

            var configList = new ConfigurationList(this);

            this.ConfigurationLists.Add(configList);
        }
Beispiel #6
0
        public Target(
            Bam.Core.Module module,
            Project project)
            :
            base(project, module.GetType().Name, "PBXNativeTarget", project.GUID)
        {
            this.Module = module;
            this.Type   = EProductType.NA;

            var configList = new ConfigurationList(this);

            this.ConfigurationList = configList;
            project.appendConfigurationList(configList);

            this.TargetDependencies         = new Bam.Core.Array <TargetDependency>();
            this.ProposedTargetDependencies = new Bam.Core.Array <Target>();

            this.BuildPhases       = new System.Lazy <Bam.Core.Array <BuildPhase> >(() => new Bam.Core.Array <BuildPhase>());
            this.SourcesBuildPhase = new System.Lazy <SourcesBuildPhase>(() =>
            {
                var phase = new SourcesBuildPhase(this);
                this.appendBuildPhase(phase);
                this.Project.appendSourcesBuildPhase(phase);
                return(phase);
            });
            this.FrameworksBuildPhase = new System.Lazy <XcodeBuilder.FrameworksBuildPhase>(() =>
            {
                var phase = new FrameworksBuildPhase(this);
                this.Project.appendFrameworksBuildPhase(phase);
                this.appendBuildPhase(phase);
                return(phase);
            });
            this.PreBuildBuildPhase = new System.Lazy <ShellScriptBuildPhase>(() =>
            {
                return(new ShellScriptBuildPhase(this, "Pre Build", (target) =>
                {
                    var content = new System.Text.StringBuilder();
                    foreach (var config in target.ConfigurationList)
                    {
                        content.AppendFormat("if [ \\\"$CONFIGURATION\\\" = \\\"{0}\\\" ]; then\\n\\n", config.Name);
                        config.SerializePreBuildCommands(content, 1);
                        content.AppendFormat("fi\\n\\n");
                    }
                    return content.ToString();
                }));
            });
            this.PostBuildBuildPhase = new System.Lazy <ShellScriptBuildPhase>(() =>
            {
                return(new ShellScriptBuildPhase(this, "Post Build", (target) =>
                {
                    var content = new System.Text.StringBuilder();
                    foreach (var config in target.ConfigurationList)
                    {
                        content.AppendFormat("if [ \\\"$CONFIGURATION\\\" = \\\"{0}\\\" ]; then\\n\\n", config.Name);
                        config.SerializePostBuildCommands(content, 1);
                        content.AppendFormat("fi\\n\\n");
                    }
                    return content.ToString();
                }));
            });
        }