Inheritance: NuspecBase
コード例 #1
0
        void GenerateNuspec()
        {
            var coreVersion = GenerationManifest.CoreVersion;

            // we're generating services only, so can automatically add the core runtime
            // as a dependency
            var awsDependencies = new Dictionary<string, string>(StringComparer.Ordinal);

            if (Configuration.ServiceDependencies != null)
            {
                var dependencies = Configuration.ServiceDependencies;
                foreach (var kvp in dependencies)
                {
                    var service = kvp.Key;
                    var version = kvp.Value;
                    var dependentService = GenerationManifest.ServiceConfigurations.FirstOrDefault(x => string.Equals(x.Namespace, "Amazon." + service, StringComparison.InvariantCultureIgnoreCase));

                    string previewFlag;
                    if (dependentService != null && dependentService.InPreview)
                    {
                        previewFlag = GeneratorDriver.NuGetPreviewFlag;
                    }
                    else if (string.Equals(service, "Core", StringComparison.InvariantCultureIgnoreCase) && GenerationManifest.DefaultToPreview)
                    {
                        previewFlag = GeneratorDriver.NuGetPreviewFlag;
                    }
                    else
                    {
                        previewFlag = string.Empty;
                    }

                    var verTokens = version.Split('.');
                    var versionRange = string.Format("[{0}{3}, {1}.{2}{3})", version, verTokens[0], int.Parse(verTokens[1]) + 1, previewFlag);

                    awsDependencies.Add(string.Format("AWSSDK.{0}", service), versionRange);
                }
            }

            var assemblyVersion = Configuration.ServiceFileVersion;
            var assemblyName = Configuration.Namespace.Replace("Amazon.", "AWSSDK.");
            var assemblyTitle = "AWSSDK - " + Configuration.ServiceModel.ServiceFullName;
            var nugetTitle = assemblyTitle;
            if (!string.IsNullOrEmpty(Configuration.NugetPackageTitleSuffix))
                nugetTitle += " " + Configuration.NugetPackageTitleSuffix;

            var session = new Dictionary<string, object>
            {
                { "AssemblyName", assemblyName },
                { "AssemblyTitle",  assemblyTitle },
                { "NuGetTitle",  nugetTitle },
                { "AssemblyDescription", Configuration.AssemblyDescription },
                { "AssemblyVersion", assemblyVersion },
                { "AWSDependencies", awsDependencies },
                { "BaseName", this.Configuration.BaseName },
                { "CodeAnalysisServiceFolder", this.Configuration.Namespace.Replace("Amazon.", "") },
                { "ProjectFileConfigurations", this.ProjectFileConfigurations},
                { "ExtraTags", Configuration.Tags == null || Configuration.Tags.Count == 0 ? string.Empty : " " + string.Join(" ", Configuration.Tags) }
            };

            if (Configuration.NugetDependencies != null)
                session.Add("NugetDependencies", Configuration.NugetDependencies);

            session["NuGetPreviewFlag"] = Configuration.InPreview ? GeneratorDriver.NuGetPreviewFlag : "";

            var nuspecGenerator = new Nuspec { Session = session };
            var text = nuspecGenerator.TransformText();
            var nuspecFilename = assemblyName + ".nuspec";
            WriteFile(ServiceFilesRoot, string.Empty, nuspecFilename, text);
        }
コード例 #2
0
        void GenerateNuspec()
        {
            var coreVersion = GenerationManifest.CoreVersion;

            // we're generating services only, so can automatically add the core runtime
            // as a dependency
            var awsDependencies = new Dictionary<string, string>(StringComparer.Ordinal);

            if (Configuration.ServiceDependencies != null)
            {
                var dependencies = Configuration.ServiceDependencies;
                foreach(var kvp in dependencies)
                {
                    var service = kvp.Key;
                    var version = kvp.Value;

                    var verTokens = version.Split('.');
                    var versionRange = string.Format("[{0}-preview, {1}.{2}-preview)", version, verTokens[0], int.Parse(verTokens[1]) + 1);

                    awsDependencies.Add(string.Format("AWSSDK.{0}", service), versionRange);
                }
            }

            var assemblyVersion = Configuration.ServiceFileVersion;
            var assemblyName = Configuration.Namespace.Replace("Amazon.", "AWSSDK.");
            var assemblyTitle = "AWSSDK - " + Configuration.ServiceModel.ServiceFullName;
            var session = new Dictionary<string, object>
            {
                { "AssemblyName", assemblyName },
                { "AssemblyTitle",  assemblyTitle },
                { "AssemblyDescription", Configuration.AssemblyDescription },
                { "AssemblyVersion", assemblyVersion },
                { "AWSDependencies", awsDependencies },
                { "BaseName", this.Configuration.BaseName }
            };

            var nuspecGenerator = new Nuspec { Session = session };
            var text = nuspecGenerator.TransformText();
            var nuspecFilename = assemblyName + ".nuspec";
            WriteFile(ServiceFilesRoot, string.Empty, nuspecFilename, text);
        }