IStripToolPolicy.Strip(
            StripModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString originalPath,
            Bam.Core.TokenizedString copiedPath)
        {
            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            var sourceFilename = System.IO.Path.GetFileName(originalPath.ToString());

            var dir = sender.CreateTokenizedString("@dir($(0))", copiedPath);

            dir.Parse();
            meta.CommonMetaData.AddDirectory(dir.ToString());
            rule.AddTarget(copiedPath, variableName: "strip_" + sourceFilename);
            rule.AddPrerequisite(originalPath);

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            rule.AddShellCommand(System.String.Format("{0} {1} {2} -o {3} {4}",
                                                      CommandLineProcessor.Processor.StringifyTool(sender.Tool as Bam.Core.ICommandLineTool),
                                                      commandLine.ToString(' '),
                                                      originalPath.ToString(),
                                                      copiedPath.ToString(),
                                                      CommandLineProcessor.Processor.TerminatingArgs(sender.Tool as Bam.Core.ICommandLineTool)));
        }
Esempio n. 2
0
 convertPaths(
     CollatedObject module,
     Bam.Core.TokenizedString inSourcePath,
     Bam.Core.TokenizedString inPublishingPath,
     out string resolvedSourcePath,
     out string resolvedDestinationDir)
 {
     if (module is CollatedDirectory)
     {
         // Posix cp only requires the destination to be added when there is a rename
         if (module.Macros.Contains("RenameLeaf"))
         {
             resolvedSourcePath = System.String.Format("{0}{1}*",
                                                       inSourcePath.ToString(),
                                                       System.IO.Path.DirectorySeparatorChar);
             resolvedDestinationDir = System.String.Format("{0}{1}{2}{1}",
                                                           inPublishingPath.ToString(),
                                                           System.IO.Path.DirectorySeparatorChar,
                                                           module.Macros["RenameLeaf"].ToString());
         }
         else
         {
             resolvedSourcePath     = inSourcePath.ToString();
             resolvedDestinationDir = inPublishingPath.ToString();
         }
     }
     else
     {
         resolvedSourcePath     = inSourcePath.ToString();
         resolvedDestinationDir = inPublishingPath.ToString();
     }
 }
Esempio n. 3
0
        convertPaths(
            CollatedObject module,
            Bam.Core.TokenizedString inSourcePath,
            Bam.Core.TokenizedString inPublishingPath,
            out string resolvedSourcePath,
            out string resolvedDestinationDir)
        {
            resolvedSourcePath = inSourcePath.ToString();

            if (module is CollatedDirectory)
            {
                // Windows XCOPY requires the directory name to be added to the destination regardless
                if (module.Macros.Contains("RenameLeaf"))
                {
                    resolvedDestinationDir = System.String.Format("{0}{1}{2}{1}",
                                                                  inPublishingPath.ToString(),
                                                                  System.IO.Path.DirectorySeparatorChar,
                                                                  module.Macros["RenameLeaf"].ToString());
                }
                else
                {
                    resolvedDestinationDir = System.String.Format("{0}{1}{2}{1}",
                                                                  inPublishingPath.ToString(),
                                                                  System.IO.Path.DirectorySeparatorChar,
                                                                  System.IO.Path.GetFileName(inSourcePath.ToString()));
                }
            }
            else
            {
                resolvedDestinationDir = inPublishingPath.ToString();
            }
        }
Esempio n. 4
0
        IZipToolPolicy.Zip(
            ZipModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString zipOutputPath,
            Bam.Core.TokenizedString zipInputPath)
        {
            var zipDir = System.IO.Path.GetDirectoryName(zipOutputPath.ToString());

            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(zipDir);

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);
            if (sender.Tool is ZipPosix)
            {
                commandLine.Add("-o");
                commandLine.Add(Bam.Core.IOWrapper.EscapeSpacesInPath(zipOutputPath.ToString()));
            }
            else
            {
                commandLine.Add(zipOutputPath.ToStringQuoteIfNecessary());
            }
            commandLine.Add("*");
            CommandLineProcessor.Processor.Execute(
                context,
                sender.Tool as Bam.Core.ICommandLineTool,
                commandLine,
                zipInputPath.ToString()
                );
        }
