private void AddBooleanPropertyIfNotNull(string name, bool?value, ref UnifiedJsonWriter jsonWriter) { if (value.HasValue) { jsonWriter.WriteBoolean(name, value.Value, escape: true); } }
private void WritePortableTargetLibrary(string key, RuntimeLibrary runtimeLibrary, CompilationLibrary compilationLibrary, ref UnifiedJsonWriter jsonWriter) { jsonWriter.WriteStartObject(key); var dependencies = new HashSet <Dependency>(); if (runtimeLibrary != null) { dependencies.UnionWith(runtimeLibrary.Dependencies); } if (compilationLibrary != null) { dependencies.UnionWith(compilationLibrary.Dependencies); } AddDependencies(dependencies, ref jsonWriter); if (runtimeLibrary != null) { // Add runtime-agnostic assets AddAssets(DependencyContextStrings.RuntimeAssembliesKey, runtimeLibrary.RuntimeAssemblyGroups.GetDefaultGroup(), ref jsonWriter); AddAssets(DependencyContextStrings.NativeLibrariesKey, runtimeLibrary.NativeLibraryGroups.GetDefaultGroup(), ref jsonWriter); AddResourceAssemblies(runtimeLibrary.ResourceAssemblies, ref jsonWriter); // Add runtime-specific assets bool wroteObjectStart = false; wroteObjectStart = AddRuntimeSpecificAssetGroups(DependencyContextStrings.RuntimeAssetType, runtimeLibrary.RuntimeAssemblyGroups, wroteObjectStart, ref jsonWriter); wroteObjectStart = AddRuntimeSpecificAssetGroups(DependencyContextStrings.NativeAssetType, runtimeLibrary.NativeLibraryGroups, wroteObjectStart, ref jsonWriter); if (wroteObjectStart) { jsonWriter.WriteEndObject(); } } if (compilationLibrary != null) { AddCompilationAssemblies(compilationLibrary.Assemblies, ref jsonWriter); } if (compilationLibrary != null && runtimeLibrary == null) { jsonWriter.WriteBoolean(DependencyContextStrings.CompilationOnlyPropertyName, true, escape: false); } jsonWriter.WriteEndObject(); }
private void WriteLibrary(string key, Library library, ref UnifiedJsonWriter jsonWriter) { jsonWriter.WriteStartObject(key); jsonWriter.WriteString(DependencyContextStrings.TypePropertyName, library.Type, escape: false); jsonWriter.WriteBoolean(DependencyContextStrings.ServiceablePropertyName, library.Serviceable, escape: false); jsonWriter.WriteString(DependencyContextStrings.Sha512PropertyName, library.Hash, escape: false); if (library.Path != null) { jsonWriter.WriteString(DependencyContextStrings.PathPropertyName, library.Path, escape: false); } if (library.HashPath != null) { jsonWriter.WriteString(DependencyContextStrings.HashPathPropertyName, library.HashPath, escape: false); } if (library.RuntimeStoreManifestName != null) { jsonWriter.WriteString(DependencyContextStrings.RuntimeStoreManifestPropertyName, library.RuntimeStoreManifestName, escape: false); } jsonWriter.WriteEndObject(); }