public string Generate()

in tools/nuget2bazel/WorkspaceEntry.cs [208:354]


        public string Generate(bool indent)
        {
            var i = indent ? "    " : "";
            var sb = new StringBuilder();
            sb.Append($"{i}nuget_package(\n");
            if (Variable == null)
                sb.Append($"{i}    name = \"{PackageIdentity.Id.ToLower()}\",\n");
            else
                sb.Append($"{i}    name = {Variable},\n");

            sb.Append($"{i}    package = \"{PackageIdentity.Id.ToLower()}\",\n");
            sb.Append($"{i}    version = \"{PackageIdentity.Version}\",\n");
            if (!String.IsNullOrEmpty(Sha256))
                sb.Append($"{i}    sha256 = \"{Sha256}\",\n");
            if (NugetSourceCustom)
                sb.Append($"{i}    source = source,\n");
            if (CoreLib != null && CoreLib.Any())
            {
                sb.Append($"{i}    core_lib = {{\n");
                foreach (var pair in CoreLib)
                    sb.Append($"{i}        \"{pair.Key}\": \"{pair.Value}\",\n");
                sb.Append($"{i}    }},\n");
            }
            if (CoreRef != null && CoreRef.Any())
            {
                sb.Append($"{i}    core_ref = {{\n");
                foreach (var pair in CoreRef)
                    sb.Append($"{i}        \"{pair.Key}\": \"{pair.Value}\",\n");
                sb.Append($"{i}    }},\n");
            }
            // if (NetLib != null && NetLib.Any())
            // {
            //     sb.Append($"{i}    net_lib = {{\n");
            //     foreach (var pair in NetLib)
            //         sb.Append($"{i}        \"{pair.Key}\": \"{pair.Value}\",\n");
            //     sb.Append($"{i}    }},\n");
            // }
            // if (NetRef != null && NetRef.Any())
            // {
            //     sb.Append($"{i}    net_ref = {{\n");
            //     foreach (var pair in NetRef)
            //         sb.Append($"{i}        \"{pair.Key}\": \"{pair.Value}\",\n");
            //     sb.Append($"{i}    }},\n");
            // }
            // if (!String.IsNullOrEmpty(MonoLib))
            //     sb.Append($"{i}    mono_lib = \"{MonoLib}\",\n");
            // if (!String.IsNullOrEmpty(MonoRef))
            //     sb.Append($"{i}    mono_ref = \"{MonoRef}\",\n");
            if (CoreTool != null && CoreTool.Sum(x => x.Value.Count()) > 0)
            {
                sb.Append($"{i}   core_tool = {{\n");
                foreach (var pair in CoreTool)
                    sb.Append($"{i}       \"{pair.Key}\": \"{pair.Value}\",\n");
                sb.Append($"{i}   }},\n");
            }
            // if (NetTool != null && NetTool.Sum(x => x.Value.Count()) > 0)
            // {
            //     sb.Append($"{i}   net_tool = {{\n");
            //     foreach (var pair in NetTool)
            //         sb.Append($"{i}       \"{pair.Key}\": \"{pair.Value}\",\n");
            //     sb.Append($"{i}   }},\n");
            // }
            // if (!String.IsNullOrEmpty(MonoTool))
            //     sb.Append($"{i}    mono_tool = \"{MonoTool}\",\n");

            if (Core_Deps != null && Core_Deps.Sum(x => x.Value.Count()) > 0)
            {
                sb.Append($"{i}    core_deps = {{\n");
                foreach (var pair in Core_Deps)
                {
                    if (!pair.Value.Any())
                        continue;

                    sb.Append($"{i}        \"{pair.Key}\": [\n");
                    foreach (var s in pair.Value)
                        sb.Append($"{i}           \"{s}\",\n");
                    sb.Append($"{i}        ],\n");
                }
                sb.Append($"{i}    }},\n");
            }

            // if (Net_Deps != null && Net_Deps.Sum(x => x.Value.Count()) > 0)
            // {
            //     sb.Append($"{i}    net_deps = {{\n");
            //     foreach (var pair in Net_Deps)
            //     {
            //         if (!pair.Value.Any())
            //             continue;

            //         sb.Append($"{i}        \"{pair.Key}\": [\n");
            //         foreach (var s in pair.Value)
            //             sb.Append($"{i}           \"{s}\",\n");
            //         sb.Append($"{i}        ],\n");
            //     }
            //     sb.Append($"{i}    }},\n");
            // }

            // if (Mono_Deps != null && Mono_Deps.Any())
            // {
            //     sb.Append($"{i}    mono_deps = [\n");
            //     foreach (var s in Mono_Deps)
            //         sb.Append($"{i}        \"{s}\",\n");
            //     sb.Append($"{i}    ],\n");
            // }

            if (Core_Files != null && Core_Files.Sum(x => x.Value.Count()) > 0)
            {
                sb.Append($"{i}    core_files = {{\n");
                foreach (var pair in Core_Files)
                {
                    if (!pair.Value.Any())
                        continue;

                    sb.Append($"{i}        \"{pair.Key}\": [\n");
                    foreach (var s in pair.Value)
                        sb.Append($"{i}           \"{s}\",\n");
                    sb.Append($"{i}        ],\n");
                }
                sb.Append($"{i}    }},\n");
            }

            // if (Net_Files != null && Net_Files.Sum(x => x.Value.Count()) > 0)
            // {
            //     sb.Append($"{i}    net_files = {{\n");
            //     foreach (var pair in Net_Files)
            //     {
            //         if (!pair.Value.Any())
            //             continue;

            //         sb.Append($"{i}        \"{pair.Key}\": [\n");
            //         foreach (var s in pair.Value)
            //             sb.Append($"{i}           \"{s}\",\n");
            //         sb.Append($"{i}        ],\n");
            //     }
            //     sb.Append($"{i}    }},\n");
            // }

            // if (Mono_Files != null && Mono_Files.Any())
            // {
            //     sb.Append($"{i}    mono_files = [\n");
            //     foreach (var s in Mono_Files)
            //         sb.Append($"{i}        \"{s}\",\n");
            //     sb.Append($"{i}    ],\n");
            // }
            sb.Append($"{i})\n");
            return sb.ToString();
        }