Esempio n. 5
0
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var commandLineArgs = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLineArgs);

            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            rule.AddTarget(objectFilePath);
            rule.AddPrerequisite(source, C.SourceFile.Key);

            var tool    = sender.Tool as Bam.Core.ICommandLineTool;
            var command = new System.Text.StringBuilder();

            command.AppendFormat("{0} {1} $< {2}",
                                 CommandLineProcessor.Processor.StringifyTool(tool),
                                 commandLineArgs.ToString(' '),
                                 CommandLineProcessor.Processor.TerminatingArgs(tool));
            rule.AddShellCommand(command.ToString());

            var objectFileDir = System.IO.Path.GetDirectoryName(objectFilePath.ToString());

            meta.CommonMetaData.Directories.AddUnique(objectFileDir);
            meta.CommonMetaData.ExtendEnvironmentVariables(tool.EnvironmentVariables);
        }
Esempio n. 6
0
        IExternalSourceGeneratorPolicy.GenerateSource(
            ExternalSourceGenerator sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString executable,
            Bam.Core.TokenizedStringArray arguments,
            Bam.Core.TokenizedString output_directory,
            System.Collections.Generic.IReadOnlyDictionary <string, Bam.Core.TokenizedString> expected_output_files,
            System.Collections.Generic.IReadOnlyDictionary <string, Bam.Core.TokenizedString> input_files
            )
        {
            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(output_directory.ToString());
            var program         = executable.ToStringQuoteIfNecessary();
            var linearised_args = arguments.ToString(' ');

            Bam.Core.Log.Info("Running: {0} {1}", program, linearised_args);
            Bam.Core.OSUtilities.RunExecutable(program, linearised_args);
            foreach (var expected_file in expected_output_files)
            {
                if (!System.IO.File.Exists(expected_file.Value.ToString()))
                {
                    throw new Bam.Core.Exception(
                              "Expected '{0}' to exist (key={1}), but it does not",
                              expected_file.Value.ToString(),
                              expected_file.Key
                              );
                }
            }
        }
Esempio n. 7
0
        IInstallNameToolPolicy.InstallName(
            InstallNameModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString oldName,
            Bam.Core.TokenizedString newName)
        {
            var originalModule = (sender.Source as ICollatedObject).SourceModule;

            if (originalModule == null)
            {
                return;
            }

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            var commands = new Bam.Core.StringArray();

            // TODO: check what happens for prebuilt modules (there shouldn't be any metadata)

            commands.Add(System.String.Format("{0} {1} {2} {3} {4} {5}",
                                              CommandLineProcessor.Processor.StringifyTool(sender.Tool as Bam.Core.ICommandLineTool),
                                              commandLine.ToString(' '),
                                              oldName.ToString(),
                                              newName.ToString(),
                                              sender.Source.GeneratedPaths[CollatedObject.Key].ToString(),
                                              CommandLineProcessor.Processor.TerminatingArgs(sender.Tool as Bam.Core.ICommandLineTool)));

            var target        = originalModule.MetaData as XcodeBuilder.Target;
            var configuration = target.GetConfiguration(originalModule);

            target.AddPostBuildCommands(commands, configuration);
        }
