Skip to content

Added support for net7.0 #682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Sep 19, 2022
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
62 changes: 62 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI

on: [push, pull_request]

jobs:
build-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install .Net Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global

- name: Run build script
run: dotnet-script build/Build.csx

build-mac:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Install .Net Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global

- name: Run build script
run: dotnet-script build/Build.csx

build-windows:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Install .Net Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
7.0.x
include-prerelease: true
- name: Install dotnet-script
run: dotnet tool install dotnet-script --global

- name: Run build script
run: dotnet-script build/Build.csx
env: # Or as an environment variable
GITHUB_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IS_SECURE_BUILDENVIRONMENT: ${{ secrets.IS_SECURE_BUILDENVIRONMENT }}
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}
126 changes: 0 additions & 126 deletions azure-pipelines.yml

This file was deleted.

6 changes: 3 additions & 3 deletions build/Build.csx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#load "Choco.csx"
#load "BuildContext.csx"

using static ReleaseManagement;
using System.Xml.Linq;
using static ChangeLog;
using static FileUtils;
using System.Xml.Linq;
using static ReleaseManagement;

[StepDescription("Runs all tests.")]
Step test = () => RunTests();
Expand Down Expand Up @@ -35,7 +35,7 @@ await StepRunner.Execute(Args);

private void CreateGitHubReleaseAsset()
{
DotNet.Publish(dotnetScriptProjectFolder, publishArtifactsFolder, "netcoreapp3.1");
DotNet.Publish(dotnetScriptProjectFolder, publishArtifactsFolder, "net6.0");
Zip(publishArchiveFolder, pathToGitHubReleaseAsset);
}

Expand Down
5 changes: 2 additions & 3 deletions build/Choco.csx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class Choco
{
string pathToProjectFile = Directory.GetFiles(pathToProjectFolder, "*.csproj").Single();
CreateSpecificationFromProject(pathToProjectFile, pathToBinaries);
Command.Execute("choco.exe", $@"pack Chocolatey\chocolatey.nuspec --outputdirectory {outputFolder}");
Command.Execute("choco.exe", $@"pack {Path.Combine(FileUtils.GetScriptFolder(), "Chocolatey", "chocolatey.nuspec")} --outputdirectory {outputFolder}");
}

public static void Push(string packagesFolder, string apiKey, string source = "https://push.chocolatey.org/")
Expand Down Expand Up @@ -78,8 +78,7 @@ public static class Choco
filesElement.Add(CreateFileElement(@"tools\*.*", $@"{packageId}\tools"));
var srcGlobPattern = $@"{pathToBinaries}\**\*";
filesElement.Add(CreateFileElement(srcGlobPattern, packageId));

using var fileStream = new FileStream("Chocolatey/chocolatey.nuspec", FileMode.Create);
using var fileStream = new FileStream(Path.Combine(FileUtils.GetScriptFolder(), "Chocolatey", "chocolatey.nuspec"), FileMode.Create);
new XDocument(packageElement).Save(fileStream);
}

Expand Down
2 changes: 1 addition & 1 deletion build/omnisharp.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"script": {
"enableScriptNuGetReferences": true,
"defaultTargetFramework": "netcoreapp3.1"
"defaultTargetFramework": "net6.0"
}
}
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"version": "7.0.100-rc.1.22431.12",
"rollForward": "latestFeature"
}
}
}
4 changes: 2 additions & 2 deletions src/Dotnet.Script.Core/Dotnet.Script.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<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>1.3.1</VersionPrefix>
<VersionPrefix>1.4.0</VersionPrefix>
<Authors>filipw</Authors>
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<AssemblyName>Dotnet.Script.Core</AssemblyName>
<PackageId>Dotnet.Script.Core</PackageId>
<PackageTags>script;csx;csharp;roslyn</PackageTags>
Expand Down
4 changes: 2 additions & 2 deletions src/Dotnet.Script.Core/ScriptAssemblyLoadContext.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if NETCOREAPP
#if NET

using System;
using System.Reflection;
Expand All @@ -20,7 +20,7 @@ public ScriptAssemblyLoadContext()
{
}

#if NETCOREAPP3_0_OR_GREATER
#if NET5_0_OR_GREATER
/// <summary>
/// Initializes a new instance of the <see cref="ScriptAssemblyLoadContext"/> class
/// with a name and a value that indicates whether unloading is enabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<RepositoryUrl>https://github.com/filipw/dotnet-script.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>script;csx;csharp;roslyn;nuget</PackageTags>
<Version>1.3.1</Version>
<Version>1.4.0</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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,8 @@ public IEnumerable<CompilationDependency> GetDependencies(string targetDirectory
result.Add(compilationDependency);
}

// On .Net Core, we need to fetch the compilation references for framework assemblies separately.
if (defaultTargetFramework.StartsWith("netcoreapp3", StringComparison.InvariantCultureIgnoreCase) ||
defaultTargetFramework.StartsWith("net5", StringComparison.InvariantCultureIgnoreCase) ||
defaultTargetFramework.StartsWith("net6", StringComparison.InvariantCultureIgnoreCase))
{
var compilationreferences = _compilationReferenceReader.Read(projectFileInfo);
result.Add(new CompilationDependency("Dotnet.Script.Default.Dependencies", "99.0", compilationreferences.Select(cr => cr.Path).ToArray(), Array.Empty<string>()));
}
var compilationReferences = _compilationReferenceReader.Read(projectFileInfo);
result.Add(new CompilationDependency("Dotnet.Script.Default.Dependencies", "99.0", compilationReferences.Select(cr => cr.Path).ToArray(), Array.Empty<string>()));

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RepositoryUrl>https://github.com/filipw/dotnet-script.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>script;csx;csharp;roslyn;omnisharp</PackageTags>
<Version>1.3.1</Version>
<Version>1.4.0</Version>
<LangVersion>latest</LangVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../dotnet-script.snk</AssemblyOriginatorKeyFile>
Expand Down
4 changes: 2 additions & 2 deletions src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public CompilationDependencyTests(ITestOutputHelper testOutputHelper)
}

[Theory]
[InlineData("netcoreapp3.1")]
[InlineData("net5.0")]
[InlineData("net6.0")]
[InlineData("net7.0")]
public void ShouldGetCompilationDependenciesForNetCoreApp(string targetFramework)
{
var resolver = CreateResolver();
Expand Down
2 changes: 1 addition & 1 deletion src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../dotnet-script.snk</AssemblyOriginatorKeyFile>
Expand Down
4 changes: 2 additions & 2 deletions src/Dotnet.Script/Dotnet.Script.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Dotnet CLI tool allowing you to run C# (CSX) scripts.</Description>
<VersionPrefix>1.3.1</VersionPrefix>
<VersionPrefix>1.4.0</VersionPrefix>
<Authors>filipw</Authors>
<PackageId>Dotnet.Script</PackageId>
<TargetFrameworks>net6.0;net5.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<DebugType>portable</DebugType>
<AssemblyName>dotnet-script</AssemblyName>
<OutputType>Exe</OutputType>
Expand Down