예제 #1
0
        ISharedObjectSymbolicLinkPolicy.Symlink(
            SharedObjectSymbolicLink sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.PreBuiltTool tool,
            ConsoleApplication target)
        {
            var meta = new MakeFileBuilder.MakeFileMeta(sender);
            var rule = meta.AddRule();

            // since this is not a referenced type, need to specify a variable name for the MakeFile
            var variableName = new System.Text.StringBuilder();

            variableName.Append(target.GetType().Name);                    // this is what it's building the symlink for
            variableName.Append("_");
            variableName.Append(sender.Macros["SymlinkUsage"].ToString()); // intended usage

            rule.AddTarget(sender.GeneratedPaths[SharedObjectSymbolicLink.Key], variableName: variableName.ToString());
            rule.AddPrerequisite(target, C.ConsoleApplication.Key);

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

            commandLineArgs.Add("-s");
            commandLineArgs.Add("-f");

            var command = new System.Text.StringBuilder();

            command.AppendFormat("{0} {1} $(notdir $<) $@ {2}",
                                 CommandLineProcessor.Processor.StringifyTool(tool),
                                 commandLineArgs.ToString(' '),
                                 CommandLineProcessor.Processor.TerminatingArgs(tool));
            rule.AddShellCommand(command.ToString());
        }
예제 #2
0
        ISharedObjectSymbolicLinkPolicy.Symlink(
            SharedObjectSymbolicLink sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.PreBuiltTool tool,
            ConsoleApplication target)
        {
            var commandLine = new Bam.Core.StringArray();

            commandLine.Add("-s");
            commandLine.Add("-f");
            var sourceFile = sender.CreateTokenizedString("@filename($(0))", target.GeneratedPaths[ConsoleApplication.Key]);

            lock (sourceFile)
            {
                if (!sourceFile.IsParsed)
                {
                    sourceFile.Parse();
                }
            }
            commandLine.Add(sourceFile.ToStringQuoteIfNecessary());
            var destination = sender.CreateTokenizedString("@dir($(0))/$(1)", target.GeneratedPaths[ConsoleApplication.Key], target.Macros[sender.Macros["SymlinkUsage"].ToString()]);

            lock (destination)
            {
                if (!destination.IsParsed)
                {
                    destination.Parse();
                }
            }
            commandLine.Add(destination.ToStringQuoteIfNecessary());
            CommandLineProcessor.Processor.Execute(context, tool, commandLine);
        }
예제 #3
0
        ISharedObjectSymbolicLinkPolicy.Symlink(
            ConsoleApplication sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.PreBuiltTool tool,
            Bam.Core.TokenizedString linkname,
            Bam.Core.TokenizedString target)
        {
            var commandLine = new Bam.Core.StringArray();

            commandLine.Add("-s");
            commandLine.Add("-f");
            commandLine.Add(sender.CreateTokenizedString("@filename($(0))", target).Parse());
            commandLine.Add(sender.CreateTokenizedString("@dir($(0))/$(1)", target, linkname).Parse());
            CommandLineProcessor.Processor.Execute(context, tool, commandLine);
        }
        ISharedObjectSymbolicLinkPolicy.Symlink(
            ConsoleApplication sender,
            Bam.Core.ExecutionContext context,
            Bam.Core.PreBuiltTool tool,
            Bam.Core.TokenizedString linkname,
            Bam.Core.TokenizedString target)
        {
            var makeMeta = sender.MetaData as MakeFileBuilder.MakeFileMeta;
            var rule     = makeMeta.Rules[0];

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

            commandLineArgs.Add("-s");
            commandLineArgs.Add("-f");

            rule.AddShellCommand(System.String.Format(@"{0} {1} $(notdir $@) $(dir $@)/{2} {3}",
                                                      CommandLineProcessor.Processor.StringifyTool(tool),
                                                      commandLineArgs.ToString(' '),
                                                      linkname.Parse(),
                                                      CommandLineProcessor.Processor.TerminatingArgs(tool)));
        }