Remove extra `[NotNull]` definition and second AssemblyInfo.cs file

- add necessary build-time dependency
- add missing `using Microsoft.Framework.Internal;` statements
- remove `[NotNull]` from tests
 - avoid duplicate definitions of `[NotNull]` from referenced projects
- remove incorrect NotNullArgument.cs and second AssemblyInfo.cs files entirely
 - merge content into AssemblyInfo.cs file in expected location

nit: clean up some trailing whitespace
This commit is contained in:
Doug Bunting 2015-04-28 10:45:51 -07:00
parent 2d20063ba5
commit 1111405786
27 changed files with 48 additions and 38 deletions

View File

@ -1,6 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNet.Razor.Runtime.Test")]

View File

@ -2,5 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")] [assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Razor.Runtime.Test")]

View File

@ -4,6 +4,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -7,6 +7,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -3,6 +3,7 @@
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -1,6 +1,8 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {
/// <summary> /// <summary>

View File

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {

View File

@ -3,6 +3,7 @@
using System; using System;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Generator namespace Microsoft.AspNet.Razor.Generator
{ {

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor namespace Microsoft.AspNet.Razor
{ {

View File

@ -1,12 +0,0 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNet.Razor
{
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
internal sealed class NotNullAttribute : Attribute
{
}
}

View File

@ -12,6 +12,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.AspNet.Razor.Utils; using Microsoft.AspNet.Razor.Utils;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser namespace Microsoft.AspNet.Razor.Parser
{ {

View File

@ -13,6 +13,7 @@ using Microsoft.AspNet.Razor.Parser.TagHelpers;
using Microsoft.AspNet.Razor.Parser.TagHelpers.Internal; using Microsoft.AspNet.Razor.Parser.TagHelpers.Internal;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser namespace Microsoft.AspNet.Razor.Parser
{ {
@ -205,14 +206,14 @@ namespace Microsoft.AspNet.Razor.Parser
/// specified <paramref name="documentRoot"/>. /// specified <paramref name="documentRoot"/>.
/// </summary> /// </summary>
/// <param name="documentRoot">The <see cref="Block"/> to scan for tag helper registrations in.</param> /// <param name="documentRoot">The <see cref="Block"/> to scan for tag helper registrations in.</param>
/// <param name="errorSink">Used to manage <see cref="RazorError"/>s encountered during the Razor parsing /// <param name="errorSink">Used to manage <see cref="RazorError"/>s encountered during the Razor parsing
/// phase.</param> /// phase.</param>
/// <returns><see cref="TagHelperDescriptor"/>s that are applicable to the <paramref name="documentRoot"/> /// <returns><see cref="TagHelperDescriptor"/>s that are applicable to the <paramref name="documentRoot"/>
/// </returns> /// </returns>
protected virtual IEnumerable<TagHelperDescriptor> GetTagHelperDescriptors([NotNull] Block documentRoot, protected virtual IEnumerable<TagHelperDescriptor> GetTagHelperDescriptors([NotNull] Block documentRoot,
[NotNull] ErrorSink errorSink) [NotNull] ErrorSink errorSink)
{ {
var addOrRemoveTagHelperSpanVisitor = var addOrRemoveTagHelperSpanVisitor =
new TagHelperDirectiveSpanVisitor(TagHelperDescriptorResolver, errorSink); new TagHelperDirectiveSpanVisitor(TagHelperDescriptorResolver, errorSink);
return addOrRemoveTagHelperSpanVisitor.GetDescriptors(documentRoot); return addOrRemoveTagHelperSpanVisitor.GetDescriptors(documentRoot);
} }

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Parser.TagHelpers namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{ {
@ -25,8 +26,9 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{ {
} }
public TagHelperDirectiveSpanVisitor([NotNull] ITagHelperDescriptorResolver descriptorResolver, public TagHelperDirectiveSpanVisitor(
[NotNull] ErrorSink errorSink) [NotNull] ITagHelperDescriptorResolver descriptorResolver,
[NotNull] ErrorSink errorSink)
{ {
_descriptorResolver = descriptorResolver; _descriptorResolver = descriptorResolver;
_errorSink = errorSink; _errorSink = errorSink;
@ -61,14 +63,14 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
{ {
var codeGenerator = (AddOrRemoveTagHelperCodeGenerator)span.CodeGenerator; var codeGenerator = (AddOrRemoveTagHelperCodeGenerator)span.CodeGenerator;
var directive = var directive =
codeGenerator.RemoveTagHelperDescriptors ? codeGenerator.RemoveTagHelperDescriptors ?
TagHelperDirectiveType.RemoveTagHelper : TagHelperDirectiveType.RemoveTagHelper :
TagHelperDirectiveType.AddTagHelper; TagHelperDirectiveType.AddTagHelper;
var directiveDescriptor = new TagHelperDirectiveDescriptor( var directiveDescriptor = new TagHelperDirectiveDescriptor(
codeGenerator.LookupText, codeGenerator.LookupText,
span.Start, span.Start,
directive); directive);
_directiveDescriptors.Add(directiveDescriptor); _directiveDescriptors.Add(directiveDescriptor);

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.SyntaxTree;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor namespace Microsoft.AspNet.Razor
{ {

View File

@ -8,6 +8,7 @@ using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.TagHelpers; using Microsoft.AspNet.Razor.TagHelpers;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor namespace Microsoft.AspNet.Razor
{ {

View File

@ -12,6 +12,7 @@ using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler; using Microsoft.AspNet.Razor.Generator.Compiler;
using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor namespace Microsoft.AspNet.Razor
{ {

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Text;
using Microsoft.Framework.Internal;
using Microsoft.Internal.Web.Utils; using Microsoft.Internal.Web.Utils;
namespace Microsoft.AspNet.Razor namespace Microsoft.AspNet.Razor

View File

@ -4,6 +4,7 @@
using System; using System;
using Microsoft.AspNet.Razor.Generator; using Microsoft.AspNet.Razor.Generator;
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp; using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers namespace Microsoft.AspNet.Razor.TagHelpers
{ {

View File

@ -3,6 +3,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers namespace Microsoft.AspNet.Razor.TagHelpers
{ {

View File

@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers namespace Microsoft.AspNet.Razor.TagHelpers
{ {

View File

@ -1,6 +1,8 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.TagHelpers namespace Microsoft.AspNet.Razor.TagHelpers
{ {
/// <summary> /// <summary>

View File

@ -1,6 +1,9 @@
{ {
"description": "Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor parser and code generation infrastructure.", "description": "Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor parser and code generation infrastructure.",
"version": "4.0.0-*", "version": "4.0.0-*",
"dependencies": {
"Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" }
},
"frameworks": { "frameworks": {
"net45": { }, "net45": { },
"dnx451": { }, "dnx451": { },

View File

@ -16,9 +16,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{ {
} }
public bool Equals( public bool Equals(IReadOnlyTagHelperAttribute attributeX, IReadOnlyTagHelperAttribute attributeY)
[NotNull] IReadOnlyTagHelperAttribute attributeX,
[NotNull] IReadOnlyTagHelperAttribute attributeY)
{ {
return return
attributeX == attributeY || attributeX == attributeY ||
@ -27,7 +25,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
Equals(attributeX.Value, attributeY.Value); Equals(attributeX.Value, attributeY.Value);
} }
public int GetHashCode([NotNull] IReadOnlyTagHelperAttribute attribute) public int GetHashCode(IReadOnlyTagHelperAttribute attribute)
{ {
return HashCodeCombiner return HashCodeCombiner
.Start() .Start()

View File

@ -70,8 +70,9 @@ namespace Microsoft.AspNet.Razor.Test.Generator
{ {
} }
protected override CSharpCodeVisitor CreateCSharpCodeVisitor([NotNull] CSharpCodeWriter writer, protected override CSharpCodeVisitor CreateCSharpCodeVisitor(
[NotNull] CodeBuilderContext context) CSharpCodeWriter writer,
CodeBuilderContext context)
{ {
var bodyVisitor = base.CreateCSharpCodeVisitor(writer, context); var bodyVisitor = base.CreateCSharpCodeVisitor(writer, context);
@ -83,11 +84,12 @@ namespace Microsoft.AspNet.Razor.Test.Generator
private class CustomTagHelperAttributeCodeRenderer : TagHelperAttributeValueCodeRenderer private class CustomTagHelperAttributeCodeRenderer : TagHelperAttributeValueCodeRenderer
{ {
public override void RenderAttributeValue([NotNull] TagHelperAttributeDescriptor attributeInfo, public override void RenderAttributeValue(
[NotNull] CSharpCodeWriter writer, TagHelperAttributeDescriptor attributeInfo,
[NotNull] CodeBuilderContext context, CSharpCodeWriter writer,
[NotNull] Action<CSharpCodeWriter> renderAttributeValue, CodeBuilderContext context,
bool complexValue) Action<CSharpCodeWriter> renderAttributeValue,
bool complexValue)
{ {
writer.Write("**From custom attribute code renderer**: "); writer.Write("**From custom attribute code renderer**: ");