Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
706c5f69
Commit
706c5f69
authored
May 19, 2010
by
Jon Skeet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to remove CLSCompliance attribute
parent
290089ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
11 deletions
+57
-11
csharp_options.proto
protos/google/protobuf/csharp_options.proto
+3
-0
ExtensionGenerator.cs
src/ProtoGen/ExtensionGenerator.cs
+3
-2
FieldGeneratorBase.cs
src/ProtoGen/FieldGeneratorBase.cs
+1
-1
CSharpOptions.cs
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
+50
-8
No files found.
protos/google/protobuf/csharp_options.proto
View file @
706c5f69
...
...
@@ -35,6 +35,9 @@ message CSharpFileOptions {
// Create subdirectories for namespaces, e.g. namespace "Foo.Bar"
// would generate files within [output directory]/Foo/Bar
optional
bool
expand_namespace_directories
=
7
;
// Generate attributes indicating non-CLS-compliance
optional
bool
cls_compliance
=
8
[
default
=
true
];
}
extend
FileOptions
{
...
...
src/ProtoGen/ExtensionGenerator.cs
View file @
706c5f69
...
...
@@ -64,12 +64,13 @@ namespace Google.ProtocolBuffers.ProtoGen {
public
void
Generate
(
TextGenerator
writer
)
{
writer
.
WriteLine
(
"public const int {0} = {1};"
,
GetFieldConstantName
(
Descriptor
),
Descriptor
.
FieldNumber
);
if
(
Descriptor
.
IsRepeated
)
{
if
(!
Descriptor
.
IsCLSCompliant
)
{
if
(!
Descriptor
.
IsCLSCompliant
&&
Descriptor
.
File
.
CSharpOptions
.
ClsCompliance
)
{
writer
.
WriteLine
(
"[global::System.CLSCompliant(false)]"
);
}
writer
.
WriteLine
(
"{0} static pb::GeneratedExtensionBase<scg::IList<{1}>> {2};"
,
ClassAccessLevel
,
type
,
name
);
}
else
{
if
(!
Descriptor
.
IsCLSCompliant
)
{
if
(!
Descriptor
.
IsCLSCompliant
&&
Descriptor
.
File
.
CSharpOptions
.
ClsCompliance
)
{
writer
.
WriteLine
(
"[global::System.CLSCompliant(false)]"
);
}
writer
.
WriteLine
(
"{0} static pb::GeneratedExtensionBase<{1}> {2};"
,
ClassAccessLevel
,
type
,
name
);
...
...
src/ProtoGen/FieldGeneratorBase.cs
View file @
706c5f69
...
...
@@ -132,7 +132,7 @@ namespace Google.ProtocolBuffers.ProtoGen {
}
protected
void
AddClsComplianceCheck
(
TextGenerator
writer
)
{
if
(!
Descriptor
.
IsCLSCompliant
)
{
if
(!
Descriptor
.
IsCLSCompliant
&&
Descriptor
.
File
.
CSharpOptions
.
ClsCompliance
)
{
writer
.
WriteLine
(
"[global::System.CLSCompliant(false)]"
);
}
}
...
...
src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs
View file @
706c5f69
...
...
@@ -37,22 +37,23 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
byte
[]
descriptorData
=
global
::
System
.
Convert
.
FromBase64String
(
"CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds"
+
"ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i"
+
"
zA
EKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1"
+
"
6g
EKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1"
+
"bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB"
+
"KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz"
+
"c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u"
+
"YW1lc3BhY2VfZGlyZWN0b3JpZXMYByABKAgiKwoSQ1NoYXJwRmllbGRPcHRp"
+
"b25zEhUKDXByb3BlcnR5X25hbWUYASABKAk6XgoTY3NoYXJwX2ZpbGVfb3B0"
+
"aW9ucxIcLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxjoByABKAsyIi5n"
+
"b29nbGUucHJvdG9idWYuQ1NoYXJwRmlsZU9wdGlvbnM6YQoUY3NoYXJwX2Zp"
+
"ZWxkX29wdGlvbnMSHS5nb29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGOgH"
+
"IAEoCzIjLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBGaWVsZE9wdGlvbnM="
);
"YW1lc3BhY2VfZGlyZWN0b3JpZXMYByABKAgSHAoOY2xzX2NvbXBsaWFuY2UY"
+
"CCABKAg6BHRydWUiKwoSQ1NoYXJwRmllbGRPcHRpb25zEhUKDXByb3BlcnR5"
+
"X25hbWUYASABKAk6XgoTY3NoYXJwX2ZpbGVfb3B0aW9ucxIcLmdvb2dsZS5w"
+
"cm90b2J1Zi5GaWxlT3B0aW9ucxjoByABKAsyIi5nb29nbGUucHJvdG9idWYu"
+
"Q1NoYXJwRmlsZU9wdGlvbnM6YQoUY3NoYXJwX2ZpZWxkX29wdGlvbnMSHS5n"
+
"b29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGOgHIAEoCzIjLmdvb2dsZS5w"
+
"cm90b2J1Zi5DU2hhcnBGaWVsZE9wdGlvbnM="
);
pbd
::
FileDescriptor
.
InternalDescriptorAssigner
assigner
=
delegate
(
pbd
::
FileDescriptor
root
)
{
descriptor
=
root
;
internal__static_google_protobuf_CSharpFileOptions__Descriptor
=
Descriptor
.
MessageTypes
[
0
];
internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpFileOptions
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpFileOptions
.
Builder
>(
internal__static_google_protobuf_CSharpFileOptions__Descriptor
,
new
string
[]
{
"Namespace"
,
"UmbrellaClassname"
,
"PublicClasses"
,
"MultipleFiles"
,
"NestClasses"
,
"CodeContracts"
,
"ExpandNamespaceDirectories"
,
});
new
string
[]
{
"Namespace"
,
"UmbrellaClassname"
,
"PublicClasses"
,
"MultipleFiles"
,
"NestClasses"
,
"CodeContracts"
,
"ExpandNamespaceDirectories"
,
"ClsCompliance"
,
});
internal__static_google_protobuf_CSharpFieldOptions__Descriptor
=
Descriptor
.
MessageTypes
[
1
];
internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable
=
new
pb
::
FieldAccess
.
FieldAccessorTable
<
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpFieldOptions
,
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpFieldOptions
.
Builder
>(
internal__static_google_protobuf_CSharpFieldOptions__Descriptor
,
...
...
@@ -162,6 +163,16 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
get
{
return
expandNamespaceDirectories_
;
}
}
public
const
int
ClsComplianceFieldNumber
=
8
;
private
bool
hasClsCompliance
;
private
bool
clsCompliance_
=
true
;
public
bool
HasClsCompliance
{
get
{
return
hasClsCompliance
;
}
}
public
bool
ClsCompliance
{
get
{
return
clsCompliance_
;
}
}
public
override
bool
IsInitialized
{
get
{
return
true
;
...
...
@@ -191,6 +202,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
if
(
HasExpandNamespaceDirectories
)
{
output
.
WriteBool
(
7
,
ExpandNamespaceDirectories
);
}
if
(
HasClsCompliance
)
{
output
.
WriteBool
(
8
,
ClsCompliance
);
}
UnknownFields
.
WriteTo
(
output
);
}
...
...
@@ -222,6 +236,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
if
(
HasExpandNamespaceDirectories
)
{
size
+=
pb
::
CodedOutputStream
.
ComputeBoolSize
(
7
,
ExpandNamespaceDirectories
);
}
if
(
HasClsCompliance
)
{
size
+=
pb
::
CodedOutputStream
.
ComputeBoolSize
(
8
,
ClsCompliance
);
}
size
+=
UnknownFields
.
SerializedSize
;
memoizedSerializedSize
=
size
;
return
size
;
...
...
@@ -335,6 +352,9 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
if
(
other
.
HasExpandNamespaceDirectories
)
{
ExpandNamespaceDirectories
=
other
.
ExpandNamespaceDirectories
;
}
if
(
other
.
HasClsCompliance
)
{
ClsCompliance
=
other
.
ClsCompliance
;
}
this
.
MergeUnknownFields
(
other
.
UnknownFields
);
return
this
;
}
...
...
@@ -395,6 +415,10 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
ExpandNamespaceDirectories
=
input
.
ReadBool
();
break
;
}
case
64
:
{
ClsCompliance
=
input
.
ReadBool
();
break
;
}
}
}
}
...
...
@@ -527,6 +551,24 @@ namespace Google.ProtocolBuffers.DescriptorProtos {
result
.
expandNamespaceDirectories_
=
false
;
return
this
;
}
public
bool
HasClsCompliance
{
get
{
return
result
.
HasClsCompliance
;
}
}
public
bool
ClsCompliance
{
get
{
return
result
.
ClsCompliance
;
}
set
{
SetClsCompliance
(
value
);
}
}
public
Builder
SetClsCompliance
(
bool
value
)
{
result
.
hasClsCompliance
=
true
;
result
.
clsCompliance_
=
value
;
return
this
;
}
public
Builder
ClearClsCompliance
()
{
result
.
hasClsCompliance
=
false
;
result
.
clsCompliance_
=
true
;
return
this
;
}
}
static
CSharpFileOptions
()
{
object
.
ReferenceEquals
(
global
::
Google
.
ProtocolBuffers
.
DescriptorProtos
.
CSharpOptions
.
Descriptor
,
null
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment