From 51eb1b405c852d1efc1dd3ca2d7e29fc0a8b67be Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 20 May 2011 12:07:49 -0500 Subject: [PATCH] Removed some uses of InternalsVisibleTo, made some stuff public --- src/ProtoBench/ProtoBench.csproj | 185 +++++++++--------- src/ProtoGen/Generator.cs | 2 +- src/ProtoGen/ProgramPreprocess.cs | 4 +- src/ProtoGen/Properties/AssemblyInfo.cs | 7 +- src/ProtoGen/SourceGenerators.cs | 3 + .../Collections/PopsicleListTest.cs | 3 + .../Descriptors/EnumDescriptor.cs | 2 +- .../Descriptors/FileDescriptor.cs | 2 +- src/ProtocolBuffers/NameHelpers.cs | 6 +- .../Properties/AssemblyInfo.cs | 175 ++++++++--------- src/ProtocolBuffers/WireFormat.cs | 16 +- 11 files changed, 201 insertions(+), 204 deletions(-) diff --git a/src/ProtoBench/ProtoBench.csproj b/src/ProtoBench/ProtoBench.csproj index 927a255702..15777167d3 100644 --- a/src/ProtoBench/ProtoBench.csproj +++ b/src/ProtoBench/ProtoBench.csproj @@ -1,100 +1,99 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C7A4A435-2813-41C8-AA87-BD914BA5223D} - Exe - Properties - Google.ProtocolBuffers.ProtoBench - ProtoBench - v4.0 - 512 - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - AllRules.ruleset - - - - - - - - - - - - - - {6908BDCE-D925-43F3-94AC-A531E6DF2591} - ProtocolBuffers - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - False - Windows Installer 3.1 - true - - - + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {C7A4A435-2813-41C8-AA87-BD914BA5223D} + Exe + Properties + Google.ProtocolBuffers.ProtoBench + ProtoBench + v4.0 + 512 + + + + + 3.5 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + AllRules.ruleset + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + --> \ No newline at end of file diff --git a/src/ProtoGen/Generator.cs b/src/ProtoGen/Generator.cs index 8b5c2cfb18..137974874c 100644 --- a/src/ProtoGen/Generator.cs +++ b/src/ProtoGen/Generator.cs @@ -124,7 +124,7 @@ namespace Google.ProtocolBuffers.ProtoGen { /// Note: this method is internal rather than private to allow testing. /// /// Not all dependencies could be resolved. - internal static IList ConvertDescriptors(CSharpFileOptions options, params FileDescriptorSet[] descriptorProtos) { + public static IList ConvertDescriptors(CSharpFileOptions options, params FileDescriptorSet[] descriptorProtos) { // Simple strategy: Keep going through the list of protos to convert, only doing ones where // we've already converted all the dependencies, until we get to a stalemate List fileList = new List(); diff --git a/src/ProtoGen/ProgramPreprocess.cs b/src/ProtoGen/ProgramPreprocess.cs index e35eb83064..3cc0826dce 100644 --- a/src/ProtoGen/ProgramPreprocess.cs +++ b/src/ProtoGen/ProgramPreprocess.cs @@ -11,7 +11,7 @@ namespace Google.ProtocolBuffers.ProtoGen { /// --descriptor_set_out= is specified the proto buffer file is kept, otherwise it will be removed /// after code generation. /// - internal class ProgramPreprocess { + public class ProgramPreprocess { private static int Main(string[] args) { try { return Environment.ExitCode = Run(args); @@ -22,7 +22,7 @@ namespace Google.ProtocolBuffers.ProtoGen { } } - internal static int Run(params string[] args) { + public static int Run(params string[] args) { bool deleteFile = false; string tempFile = null; int result; diff --git a/src/ProtoGen/Properties/AssemblyInfo.cs b/src/ProtoGen/Properties/AssemblyInfo.cs index a3612f9879..7f77b2590e 100644 --- a/src/ProtoGen/Properties/AssemblyInfo.cs +++ b/src/ProtoGen/Properties/AssemblyInfo.cs @@ -34,9 +34,4 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("2.3.0.277")] [assembly: AssemblyVersion("2.3.0.277")] [assembly: AssemblyFileVersion("2.3.0.277")] -[assembly: InternalsVisibleTo("Google.ProtocolBuffers.ProtoGen.Test,PublicKey=" + -"0024000004800000940000000602000000240000525341310004000001000100cf43741ffc3e65" + -"c85707245e144e90f1bb82f20d1b1555846008d4d5d5c9270a980350dcb1ddd40fcdde13c2780c" + -"75c9057123daa5613cb6551e2b8bd2254e8f84b3893369869e5119b752442aef7156c4defc489b" + -"96c44ff801fe8d94199e048f8ff414813c9c811a029bcd697040700dc66982539e9b368cb5e725" + -"feed60f2")] + diff --git a/src/ProtoGen/SourceGenerators.cs b/src/ProtoGen/SourceGenerators.cs index 0a809959ee..33f5573eb7 100644 --- a/src/ProtoGen/SourceGenerators.cs +++ b/src/ProtoGen/SourceGenerators.cs @@ -37,6 +37,9 @@ using System.Collections.Generic; using Google.ProtocolBuffers.Descriptors; namespace Google.ProtocolBuffers.ProtoGen { + + public delegate TResult Func(T arg); + internal static class SourceGenerators { private static readonly Dictionary> GeneratorFactories = new Dictionary> { diff --git a/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs b/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs index 9d9fe42c4e..6b42209bb7 100644 --- a/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs +++ b/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs @@ -35,6 +35,9 @@ using System; using NUnit.Framework; +delegate void Action(); + + namespace Google.ProtocolBuffers.Collections { [TestFixture] public class PopsicleListTest { diff --git a/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs b/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs index d6ef4e17f6..acf113de83 100644 --- a/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs +++ b/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs @@ -95,7 +95,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// /// The unqualified name of the value (e.g. "FOO"). /// The value's descriptor, or null if not found. - internal EnumValueDescriptor FindValueByName(string name) { + public EnumValueDescriptor FindValueByName(string name) { return File.DescriptorPool.FindSymbol(FullName + "." + name); } diff --git a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs index f1eba496e1..1648c34ffe 100644 --- a/src/ProtocolBuffers/Descriptors/FileDescriptor.cs +++ b/src/ProtocolBuffers/Descriptors/FileDescriptor.cs @@ -81,7 +81,7 @@ namespace Google.ProtocolBuffers.Descriptors { /// Allows a file descriptor to be configured with a set of external options, e.g. from the /// command-line arguments to protogen. /// - internal void ConfigureWithDefaultOptions(CSharpFileOptions options) { + public void ConfigureWithDefaultOptions(CSharpFileOptions options) { csharpFileOptions = BuildOrFakeWithDefaultOptions(options); } diff --git a/src/ProtocolBuffers/NameHelpers.cs b/src/ProtocolBuffers/NameHelpers.cs index 9cf256994f..ddaf1a3f2d 100644 --- a/src/ProtocolBuffers/NameHelpers.cs +++ b/src/ProtocolBuffers/NameHelpers.cs @@ -39,13 +39,13 @@ namespace Google.ProtocolBuffers { /// /// Helpers for converting names to pascal case etc. /// - internal class NameHelpers { + public class NameHelpers { - internal static string UnderscoresToPascalCase(string input) { + public static string UnderscoresToPascalCase(string input) { return UnderscoresToPascalOrCamelCase(input, true); } - internal static string UnderscoresToCamelCase(string input) { + public static string UnderscoresToCamelCase(string input) { return UnderscoresToPascalOrCamelCase(input, false); } diff --git a/src/ProtocolBuffers/Properties/AssemblyInfo.cs b/src/ProtocolBuffers/Properties/AssemblyInfo.cs index 64c121a3e1..0ec29fb13c 100644 --- a/src/ProtocolBuffers/Properties/AssemblyInfo.cs +++ b/src/ProtocolBuffers/Properties/AssemblyInfo.cs @@ -1,89 +1,86 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// http://github.com/jskeet/dotnet-protobufs/ -// Original C++/Java/Python code: -// http://code.google.com/p/protobuf/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -using System; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -// 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("ProtocolBuffers")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ProtocolBuffers")] -[assembly: AssemblyCopyright("Copyright © 2008")] -[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("279b643d-70e8-47ae-9eb1-500d1c48bab6")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("2.3.0.277")] -[assembly: AssemblyVersion("2.3.0.277")] -#if !COMPACT_FRAMEWORK_35 -[assembly: AssemblyFileVersion("2.3.0.277")] -#endif - -[assembly:InternalsVisibleTo("Google.ProtocolBuffers.Test,PublicKey="+ -"00240000048000009400000006020000002400005253413100040000010001008179f2dd31a648"+ -"2a2359dbe33e53701167a888e7c369a9ae3210b64f93861d8a7d286447e58bc167e3d99483beda"+ -"72f738140072bb69990bc4f98a21365de2c105e848974a3d210e938b0a56103c0662901efd6b78"+ -"0ee6dbe977923d46a8fda18fb25c65dd73b149a5cd9f3100668b56649932dadd8cf5be52eb1dce"+ -"ad5cedbf")] -[assembly: InternalsVisibleTo("Google.ProtocolBuffersLite.Test,PublicKey=" + -"00240000048000009400000006020000002400005253413100040000010001008179f2dd31a648" + -"2a2359dbe33e53701167a888e7c369a9ae3210b64f93861d8a7d286447e58bc167e3d99483beda" + -"72f738140072bb69990bc4f98a21365de2c105e848974a3d210e938b0a56103c0662901efd6b78" + -"0ee6dbe977923d46a8fda18fb25c65dd73b149a5cd9f3100668b56649932dadd8cf5be52eb1dce" + -"ad5cedbf")] -[assembly: InternalsVisibleTo("ProtoGen,PublicKey=" + -"00240000048000009400000006020000002400005253413100040000010001006d739020e13bdc" + -"038e86fa8aa5e1b13aae65d3ae79d622816c6067ab5b6955be50cc887130117582349208c13a55" + -"5e09a6084558f989ccde66094f07822808d3a9b922b0e85b912070032e90bb35360be7efb7982b" + -"702d7a5c6ed1e21d8ca587b4f4c9d2b81210d3641cc75f506cdfc628ac5453ff0a6886986c981d" + -"12245bc7")] -[assembly: CLSCompliant(true)] \ No newline at end of file +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +using System; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +// 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("ProtocolBuffers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtocolBuffers")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[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("279b643d-70e8-47ae-9eb1-500d1c48bab6")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.3.0.277")] +[assembly: AssemblyVersion("2.3.0.277")] +#if !COMPACT_FRAMEWORK_35 +[assembly: AssemblyFileVersion("2.3.0.277")] +#endif + +[assembly: InternalsVisibleTo("Google.ProtocolBuffers.Test,PublicKey=" + Google.ProtocolBuffers.Properties.KnownKeys.PublishedKey)] +[assembly: InternalsVisibleTo("Google.ProtocolBuffersLite.Test,PublicKey=" + Google.ProtocolBuffers.Properties.KnownKeys.PublishedKey)] + +[assembly: CLSCompliant(true)] + +namespace Google.ProtocolBuffers.Properties +{ + class KnownKeys + { + public const string PublishedKey = @"00240000048000009400000006020000002400005253413100040000110000003b4611704c5379" + + "39c3e0fbe9447dd6fa5462507f9dd4fd9fbf0712457e415b037da6d2c4eb5d2c7d29c86380af68" + + "7cf400401bb183f2a70bd3b631c1fcb7db8aa66c766694a9fb53fa765df6303104da8c978f3b6d" + + "53909cd30685b8bc9922c726cd82b5995e9e2cfca6df7a2d189d851492e49f4b76f269ce6dfd08" + + "c34a7d98"; + } +} diff --git a/src/ProtocolBuffers/WireFormat.cs b/src/ProtocolBuffers/WireFormat.cs index 508f1b485d..b98d364cf8 100644 --- a/src/ProtocolBuffers/WireFormat.cs +++ b/src/ProtocolBuffers/WireFormat.cs @@ -51,14 +51,14 @@ namespace Google.ProtocolBuffers { public static class WireFormat { #region Fixed sizes. - // TODO(jonskeet): Move these somewhere else. They're messy. Consider making FieldType a smarter kind of enum - internal const int Fixed32Size = 4; - internal const int Fixed64Size = 8; - internal const int SFixed32Size = 4; - internal const int SFixed64Size = 8; - internal const int FloatSize = 4; - internal const int DoubleSize = 8; - internal const int BoolSize = 1; + // TODO(jonskeet): Move these somewhere else. They're messy. Consider making FieldType a smarter kind of enum + public const int Fixed32Size = 4; + public const int Fixed64Size = 8; + public const int SFixed32Size = 4; + public const int SFixed64Size = 8; + public const int FloatSize = 4; + public const int DoubleSize = 8; + public const int BoolSize = 1; #endregion [CLSCompliant(false)]