diff --git a/build/.vscode/launch.json b/build/.vscode/launch.json index 782b175..4a0fd33 100644 --- a/build/.vscode/launch.json +++ b/build/.vscode/launch.json @@ -8,7 +8,7 @@ "program": "dotnet", "args": [ "exec", - "/Users/bernhardrichter/.dotnet/tools/.store/dotnet-script/0.28.0/dotnet-script/0.28.0/tools/netcoreapp2.1/any/dotnet-script.dll", + "/Users/bernhardrichter/.dotnet/tools/.store/dotnet-script/0.29.1/dotnet-script/0.29.1/tools/netcoreapp2.1/any/dotnet-script.dll", "${file}" ], "cwd": "${workspaceRoot}", diff --git a/build/BuildContext.csx b/build/BuildContext.csx index c2a0835..48d370a 100644 --- a/build/BuildContext.csx +++ b/build/BuildContext.csx @@ -1,10 +1,12 @@ -#load "nuget:Dotnet.Build, 0.4.0" +#load "nuget:Dotnet.Build, 0.5.0" using static FileUtils; using System.Xml.Linq; var owner = "seesharper"; var projectName = "LightInject.Interception"; var root = FileUtils.GetScriptFolder(); + +var repoFolder = Path.Combine(root, ".."); var solutionFolder = Path.Combine(root, "..", "src"); var projectFolder = Path.Combine(root, "..", "src", "LightInject.Interception"); diff --git a/build/build.csx b/build/build.csx index f5dc994..cc1b6c5 100644 --- a/build/build.csx +++ b/build/build.csx @@ -1,49 +1,43 @@ -#load "nuget:Dotnet.Build, 0.4.0" -#load "nuget:dotnet-steps, 0.0.1" +#load "nuget:Dotnet.Build, 0.5.0" #load "nuget:github-changelog, 0.1.5" +#load "nuget:dotnet-steps, 0.0.1" #load "BuildContext.csx" -using static FileUtils; -using static Internalizer; -using static xUnit; -using static DotNet; + using static ChangeLog; using static ReleaseManagement; - [StepDescription("Runs the tests with test coverage")] Step testcoverage = () => { - DotNet.TestWithCodeCoverage(projectName, testProjectFolder, coverageArtifactsFolder, targetFramework: "netcoreapp2.0"); + DotNet.TestWithCodeCoverage(projectName, testProjectFolder, coverageArtifactsFolder, targetFramework: "netcoreapp2.0", threshold: 90); }; +[StepDescription("Runs all the tests for all target frameworks")] +Step test = () => +{ + DotNet.Test(testProjectFolder); +}; -await StepRunner.Execute(Args); -return 0; - -Build(projectFolder); -Test(testProjectFolder); -AnalyzeCodeCoverage(pathToTestAssembly, $"+[{projectName}]*"); -Pack(projectFolder, nuGetArtifactsFolder); +[StepDescription("Creates the NuGet packages")] +Step pack = () => +{ + test(); + testcoverage(); + DotNet.Pack(projectFolder, nuGetArtifactsFolder, Git.Default.GetCurrentShortCommitHash()); + NuGet.CreateSourcePackage(repoFolder, projectName, nuGetArtifactsFolder); +}; -using (var sourceBuildFolder = new DisposableFolder()) +[DefaultStep] +[StepDescription("Deploys packages if we are on a tag commit in a secure environment.")] +AsyncStep deploy = async () => { - string pathToSourceProjectFolder = Path.Combine(sourceBuildFolder.Path, "LightInject.Interception"); - Copy(solutionFolder, sourceBuildFolder.Path, new[] { ".vs", "obj" }); - Internalize(pathToSourceProjectFolder, exceptTheseTypes); - DotNet.Build(Path.Combine(sourceBuildFolder.Path, "LightInject.Interception")); - using (var nugetPackFolder = new DisposableFolder()) + pack(); + if (!BuildEnvironment.IsSecure) { - var contentFolder = CreateDirectory(nugetPackFolder.Path, "content", "netstandard1.1", "LightInject.Interception"); - Copy("LightInject.Interception.Source.nuspec", nugetPackFolder.Path); - string pathToSourceFileTemplate = Path.Combine(contentFolder, "LightInject.Interception.cs.pp"); - Copy(Path.Combine(pathToSourceProjectFolder, "LightInject.Interception.cs"), pathToSourceFileTemplate); - FileUtils.ReplaceInFile(@"namespace \S*", $"namespace $rootnamespace$.{projectName}", pathToSourceFileTemplate); - NuGet.Pack(nugetPackFolder.Path, nuGetArtifactsFolder, version); + Logger.Log("Deployment can only be done in a secure environment"); + return; } -} -if (BuildEnvironment.IsSecure) -{ await CreateReleaseNotes(); if (Git.Default.IsTagCommit()) @@ -53,7 +47,12 @@ if (BuildEnvironment.IsSecure) .CreateRelease(Git.Default.GetLatestTag(), pathToReleaseNotes, Array.Empty()); NuGet.TryPush(nuGetArtifactsFolder); } -} +}; + + +await StepRunner.Execute(Args); +return 0; + private async Task CreateReleaseNotes() { @@ -63,5 +62,5 @@ private async Task CreateReleaseNotes() { generator = generator.IncludeUnreleased(); } - await generator.Generate(pathToReleaseNotes); -} \ No newline at end of file + await generator.Generate(pathToReleaseNotes, FormattingOptions.Default.WithPullRequestBody()); +} diff --git a/src/LightInject.Interception/LightInject.Interception.cs b/src/LightInject.Interception/LightInject.Interception.cs index b8d8cbe..1111bbd 100644 --- a/src/LightInject.Interception/LightInject.Interception.cs +++ b/src/LightInject.Interception/LightInject.Interception.cs @@ -183,6 +183,7 @@ namespace LightInject.Interception /// /// Implemented by all proxy types. /// + [NoInternalize] public interface IProxy { /// @@ -194,6 +195,7 @@ public interface IProxy /// /// Represents a class that contains detailed information about the method being invoked. /// + [NoInternalize] public interface IInvocationInfo { /// @@ -228,6 +230,7 @@ public interface IInvocationInfo /// Represents a class that is capable of creating a delegate used to invoke /// a method without using late-bound invocation. /// + [NoInternalize] public interface IMethodBuilder { /// @@ -241,6 +244,7 @@ public interface IMethodBuilder /// /// Represents the skeleton of a dynamic method. /// + [NoInternalize] public interface IDynamicMethodSkeleton { /// @@ -259,6 +263,7 @@ public interface IDynamicMethodSkeleton /// /// Represents a class that is capable of creating a proxy . /// + [NoInternalize] public interface IProxyBuilder { /// @@ -273,6 +278,7 @@ public interface IProxyBuilder /// /// Represents a class that intercepts method calls. /// + [NoInternalize] public interface IInterceptor { /// @@ -326,6 +332,7 @@ public interface IMethodSelector /// A factory class used to create a if the target method has /// multiple interceptors. /// + [NoInternalize] public static class MethodInterceptorFactory { /// @@ -348,6 +355,7 @@ public static Lazy CreateMethodInterceptor(Lazy[] in /// /// Contains information about the target method being intercepted. /// + [NoInternalize] public class TargetMethodInfo { /// @@ -386,6 +394,7 @@ public TargetMethodInfo(MethodInfo method, MethodInfo methodInvocationTarget) /// /// Contains information about the open generic target method being intercepted. /// + [NoInternalize] public class OpenGenericTargetMethodInfo { private readonly MethodInfo openGenericMethod; @@ -458,6 +467,7 @@ private TargetMethodInfo CreateTargetMethodInfo(Type[] types) /// A class that is capable of creating a delegate used to invoke /// a method without using late-bound invocation. /// + [NoInternalize] public class DynamicMethodBuilder : IMethodBuilder { private readonly Func methodSkeletonFactory; @@ -610,6 +620,7 @@ public Func CreateDelegate() /// An cache decorator that ensures that /// for a given , only a single dynamic method is created. /// + [NoInternalize] public class CachedMethodBuilder : IMethodBuilder { private readonly IMethodBuilder methodBuilder; @@ -641,6 +652,7 @@ public Func GetDelegate(MethodInfo targetMethod) /// An implementation of the interface that forwards /// method calls the actual target. /// + [NoInternalize] public class TargetInvocationInfo : IInvocationInfo { private readonly TargetMethodInfo targetMethodInfo; @@ -719,6 +731,7 @@ public object Proceed() /// An implementation of the interface that forwards /// method calls to the next in the interceptor chain. /// + [NoInternalize] public class InterceptorInvocationInfo : IInvocationInfo { private readonly IInvocationInfo nextInvocationInfo; @@ -793,6 +806,7 @@ public object Proceed() /// A composite that is responsible for /// passing the down the interceptor chain. /// + [NoInternalize] public class CompositeInterceptor : IInterceptor { private readonly Lazy[] interceptors; @@ -827,6 +841,7 @@ public object Invoke(IInvocationInfo invocationInfo) /// /// Contains information about a registered . /// + [NoInternalize] public class InterceptorInfo { /// @@ -848,6 +863,7 @@ public class InterceptorInfo /// /// Represents the definition of a proxy type. /// + [NoInternalize] public class ProxyDefinition { private readonly ICollection interceptors = new Collection(); @@ -2482,4 +2498,8 @@ public class ExcludeFromCodeCoverageAttribute : Attribute } #endif + internal class NoInternalize : Attribute + { + + } } diff --git a/src/LightInject.Interception/LightInject.Interception.csproj b/src/LightInject.Interception/LightInject.Interception.csproj index e34b57f..39d4fd6 100644 --- a/src/LightInject.Interception/LightInject.Interception.csproj +++ b/src/LightInject.Interception/LightInject.Interception.csproj @@ -4,7 +4,7 @@ net46;netstandard1.1;netstandard2.0 2.0.3 Bernhard Richter - http//www.lightinject.net + http://www.lightinject.net git https://github.com/seesharper/LightInject.Interception http://opensource.org/licenses/MIT