diff options
Diffstat (limited to 'examples/dotnet')
-rw-r--r-- | examples/dotnet/example_binary/BUILD | 12 | ||||
-rw-r--r-- | examples/dotnet/example_binary/Program.cs | 14 | ||||
-rw-r--r-- | examples/dotnet/example_binary/Properties/AssemblyInfo.cs | 27 | ||||
-rw-r--r-- | examples/dotnet/example_lib/BUILD | 13 | ||||
-rw-r--r-- | examples/dotnet/example_lib/MyClass.cs | 19 | ||||
-rw-r--r-- | examples/dotnet/example_lib/Properties/AssemblyInfo.cs | 27 | ||||
-rw-r--r-- | examples/dotnet/example_test/BUILD | 11 | ||||
-rw-r--r-- | examples/dotnet/example_test/MyTest.cs | 24 | ||||
-rw-r--r-- | examples/dotnet/example_transitive_lib/BUILD | 10 | ||||
-rw-r--r-- | examples/dotnet/example_transitive_lib/Properties/AssemblyInfo.cs | 27 | ||||
-rw-r--r-- | examples/dotnet/example_transitive_lib/TransitiveClass.cs | 14 |
11 files changed, 198 insertions, 0 deletions
diff --git a/examples/dotnet/example_binary/BUILD b/examples/dotnet/example_binary/BUILD new file mode 100644 index 0000000000..04c126a31e --- /dev/null +++ b/examples/dotnet/example_binary/BUILD @@ -0,0 +1,12 @@ +load("/tools/build_defs/dotnet/csharp", "csharp_binary") + +csharp_binary( + name = "hello", + srcs = [ + "Program.cs", + "Properties/AssemblyInfo.cs", + ], + deps = [ + "//examples/dotnet/example_lib:MyClass", + ], +) diff --git a/examples/dotnet/example_binary/Program.cs b/examples/dotnet/example_binary/Program.cs new file mode 100644 index 0000000000..7780823347 --- /dev/null +++ b/examples/dotnet/example_binary/Program.cs @@ -0,0 +1,14 @@ +using System; +using example_lib; + +namespace example_binary +{ + class MainClass + { + public static void Main(string[] args) + { + var mc = new MyClass(); + Console.WriteLine(mc.Message); + } + } +} diff --git a/examples/dotnet/example_binary/Properties/AssemblyInfo.cs b/examples/dotnet/example_binary/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d7700ef2b3 --- /dev/null +++ b/examples/dotnet/example_binary/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("example_binary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("VAE Inc")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/examples/dotnet/example_lib/BUILD b/examples/dotnet/example_lib/BUILD new file mode 100644 index 0000000000..0ec2cd7dab --- /dev/null +++ b/examples/dotnet/example_lib/BUILD @@ -0,0 +1,13 @@ +load("/tools/build_defs/dotnet/csharp", "csharp_library") + +csharp_library( + name = "MyClass", + srcs = [ + "MyClass.cs", + "Properties/AssemblyInfo.cs", + ], + visibility = ["//visibility:public"], + deps = [ + "//examples/dotnet/example_transitive_lib:TransitiveClass", + ], +) diff --git a/examples/dotnet/example_lib/MyClass.cs b/examples/dotnet/example_lib/MyClass.cs new file mode 100644 index 0000000000..8ff7c18d56 --- /dev/null +++ b/examples/dotnet/example_lib/MyClass.cs @@ -0,0 +1,19 @@ +using System; +using System.Runtime.Remoting.Messaging; + +using example_transitive_lib; + +namespace example_lib +{ + public class MyClass + { + public string Message + { + get { return example_transitive_lib.TransitiveClass.Message; } + } + + public MyClass() + { + } + } +} diff --git a/examples/dotnet/example_lib/Properties/AssemblyInfo.cs b/examples/dotnet/example_lib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..1e8e2dd20e --- /dev/null +++ b/examples/dotnet/example_lib/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("example_lib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/examples/dotnet/example_test/BUILD b/examples/dotnet/example_test/BUILD new file mode 100644 index 0000000000..06461ca3c5 --- /dev/null +++ b/examples/dotnet/example_test/BUILD @@ -0,0 +1,11 @@ +load("/tools/build_defs/dotnet/csharp", "csharp_nunit_test") + +csharp_nunit_test( + name = "MyTest", + srcs = [ + "MyTest.cs", + ], + deps = [ + "//examples/dotnet/example_lib:MyClass", + ], +) diff --git a/examples/dotnet/example_test/MyTest.cs b/examples/dotnet/example_test/MyTest.cs new file mode 100644 index 0000000000..d5d5d3e5c7 --- /dev/null +++ b/examples/dotnet/example_test/MyTest.cs @@ -0,0 +1,24 @@ +using System; + +using NUnit.Framework; + +using example_lib; + +namespace example_test +{ + [TestFixture] + public class MyTest + { + [Test] + public void MyTest1() + { + Assert.That("foo", Is.EqualTo("Foo")); + } + + [Test] + public void MyTest2() + { + Assert.That("bar", Is.EqualTo("bar")); + } + } +}
\ No newline at end of file diff --git a/examples/dotnet/example_transitive_lib/BUILD b/examples/dotnet/example_transitive_lib/BUILD new file mode 100644 index 0000000000..c6535d781c --- /dev/null +++ b/examples/dotnet/example_transitive_lib/BUILD @@ -0,0 +1,10 @@ +load("/tools/build_defs/dotnet/csharp", "csharp_library") + +csharp_library( + name = "TransitiveClass", + srcs = [ + "Properties/AssemblyInfo.cs", + "TransitiveClass.cs", + ], + visibility = ["//visibility:public"], +) diff --git a/examples/dotnet/example_transitive_lib/Properties/AssemblyInfo.cs b/examples/dotnet/example_transitive_lib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..ebc927a51e --- /dev/null +++ b/examples/dotnet/example_transitive_lib/Properties/AssemblyInfo.cs @@ -0,0 +1,27 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("example_transitive_lib")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/examples/dotnet/example_transitive_lib/TransitiveClass.cs b/examples/dotnet/example_transitive_lib/TransitiveClass.cs new file mode 100644 index 0000000000..948fadb589 --- /dev/null +++ b/examples/dotnet/example_transitive_lib/TransitiveClass.cs @@ -0,0 +1,14 @@ +using System; +using System.Runtime.Remoting.Messaging; + +namespace example_transitive_lib +{ + public class TransitiveClass + { + public static string Message + { + get { return "Hello World!"; } + } + } +} + |