private void WriteCompilationOptions(CompilationOptions compilationOptions, ref UnifiedJsonWriter jsonWriter) { jsonWriter.WriteStartObject(DependencyContextStrings.CompilationOptionsPropertName, escape: false); if (compilationOptions.Defines?.Any() == true) { jsonWriter.WriteStartArray(DependencyContextStrings.DefinesPropertyName, escape: false); foreach (string define in compilationOptions.Defines) { jsonWriter.WriteStringValue(define); } jsonWriter.WriteEndArray(); } AddStringPropertyIfNotNull(DependencyContextStrings.LanguageVersionPropertyName, compilationOptions.LanguageVersion, ref jsonWriter); AddStringPropertyIfNotNull(DependencyContextStrings.PlatformPropertyName, compilationOptions.Platform, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.AllowUnsafePropertyName, compilationOptions.AllowUnsafe, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.WarningsAsErrorsPropertyName, compilationOptions.WarningsAsErrors, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.OptimizePropertyName, compilationOptions.Optimize, ref jsonWriter); AddStringPropertyIfNotNull(DependencyContextStrings.KeyFilePropertyName, compilationOptions.KeyFile, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.DelaySignPropertyName, compilationOptions.DelaySign, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.PublicSignPropertyName, compilationOptions.PublicSign, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.EmitEntryPointPropertyName, compilationOptions.EmitEntryPoint, ref jsonWriter); AddBooleanPropertyIfNotNull(DependencyContextStrings.GenerateXmlDocumentationPropertyName, compilationOptions.GenerateXmlDocumentation, ref jsonWriter); AddStringPropertyIfNotNull(DependencyContextStrings.DebugTypePropertyName, compilationOptions.DebugType, ref jsonWriter); jsonWriter.WriteEndObject(); }
private void WriteRuntimeGraph(DependencyContext context, ref UnifiedJsonWriter jsonWriter) { jsonWriter.WriteStartObject(DependencyContextStrings.RuntimesPropertyName, escape: false); foreach (RuntimeFallbacks runtimeFallback in context.RuntimeGraph) { jsonWriter.WriteStartArray(runtimeFallback.Runtime); foreach (string fallback in runtimeFallback.Fallbacks) { jsonWriter.WriteStringValue(fallback); } jsonWriter.WriteEndArray(); } jsonWriter.WriteEndObject(); }