Skip to content

Commit

Permalink
Replace expressions nuget package with stripped down library (Azure#182)
Browse files Browse the repository at this point in the history
* Pull in expressions library as-is

* Strip out unused bits

* Remove private nuget feed references

* Address PR feedback
  • Loading branch information
anthony-c-martin authored Aug 15, 2020
1 parent 53c3543 commit d304238
Show file tree
Hide file tree
Showing 16 changed files with 474 additions and 26 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ jobs:
with:
dotnet-version: 3.1.301

- name: Update NuGet config
# workaround for bug in setup-dotnet action (the config samples for authenticated feeds don't work)
# encryption does not work on Linux or MacOS
run: dotnet nuget update source Official --username bicep --password ${{ secrets.MSAZURE_NUGET_AUTH }} --valid-authentication-types=basic --configfile ./NuGet.config --store-password-in-clear-text

- name: Build
run: dotnet build --configuration ${{ matrix.configuration }}

Expand Down Expand Up @@ -119,11 +114,6 @@ jobs:
with:
dotnet-version: 3.1.301

- name: Update NuGet config
# workaround for bug in setup-dotnet action (the config samples for authenticated feeds don't work)
# encryption does not work on Linux or MacOS
run: dotnet nuget update source Official --username bicep --password ${{ secrets.MSAZURE_NUGET_AUTH }} --valid-authentication-types=basic --configfile ./NuGet.config --store-password-in-clear-text

- name: Setup Node.js
uses: actions/[email protected]
with:
Expand Down
9 changes: 9 additions & 0 deletions Bicep.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bicep.Core.Samples", "src\B
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bicep.Cli.UnitTests", "src\Bicep.Cli.UnitTests\Bicep.Cli.UnitTests.csproj", "{29A1AE2B-D47D-41DD-9824-279475D9B6C2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9EA83F16-962D-4596-A6E0-DCFF2D8E1FA3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Arm.Expression", "src\Arm.Expression\Arm.Expression.csproj", "{3229C864-9524-4FDB-BE76-3714ABE7F4E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -71,6 +75,10 @@ Global
{29A1AE2B-D47D-41DD-9824-279475D9B6C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29A1AE2B-D47D-41DD-9824-279475D9B6C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29A1AE2B-D47D-41DD-9824-279475D9B6C2}.Release|Any CPU.Build.0 = Release|Any CPU
{3229C864-9524-4FDB-BE76-3714ABE7F4E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3229C864-9524-4FDB-BE76-3714ABE7F4E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3229C864-9524-4FDB-BE76-3714ABE7F4E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3229C864-9524-4FDB-BE76-3714ABE7F4E2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -85,6 +93,7 @@ Global
{F7B0F06D-56CE-4F4A-8EF9-ED6EC3D77EE7} = {76F6CBAF-FE81-4B56-B0DB-DE6FD7174771}
{A2E4B91C-3B7F-4CB1-B482-BE40F7709EB5} = {FE323E78-E865-46E2-859A-E4F6FB312C0F}
{29A1AE2B-D47D-41DD-9824-279475D9B6C2} = {B02251C3-B01E-40EB-B145-2B03F25FE653}
{3229C864-9524-4FDB-BE76-3714ABE7F4E2} = {9EA83F16-962D-4596-A6E0-DCFF2D8E1FA3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {21F77282-91E7-4304-B1EF-FADFA4F39E37}
Expand Down
1 change: 0 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="Official" value="https://pkgs.dev.azure.com/msazure/_packaging/Official/nuget/v3/index.json" />
</packageSources>
</configuration>
12 changes: 12 additions & 0 deletions src/Arm.Expression/Arm.Expression.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions src/Arm.Expression/Configuration/ExpressionSerializerSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------

namespace Arm.Expression.Configuration
{
/// <summary>
/// Expression serializer settings.
/// </summary>
public class ExpressionSerializerSettings
{
/// <summary>
/// Gets or sets a value indicating whether the expression serializer will include the outer [ and ]
/// characters when serializing a LanguageExpression. This setting is ignored if the serializer decides to serialize
/// the expression into a single string literal.
/// </summary>
public bool IncludeOuterSquareBrackets { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether the expression serializer will serialize a single string literal
/// expression as a string
/// </summary>
public ExpressionSerializerSingleStringHandling SingleStringHandling { get; set; } = ExpressionSerializerSingleStringHandling.SerializeAsJTokenExpression;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------

namespace Arm.Expression.Configuration
{
/// <summary>
/// Configures how expression serializer handles single string literal expressions.
/// </summary>
public enum ExpressionSerializerSingleStringHandling
{
/// <summary>
/// Not specified.
/// </summary>
NotSpecified = 0,

/// <summary>
/// Serializes the single string literal as a string literal expression of the form
/// ['string contents']. This is the default behavior. The behavior does not apply for
/// Language expressions that are not a single JTokenExpression with a string value.
/// </summary>
SerializeAsJTokenExpression = 1,

/// <summary>
/// Serializes the single string literal as a string value. If the string begins with a
/// [ character, it will be escaped with [[. The behavior does not apply for
/// Language expressions that are not a single JTokenExpression with a string value.
/// </summary>
SerializeAsString = 2,
}
}
Loading

0 comments on commit d304238

Please sign in to comment.