Skip to content

Commit

Permalink
Merge branch 'master' into fix-resharper-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy authored Jun 16, 2021
2 parents c158346 + 6ca6f06 commit 88def79
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
11 changes: 11 additions & 0 deletions InspectCode.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dotnet tool restore

# Temporarily disabled until the tool is upgraded to 5.0.
# The version specified in .config/dotnet-tools.json (3.1.37601) won't run on .NET hosts >=5.0.7.
# - cmd: dotnet format --dry-run --check

dotnet CodeFileSanity
dotnet jb inspectcode "osu-framework.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors

exit $LASTEXITCODE
6 changes: 6 additions & 0 deletions InspectCode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

dotnet tool restore
dotnet CodeFileSanity
dotnet jb inspectcode "osu-framework.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Build configurations for the recommended IDEs (listed above) are included. You s

### Code analysis

Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternatively, you can install resharper or use rider to get inline support in your IDE of choice.
Code analysis can be run with `powershell ./InspectCode.ps1` or `InspectCode.sh`.

## Contributing

Expand Down
20 changes: 12 additions & 8 deletions osu.Framework/Testing/DynamicClassCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public void SetRecompilationTarget(T target)

public void Start()
{
var di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);

if (Debugger.IsAttached)
{
referenceBuilder = new EmptyTypeReferenceBuilder();
Expand All @@ -55,6 +53,17 @@ public void Start()
return;
}

var di = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
var basePath = getSolutionPath(di);

if (!Directory.Exists(basePath))
{
referenceBuilder = new EmptyTypeReferenceBuilder();

Logger.Log("Dynamic compilation disabled (no solution file found).");
return;
}

#if NET5_0
referenceBuilder = new RoslynTypeReferenceBuilder();
#else
Expand All @@ -65,12 +74,7 @@ public void Start()
{
Logger.Log("Initialising dynamic compilation...");

var basePath = getSolutionPath(di);

if (!Directory.Exists(basePath))
return;

await referenceBuilder.Initialise(Directory.GetFiles(getSolutionPath(di), "*.sln").First()).ConfigureAwait(false);
await referenceBuilder.Initialise(Directory.GetFiles(basePath, "*.sln").First()).ConfigureAwait(false);

foreach (var dir in Directory.GetDirectories(basePath))
{
Expand Down

0 comments on commit 88def79

Please sign in to comment.