Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Dotnet 5 support + ContainsDotNetProjects() method fix for Octokit (#…
Browse files Browse the repository at this point in the history
…1084)

* Testing dotnet 5 support

* First run

[skip ci]

* Reverted filter testing

* Fixes to correctly check if a repo contains dotnet code

* Re-added search term for compatibility with other CollaborationPlatforms
  • Loading branch information
krissetto committed Feb 17, 2021
1 parent 18d6cdb commit c189fda
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .azure-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
steps:
- task: DotNetCoreInstaller@1
displayName: 'Use .NET Core sdk 3.1.x'
displayName: 'Use .NET Core sdk 5.0.x'
inputs:
version: 3.1.x
version: 5.0.x

- bash: echo NugetVersion is $NugetVersion; export NugetVersion
displayName: 'export NugetVersion into env vars'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ public SearchRepo(string owner, string name)

public class SearchCodeRequest
{
public SearchCodeRequest(string term, IEnumerable<SearchRepo> repos)
public SearchCodeRequest(IEnumerable<SearchRepo> repos, string term, IEnumerable<string> extensions)
{
Term = term;
Extensions = extensions;
Repos = repos.ToList();
}

public string Term { get; }
public IEnumerable<string> Extensions { get; }
public IReadOnlyCollection<SearchRepo> Repos { get; }
public int PerPage { get; set; }
}
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.Git.Tests/NuKeeper.Git.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.GitHub.Tests/NuKeeper.GitHub.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion NuKeeper.GitHub/OctokitClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ public async Task<SearchCodeResult> Search(SearchCodeRequest search)
}
var result = await _client.Search.SearchCode(
new Octokit.SearchCodeRequest(search.Term)
new Octokit.SearchCodeRequest()
{
Repos = repos,
Extensions = search.Extensions,
In = new[] { CodeInQualifier.Path },
PerPage = search.PerPage
});
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.Gitea.Tests/NuKeeper.Gitea.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
Expand Down
5 changes: 2 additions & 3 deletions NuKeeper.Gitlab.Tests/NuKeeper.Gitlab.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<CodeAnalysisRuleSet>..\CodeAnalysisRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.Inspection.Tests/NuKeeper.Inspection.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<CodeAnalysisRuleSet>..\CodeAnalysisRulesForTests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private static DirectoryInfo GetOwnRootDir()
// then the app root directory to scan is "C:\Code\NuKeeper\"
// So go up four dir levels to the root
// Self is a convenient source of a valid project to scan
var fullPath = new Uri(typeof(RepositoryScanner).GetTypeInfo().Assembly.CodeBase).LocalPath;
var fullPath = new Uri(typeof(RepositoryScanner).GetTypeInfo().Assembly.Location).LocalPath;
var runDir = Path.GetDirectoryName(fullPath);

var projectRootDir = Directory.GetParent(runDir).Parent.Parent.Parent;
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.Tests/NuKeeper.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<CodeAnalysisRuleSet>..\CodeAnalysisRulesForTests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper.Update.Tests/NuKeeper.Update.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions NuKeeper/Engine/RepositoryFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using NuKeeper.Abstractions.Logging;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using NuKeeper.Abstractions.CollaborationModels;

Expand All @@ -26,14 +27,15 @@ public async Task<bool> ContainsDotNetProjects(RepositorySettings repository)
throw new ArgumentNullException(nameof(repository));
}

const string dotNetCodeFiles = "\"packages.config\" OR \".csproj\" OR \".fsproj\" OR \".vbproj\"";
IEnumerable<string> dotNetCodeExtensions = new ReadOnlyCollection<string>(new List<string>(){ ".sln", ".csproj", ".fsproj", ".vbproj" });
const string dotNetCodeTerms = "\"packages.config\" OR \".csproj\" OR \".fsproj\" OR \".vbproj\"";

var repos = new List<SearchRepo>
{
new SearchRepo(repository.RepositoryOwner, repository.RepositoryName)
};

var searchCodeRequest = new SearchCodeRequest(dotNetCodeFiles, repos)
var searchCodeRequest = new SearchCodeRequest(repos, dotNetCodeTerms, dotNetCodeExtensions)
{
PerPage = 1
};
Expand Down
2 changes: 1 addition & 1 deletion NuKeeper/NuKeeper.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<PackAsTool>true</PackAsTool>
<PackageId>nukeeper</PackageId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down

0 comments on commit c189fda

Please sign in to comment.