Skip to content
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
6 changes: 3 additions & 3 deletions src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn.</Description>
<VersionPrefix>0.29.0</VersionPrefix>
<VersionPrefix>0.29.0-beta1</VersionPrefix>
<Authors>filipw</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Dotnet.Script.Core</AssemblyName>
Expand Down Expand Up @@ -33,9 +33,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.0.0-beta2-final" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ReadLine" Version="2.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
<PackageReference Include="System.Reflection.Metadata" Version="1.6.0" />
Expand Down
6 changes: 6 additions & 0 deletions src/Dotnet.Script.Core/ScriptCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ static ScriptCompiler()
{
CSharpScript.Create<object>("1", ScriptOptions.Default, typeof(CommandLineScriptGlobals), new InteractiveAssemblyLoader()).RunAsync(new CommandLineScriptGlobals(Console.Out, CSharpObjectFormatter.Instance)).GetAwaiter().GetResult();
});

// reset default scripting mode to latest language version to enable C# 8.0 features
// this is not needed once Roslyn 3.0 stable ships
var csharpScriptCompilerType = typeof(CSharpScript).GetTypeInfo().Assembly.GetType("Microsoft.CodeAnalysis.CSharp.Scripting.CSharpScriptCompiler");
var parseOptionsField = csharpScriptCompilerType?.GetField("s_defaultOptions", BindingFlags.Static | BindingFlags.NonPublic);
parseOptionsField?.SetValue(null, new CSharpParseOptions(LanguageVersion.CSharp8, kind: SourceCodeKind.Script));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@filipw filipw Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no way to make nullable work yet because it only emits warnings and we swallow warnings at the moment. we also don't expose the ability to treat warnings as errors. I will open a separate issue to handle that

}

protected virtual IEnumerable<string> ImportedNamespaces => new[]
Expand Down
1 change: 0 additions & 1 deletion src/Dotnet.Script.Core/Versioning/VersionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ VersionInfo ParseTagName(string json)
public VersionInfo GetCurrentVersion()
{
var versionAttribute = typeof(VersionProvider).Assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().Single();
var version = Version.Parse(versionAttribute.InformationalVersion);
return new VersionInfo(versionAttribute.InformationalVersion, isResolved:true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<RepositoryUrl>https://github.com/filipw/dotnet-script.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>script;csx;csharp;roslyn;nuget</PackageTags>
<Version>0.7.1</Version>
<Version>0.8.0-beta1</Version>
<Description>A MetadataReferenceResolver that allows inline nuget references to be specified in script(csx) files.</Description>
<Authors>dotnet-script</Authors>
<Company>dotnet-script</Company>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.0.0-beta2-final" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Dotnet.Script.Extras/Dotnet.Script.Extras.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="2.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.0.0-beta2-final" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
</ItemGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/Dotnet.Script.Tests/EnvironmentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public void ShouldPrintVersionNumber(string versionFlag)
var result = ScriptTestRunner.Default.Execute(versionFlag);
Assert.Equal(0, result.exitCode);
// TODO test that version appears on first line of output!
Assert.Matches(@"^[0-9]+(\.[0-9]+){2}$", result.output);
// semver regex from https://github.com/semver/semver/issues/232#issue-48635632
Assert.Matches(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$", result.output);
}

[Fact]
Expand Down
8 changes: 8 additions & 0 deletions src/Dotnet.Script.Tests/ScriptExecutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ public void ShouldHandleCSharp72()
Assert.Contains("hi", result.output);
}

[Fact]
public void ShouldHandleCSharp80()
{
var result = ScriptTestRunner.Default.ExecuteFixture("CSharp80");
Assert.Equal(0, result.exitCode);

}

[Fact]
public void ShouldEvaluateCode()
{
Expand Down
5 changes: 5 additions & 0 deletions src/Dotnet.Script.Tests/TestFixtures/CSharp80/CSharp80.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// static local functions are C# 8.0 feature
void Foo()
{
static void Bar() { };
}
4 changes: 2 additions & 2 deletions src/Dotnet.Script/Dotnet.Script.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Dotnet CLI tool allowing you to run C# (CSX) scripts.</Description>
<VersionPrefix>0.29.0</VersionPrefix>
<VersionPrefix>0.29.0-beta1</VersionPrefix>
<Authors>filipw</Authors>
<PackageId>Dotnet.Script</PackageId>
<TargetFramework>netcoreapp2.1</TargetFramework>
Expand All @@ -22,7 +22,7 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="2.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.0.0-beta2-final" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
</ItemGroup>
Expand Down