Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Use live code flow for corefx dependency and react to S.T.Json breaks #11639

Merged
merged 4 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@
<Target Name="SetTelemetryProfile">
<SetEnvVar Name="DOTNET_CLI_TELEMETRY_PROFILE" Value="$(DOTNET_CLI_TELEMETRY_PROFILE);https://github.com/dotnet/cli;$(BuildNumber)" />
</Target>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'
and $(MicrosoftNETCoreAppPackageVersion.StartsWith('$(_TargetFrameworkVersionWithoutV)'))">
<FrameworkReference
Update="Microsoft.NETCore.App"
TargetingPackVersion="$(MicrosoftNETCoreAppPackageVersion)"
RuntimeFrameworkVersion="$(MicrosoftNETCoreAppPackageVersion)" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NETCore.App" Version="3.0.0-preview7-27826-20">
<Uri>https://github.com/dotnet/core-setup</Uri>
<Sha>ee0c7ead1a46f06f98aff9102b785f532b71da9c</Sha>
</Dependency>
<Dependency Name="Microsoft.TemplateEngine.Cli" Version="1.0.2-beta5.19320.1">
<Uri>https://github.com/dotnet/templating</Uri>
<Sha>cd8a65408312bf4a92de7e97948782f9f88471e6</Sha>
Expand Down
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</PropertyGroup>
<!-- Production Dependencies -->
<PropertyGroup>
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview7-27826-20</MicrosoftNETCoreAppPackageVersion>
<DotNetCoreSdkLKGVersion>3.0.100-preview7-012358</DotNetCoreSdkLKGVersion>
<MicrosoftAspNetCoreDeveloperCertificatesXPlatPackageVersion>3.0.0-preview7.19325.7</MicrosoftAspNetCoreDeveloperCertificatesXPlatPackageVersion>
<MicrosoftNETCoreDotNetHostResolverPackageVersion>2.2.1</MicrosoftNETCoreDotNetHostResolverPackageVersion>
Expand Down
7 changes: 6 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"tools": {
"dotnet": "3.0.100-preview7-012358"
"dotnet": "3.0.100-preview7-012358",
"runtimes": {
"dotnet": [
"$(MicrosoftNETCoreAppPackageVersion)"
]
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19323.4"
Expand Down
12 changes: 6 additions & 6 deletions src/dotnet/ToolManifest/JsonElementExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ internal static bool TryGetStringValue(this JsonElement element, string name, ou
value = null;
if (element.TryGetProperty(name, out JsonElement jsonValue))
{
if (jsonValue.Type != JsonValueType.String)
if (jsonValue.ValueKind != JsonValueKind.String)
{
throw new ToolManifestException(
string.Format(
LocalizableStrings.UnexpectedTypeInJson,
JsonValueType.String.ToString(),
JsonValueKind.String.ToString(),
name));
}
value = jsonValue.GetString();
Expand All @@ -35,12 +35,12 @@ internal static bool TryGetInt32Value(this JsonElement element, string name, out
value = default;
if (element.TryGetProperty(name, out JsonElement jsonValue))
{
if (jsonValue.Type != JsonValueType.Number)
if (jsonValue.ValueKind != JsonValueKind.Number)
{
throw new ToolManifestException(
string.Format(
LocalizableStrings.UnexpectedTypeInJson,
JsonValueType.Number.ToString(),
JsonValueKind.Number.ToString(),
name));
}
value = jsonValue.GetInt32();
Expand All @@ -55,12 +55,12 @@ internal static bool TryGetBooleanValue(this JsonElement element, string name, o
value = default;
if (element.TryGetProperty(name, out JsonElement jsonValue))
{
if (!(jsonValue.Type == JsonValueType.True || jsonValue.Type == JsonValueType.False))
if (!(jsonValue.ValueKind == JsonValueKind.True || jsonValue.ValueKind == JsonValueKind.False))
{
throw new ToolManifestException(
string.Format(
LocalizableStrings.UnexpectedTypeInJson,
JsonValueType.True.ToString() + "|" + JsonValueType.False.ToString(),
JsonValueKind.True.ToString() + "|" + JsonValueKind.False.ToString(),
name));
}
value = jsonValue.GetBoolean();
Expand Down
12 changes: 6 additions & 6 deletions src/dotnet/ToolManifest/ToolManifestEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ private SerializableLocalToolsManifest DeserializeLocalToolsManifest(FilePath po
serializableLocalToolsManifest.Tools =
new List<SerializableLocalToolSinglePackage>();

if (tools.Type != JsonValueType.Object)
if (tools.ValueKind != JsonValueKind.Object)
{
throw new ToolManifestException(
string.Format(LocalizableStrings.UnexpectedTypeInJson,
JsonValueType.Object.ToString(),
JsonValueKind.Object.ToString(),
JsonPropertyTools));
}

Expand All @@ -184,21 +184,21 @@ private SerializableLocalToolsManifest DeserializeLocalToolsManifest(FilePath po
var commands = new List<string>();
if (toolJson.Value.TryGetProperty(JsonPropertyCommands, out var commandsJson))
{
if (commandsJson.Type != JsonValueType.Array)
if (commandsJson.ValueKind != JsonValueKind.Array)
{
throw new ToolManifestException(
string.Format(LocalizableStrings.UnexpectedTypeInJson,
JsonValueType.Array.ToString(),
JsonValueKind.Array.ToString(),
JsonPropertyCommands));
}

foreach (var command in commandsJson.EnumerateArray())
{
if (command.Type != JsonValueType.String)
if (command.ValueKind != JsonValueKind.String)
{
throw new ToolManifestException(
string.Format(LocalizableStrings.UnexpectedTypeInJson,
JsonValueType.String.ToString(),
JsonValueKind.String.ToString(),
"command"));
}

Expand Down
6 changes: 3 additions & 3 deletions src/dotnet/ToolPackage/LocalToolsResolverCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void Save(

_fileSystem.File.WriteAllText(
packageCacheFile,
JsonSerializer.ToString(existingCacheTable.Concat(diffedRow)));
JsonSerializer.Serialize(existingCacheTable.Concat(diffedRow)));
}
else
{
Expand All @@ -64,7 +64,7 @@ public void Save(

_fileSystem.File.WriteAllText(
packageCacheFile,
JsonSerializer.ToString(rowsToAdd));
JsonSerializer.Serialize(rowsToAdd));
}
}
}
Expand Down Expand Up @@ -96,7 +96,7 @@ private CacheRow[] GetCacheTable(string packageCacheFile)
try
{
cacheTable =
JsonSerializer.Parse<CacheRow[]>(_fileSystem.File.ReadAllText(packageCacheFile));
JsonSerializer.Deserialize<CacheRow[]>(_fileSystem.File.ReadAllText(packageCacheFile));
}
catch (JsonException)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static LaunchSettingsApplyResult TryApplyLaunchSettings(string launchSett
{
var model = document.RootElement;

if (model.Type != JsonValueType.Object || !model.TryGetProperty(ProfilesKey, out var profilesObject) || profilesObject.Type != JsonValueType.Object)
if (model.ValueKind != JsonValueKind.Object || !model.TryGetProperty(ProfilesKey, out var profilesObject) || profilesObject.ValueKind != JsonValueKind.Object)
{
return new LaunchSettingsApplyResult(false, LocalizableStrings.LaunchProfilesCollectionIsNotAJsonObject);
}
Expand All @@ -43,19 +43,19 @@ public static LaunchSettingsApplyResult TryApplyLaunchSettings(string launchSett
}
else
{
if (!profilesObject.TryGetProperty(profileName, out profileObject) || profileObject.Type != JsonValueType.Object)
if (!profilesObject.TryGetProperty(profileName, out profileObject) || profileObject.ValueKind != JsonValueKind.Object)
{
return new LaunchSettingsApplyResult(false, LocalizableStrings.LaunchProfileIsNotAJsonObject);
}
}

if (profileObject.Type == default)
if (profileObject.ValueKind == default)
{
foreach (var prop in profilesObject.EnumerateObject())
{
if (prop.Value.Type == JsonValueType.Object)
if (prop.Value.ValueKind == JsonValueKind.Object)
{
if (prop.Value.TryGetProperty(CommandNameKey, out var commandNameElement) && commandNameElement.Type == JsonValueType.String)
if (prop.Value.TryGetProperty(CommandNameKey, out var commandNameElement) && commandNameElement.ValueKind == JsonValueKind.String)
{
if (_providers.ContainsKey(commandNameElement.GetString()))
{
Expand All @@ -67,13 +67,13 @@ public static LaunchSettingsApplyResult TryApplyLaunchSettings(string launchSett
}
}

if (profileObject.Type == default)
if (profileObject.ValueKind == default)
{
return new LaunchSettingsApplyResult(false, LocalizableStrings.UsableLaunchProfileCannotBeLocated);
}

if (!profileObject.TryGetProperty(CommandNameKey, out var finalCommandNameElement)
|| finalCommandNameElement.Type != JsonValueType.String)
|| finalCommandNameElement.ValueKind != JsonValueKind.String)
{
return new LaunchSettingsApplyResult(false, LocalizableStrings.UsableLaunchProfileCannotBeLocated);
}
Expand All @@ -100,9 +100,9 @@ private static bool TryLocateHandler(string commandName, out ILaunchSettingsProv

private static bool IsDefaultProfileType(JsonProperty profileProperty)
{
if (profileProperty.Value.Type != JsonValueType.Object
if (profileProperty.Value.ValueKind != JsonValueKind.Object
|| !profileProperty.Value.TryGetProperty(CommandNameKey, out var commandNameElement)
|| commandNameElement.Type != JsonValueType.String)
|| commandNameElement.ValueKind != JsonValueKind.String)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public LaunchSettingsApplyResult TryApplySettings(JsonElement model, ref IComman
}
else if (string.Equals(property.Name, nameof(ProjectLaunchSettingsModel.EnvironmentVariables), StringComparison.OrdinalIgnoreCase))
{
if (property.Value.Type != JsonValueType.Object)
if (property.Value.ValueKind != JsonValueKind.Object)
{
return new LaunchSettingsApplyResult(false, string.Format(LocalizableStrings.ValueMustBeAnObject, property.Name));
}
Expand Down Expand Up @@ -88,23 +88,23 @@ public LaunchSettingsApplyResult TryApplySettings(JsonElement model, ref IComman

private static bool TryGetBooleanValue(JsonElement element, out bool value)
{
switch (element.Type)
switch (element.ValueKind)
{
case JsonValueType.True:
case JsonValueKind.True:
value = true;
return true;
case JsonValueType.False:
case JsonValueKind.False:
value = false;
return true;
case JsonValueType.Number:
case JsonValueKind.Number:
if (element.TryGetDouble(out var doubleValue))
{
value = doubleValue != 0;
return true;
}
value = false;
return false;
case JsonValueType.String:
case JsonValueKind.String:
return bool.TryParse(element.GetString(), out value);
default:
value = false;
Expand All @@ -114,21 +114,21 @@ private static bool TryGetBooleanValue(JsonElement element, out bool value)

private static bool TryGetStringValue(JsonElement element, out string value)
{
switch (element.Type)
switch (element.ValueKind)
{
case JsonValueType.True:
case JsonValueKind.True:
value = bool.TrueString;
return true;
case JsonValueType.False:
case JsonValueKind.False:
value = bool.FalseString;
return true;
case JsonValueType.Null:
case JsonValueKind.Null:
value = string.Empty;
return true;
case JsonValueType.Number:
case JsonValueKind.Number:
value = element.GetRawText();
return false;
case JsonValueType.String:
case JsonValueKind.String:
value = element.GetString();
return true;
default:
Expand Down
6 changes: 6 additions & 0 deletions src/redist/redist.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
DestinationFiles="@(SdksContent -> '$(PublishDir)Sdks/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<Target Name="CopyRuntimeConfiguration"
AfterTargets="Publish">
<Copy SourceFiles="$(ProjectRuntimeConfigFilePath)"
DestinationFiles="$(PublishDir)dotnet.runtimeconfig.json" />
</Target>

<Target Name="ChmodPublishDir"
AfterTargets="PublishMSBuildExtensions"
Condition=" '$(OS)' != 'Windows_NT' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void CreateApphostShellShim(FilePath entryPoint, FilePath shimPath)

_fileSystem.File.WriteAllText(
shimPath.Value,
JsonSerializer.ToString(shim));
JsonSerializer.Serialize(shim));
}

public class FakeShim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void Restore(FilePath project,
fakeExecutablePath);
_fileSystem.File.WriteAllText(
assetJsonOutput.WithFile(FakeCommandSettingsFileName).Value,
JsonSerializer.ToString(new {Name = feedPackage.ToolCommandName}));
JsonSerializer.Serialize(new {Name = feedPackage.ToolCommandName}));
}

public MockFeedPackage GetPackage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void WhenRunWithPackageIdItShouldCreateValidShim()

// It is hard to simulate shell behavior. Only Assert shim can point to executable dll
_fileSystem.File.Exists(ExpectedCommandPath()).Should().BeTrue();
var deserializedFakeShim = JsonSerializer.Parse<AppHostShellShimMakerMock.FakeShim>(
var deserializedFakeShim = JsonSerializer.Deserialize<AppHostShellShimMakerMock.FakeShim>(
_fileSystem.File.ReadAllText(ExpectedCommandPath()));

_fileSystem.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue();
Expand Down Expand Up @@ -151,7 +151,7 @@ public void WhenRunWithPackageIdWithSourceItShouldCreateValidShim()
_fileSystem.File.Exists(ExpectedCommandPath())
.Should().BeTrue();
var deserializedFakeShim =
JsonSerializer.Parse<AppHostShellShimMakerMock.FakeShim>(
JsonSerializer.Deserialize<AppHostShellShimMakerMock.FakeShim>(
_fileSystem.File.ReadAllText(ExpectedCommandPath()));
_fileSystem.File.Exists(deserializedFakeShim.ExecutablePath).Should().BeTrue();
}
Expand Down