コード例 #1
0
            public override string Resolve(string rootPath, string bffFilePath, Resolver resolver)
            {
                var normalizedSource      = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Source);
                var normalizedDestination = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Destination);

                using (resolver.NewScopedParameter("fastBuildCopyDirName", Identifier))
                    using (resolver.NewScopedParameter("fastBuildCopyDirSourcePath", Util.EnsureTrailingSeparator(normalizedSource)))
                        using (resolver.NewScopedParameter("fastBuildCopyDirDestinationPath", Util.EnsureTrailingSeparator(normalizedDestination)))
                            using (resolver.NewScopedParameter("fastBuildCopyDirRecurse", Recurse.ToString().ToLower()))
                                using (resolver.NewScopedParameter("fastBuildCopyDirPattern", UtilityMethods.GetBffFileCopyPattern(FilePattern)))
                                    using (resolver.NewScopedParameter("fastBuildCopyDirDependencies", Dependencies.Count > 0 ? UtilityMethods.FBuildFormatList(Dependencies.ToList(), 42) : FileGeneratorUtilities.RemoveLineTag))
                                    {
                                        return(resolver.Resolve(Bff.Template.ConfigurationFile.CopyDirSection));
                                    }
            }
コード例 #2
0
ファイル: MasterBff.cs プロジェクト: xubingyue/Sharpmake
        private static void WriteEvents(
            FileGenerator fileGenerator,
            Dictionary <string, Project.Configuration.BuildStepBase> buildEvents,
            Dictionary <string, string> bffSection,
            string relativeTo
            )
        {
            foreach (var buildEvent in buildEvents)
            {
                if (buildEvent.Value is Project.Configuration.BuildStepExecutable)
                {
                    var execCommand = buildEvent.Value as Project.Configuration.BuildStepExecutable;

                    using (fileGenerator.Declare("fastBuildPreBuildName", buildEvent.Key))
                        using (fileGenerator.Declare("fastBuildPrebuildExeFile", Util.PathGetRelative(relativeTo, execCommand.ExecutableFile)))
                            using (fileGenerator.Declare("fastBuildPreBuildInputFile", Util.PathGetRelative(relativeTo, execCommand.ExecutableInputFileArgumentOption)))
                                using (fileGenerator.Declare("fastBuildPreBuildOutputFile", Util.PathGetRelative(relativeTo, execCommand.ExecutableOutputFileArgumentOption)))
                                    using (fileGenerator.Declare("fastBuildPreBuildArguments", string.IsNullOrWhiteSpace(execCommand.ExecutableOtherArguments) ? FileGeneratorUtilities.RemoveLineTag : execCommand.ExecutableOtherArguments))
                                        using (fileGenerator.Declare("fastBuildPrebuildWorkingPath", execCommand.ExecutableWorkingDirectory == string.Empty ? FileGeneratorUtilities.RemoveLineTag : Util.PathGetRelative(relativeTo, execCommand.ExecutableWorkingDirectory)))
                                            using (fileGenerator.Declare("fastBuildPrebuildUseStdOutAsOutput", execCommand.FastBuildUseStdOutAsOutput ? "true" : FileGeneratorUtilities.RemoveLineTag))
                                                using (fileGenerator.Declare("fastBuildPrebuildAlwaysShowOutput", execCommand.FastBuildAlwaysShowOutput ? "true" : FileGeneratorUtilities.RemoveLineTag))
                                                {
                                                    string eventKey = fileGenerator.Resolver.Resolve(buildEvent.Key);
                                                    if (!bffSection.ContainsKey(eventKey))
                                                    {
                                                        bffSection.Add(eventKey, fileGenerator.Resolver.Resolve(Bff.Template.ConfigurationFile.GenericExcutableSection));
                                                    }
                                                }
                }
                else if (buildEvent.Value is Project.Configuration.BuildStepCopy)
                {
                    var copyCommand = buildEvent.Value as Project.Configuration.BuildStepCopy;

                    string sourcePath      = Util.PathGetRelative(relativeTo, copyCommand.SourcePath);
                    string destinationPath = Util.PathGetRelative(relativeTo, copyCommand.DestinationPath);

                    using (fileGenerator.Declare("fastBuildCopyAlias", buildEvent.Key))
                        using (fileGenerator.Declare("fastBuildCopySource", sourcePath))
                            using (fileGenerator.Declare("fastBuildCopyDest", destinationPath))
                                using (fileGenerator.Declare("fastBuildCopyDirName", buildEvent.Key))
                                    using (fileGenerator.Declare("fastBuildCopyDirSourcePath", Util.EnsureTrailingSeparator(sourcePath)))
                                        using (fileGenerator.Declare("fastBuildCopyDirDestinationPath", Util.EnsureTrailingSeparator(destinationPath)))
                                            using (fileGenerator.Declare("fastBuildCopyDirRecurse", copyCommand.IsRecurse.ToString().ToLower()))
                                                using (fileGenerator.Declare("fastBuildCopyDirPattern", UtilityMethods.GetBffFileCopyPattern(copyCommand.CopyPattern)))
                                                {
                                                    string eventKey = fileGenerator.Resolver.Resolve(buildEvent.Key);
                                                    if (!bffSection.ContainsKey(eventKey))
                                                    {
                                                        if (copyCommand.IsFileCopy)
                                                        {
                                                            bffSection.Add(eventKey, fileGenerator.Resolver.Resolve(Bff.Template.ConfigurationFile.CopyFileSection));
                                                        }
                                                        else
                                                        {
                                                            bffSection.Add(eventKey, fileGenerator.Resolver.Resolve(Bff.Template.ConfigurationFile.CopyDirSection));
                                                        }
                                                    }
                                                }
                }
                else
                {
                    throw new Error("error, BuildStep not supported: {0}", buildEvent.GetType().FullName);
                }
            }
        }
コード例 #3
0
            public string Resolve(string rootPath, string bffFilePath, Resolver resolver)
            {
                var normalizedSource      = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Source);
                var normalizedDestination = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Destination);

                using (resolver.NewScopedParameter("fastBuildCopyDirName", BuildStepKey))
                    using (resolver.NewScopedParameter("fastBuildCopyDirSourcePath", Util.EnsureTrailingSeparator(normalizedSource)))
                        using (resolver.NewScopedParameter("fastBuildCopyDirDestinationPath", Util.EnsureTrailingSeparator(normalizedDestination)))
                            using (resolver.NewScopedParameter("fastBuildCopyDirRecurse", Recurse.ToString().ToLower()))
                                using (resolver.NewScopedParameter("fastBuildCopyDirPattern", UtilityMethods.GetBffFileCopyPattern(FilePattern)))
                                {
                                    return(resolver.Resolve(Bff.Template.ConfigurationFile.CopyDirSection));
                                }
            }