diff --git a/.gitignore b/.gitignore
index 671cb8c..bff54b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -226,4 +226,5 @@ packages
# Cake
tools/
-.vs/
\ No newline at end of file
+.vs/
+artifacts/
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..637de91
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,19 @@
+
+
+ 1.0.6
+
+ dev.0+sha.0
+
+ A Slack wrapper for direct interaction with their APIs.
+ Inumedia - Copyright © 2018
+ SlackAPI
+ en-US
+ Inumedia
+ Inumedia
+ https://github.com/Inumedia/SlackAPI
+ http://choosealicense.com/licenses/mit/
+ true
+ git
+ https://github.com/Inumedia/SlackAPI
+
+
\ No newline at end of file
diff --git a/GlobalAssemblyVersion.cs b/GlobalAssemblyVersion.cs
deleted file mode 100644
index 01acc99..0000000
--- a/GlobalAssemblyVersion.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by Cake.
-//
-//------------------------------------------------------------------------------
-using System.Reflection;
-
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: AssemblyInformationalVersion("1.0.0.0")]
-
diff --git a/SlackAPI.Console/SlackAPI.Console.csproj b/SlackAPI.Console/SlackAPI.Console.csproj
index 890f211..2795092 100644
--- a/SlackAPI.Console/SlackAPI.Console.csproj
+++ b/SlackAPI.Console/SlackAPI.Console.csproj
@@ -42,9 +42,6 @@
-
- Properties\GlobalAssemblyVersion.cs
-
@@ -65,4 +62,4 @@
-->
-
+
\ No newline at end of file
diff --git a/SlackAPI.NetCore.sln b/SlackAPI.NetCore.sln
deleted file mode 100755
index f77c444..0000000
--- a/SlackAPI.NetCore.sln
+++ /dev/null
@@ -1,28 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26228.4
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlackAPI.NetCore", "SlackAPI\SlackAPI.NetCore.csproj", "{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlackAPI.Tests.NetCore", "SlackAPI.Tests\SlackAPI.Tests.NetCore.csproj", "{DEFA9559-0F8F-4C38-9644-67A080EDC46D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.Build.0 = Release|Any CPU
- {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/SlackAPI.Tests/Properties/AssemblyInfo.cs b/SlackAPI.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 14ebb5c..0000000
--- a/SlackAPI.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-using Xunit;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("SlackAPI.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("SlackAPI.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("c254f6ff-81d4-46df-aa21-3d1a6456253b")]
diff --git a/SlackAPI.Tests/SlackAPI.Tests.NetCore.csproj b/SlackAPI.Tests/SlackAPI.Tests.NetCore.csproj
deleted file mode 100755
index 84bbd42..0000000
--- a/SlackAPI.Tests/SlackAPI.Tests.NetCore.csproj
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
- net452;netcoreapp1.0
- SlackAPI.Tests
- false
- false
- false
- false
- false
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
-
-
- $(DefineConstants);RELEASE
-
-
diff --git a/SlackAPI.Tests/SlackAPI.Tests.csproj b/SlackAPI.Tests/SlackAPI.Tests.csproj
index 1389905..df257da 100644
--- a/SlackAPI.Tests/SlackAPI.Tests.csproj
+++ b/SlackAPI.Tests/SlackAPI.Tests.csproj
@@ -1,109 +1,34 @@
-
-
-
+
+
- Debug
- AnyCPU
- {C254F6FF-81D4-46DF-AA21-3D1A6456253B}
+ net452;netcoreapp2.1
Library
- Properties
+ Full
SlackAPI.Tests
SlackAPI.Tests
- v4.5
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\packages\Microsoft.TestPlatform.ObjectModel.11.0.0\lib\net35\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll
- True
-
-
- ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
- True
-
-
-
- ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll
- True
-
-
- ..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll
- True
-
-
- ..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll
- True
-
-
- ..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll
- True
-
-
+
-
- Properties\GlobalAssemblyVersion.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
-
- {0c0a58a8-174e-4a4c-907b-c3569144d15d}
- SlackAPI
-
+
+
-
-
- Always
+
+ PreserveNewest
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
\ No newline at end of file
+
+
+ $(DefineConstants);RELEASE
+
+
+
diff --git a/SlackAPI.Tests/packages.config b/SlackAPI.Tests/packages.config
deleted file mode 100644
index 23396f5..0000000
--- a/SlackAPI.Tests/packages.config
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SlackAPI.sln b/SlackAPI.sln
index 5a1913b..9b364b7 100644
--- a/SlackAPI.sln
+++ b/SlackAPI.sln
@@ -1,34 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlackAPI", "SlackAPI\SlackAPI.csproj", "{0C0A58A8-174E-4A4C-907B-C3569144D15D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlackAPI", "SlackAPI\SlackAPI.csproj", "{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlackAPI.Tests", "SlackAPI.Tests\SlackAPI.Tests.csproj", "{C254F6FF-81D4-46DF-AA21-3D1A6456253B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlackAPI.Tests", "SlackAPI.Tests\SlackAPI.Tests.csproj", "{DEFA9559-0F8F-4C38-9644-67A080EDC46D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlackAPI.Console", "SlackAPI.Console\SlackAPI.Console.csproj", "{19140E48-E1A9-421D-86DB-5AF18EECFEF2}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{9FC74E78-2D91-407E-B4C8-7C89D6CECB5B}"
- ProjectSection(SolutionItems) = preProject
- LICENSE = LICENSE
- README.md = README.md
- EndProjectSection
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0C0A58A8-174E-4A4C-907B-C3569144D15D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0C0A58A8-174E-4A4C-907B-C3569144D15D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0C0A58A8-174E-4A4C-907B-C3569144D15D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0C0A58A8-174E-4A4C-907B-C3569144D15D}.Release|Any CPU.Build.0 = Release|Any CPU
- {C254F6FF-81D4-46DF-AA21-3D1A6456253B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C254F6FF-81D4-46DF-AA21-3D1A6456253B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C254F6FF-81D4-46DF-AA21-3D1A6456253B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C254F6FF-81D4-46DF-AA21-3D1A6456253B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.Build.0 = Release|Any CPU
{19140E48-E1A9-421D-86DB-5AF18EECFEF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19140E48-E1A9-421D-86DB-5AF18EECFEF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19140E48-E1A9-421D-86DB-5AF18EECFEF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/SlackAPI/Properties/AssemblyInfo.cs b/SlackAPI/Properties/AssemblyInfo.cs
deleted file mode 100644
index cfb52e4..0000000
--- a/SlackAPI/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("SlackAPI")]
-[assembly: AssemblyDescription("A Slack wrapper for direct interaction with their APIs.")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Inumedia")]
-[assembly: AssemblyProduct("SlackAPI")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("80fe3ab4-f0d5-4fee-a6ae-524b523cebcc")]
-
-[assembly: InternalsVisibleTo("SlackAPI.Tests")]
diff --git a/SlackAPI/Properties/InternalsVisibleTo.cs b/SlackAPI/Properties/InternalsVisibleTo.cs
new file mode 100644
index 0000000..d747d59
--- /dev/null
+++ b/SlackAPI/Properties/InternalsVisibleTo.cs
@@ -0,0 +1,3 @@
+using System.Runtime.CompilerServices;
+
+[assembly:InternalsVisibleTo("SlackAPI.Tests")]
\ No newline at end of file
diff --git a/SlackAPI/SlackAPI.NetCore.csproj b/SlackAPI/SlackAPI.NetCore.csproj
deleted file mode 100755
index 737e753..0000000
--- a/SlackAPI/SlackAPI.NetCore.csproj
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
- A Slack wrapper for direct interaction with their APIs.
- Inumedia - Copyright © 2014
- SlackAPI
- en-US
- 1.0.0
-
- Inumedia
- net45;netstandard1.6;netstandard1.3
- SlackAPI
- https://github.com/Inumedia/SlackAPI
- http://choosealicense.com/licenses/mit/
- true
- git
- https://github.com/Inumedia/SlackAPI
- false
- false
- false
- false
- false
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SlackAPI
-
-
- $(DefineConstants);RELEASE
-
-
diff --git a/SlackAPI/SlackAPI.csproj b/SlackAPI/SlackAPI.csproj
index c2ccdea..b7ca772 100644
--- a/SlackAPI/SlackAPI.csproj
+++ b/SlackAPI/SlackAPI.csproj
@@ -1,184 +1,32 @@
-
-
-
-
- Debug
- AnyCPU
- {0C0A58A8-174E-4A4C-907B-C3569144D15D}
- Library
- Properties
+
+
+
+ net45;netstandard1.3;netstandard1.6
+ Full
SlackAPI
SlackAPI
- v4.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET45
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE;NET45
- prompt
- 4
+
-
- ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll
- True
-
-
-
-
-
-
-
-
-
+
+
-
-
- Properties\GlobalAssemblyVersion.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
\ No newline at end of file
+
+
+ $(DefineConstants);RELEASE
+
+
+
diff --git a/SlackAPI/SlackSocket.cs b/SlackAPI/SlackSocket.cs
index dc541eb..f32d820 100644
--- a/SlackAPI/SlackSocket.cs
+++ b/SlackAPI/SlackSocket.cs
@@ -10,8 +10,8 @@
using System.Threading.Tasks;
using System.Linq;
-#if NETSTANDARD1_6
-using Microsoft.Extensions.DependencyModel;
+#if NETSTANDARD1_6
+using Microsoft.Extensions.DependencyModel;
#endif
namespace SlackAPI
@@ -47,7 +47,7 @@ static SlackSocket()
var assemblies = DependencyContext.Default.GetDefaultAssemblyNames().Select(Assembly.Load);
#elif NETSTANDARD1_3
var assemblies = new[] { typeof(SlackSocket).GetType().GetTypeInfo().Assembly };
-#warning Autodetection not supported
+#warning Routing messages in custom assemblies are not supported with .Net Standard 1.3
#else
#error Platform not supported
#endif
diff --git a/SlackAPI/packages.config b/SlackAPI/packages.config
deleted file mode 100644
index e1fae9c..0000000
--- a/SlackAPI/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index b9c5120..2e0a39d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,34 +1,10 @@
-version: 1.0.6.{build}
image: Visual Studio 2017
pull_requests:
do_not_increment_build_number: true
-nuget:
- disable_publish_on_pr: true
-
skip_branch_with_pr: true
-before_build:
-- ps: >-
- $config = @"
-
- {
- "slack": {
- "userAuthToken": "$env:userAuthToken",
- "botAuthToken": "$env:botAuthToken",
- "testChannel": "$env:testChannel",
- "directMessageUser": "$env:directMessageUser",
- "authCode": "$env:authCode",
- "clientId": "$env:clientId",
- "clientSecret": "$env:clientSecret"
- }
- }
-
- "@
-
- $config | Set-Content SlackAPI.Tests\Configuration\config.json
-
build_script:
- ps: .\build.ps1
@@ -37,20 +13,3 @@ test: off
artifacts:
- path: '.\artifacts\**\*.nupkg'
name: Nuget packages
-
-deploy:
-- provider: NuGet
- server: https://www.myget.org/F/slackapi/api/v2
- api_key:
- secure: dt+bmkFjmkMgVdDXaaqTC4IRORfSrBSEePOGaaVPkEsKs/lGxxth21bkkBqMuJqM
- # Deploy symbol package too
- skip_symbols: false
- symbol_server: https://www.myget.org/F/slackapi/symbols/api/v2/package
-
-#- provider: NuGet
-# name: production
-# api_key:
-# secure: OVMRfHowHPun4n8cJXPNGg==
-# on:
-# branch: master
-# appveyor_repo_tag: true
diff --git a/build.cake b/build.cake
index b5b2429..5dad9af 100644
--- a/build.cake
+++ b/build.cake
@@ -1,21 +1,18 @@
-#addin nuget:?package=Cake.Git
-#addin "MagicChunks"
+#tool "nuget:?package=GitVersion.CommandLine"
#addin "Cake.FileHelpers"
+using System.Text.RegularExpressions;
+
var configuration = Argument("configuration", "Release");
var target = Argument("target", "Default");
-var mainProject = File("./SlackAPI/SlackApi.Netcore.csproj");
-var testProject = File("./SlackAPI.Tests/SlackApi.Tests.NetCore.csproj");
-var projects = new[] { mainProject, testProject };
-var artifactsDirectory = Directory("./artifacts");
-var revision = AppVeyor.IsRunningOnAppVeyor ? AppVeyor.Environment.Build.Number : 0;
-var version = AppVeyor.IsRunningOnAppVeyor ? new Version(AppVeyor.Environment.Build.Version.Split('-')[0]).ToString(3) : "1.0.0";
-var globalAssemblyInfo = File("./GlobalAssemblyVersion.cs");
-
-var generatedVersion = "";
-var generatedSuffix = "";
-
+var project = File("./SlackAPI/SlackApi.csproj");
+var testProject = File("./SlackAPI.Tests/SlackApi.Tests.csproj");
+var testConfig = File("./SlackAPI.Tests/Configuration/config.json");
+var projects = new[] { project, testProject };
+var artifactsDirectory = "./artifacts";
+var versionSuffix = string.Empty;
+var isReleaseBuild = false;
Task("Clean")
.Does(() =>
@@ -24,65 +21,67 @@ Task("Clean")
});
-Task("Restore-Packages")
+Task("Configure")
.Does(() =>
{
- foreach(var project in projects)
+ var buildNumber = 0;
+ if (AppVeyor.IsRunningOnAppVeyor)
{
- DotNetCoreRestore(project);
+ isReleaseBuild = AppVeyor.Environment.Repository.Branch == "master" && AppVeyor.Environment.Repository.Tag.IsTag;
+ buildNumber = AppVeyor.Environment.Build.Number;
+ Information("Build number is '{0}' (CI build)", buildNumber);
+ }
+ else
+ {
+ buildNumber = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
+ Information("Build number is '{0}' (local build)", buildNumber);
}
-});
-
-Task("Generate-Versionning")
- .Does(() =>
-{
- generatedVersion = version + "." + revision;
- Information("Generated version '{0}'", generatedVersion);
+ // If the build is a tag on master, generate a clean version (1.0.0)
+ // following SemVer 1.0.0 rules. NuGet supports only SemVer 1.0.0
+ // In other cases, generate a prerelease version (1.0.0-branch.123+sha.abcdefg)
+ // following SevVer 2.0.0 rules. MyGet supports SemVer 2.0.0
+ if (isReleaseBuild)
+ {
+ versionSuffix = string.Empty;
+ }
+ else
+ {
+ var gitVersion = GitVersion();
+ var gitBranch = (AppVeyor.IsRunningOnAppVeyor
+ ? AppVeyor.Environment.Repository.Branch
+ : gitVersion.BranchName);
+ gitBranch = Regex.Replace(gitBranch, @"[/\-_]", string.Empty);
+ gitBranch = gitBranch.Substring(0, Math.Min(10, gitBranch.Length));
- var branch = (AppVeyor.IsRunningOnAppVeyor ? AppVeyor.Environment.Repository.Branch : GitBranchCurrent(".").FriendlyName).Replace('/', '-');
- generatedSuffix = (branch == "master" && revision > 0) ? "" : branch.Substring(0, Math.Min(10, branch.Length)) + "-" + revision;
- Information("Generated suffix '{0}'", generatedSuffix);
-});
+ Information("Current git branch is '{0}' (normalized)", gitBranch);
+ var gitCommitId = (AppVeyor.IsRunningOnAppVeyor
+ ? AppVeyor.Environment.Repository.Commit.Id
+ : gitVersion.Sha)
+ .Substring(0, 8);
-Task("Patch-GlobalAssemblyVersions")
- .IsDependentOn("Generate-Versionning")
- .Does(() =>
-{
- CreateAssemblyInfo(globalAssemblyInfo, new AssemblyInfoSettings {
- FileVersion = generatedVersion,
- InformationalVersion = version + "-" + generatedSuffix,
- Version = generatedVersion
- }
- );
-});
+ Information("Current git sha is '{0}' (normalized)", gitCommitId);
+ versionSuffix = $"{gitBranch}.{buildNumber}+sha.{gitCommitId}";
+ }
-Task("Patch-ProjectJson")
- .IsDependentOn("Generate-Versionning")
- .Does(() =>
-{
- TransformConfig(
- mainProject,
- mainProject,
- new TransformationCollection
- {
- { "Project/PropertyGroup/VersionPrefix", version },
- { "Project/PropertyGroup/VersionSuffix", generatedSuffix }
- }
- );
-});
+ var versionPrefix = XmlPeek("./Directory.Build.props", "/Project/PropertyGroup/VersionPrefix");
+ var version = string.Join("-", versionPrefix, versionSuffix);
+ if (AppVeyor.IsRunningOnAppVeyor)
+ {
+ // Update AppVeyor build version so it will match the build version in assemblies and package
+ AppVeyor.UpdateBuildVersion(version);
+ }
-Task("Patch")
- .IsDependentOn("Patch-GlobalAssemblyVersions")
- .IsDependentOn("Patch-ProjectJson");
+ Information("Using version '{0}'", version);
+ Information("Release type build (skip symbols): {0}", isReleaseBuild);
+});
Task("Build")
- .IsDependentOn("Restore-Packages")
- .IsDependentOn("Patch")
+ .IsDependentOn("Configure")
.Does(() =>
{
foreach(var project in projects)
@@ -91,16 +90,39 @@ Task("Build")
project,
new DotNetCoreBuildSettings
{
- Configuration = configuration
+ Configuration = configuration,
+ VersionSuffix = versionSuffix
}
);
}
});
+Task("ConfigureTest")
+ .Does(() =>
+{
+ if (AppVeyor.IsRunningOnAppVeyor)
+ {
+ FileWriteText(testConfig, $@"
+ {{
+ ""slack"":
+ {{
+ ""userAuthToken"": ""{EnvironmentVariable("userAuthToken")}"",
+ ""botAuthToken"": ""{EnvironmentVariable("botAuthToken")}"",
+ ""testChannel"": ""{EnvironmentVariable("testChannel")}"",
+ ""directMessageUser"": ""{EnvironmentVariable("directMessageUser")}"",
+ ""authCode"": ""{EnvironmentVariable("authCode")}"",
+ ""clientId"": ""{EnvironmentVariable("clientId")}"",
+ ""clientSecret"": ""{EnvironmentVariable("clientSecret")}""
+ }}
+ }}");
+ }
+});
+
+
Task("Test")
- .IsDependentOn("Restore-Packages")
- .IsDependentOn("Patch")
+ .IsDependentOn("ConfigureTest")
+ .IsDependentOn("Build")
.Does(() =>
{
// AppVeyor is unable to differentiate tests from multiple frameworks
@@ -110,7 +132,7 @@ Task("Test")
// - replace assembly name in test report
// - manualy push test result
- foreach (var framework in new[] { "net452", "netcoreapp1.0"})
+ foreach (var framework in new[] { "net452", "netcoreapp2.1"})
{
DotNetCoreTest(
testProject,
@@ -133,7 +155,7 @@ Task("Test")
testResult,
@"slackapi\.tests\.dll",
"SlackAPI.Tests." + framework + ".dll",
- System.Text.RegularExpressions.RegexOptions.IgnoreCase);
+ RegexOptions.IgnoreCase);
AppVeyor.UploadTestResults(testResult, AppVeyorTestResultsType.MSTest);
}
@@ -141,28 +163,63 @@ Task("Test")
});
-Task("Pack")
+Task("Package")
.IsDependentOn("Clean")
.IsDependentOn("Build")
.IsDependentOn("Test")
.Does(() =>
{
DotNetCorePack(
- mainProject,
+ project,
new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = artifactsDirectory,
- VersionSuffix = generatedSuffix,
- ArgumentCustomization = args => args.Append("--include-symbols")
+ VersionSuffix = versionSuffix,
+ IncludeSymbols = !isReleaseBuild,
+ IncludeSource = !isReleaseBuild
}
);
});
+Task("Publish")
+ .IsDependentOn("Package")
+ .WithCriteria(() => AppVeyor.IsRunningOnAppVeyor, "Publishing is supported only from CI")
+ .Does(() =>
+{
+ // Publish on Nuget if it's a release build or on MyGet for others builds
+ var mapping = new Dictionary
+ {
+ { true, ("NUGET_APITOKEN", "NuGet", "https://nuget.org/api/v2/package") },
+ { false, ("MYGET_APITOKEN", "MyGet", "https://www.myget.org/F/slackapi/api/v2") },
+ };
+
+ var config = mapping[isReleaseBuild];
+
+ var apiToken = EnvironmentVariable(config.token);
+ if (string.IsNullOrEmpty(apiToken))
+ {
+ Error("{0} environment variable not found. Unable to push package on {1}", config.token, config.provider);
+ }
+ else
+ {
+ var packages = GetFiles(artifactsDirectory + "/**/*.nupkg");
+
+ NuGetPush(packages, new NuGetPushSettings
+ {
+ Source = config.source,
+ ApiKey = apiToken,
+ Verbosity = NuGetVerbosity.Detailed,
+ });
+ }
+});
+
+
Task("Default")
- .IsDependentOn("Pack");
+ .IsDependentOn("Package")
+ .IsDependentOn("Publish");
RunTarget(target);