Esempio n. 8
0
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            if (!sender.PerformCompilation)
            {
                return;
            }
            if (sender.ReasonToExecute.Reason == Bam.Core.ExecuteReasoning.EReason.DeferredEvaluation)
            {
                if (!DeferredEvaluationRequiresBuild(sender))
                {
                    return;
                }
            }

            var objectFileDir = System.IO.Path.GetDirectoryName(objectFilePath.ToString());

            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(objectFileDir);

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);
            commandLine.Add(source.GeneratedPaths[SourceFile.Key].ParseAndQuoteIfNecessary());
            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
        IExternalSourceGeneratorPolicy.GenerateSource(
            ExternalSourceGenerator sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString executable,
            Bam.Core.TokenizedStringArray arguments,
            Bam.Core.TokenizedString output_directory,
            System.Collections.Generic.IReadOnlyDictionary <string, Bam.Core.TokenizedString> expected_output_files,
            System.Collections.Generic.IReadOnlyDictionary <string, Bam.Core.TokenizedString> input_files
            )
        {
            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            rule.AddTarget(expected_output_files.Values.First());
            foreach (var input in input_files.Values)
            {
                rule.AddPrerequisite(input);
            }

            rule.AddShellCommand(
                System.String.Format("{0} {1}", executable.ToStringQuoteIfNecessary(), arguments.ToString(' '))
                );

            meta.CommonMetaData.AddDirectory(output_directory.ToString());
        }
Esempio n. 10
0
        IArchivingPolicy.Archive(
            StaticLibrary sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString libraryPath,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> objectFiles,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> headers)
        {
            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            var libraryFileDir = System.IO.Path.GetDirectoryName(libraryPath.ToString());

            if (!System.IO.Directory.Exists(libraryFileDir))
            {
                System.IO.Directory.CreateDirectory(libraryFileDir);
            }

            foreach (var input in objectFiles)
            {
                commandLine.Add(input.GeneratedPaths[C.ObjectFile.Key].ToString());
            }

            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
Esempio n. 11
0
        IArchivingPolicy.Archive(
            StaticLibrary sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString libraryPath,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> objectFiles,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> headers)
        {
            if (sender.ReasonToExecute.Reason == Bam.Core.ExecuteReasoning.EReason.DeferredEvaluation)
            {
                if (!DeferredEvaluationRequiresBuild(sender, objectFiles))
                {
                    return;
                }
            }

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            var libraryFileDir = System.IO.Path.GetDirectoryName(libraryPath.ToString());

            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(libraryFileDir);

            foreach (var input in objectFiles)
            {
                if (!(input as C.ObjectFileBase).PerformCompilation)
                {
                    continue;
                }
                commandLine.Add(input.GeneratedPaths[C.ObjectFile.Key].ToString());
            }

            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
        GetSettingsGroup(
            VSSettingsGroup.ESettingsGroup group,
            Bam.Core.TokenizedString include = null,
            bool uniqueToProject             = false)
        {
            lock (this.SettingGroups)
            {
                foreach (var settings in this.SettingGroups)
                {
                    if (null == include)
                    {
                        if ((null == settings.Include) && (settings.Group == group))
                        {
                            return(settings);
                        }
                    }
                    else
                    {
                        // ignore group, as files can mutate between them during the buildprocess (e.g. headers into custom builds)
                        // TODO: can this be a TokenizedString hash compare?
                        if ((null != include) && (settings.Include.ToString() == include.ToString()))
                        {
                            return(settings);
                        }
                    }
                }

                var newGroup = uniqueToProject ?
                               this.Project.GetUniqueSettingsGroup(this.Module, group, include) :
                               new VSSettingsGroup(this.Project, this.Module, group, include);
                this.SettingGroups.Add(newGroup);
                return(newGroup);
            }
        }
Esempio n. 13
0
        ITarPolicy.CreateTarBall(
            TarBall sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.ICommandLineTool compiler,
            Bam.Core.TokenizedString scriptPath,
            Bam.Core.TokenizedString outputPath)
        {
            var tarPath = outputPath.ToString();
            var tarDir  = System.IO.Path.GetDirectoryName(tarPath);

            if (!System.IO.Directory.Exists(tarDir))
            {
                System.IO.Directory.CreateDirectory(tarDir);
            }

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            commandLine.Add("-c");
            commandLine.Add("-v");
            commandLine.Add("-T");
            commandLine.Add(scriptPath.Parse());
            commandLine.Add("-f");
            commandLine.Add(tarPath);
            CommandLineProcessor.Processor.Execute(context, compiler, commandLine);
        }
Esempio n. 14
0
        IZipToolPolicy.Zip(
            ZipModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString zipOutputPath,
            Bam.Core.TokenizedString zipInputPath)
        {
            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            var dir = sender.CreateTokenizedString("@dir($(0))", zipOutputPath);

            dir.Parse();
            meta.CommonMetaData.AddDirectory(dir.ToString());
            rule.AddTarget(zipOutputPath);

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            var args = new Bam.Core.StringArray();

            args.Add(System.String.Format("cd {0};", zipInputPath.ToString()));
            args.Add(
                System.String.Format("{0} {1} -o {2} {3} {4}",
                                     CommandLineProcessor.Processor.StringifyTool(sender.Tool as Bam.Core.ICommandLineTool),
                                     commandLine.ToString(' '),
                                     zipOutputPath.ToString(),
                                     "*",
                                     CommandLineProcessor.Processor.TerminatingArgs(sender.Tool as Bam.Core.ICommandLineTool)
                                     )
                );
            rule.AddShellCommand(args.ToString(' '));
        }
Esempio n. 15
0
        IAssemblerPolicy.Assemble(
            AssembledObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            if (!sender.PerformCompilation)
            {
                return;
            }

            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            rule.AddTarget(objectFilePath);
            rule.AddPrerequisite(source, C.SourceFile.Key);

            var outputPath = objectFilePath.ToString();

            var args = new Bam.Core.StringArray();

            args.Add(CommandLineProcessor.Processor.StringifyTool(sender.Tool as Bam.Core.ICommandLineTool));
            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(args);
            args.Add("$<");
            rule.AddShellCommand(args.ToString(' '));

            meta.CommonMetaData.AddDirectory(System.IO.Path.GetDirectoryName(outputPath));
        }
Esempio n. 16
0
        IArchivingPolicy.Archive(
            StaticLibrary sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString libraryPath,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> objectFiles,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> headers)
        {
            var commandLineArgs = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLineArgs);

            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            rule.AddTarget(libraryPath);
            foreach (var input in objectFiles)
            {
                rule.AddPrerequisite(input, C.ObjectFile.Key);
            }

            var tool    = sender.Tool as Bam.Core.ICommandLineTool;
            var command = new System.Text.StringBuilder();

            command.AppendFormat("{0} {1} $^ {2}",
                                 CommandLineProcessor.Processor.StringifyTool(tool),
                                 commandLineArgs.ToString(' '),
                                 CommandLineProcessor.Processor.TerminatingArgs(tool));
            rule.AddShellCommand(command.ToString());

            var libraryFileDir = System.IO.Path.GetDirectoryName(libraryPath.ToString());

            meta.CommonMetaData.Directories.AddUnique(libraryFileDir);
            meta.CommonMetaData.ExtendEnvironmentVariables(tool.EnvironmentVariables);
        }
Esempio n. 17
0
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            if (!sender.PerformCompilation)
            {
                return;
            }

            var commandLineArgs = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLineArgs);

            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            rule.AddTarget(objectFilePath);
            rule.AddPrerequisite(source, C.SourceFile.Key);

            var tool    = sender.Tool as Bam.Core.ICommandLineTool;
            var command = new System.Text.StringBuilder();

            command.AppendFormat("{0} {1} $< {2}",
                                 CommandLineProcessor.Processor.StringifyTool(tool),
                                 commandLineArgs.ToString(' '),
                                 CommandLineProcessor.Processor.TerminatingArgs(tool));
            rule.AddShellCommand(command.ToString());

            var objectFileDir = System.IO.Path.GetDirectoryName(objectFilePath.ToString());

            meta.CommonMetaData.AddDirectory(objectFileDir);
            meta.CommonMetaData.ExtendEnvironmentVariables(tool.EnvironmentVariables);

            // add dependencies, such as procedurally generated headers
            foreach (var dep in sender.Dependents)
            {
                if (null == dep.MetaData)
                {
                    continue;
                }
                if (dep is C.SourceFile)
                {
                    continue;
                }
                var depMeta = dep.MetaData as MakeFileBuilder.MakeFileMeta;
                foreach (var depRule in depMeta.Rules)
                {
                    depRule.ForEachTarget(target =>
                    {
                        if (!target.IsPhony)
                        {
                            rule.AddPrerequisite(target.Path);
                        }
                    });
                }
            }
        }
