-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1583 from laedit/SonarQube-migration
Sonarqube migration
- Loading branch information
Showing
11 changed files
with
195 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Auto-Generated by FAKE; do not edit | ||
namespace System | ||
open System.Reflection | ||
|
||
[<assembly: AssemblyTitleAttribute("FAKE - F# Make Analizing your project with SOnarQube")>] | ||
[<assembly: AssemblyProductAttribute("FAKE - F# Make")>] | ||
[<assembly: AssemblyVersionAttribute("5.0.0")>] | ||
[<assembly: AssemblyInformationalVersionAttribute("5.0.0")>] | ||
[<assembly: AssemblyFileVersionAttribute("5.0.0")>] | ||
do () | ||
|
||
module internal AssemblyVersionInformation = | ||
let [<Literal>] AssemblyTitle = "FAKE - F# Make Analizing your project with SOnarQube" | ||
let [<Literal>] AssemblyProduct = "FAKE - F# Make" | ||
let [<Literal>] AssemblyVersion = "5.0.0" | ||
let [<Literal>] AssemblyInformationalVersion = "5.0.0" | ||
let [<Literal>] AssemblyFileVersion = "5.0.0" |
34 changes: 34 additions & 0 deletions
34
src/app/Fake.Testing.SonarQube/Fake.Testing.SonarQube.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<VersionPrefix>1.0.0-alpha-10</VersionPrefix> | ||
<TargetFramework>netstandard1.6</TargetFramework> | ||
<DefineConstants>$(DefineConstants);NO_DOTNETCORE_BOOTSTRAP</DefineConstants> | ||
<DebugType>pdbonly</DebugType> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<AssemblyName>Fake.Testing.SonarQube</AssemblyName> | ||
<OutputType>Library</OutputType> | ||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.6' ">$(PackageTargetFallback);portable-net45+win8;dnxcore50</PackageTargetFallback> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' "> | ||
<DefineConstants>$(DefineConstants);NETSTANDARD;USE_HTTPCLIENT</DefineConstants> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="SonarQube.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Fake.Core.Tracing\Fake.Core.Tracing.fsproj" /> | ||
<ProjectReference Include="..\Fake.Core.Process\Fake.Core.Process.fsproj" /> | ||
<ProjectReference Include="..\Fake.Core.Globbing\Fake.Core.Globbing.fsproj" /> | ||
<ProjectReference Include="..\Fake.IO.FileSystem\Fake.IO.FileSystem.fsproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<DotNetCliToolReference Include="dotnet-compile-fsc"> | ||
<Version>1.0.0-preview2-020000</Version> | ||
</DotNetCliToolReference> | ||
</ItemGroup> | ||
<Import Project="..\..\..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/// Contains a task to run the msbuild runner of [SonarQube analyzer](http://sonarqube.org). | ||
module Fake.Testing.SonarQube | ||
|
||
open System.IO | ||
open Fake.Core | ||
open Fake.Core.Globbing | ||
open Fake.Core.Process | ||
open Fake.IO.FileSystem.Operators | ||
|
||
/// [omit] | ||
/// The supported commands of SonarQube. It is called with Begin before compilation, and End after compilation. | ||
type private SonarQubeCall = Begin | End | ||
|
||
/// Parameter type to configure the SonarQube runner. | ||
type SonarQubeParams = { | ||
/// FileName of the SonarQube runner exe. | ||
ToolsPath : string | ||
/// Key to identify the SonarQube project | ||
Key : string | ||
/// Name of the project | ||
Name : string | ||
/// Version number of the project | ||
Version : string | ||
/// Individual global settings for SonarQube | ||
Settings : string list | ||
/// Read settings from configuration file | ||
Config : string option | ||
} | ||
|
||
/// SonarQube default parameters - tries to locate MSBuild.SonarQube.exe in any subfolder. | ||
let SonarQubeDefaults = | ||
{ ToolsPath = Tools.findToolInSubPath "MSBuild.SonarQube.Runner.exe" (Directory.GetCurrentDirectory() @@ "tools" @@ "SonarQube") | ||
Key = null | ||
Name = null | ||
Version = "1.0" | ||
Settings = [] | ||
Config = None } | ||
|
||
/// [omit] | ||
/// Execute the external msbuild runner of SonarQube. Parameters are given to the command line tool as required. | ||
let private SonarQubeCall (call: SonarQubeCall) (parameters : SonarQubeParams) = | ||
let sonarPath = parameters.ToolsPath | ||
let setArgs = parameters.Settings |> List.fold (fun acc x -> acc + "/d:" + x + " ") "" | ||
|
||
let cfgArgs = | ||
match parameters.Config with | ||
| Some(x) -> (" /s:"+x) | ||
| None -> "" | ||
|
||
let args = | ||
match call with | ||
| Begin -> "begin /k:\"" + parameters.Key + "\" /n:\"" + parameters.Name + "\" /v:\"" + parameters.Version + "\" " + setArgs + cfgArgs | ||
| End -> "end " + setArgs + cfgArgs | ||
|
||
let result = | ||
ExecProcess (fun info -> | ||
info.FileName <- sonarPath | ||
info.Arguments <- args) System.TimeSpan.MaxValue | ||
if result <> 0 then failwithf "Error during sonar qube call %s" (call.ToString()) | ||
|
||
/// This task to can be used to run the begin command of [Sonar Qube](http://sonarqube.org/) on a project. | ||
/// ## Parameters | ||
/// | ||
/// - `setParams` - Function used to overwrite the SonarQube default parameters. | ||
/// | ||
/// ## Sample | ||
/// open Fake.Testing | ||
/// | ||
/// SonarQube.Begin (fun p -> | ||
/// {p with | ||
/// Key = "MyProject" | ||
/// Name = "MainTool" | ||
/// Version = "1.0 }) | ||
/// | ||
let Begin setParams = | ||
use __ = Trace.traceTask "SonarQube" "Begin" | ||
let parameters = setParams SonarQubeDefaults | ||
SonarQubeCall Begin parameters | ||
|
||
/// This task to can be used to run the end command of [Sonar Qube](http://sonarqube.org/) on a project. | ||
/// ## Parameters | ||
/// | ||
/// - `setParams` - Function used to overwrite the SonarQube default parameters. | ||
/// | ||
/// ## Sample | ||
/// open Fake.Testing | ||
/// | ||
/// SonarQube.End None | ||
/// | ||
/// SonarQube.End (fun p -> | ||
/// {p with | ||
/// Settings = ["sonar.login=login", "sonar.password=password"] }) | ||
/// | ||
let End setParams = | ||
use __ = Trace.traceTask "SonarQube" "End" | ||
let parameters = match setParams with | ||
| Some setParams -> setParams SonarQubeDefaults | ||
| None -> (fun p -> { p with Settings = [] }) SonarQubeDefaults | ||
SonarQubeCall End parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
group netcore | ||
FSharp.NET.Sdk | ||
FSharp.Core | ||
NETStandard.Library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters