Skip to content

Commit

Permalink
Merge pull request #6 from DIPSASA/feature/netstandard-support
Browse files Browse the repository at this point in the history
Adding .netstandard2.0 targets.
  • Loading branch information
epaulsen authored May 3, 2018
2 parents 450bd3c + 52836b9 commit e9b65d1
Show file tree
Hide file tree
Showing 15 changed files with 719 additions and 403 deletions.
4 changes: 2 additions & 2 deletions .paket/Paket.Restore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@

<!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
<PropertyGroup>
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketRestoreCacheFile)" | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketLockFilePath)" | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
</PropertyGroup>

<!-- If shasum and awk exist get the hashes -->
Expand Down
68 changes: 45 additions & 23 deletions default.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,51 @@ task default -depends Test

$buildArtifacts = Join-Path $PSScriptRoot "buildartifacts"
$slnFile = Join-Path $PSScriptRoot "src\Dapper.Oracle.sln"
$testRunner = Join-Path $PSScriptRoot "packages\xunit.runner.console\tools\net452\xunit.console.x86.exe"
$testRunner = Join-Path $PSScriptRoot "packages\tools\dotnet-xunit\tools\net452\xunit.console.x86.exe"
$testFolder = Join-Path $PSScriptRoot "src\Tests.Dapper.Oracle\bin"
$paketExe = Join-Path $PSScriptRoot ".paket\paket.exe"

task Init {
Exec {
& $paketExe restore
if(Test-Path -Path $buildArtifacts)
{
Remove-Item -Path $buildArtifacts -Force -Recurse
}
$propertiesFile = Join-Path $PSScriptRoot "src\Dapper.Oracle\obj\VersionInfo.g.props"

task Init {
dotnet restore $slnFile
if(Test-Path -Path $buildArtifacts)
{
Remove-Item -Path $buildArtifacts -Force -Recurse
}
}

task Test -depends Compile, Clean {
Exec {
$testAssemblies = [System.IO.Path]::Combine($testFolder,$configuration,"Tests.Dapper.Oracle.dll")
& $testRunner $testAssemblies -verbose
}
task Test -depends Compile {
Exec {
pushd .\src\Tests.Dapper.Oracle

dotnet xunit -framework net452 -c $configuration -nobuild -x86
dotnet xunit -framework netcoreapp2.0 -c $configuration -nobuild --fx-version 2.0.0

popd
}
}

task Compile -depends Clean,Init {
task Compile -depends Init {
Exec {
$version = Invoke-GitVersion
$versionNumber = [string]::Format("{0}.0",$version.MajorMinorPatch)
Update-AssemblyInfoFiles -version $versionNumber -assemblyInformalVersion $version.InformationalVersion
msbuild $slnFile /t:Rebuild /p:Configuration=$configuration /v:quiet
dotnet build $slnfile -c $configuration
}
}

task Clean {
Exec { msbuild $slnFile /t:Clean /p:Configuration=$configuration /v:quiet }
Exec {
dotnet clean $slnfile
Get-ChildItem . -Include obj -Recurse | Remove-Item -Recurse -Force
}
}

task Package -depends Test {
Exec {
$version = Invoke-GitVersion
Write-PaketTemplateFiles
& $paketExe pack $buildArtifacts --verbose --version $version.MajorMinorPatch
Exec {
$version = Invoke-GitVersion
Write-PaketTemplateFiles
Write-VersionInfo($version)
dotnet pack $slnFile -c Release --no-build -o ..\..\buildartifacts
}
}

Expand All @@ -63,7 +69,7 @@ task ? -Description "Helper to display task info" {
}

function Invoke-Gitversion() {
$gitVersionPath = Join-Path $PSScriptRoot "packages\GitVersion.CommandLine\tools\GitVersion.exe"
$gitVersionPath = Join-Path $PSScriptRoot "packages\tools\GitVersion.CommandLine\tools\GitVersion.exe"
& $gitVersionPath /output json | ConvertFrom-Json
}

Expand All @@ -81,6 +87,22 @@ function Write-PaketTemplateFiles()
}
}

function Write-VersionInfo($version)
{
$xml = [Xml]@"
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>
</Project>
"@
$xml.Project.PropertyGroup.VersionPrefix = $version.MajorMinorPatch
$xml.Project.PropertyGroup.VersionSuffix = $version.PreReleaseTag
$xml.Save($propertiesFile)
}

function Write-Documentation
{
Write-Host "Available tasks:Clean,Init,Compile,Test,Package"
Expand Down
43 changes: 32 additions & 11 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
source https://api.nuget.org/v3/index.json
framework: net451
nuget Dapper >= 1.50.2
nuget Oracle.ManagedDataAccess >= 12.2.1100
nuget Oracle.DataAccess.x86 >= 2.112.1
nuget FluentAssertions >= 5.3.0
nuget Moq ~> 4.8.2
nuget xunit >= 2.3.1
nuget xunit.runner.console >= 2.3.1
nuget xunit.runner.visualstudio >= 2.3.1
nuget GitVersion.CommandLine
framework: net451, netstandard2.0
source https://www.nuget.org/api/v2
clitool dotnet-xunit >= 2.3.1

group Main
framework: net451, netstandard2.0
source https://www.nuget.org/api/v2
nuget Dapper >= 1.50.2

group Test
source https://www.nuget.org/api/v2
framework: net452,netcoreapp2.0
nuget FluentAssertions >= 5.3.0
nuget xunit >= 2.3.1
nuget xunit.runner.visualstudio >= 2.3.1

group Test-netframework
source https://www.nuget.org/api/v2
framework: net452
nuget Oracle.ManagedDataAccess >= 12.2.1100
nuget Oracle.DataAccess.x86 >= 2.112.1

group Test-netcore
source https://www.nuget.org/api/v2
framework: netcoreapp2.0
nuget Oracle.ManagedDataAccess.Core 2.12.0-beta2

group tools
framework: net451
source https://www.nuget.org/api/v2
nuget GitVersion.CommandLine

Loading

0 comments on commit e9b65d1

Please sign in to comment.