Esempio n. 18
0
 assignGroupToPath(
     Bam.Core.TokenizedString path,
     Group group)
 {
     lock (this.GroupMap)
     {
         this.GroupMap.Add(path.ToString(), group);
     }
 }
Esempio n. 19
0
 convertPaths(
     CollatedObject module,
     Bam.Core.TokenizedString inSourcePath,
     Bam.Core.TokenizedString inPublishingPath,
     out string resolvedSourcePath,
     out string resolvedDestinationDir)
 {
     resolvedSourcePath     = inSourcePath.ToString();
     resolvedDestinationDir = inPublishingPath.ToString();
 }
Esempio n. 20
0
 public Group(
     Target target,
     string name,
     Bam.Core.TokenizedString fullPath)
     :
     base(target.Project, name, "PBXGroup", fullPath.ToString())
 {
     this.SourceTree = "<group>";
     this.Children   = new Bam.Core.Array <Object>();
 }
Esempio n. 21
0
        getGroupForPath(
            Bam.Core.TokenizedString path)
        {
            var match = this.GroupMap.FirstOrDefault(item => item.Key == path.ToString());

            if (match.Equals(default(System.Collections.Generic.KeyValuePair <string, Group>)))
            {
                return(null);
            }
            return(match.Value);
        }
Esempio n. 22
0
        GetRelativePathToProject(
            Bam.Core.TokenizedString inputPath)
        {
            var relPath = Bam.Core.RelativePathUtilities.GetPath(inputPath.ToString(), this.ProjectDir.ToString());

            if (Bam.Core.RelativePathUtilities.IsPathAbsolute(relPath))
            {
                return(null);
            }
            return(relPath);
        }
Esempio n. 23
0
 public VSProject(
     VSSolution solution,
     Bam.Core.Module module,
     Bam.Core.TokenizedString projectPath)
     :
     base(projectPath.ToString())
 {
     this.Solution                   = solution;
     this.Module                     = module;
     this.ProjectPath                = projectPath.ToString();
     this.Configurations             = new System.Collections.Generic.Dictionary <Bam.Core.EConfiguration, VSProjectConfiguration>();
     this.ProjectSettings            = new Bam.Core.Array <VSSettingsGroup>();
     this.Headers                    = new Bam.Core.Array <VSSettingsGroup>();
     this.Sources                    = new Bam.Core.Array <VSSettingsGroup>();
     this.Others                     = new Bam.Core.Array <VSSettingsGroup>();
     this.Resources                  = new Bam.Core.Array <VSSettingsGroup>();
     this.AssemblyFiles              = new Bam.Core.Array <VSSettingsGroup>();
     this.Filter                     = new VSProjectFilter(this);
     this.OrderOnlyDependentProjects = new Bam.Core.Array <VSProject>();
     this.LinkDependentProjects      = new Bam.Core.Array <VSProject>();
 }
