Fix up the Rakefile

We no longer generate test code coverage, as that's hard on .net core

Also remove GitLink
This commit is contained in:
Antony Male 2019-09-22 15:36:00 +01:00
parent b3064171c1
commit 9b5da1f82e
6 changed files with 14 additions and 89 deletions

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@
<title>Stylet.Start</title>
<authors>Antony Male</authors>
<owners>Antony Male</owners>
<licenseUrl>http://github.com/canton7/Stylet/blob/master/LICENSE.txt</licenseUrl>
<license type="expression">MIT</license>
<projectUrl>http://github.com/canton7/Stylet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/canton7/Stylet/master/StyletIcon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

View File

@ -6,7 +6,7 @@
<title>Stylet</title>
<authors>Antony Male</authors>
<owners>Antony Male</owners>
<licenseUrl>http://github.com/canton7/Stylet/blob/master/LICENSE.txt</licenseUrl>
<license type="expression">MIT</license>
<projectUrl>http://github.com/canton7/Stylet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/canton7/Stylet/master/StyletIcon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@ -16,10 +16,10 @@
</metadata>
<files>
<file src="..\Stylet\bin\Release\Stylet.dll" target="lib\net45"/>
<file src="..\Stylet\bin\Release\Stylet.pdb" target="lib\net45"/>
<file src="..\Stylet\bin\Release\Stylet.pdb.srcsrv" target="lib\net45"/>
<file src="..\Stylet\bin\Release\Stylet.xml" target="lib\net45"/>
<file src="..\Stylet\bin\Release\net45\Stylet.dll" target="lib\net45"/>
<file src="..\Stylet\bin\Stylet.xml" target="lib\net45"/>
<file src="..\Stylet\bin\Release\netcoreapp3.0\Stylet.dll" target="lib\netcoreapp3.0"/>
<file src="..\Stylet\bin\Stylet.xml" target="lib\netcoreapp3.0"/>
<file src="readme.txt" target=""/>
</files>
</package>

View File

@ -10,100 +10,24 @@ NUSPEC_START = 'NuGet/Stylet.start.nuspec'
ASSEMBLY_INFO = 'Stylet/Properties/AssemblyInfo.cs'
CSPROJ = 'Stylet/Stylet.csproj'
MSBUILD = %q{C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe}
UNIT_TESTS = 'StyletUnitTests/StyletUnitTests.csproj'
directory COVERAGE_DIR
desc "Build the project for release"
desc "Build the project using the current CONFIG (or Debug)"
task :build do
sh MSBUILD, CSPROJ, "/t:Clean;Rebuild", "/p:Configuration=Release", "/verbosity:normal"
end
task :test_environment => [:build] do
NUNIT_TOOLS = 'packages/NUnit.Runners.*/tools'
NUNIT_CONSOLE = Dir[File.join(NUNIT_TOOLS, 'nunit-console.exe')].first
NUNIT_EXE = Dir[File.join(NUNIT_TOOLS, 'nunit.exe')].first
OPENCOVER_CONSOLE = Dir['packages/OpenCover.*/tools/OpenCover.Console.exe'].first
REPORT_GENERATOR = Dir['packages/ReportGenerator.*/tools/ReportGenerator.exe'].first
UNIT_TESTS_DLL = "StyletUnitTests/bin/#{CONFIG}/StyletUnitTests.dll"
INTEGRATION_TESTS_EXE = "StyletIntegrationTests/bin/#{CONFIG}/StyletIntegrationTests.exe"
raise "NUnit.Runners not found. Restore NuGet packages" unless NUNIT_CONSOLE && NUNIT_EXE
raise "OpenCover not found. Restore NuGet packages" unless OPENCOVER_CONSOLE
raise "ReportGenerator not found. Restore NuGet packages" unless REPORT_GENERATOR
end
task :nunit_test_runner => [:test_environment] do
sh NUNIT_CONSOLE, UNIT_TESTS_DLL
sh 'dotnet', 'build', '-c', CONFIG, CSPROJ
end
desc "Run unit tests using the current CONFIG (or Debug)"
task :test => [:nunit_test_runner] do |t|
rm 'TestResult.xml', :force => true
end
desc "Launch the NUnit gui pointing at the correct DLL for CONFIG (or Debug)"
task :nunit => [:test_environment] do |t|
sh NUNIT_EXE, UNIT_TESTS_DLL
end
namespace :cover do
desc "Generate unit test code coverage reports for CONFIG (or Debug)"
task :unit => [:test_environment, COVERAGE_DIR] do |t|
coverage(instrument(:nunit, UNIT_TESTS_DLL))
end
desc "Create integration test code coverage reports for CONFIG (or Debug)"
task :integration => [:test_environment, COVERAGE_DIR] do |t|
coverage(instrument(:exe, INTEGRATION_TESTS_EXE))
end
desc "Create test code coverage for everything for CONFIG (or Debug)"
task :all => [:test_environment, COVERAGE_DIR] do |t|
coverage([instrument(:nunit, UNIT_TESTS_DLL), instrument(:exe, INTEGRATION_TESTS_EXE)])
end
end
def instrument(runner, target)
case runner
when :nunit
opttarget = NUNIT_CONSOLE
opttargetargs = target
when :exe
opttarget = target
opttargetargs = ''
else
raise "Unknown runner #{runner}"
end
coverage_file = File.join(COVERAGE_DIR, File.basename(target).ext('xml'))
sh OPENCOVER_CONSOLE, '-register:user', "-target:#{opttarget}", "-filter:+[Stylet]* -[Stylet]XamlGeneratedNamespace.*", "-targetargs:#{opttargetargs} /noshadow", "-output:#{coverage_file}"
rm('TestResult.xml', :force => true) if runner == :nunit
coverage_file
end
def coverage(coverage_files)
coverage_files = [*coverage_files]
sh REPORT_GENERATOR, "-reports:#{coverage_files.join(';')}", "-targetdir:#{COVERAGE_DIR}"
task :test do
sh 'dotnet', 'test', '-c', CONFIG, UNIT_TESTS
end
desc "Create NuGet package"
task :package do
local_hash = `git rev-parse HEAD`.chomp
sh "NuGet/GitLink.exe . -s #{local_hash} -u #{GITLINK_REMOTE} -f Stylet.sln -ignore StyletUnitTests,StyletIntegrationTests"
Dir.chdir(File.dirname(NUSPEC)) do
sh "nuget.exe pack #{File.basename(NUSPEC)}"
end
Dir.chdir(File.dirname(NUSPEC_START)) do
sh "nuget.exe pack #{File.basename(NUSPEC_START)}"
end
sh 'dotnet', 'pack', '-c', CONFIG, CSPROJ, "-p:NuSpecFile=../#{NUSPEC}"
sh 'dotnet', 'pack', '-c', CONFIG, CSPROJ, "-p:NuSpecFile=../#{NUSPEC_START}"
end
desc "Bump version number"

View File

@ -10,6 +10,7 @@
<AssemblyName>Stylet</AssemblyName>
<CodeAnalysisRuleSet />
<EnableDefaultItems>false</EnableDefaultItems>
<DocumentationFile>bin\Stylet.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>