diff --git a/.circleci/config.yml b/.circleci/config.yml
index b8b24fe..a19c147 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,54 +1,50 @@
version: 2
jobs:
- build:
+ build-and-test:
docker:
- image: aparker/circleci-dotnet-mono:latest
steps:
- checkout
- - run: msbuild /t:Restore
- - run: msbuild src/LightStep/LightStep.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=tracerSign.snk /t:Build
- test:
- docker:
- - image: aparker/circleci-dotnet-mono:latest
- steps:
- - checkout
- - run: msbuild /t:Restore
- - run: msbuild src/LightStep/LightStep.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=tracerSign.snk /t:Build
- - run: msbuild test/LightStep.Tests/LightStep.Tests.csproj /t:Build
- - run: msbuild test/LightStep.Tests/LightStep.Tests.csproj /t:Test
- pack:
- docker:
- - image: aparker/circleci-dotnet-mono:latest
- steps:
- - checkout
- - run: msbuild /t:Restore
- - run: msbuild src/LightStep/LightStep.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=tracerSign.snk /t:Build
- - run: sn -R src/LightStep/bin/Debug/net45/LightStep.dll src/LightStep/tracerSign.snk && sn -vf src/LightStep/bin/Debug/net45/LightStep.dll
- - run: msbuild src/LightStep/LightStep.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=tracerSign.snk /t:Pack /p:PackageOutputPath="/pkg"
- - store_artifacts:
- path: /pkg
+ - run: dotnet tool install -g dotnet-xunit-to-junit
+ - run: dotnet tool install -g Cake.Tool
+ - run: export PATH="$PATH:/root/.dotnet/tools"
+ - run:
+ name: Update PATH and Define Environment Variable at Runtime
+ command: |
+ echo 'export PATH="$PATH:/root/.dotnet/tools"' >> $BASH_ENV
+ source $BASH_ENV
+ - run: dotnet cake build.cake -t=Test
+ - run: dotnet xunit-to-junit ./build/test_results.xml ./build/LightStep.Tests.dll.junit.xml
+ - store_test_results:
+ path: build/LightStep.Tests.dll.junit.xml
publish:
docker:
- image: aparker/circleci-dotnet-mono:latest
steps:
- checkout
- - run: msbuild /t:Restore
- - run: msbuild /t:Build
- - run: msbuild src/LightStep/LightStep.csproj /t:Pack
- - run: dotnet nuget push src/LightStep/bin/Debug/*.nupkg -k $NuGet
+ - run: dotnet tool install -g dotnet-xunit-to-junit
+ - run: dotnet tool install -g Cake.Tool
+ - run:
+ name: Update PATH and Define Environment Variable at Runtime
+ command: |
+ echo 'export PATH="$PATH:/root/.dotnet/tools"' >> $BASH_ENV
+ source $BASH_ENV
+ - run: dotnet cake build.cake -t=Publish
+ - run: dotnet xunit-to-junit ./build/test_results.xml ./build/LightStep.Tests.dll.junit.xml
+ - store_test_results:
+ path: build/LightStep.Tests.dll.junit.xml
workflows:
version: 2
- build-test-and-pack:
+ untagged-build:
+ jobs:
+ - build-and-test
+ tagged-build:
jobs:
- - build
- - test:
- requires:
- - build
- - pack:
- requires:
- - test
+ - publish:
filters:
branches:
- only: master
+ ignore: /.*/
+ tags:
+ only: /^v.*/
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 7023fb3..cb3f372 100644
--- a/.gitignore
+++ b/.gitignore
@@ -327,4 +327,14 @@ ASALocalRun/
*.nvuser
# MFractors (Xamarin productivity tool) working folder
-.mfractor/
\ No newline at end of file
+.mfractor/
+
+# cakebuild tools
+tools/
+
+dist/
+build/
+
+# this is generated at build, ignoring it here
+src/LightStep/Properties/AssemblyInfo.cs
+
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 3b498ff..e9de810 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -4,21 +4,23 @@
"version": "2.0.0",
"tasks": [
{
- "label": "build",
- "type": "shell",
- "command": "msbuild",
- "args": [
- // Ask msbuild to generate full paths for file names.
- "/property:GenerateFullPaths=true",
- "/t:build"
- ],
- "group": "build",
- "presentation": {
- // Reveal the output only if unrecognized errors occur.
- "reveal": "silent"
- },
- // Use the standard MS compiler pattern to detect errors, warnings and infos
- "problemMatcher": "$msCompile"
+ "type": "cake",
+ "script": "Default",
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "type": "cake",
+ "script": "Test",
+ "problemMatcher": [],
+ "group": "test"
+ },
+ {
+ "type": "cake",
+ "script": "Clean",
+ "problemMatcher": []
}
]
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4d9e2b..7443591 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
_vNext_
+- We now build using [Cake](https://cakebuild.net).
- All value types are now properly handled in span serialization.
- The platform version detection code has been improved and should be resilient to dynamic injection scenarios.
- Logging now exists for many operations via the LibLog library. See the README for more details.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..68af856
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,42 @@
+# Contributing Guide
+
+First, thanks for your contribution! 🎉
+
+We gladly accept issues and pull requests to this repository. If this is a security-related issue, please email us directly at infosec@lightstep.com.
+
+Please note the following general guidelines and advice -
+
+## Issues
+When submitting an issue, please include the following in addition to an explanation of the issue:
+- Version of the library you're using.
+- The runtime and platform version you're using (e.g., .NET 4.6.1 or .NET Core 2.1).
+- Any stack trace or diagnostic logs you may have that demonstrate the issue.
+
+## Pull Requests
+Before making a pull request for a feature, please open an issue in order to gain consensus on the work you're doing.
+
+All pull requests should be rebased against `master`, and all tests should pass before a PR will be merged.
+
+In addition, ensure that:
+- Test coverage has been added, where appropriate.
+- The CHANGELOG and README have been updated.
+- If you are making a breaking change, indicate it in the CHANGELOG.
+
+## Releases
+To make a release, commit a tag to master of the format `vmajor.minor.patch` or `vmajor.minor.patch-alpha/beta`. CircleCI should automatically build and publish the resulting artifact.
+
+## Developing
+
+This library is intended for cross-platform usage, as well as cross-platform development. Please ensure that any dependencies added or changed fully support cross-platform .NET via Mono and .NET Core.
+
+_Development Dependencies_
+- .NET Framework 4.5+ (On MacOS/Linux, you need Mono 5.16, stable channel). **If on MacOS, install Mono via its installer and not Homebrew**
+- .NET Core 2.1+
+- Cake (see _Local Builds_)
+- PostSharp (Windows only, for `LightStep.CSharpAspectTestApp`)
+
+_Local Builds_
+
+We use [Cake](https://cakebuild.net/) as a build tool. Run `dotnet tool install -g Cake.Tool` to make Cake globally available, then run `dotnet cake build.cake` to run tests. This requires .NET Core 2.1+.
+
+You should be able to use any C# development environment, such as [Visual Studio Code](https://code.visualstudio.com/) with the C# extension, [Visual Studio 2017](https://visualstudio.microsoft.com/), or [JetBrains Rider](https://www.jetbrains.com/rider/).
\ No newline at end of file
diff --git a/README.md b/README.md
index 9ea22f9..4f40323 100644
--- a/README.md
+++ b/README.md
@@ -3,16 +3,8 @@ The LightStep distributed tracing library for C#
[](https://www.nuget.org/packages/LightStep) [](https://circleci.com/gh/lightstep/lightstep-tracer-csharp)
-# Development Requirements
-- C# 7
-- .NET Core 2+
-- .NET 4.5
-
-This translates to requiring at least Visual Studio 2017 (15.0).
-You may need [PostSharp](https://www.postsharp.net/) to work on the `LightStep.CSharpAspectTestApp`.
-
# Installation
-Install the package via NuGet into your solution, or use `Install-Package LightStep`.
+Install the package via NuGet into your solution, or use `Install-Package LightStep` / `dotnet add package LightStep`.
# Basic Usage
It's recommended to initialize the tracer once at the beginning of your application and assign it as the global tracer, as follows:
diff --git a/build.cake b/build.cake
new file mode 100644
index 0000000..0b06d60
--- /dev/null
+++ b/build.cake
@@ -0,0 +1,85 @@
+#tool "xunit.runner.console"
+
+var target = Argument("target", "Default");
+var configuration = Argument("configuration", "Release");
+var debugConfiguration = Argument("configuration", "Debug");
+var buildDir = Directory("./build");
+var distDir = Directory("./dist");
+var solution = "./LightStep.sln";
+var library = "./src/LightStep/LightStep.csproj";
+var lightStepAssemblyInfoFile = "./src/LightStep/Properties/AssemblyInfo.cs";
+var version = EnvironmentVariable("CIRCLE_TAG") ?? "v0.0.0";
+version = version.TrimStart('v');
+var buildNo = String.IsNullOrWhiteSpace(EnvironmentVariable("CIRCLE_BUILD_NUM")) ? "local" : EnvironmentVariable("CIRCLE_BUILD_NUM");
+var semVersion = string.Concat(version + "-" + buildNo);
+var nuGetApiKey = EnvironmentVariable("NuGet");
+
+Task("Clean")
+ .Does( ()=>
+{
+ CleanDirectory(buildDir);
+ CleanDirectory(distDir);
+ CleanDirectories("./**/obj/*.*");
+ CleanDirectories($"./**/bin/{configuration}/*.*");
+ CleanDirectories($"./**/bin/{debugConfiguration}/*.*");
+});
+
+Task("Restore")
+ .IsDependentOn("Clean")
+ .Does( ()=>
+{
+ DotNetCoreRestore(solution);
+});
+
+Task("Build")
+ .IsDependentOn("Restore")
+ .Does(() =>
+ {
+ CreateAssemblyInfo(lightStepAssemblyInfoFile, new AssemblyInfoSettings {
+ Product = "LightStep",
+ Version = version,
+ FileVersion = version,
+ InformationalVersion = semVersion,
+ Copyright = string.Format("Copyright (c) LightStep 2018 - {0}", DateTime.Now.Year)
+ });
+ var assemblyInfo = ParseAssemblyInfo(lightStepAssemblyInfoFile);
+ Information("Version: {0}", assemblyInfo.AssemblyVersion);
+ Information("File version: {0}", assemblyInfo.AssemblyFileVersion);
+ Information("Informational version: {0}", assemblyInfo.AssemblyInformationalVersion);
+ MSBuild(library, settings => settings
+ .SetConfiguration(configuration)
+ .WithTarget("Rebuild")
+ .WithProperty("Version", assemblyInfo.AssemblyInformationalVersion)
+ .SetVerbosity(Verbosity.Minimal));
+ });
+
+Task("Test")
+ .IsDependentOn("Build")
+ .Does(() =>
+ {
+ var projects = GetFiles("./test/**/*.csproj");
+
+ foreach(var project in projects)
+ {
+ DotNetCoreTest(project.FullPath, new DotNetCoreTestSettings {
+ Logger = "xunit;LogFilePath=../../build/test_results.xml"
+ });
+ }
+
+});
+
+Task("Publish")
+ .IsDependentOn("Test")
+ .WithCriteria(() => EnvironmentVariable("CI") == "true")
+ .Does(() =>
+ {
+ var nupkg = GetFiles("./src/LightStep/bin/Release/*.nupkg").First();
+ DotNetCoreNuGetPush(nupkg.FullPath, new DotNetCoreNuGetPushSettings {
+ ApiKey = nuGetApiKey
+ });
+ });
+
+Task("Default")
+ .IsDependentOn("Test");
+
+RunTarget(target);
\ No newline at end of file
diff --git a/examples/LightStep.CSharpAspectTestApp/Properties/AssemblyInfo.cs b/examples/LightStep.CSharpAspectTestApp/Properties/AssemblyInfo.cs
index 89c00af..35d597b 100644
--- a/examples/LightStep.CSharpAspectTestApp/Properties/AssemblyInfo.cs
+++ b/examples/LightStep.CSharpAspectTestApp/Properties/AssemblyInfo.cs
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -31,6 +31,8 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+// [assembly: AssemblyVersion("0.1.29.0")]
+[assembly: AssemblyVersion("0.1.29.0")]
+[assembly: AssemblyFileVersion("0.1.29.0")]
+
+[assembly: AssemblyInformationalVersion("0.1.29-enhancement-addCake.1-2018-11-12")]
diff --git a/src/LightStep/LightStep.csproj b/src/LightStep/LightStep.csproj
index dca0812..a76f932 100644
--- a/src/LightStep/LightStep.csproj
+++ b/src/LightStep/LightStep.csproj
@@ -38,15 +38,11 @@
Austin Parker
- 0.0.8-alpha-$(CIRCLE_BUILD_NUM)
LightStep
en-US
LightStep
OpenTracing compliant tracer for LightStep.
LightStep 2018
-
-
-
tracing
https://github.com/lightstep/lightstep-tracer-csharp/blob/master/CHANGELOG.md
https://raw.githubusercontent.com/lightstep/lightstep-tracer-csharp/master/ls128x128.png
@@ -63,5 +59,7 @@
tracerSign.snk
<_UseRoslynPublicSignHack>false
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+ false
+ true
\ No newline at end of file
diff --git a/src/LightStep/Options.cs b/src/LightStep/Options.cs
index 8190045..a6d1f73 100644
--- a/src/LightStep/Options.cs
+++ b/src/LightStep/Options.cs
@@ -156,7 +156,7 @@ private IDictionary InitializeDefaultTags()
{
[LightStepConstants.TracerPlatformKey] = LightStepConstants.TracerPlatformValue,
[LightStepConstants.TracerPlatformVersionKey] = GetPlatformVersion(),
- [LightStepConstants.TracerVersionKey] = "0.0.7-alpha",
+ [LightStepConstants.TracerVersionKey] = GetTracerVersion(),
[LightStepConstants.ComponentNameKey] = GetComponentName(),
[LightStepConstants.HostnameKey] = GetHostName(),
[LightStepConstants.CommandLineKey] = GetCommandLine()
@@ -164,6 +164,11 @@ private IDictionary InitializeDefaultTags()
return attributes;
}
+ private static string GetTracerVersion()
+ {
+ return typeof(LightStep.Tracer).Assembly.GetName().Version.ToString();
+ }
+
private static string GetComponentName()
{
var entryAssembly = "";
diff --git a/src/LightStep/Properties/AssemblyInfo.cs b/src/LightStep/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..5d5b06f
--- /dev/null
+++ b/src/LightStep/Properties/AssemblyInfo.cs
@@ -0,0 +1,13 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by Cake.
+//
+//------------------------------------------------------------------------------
+using System.Reflection;
+
+[assembly: AssemblyProduct("LightStep")]
+[assembly: AssemblyVersion("0.0.0")]
+[assembly: AssemblyFileVersion("0.0.0")]
+[assembly: AssemblyInformationalVersion("0.0.0-local")]
+[assembly: AssemblyCopyright("Copyright (c) LightStep 2018 - 2018")]
+
diff --git a/test/LightStep.Tests/LightStep.Tests.csproj b/test/LightStep.Tests/LightStep.Tests.csproj
index de05a4d..8b23ab9 100644
--- a/test/LightStep.Tests/LightStep.Tests.csproj
+++ b/test/LightStep.Tests/LightStep.Tests.csproj
@@ -1,22 +1,16 @@
-
+
false
- net452
+ netcoreapp2.1
-
+
+
-
-
-
-
-
\ No newline at end of file