Skip to content

Commit ce6e610

Browse files
Merge pull request #8 from martincostello/Support-DotNet-Core
Support .NET Core
2 parents 64c7443 + d874303 commit ce6e610

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+574
-710
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = crlf
7+
indent_size = 4
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.json]
13+
indent_size = 2

.gitattributes

Lines changed: 0 additions & 63 deletions
This file was deleted.

.gitignore

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
.DS_Store
2+
.dotnetcli
23
.metadata
34
.settings
45
.vs
56
_ReSharper*
7+
_reports
8+
_UpgradeReport_Files/
9+
artifacts/
10+
Backup*/
611
bin
712
Bin
8-
BuildOutput
913
obj
1014
packages
1115
project.lock.json
1216
TestResults
17+
UpgradeLog*.htm
18+
UpgradeLog*.XML
1319
*.DotSettings
1420
*.GhostDoc.xml
15-
*.opensdf
16-
*.sdf
21+
*.log
22+
*.nupkg
23+
*.[Pp]ublish.xml
1724
*.sln.cache
25+
*.sln.docstates
1826
*.sln.ide
1927
*.suo
2028
*.user
21-
/src/Tools/NuGet/NuGet.exe.old

.travis.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
language: csharp
2+
3+
sudo: required
4+
dist: trusty
5+
6+
env:
7+
global:
8+
- CLI_VERSION=1.0.0-preview2-003121
9+
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
10+
- NUGET_XMLDOC_MODE=skip
11+
12+
branches:
13+
only:
14+
- master
15+
16+
addons:
17+
apt:
18+
packages:
19+
- gettext
20+
- libcurl4-openssl-dev
21+
- libicu-dev
22+
- libssl-dev
23+
- libunwind8
24+
25+
mono:
26+
- latest
27+
28+
install:
29+
- export DOTNET_INSTALL_DIR="$PWD/.dotnetcli"
30+
- curl -sSL https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh | bash /dev/stdin --version "$CLI_VERSION" --install-dir "$DOTNET_INSTALL_DIR"
31+
- export PATH="$DOTNET_INSTALL_DIR:$PATH"
32+
33+
script:
34+
- ./build.sh
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
using System.Reflection;
55

6-
[assembly: AssemblyVersion("1.2.0.0")]
7-
[assembly: AssemblyFileVersion("1.2.0.0")]
8-
[assembly: AssemblyInformationalVersion("1.2.0.0")]
6+
[assembly: AssemblyVersion("2.0.0.0")]
7+
[assembly: AssemblyFileVersion("2.0.0.0")]
8+
[assembly: AssemblyInformationalVersion("2.0.0.0")]

Build.cmd

Lines changed: 0 additions & 9 deletions
This file was deleted.

Build.ps1

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
param(
2+
[Parameter(Mandatory=$false)][bool] $RestorePackages = $false,
3+
[Parameter(Mandatory=$false)][string] $Configuration = "Release",
4+
[Parameter(Mandatory=$false)][string] $VersionSuffix = "",
5+
[Parameter(Mandatory=$false)][string] $OutputPath = "",
6+
[Parameter(Mandatory=$false)][bool] $PatchVersion = $false,
7+
[Parameter(Mandatory=$false)][bool] $RunTests = $true,
8+
[Parameter(Mandatory=$false)][bool] $CreatePackages = $true
9+
)
10+
11+
$ErrorActionPreference = "Stop"
12+
13+
$solutionPath = Split-Path $MyInvocation.MyCommand.Definition
14+
$getDotNet = Join-Path $solutionPath "tools\install.ps1"
15+
$dotnetVersion = "1.0.0-preview2-003121"
16+
17+
if ($OutputPath -eq "") {
18+
$OutputPath = "$(Convert-Path "$PSScriptRoot")\artifacts"
19+
}
20+
21+
$env:DOTNET_INSTALL_DIR = "$(Convert-Path "$PSScriptRoot")\.dotnetcli"
22+
23+
if ($env:CI -ne $null) {
24+
25+
$RestorePackages = $true
26+
$PatchVersion = $true
27+
28+
if (($VersionSuffix -eq "" -and $env:APPVEYOR_REPO_TAG -eq "false" -and $env:APPVEYOR_BUILD_NUMBER -ne "") -eq $true) {
29+
30+
$LastVersionBuild = (Get-Content ".\releases.txt" | Select -Last 1)
31+
$LastVersion = New-Object -TypeName System.Version -ArgumentList $LastVersionBuild
32+
$ThisVersion = $env:APPVEYOR_BUILD_NUMBER -as [int]
33+
$ThisBuildNumber = $ThisVersion - $LastVersion.Build
34+
35+
$VersionSuffix = "beta-" + $ThisBuildNumber.ToString("0000")
36+
}
37+
}
38+
39+
if (!(Test-Path $env:DOTNET_INSTALL_DIR)) {
40+
mkdir $env:DOTNET_INSTALL_DIR | Out-Null
41+
$installScript = Join-Path $env:DOTNET_INSTALL_DIR "install.ps1"
42+
Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile $installScript
43+
& $installScript -Version "$dotnetVersion" -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath
44+
}
45+
46+
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
47+
$dotnet = "$env:DOTNET_INSTALL_DIR\dotnet"
48+
49+
function DotNetRestore { param([string]$Project)
50+
& $dotnet restore $Project --verbosity minimal
51+
if ($LASTEXITCODE -ne 0) {
52+
throw "dotnet restore failed with exit code $LASTEXITCODE"
53+
}
54+
}
55+
56+
function DotNetBuild { param([string]$Project, [string]$Configuration, [string]$Framework, [string]$VersionSuffix)
57+
if ($VersionSuffix) {
58+
& $dotnet build $Project --output (Join-Path $OutputPath $Framework) --framework $Framework --configuration $Configuration --version-suffix "$VersionSuffix"
59+
} else {
60+
& $dotnet build $Project --output (Join-Path $OutputPath $Framework) --framework $Framework --configuration $Configuration
61+
}
62+
if ($LASTEXITCODE -ne 0) {
63+
throw "dotnet build failed with exit code $LASTEXITCODE"
64+
}
65+
}
66+
67+
function DotNetTest { param([string]$Project)
68+
& $dotnet test $Project
69+
if ($LASTEXITCODE -ne 0) {
70+
throw "dotnet test failed with exit code $LASTEXITCODE"
71+
}
72+
}
73+
74+
function DotNetPack { param([string]$Project, [string]$Configuration, [string]$VersionSuffix)
75+
if ($VersionSuffix) {
76+
& $dotnet pack $Project --output $OutputPath --configuration $Configuration --version-suffix "$VersionSuffix" --no-build
77+
} else {
78+
& $dotnet pack $Project --output $OutputPath --configuration $Configuration --no-build
79+
}
80+
if ($LASTEXITCODE -ne 0) {
81+
throw "dotnet pack failed with exit code $LASTEXITCODE"
82+
}
83+
}
84+
85+
if ($PatchVersion -eq $true) {
86+
87+
$gitRevision = (git rev-parse HEAD | Out-String).Trim()
88+
$gitBranch = (git rev-parse --abbrev-ref HEAD | Out-String).Trim()
89+
$timestamp = [DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ssK")
90+
91+
$assemblyVersion = Get-Content ".\AssemblyVersion.cs" -Raw
92+
$assemblyVersionWithMetadata = "{0}[assembly: AssemblyMetadata(""CommitHash"", ""{1}"")]`r`n[assembly: AssemblyMetadata(""CommitBranch"", ""{2}"")]`r`n[assembly: AssemblyMetadata(""BuildTimestamp"", ""{3}"")]" -f $assemblyVersion, $gitRevision, $gitBranch, $timestamp
93+
94+
Set-Content ".\AssemblyVersion.cs" $assemblyVersionWithMetadata -Encoding utf8
95+
}
96+
97+
$projects = @(
98+
(Join-Path $solutionPath "src\MartinCostello.BrowserStack.Automate\project.json")
99+
)
100+
101+
$testProjects = @(
102+
(Join-Path $solutionPath "tests\MartinCostello.BrowserStack.Automate.Tests\project.json")
103+
)
104+
105+
$packageProjects = @(
106+
(Join-Path $solutionPath "src\MartinCostello.BrowserStack.Automate\project.json")
107+
)
108+
109+
$restoreProjects = @(
110+
(Join-Path $solutionPath "src\MartinCostello.BrowserStack.Automate\project.json"),
111+
(Join-Path $solutionPath "tests\MartinCostello.BrowserStack.Automate.Tests\project.json")
112+
)
113+
114+
if ($RestorePackages -eq $true) {
115+
Write-Host "Restoring NuGet packages for $($restoreProjects.Count) projects..." -ForegroundColor Green
116+
ForEach ($project in $restoreProjects) {
117+
DotNetRestore $project
118+
}
119+
}
120+
121+
Write-Host "Building $($projects.Count) projects..." -ForegroundColor Green
122+
ForEach ($project in $projects) {
123+
DotNetBuild $project $Configuration "netstandard1.3" $VersionSuffix
124+
DotNetBuild $project $Configuration "net451" $VersionSuffix
125+
}
126+
127+
if ($RunTests -eq $true) {
128+
Write-Host "Testing $($testProjects.Count) project(s)..." -ForegroundColor Green
129+
ForEach ($project in $testProjects) {
130+
DotNetTest $project
131+
}
132+
}
133+
134+
if ($CreatePackages -eq $true) {
135+
Write-Host "Creating $($packageProjects.Count) package(s)..." -ForegroundColor Green
136+
ForEach ($project in $packageProjects) {
137+
DotNetPack $project $Configuration $VersionSuffix
138+
}
139+
}
140+
141+
if ($PatchVersion -eq $true) {
142+
Set-Content ".\AssemblyVersion.cs" $assemblyVersion.Trim() -Encoding utf8
143+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[assembly: AssemblyCompany("https://github.com/martincostello/browserstack-automate")]
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCulture("")]
12-
[assembly: AssemblyCopyright("Copyright © Martin Costello, 2015.")]
12+
[assembly: AssemblyCopyright("Copyright (c) Martin Costello, 2015.")]
1313
[assembly: AssemblyProduct("MartinCostello.BrowserStack.Automate")]
1414
[assembly: AssemblyTrademark("")]
1515

src/MartinCostello.BrowserStack.Automate.ruleset renamed to MartinCostello.BrowserStack.Automate.ruleset

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RuleSet Name="MartinCostello.BrowserStack.Automate Rules" Description="This rule set contains rules for the MartinCostello.BrowserStack.Automate solution." ToolsVersion="14.0">
33
<IncludeAll Action="Warning" />
4-
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
5-
<Rule Id="CA1006" Action="None" />
6-
<Rule Id="CA1024" Action="None" />
7-
<Rule Id="CA1056" Action="None" />
8-
<Rule Id="CA2227" Action="None" />
9-
<Rule Id="CA1707" Action="None" />
10-
</Rules>
114
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
125
<Rule Id="SA1100" Action="None" />
136
<Rule Id="SA1101" Action="None" />
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.25420.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{14426345-2DE8-4450-A2F6-D23107D62989}"
7+
ProjectSection(SolutionItems) = preProject
8+
.editorconfig = .editorconfig
9+
.gitignore = .gitignore
10+
.travis.yml = .travis.yml
11+
appveyor.yml = appveyor.yml
12+
AssemblyVersion.cs = AssemblyVersion.cs
13+
Build.ps1 = Build.ps1
14+
build.sh = build.sh
15+
CommonAssemblyInfo.cs = CommonAssemblyInfo.cs
16+
global.json = global.json
17+
LICENSE = LICENSE
18+
MartinCostello.BrowserStack.Automate.ruleset = MartinCostello.BrowserStack.Automate.ruleset
19+
MartinCostello.BrowserStack.Automate.snk = MartinCostello.BrowserStack.Automate.snk
20+
README.md = README.md
21+
stylecop.json = stylecop.json
22+
EndProjectSection
23+
EndProject
24+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F0ED165C-03B3-4578-8B19-64B15F673E76}"
25+
EndProject
26+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0F694B07-6EBF-45FB-99A0-266542E16DEE}"
27+
EndProject
28+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MartinCostello.BrowserStack.Automate", "src\MartinCostello.BrowserStack.Automate\MartinCostello.BrowserStack.Automate.xproj", "{DA306F05-7E38-43DA-9C48-674028A34577}"
29+
EndProject
30+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MartinCostello.BrowserStack.Automate.Tests", "tests\MartinCostello.BrowserStack.Automate.Tests\MartinCostello.BrowserStack.Automate.Tests.xproj", "{DC723DF1-5852-45B1-B2BD-71BA85CDED1E}"
31+
EndProject
32+
Global
33+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
34+
Debug|Any CPU = Debug|Any CPU
35+
Release|Any CPU = Release|Any CPU
36+
EndGlobalSection
37+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
38+
{DA306F05-7E38-43DA-9C48-674028A34577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{DA306F05-7E38-43DA-9C48-674028A34577}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{DA306F05-7E38-43DA-9C48-674028A34577}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{DA306F05-7E38-43DA-9C48-674028A34577}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{DC723DF1-5852-45B1-B2BD-71BA85CDED1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{DC723DF1-5852-45B1-B2BD-71BA85CDED1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{DC723DF1-5852-45B1-B2BD-71BA85CDED1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{DC723DF1-5852-45B1-B2BD-71BA85CDED1E}.Release|Any CPU.Build.0 = Release|Any CPU
46+
EndGlobalSection
47+
GlobalSection(SolutionProperties) = preSolution
48+
HideSolutionNode = FALSE
49+
EndGlobalSection
50+
GlobalSection(NestedProjects) = preSolution
51+
{DA306F05-7E38-43DA-9C48-674028A34577} = {F0ED165C-03B3-4578-8B19-64B15F673E76}
52+
{DC723DF1-5852-45B1-B2BD-71BA85CDED1E} = {0F694B07-6EBF-45FB-99A0-266542E16DEE}
53+
EndGlobalSection
54+
EndGlobal

0 commit comments

Comments
 (0)