Esempio n. 24
0
        ILinkingPolicy.Link(
            ConsoleApplication sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString executablePath,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> objectFiles,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> headers,
            System.Collections.ObjectModel.ReadOnlyCollection <Bam.Core.Module> libraries)
        {
            if (sender.ReasonToExecute.Reason == Bam.Core.ExecuteReasoning.EReason.DeferredEvaluation)
            {
                if (!DeferredEvaluationRequiresBuild(sender, objectFiles, libraries))
                {
                    return;
                }
            }

            // any libraries added prior to here, need to be moved to the end
            // they are external dependencies, and thus all built modules (to be added now) may have
            // a dependency on them (and not vice versa)
            var linker       = sender.Settings as C.ICommonLinkerSettings;
            var externalLibs = linker.Libraries;

            linker.Libraries = new Bam.Core.StringArray();
            foreach (var library in libraries)
            {
                (sender.Tool as C.LinkerTool).ProcessLibraryDependency(sender as CModule, library as CModule);
            }
            linker.Libraries.AddRange(externalLibs);

            var executableDir = System.IO.Path.GetDirectoryName(executablePath.ToString());

            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(executableDir);

            var commandLine = new Bam.Core.StringArray();

            // first object files
            foreach (var input in objectFiles)
            {
                if (!(input as C.ObjectFileBase).PerformCompilation)
                {
                    continue;
                }
                commandLine.Add(input.GeneratedPaths[C.ObjectFile.Key].ToString());
            }

            // then all options
            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
        IInstallNameToolPolicy.InstallName(
            InstallNameModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString oldName,
            Bam.Core.TokenizedString newName)
        {
            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);

            commandLine.Add(newName.ToString());
            commandLine.Add(sender.Source.GeneratedPaths[CollatedObject.Key].ToString());
            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
Esempio n. 26
0
        IObjCopyToolPolicy.ObjCopy(
            ObjCopyModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString originalPath,
            Bam.Core.TokenizedString copiedPath)
        {
            var copiedDir = System.IO.Path.GetDirectoryName(copiedPath.ToString());

            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(copiedDir);

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);
            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
Esempio n. 27
0
 public FileReference(
     Bam.Core.TokenizedString path,
     EFileType type,
     Project project,
     bool explicitType      = false,
     ESourceTree sourceTree = ESourceTree.NA,
     string relativePath    = null)
     :
     base(project, path.ToString(), "PBXFileReference", type.ToString(), project.GUID, explicitType.ToString(), sourceTree.ToString(), relativePath)
 {
     this.Path         = path;
     this.Type         = type;
     this.SourceTree   = sourceTree;
     this.ExplicitType = explicitType;
     this.RelativePath = relativePath;
 }
Esempio n. 28
0
        IStripToolPolicy.Strip(
            StripModule sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString originalPath,
            Bam.Core.TokenizedString strippedPath)
        {
            var strippedDir = System.IO.Path.GetDirectoryName(strippedPath.ToString());

            Bam.Core.IOWrapper.CreateDirectoryIfNotExists(strippedDir);

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);
            commandLine.Add(originalPath.ToStringQuoteIfNecessary());
            commandLine.Add(System.String.Format("-o {0}", strippedPath.ToStringQuoteIfNecessary()));
            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }
Esempio n. 29
0
        AddSetting(
            string name,
            Bam.Core.TokenizedString path,
            string condition     = null,
            bool inheritExisting = false,
            bool isPath          = false)
        {
            lock (this.Settings)
            {
                var stringValue = isPath ? toRelativePath(path) : path.ToString();
                if (this.Settings.Any(item => item.Name == name && item.Condition == condition && item.Value != stringValue))
                {
                    throw new Bam.Core.Exception("Cannot change the value of existing tokenized path option {0} to {1}", name, path.ToString());
                }

                this.Settings.AddUnique(new VSSetting(name, stringValue, condition));
            }
        }
Esempio n. 30
0
        ICompilationPolicy.Compile(
            ObjectFile sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.TokenizedString objectFilePath,
            Bam.Core.Module source)
        {
            var objectFileDir = System.IO.Path.GetDirectoryName(objectFilePath.ToString());

            if (!System.IO.Directory.Exists(objectFileDir))
            {
                System.IO.Directory.CreateDirectory(objectFileDir);
            }

            var commandLine = new Bam.Core.StringArray();

            (sender.Settings as CommandLineProcessor.IConvertToCommandLine).Convert(commandLine);
            commandLine.Add(source.GeneratedPaths[SourceFile.Key].ParseAndQuoteIfNecessary());
            CommandLineProcessor.Processor.Execute(context, sender.Tool as Bam.Core.ICommandLineTool, commandLine);
        }