ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject ignite git commit: IGNITE-3311 .NET: Include configuration schema in NuGet package
Date Thu, 16 Jun 2016 12:20:49 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 277480c29 -> cc58eb0d5


IGNITE-3311 .NET: Include configuration schema in NuGet package

This closes #803


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cc58eb0d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cc58eb0d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cc58eb0d

Branch: refs/heads/master
Commit: cc58eb0d51016872c7de99465b3536f68aa966a3
Parents: 277480c
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Thu Jun 16 15:20:41 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Thu Jun 16 15:20:41 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.NuGet.csproj       |  6 ++
 .../SchemaTest.cs                               | 62 ++++++++++++++++++++
 .../install-package.ps1                         | 21 +++++--
 .../packages.config                             |  1 +
 .../Apache.Ignite.Core.Schema.nuspec            | 53 +++++++++++++++++
 .../Apache.Ignite.Core.csproj                   |  1 +
 6 files changed, 138 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cc58eb0d/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
index af3037c..22a203e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/Apache.Ignite.Core.Tests.NuGet.csproj
@@ -93,9 +93,11 @@
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ComputeTest.cs" />
+    <Compile Include="SchemaTest.cs" />
     <Compile Include="StartupTest.cs" />
     <Compile Include="CacheTest.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
@@ -109,6 +111,10 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="Apache.Ignite.Core.Tests.NuGet.sln.DotSettings" />
+    <Content Include="IgniteConfigurationSection.xsd">
+      <SubType>Designer</SubType>
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <None Include="install-package.ps1" />
     <None Include="NuGet.config" />
     <None Include="packages.config">

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc58eb0d/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs
new file mode 100644
index 0000000..ac48619
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/SchemaTest.cs
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests.NuGet
+{
+    using System.IO;
+    using System.Xml;
+    using System.Xml.Schema;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests the Apache.Ignite.Schema package.
+    /// </summary>
+    public class SchemaTest
+    {
+        /// <summary>
+        /// Tests that schema exists and validates XML config properly..
+        /// </summary>
+        [Test]
+        public void TestSchemavalidation()
+        {
+            Assert.IsTrue(File.Exists("IgniteConfigurationSection.xsd"));
+
+            // Valid schema
+            CheckSchemaValidation(@"<igniteConfiguration xmlns='http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection'
gridName='myGrid'><binaryConfiguration /></igniteConfiguration>");
+
+            // Invalid schema
+            Assert.Throws<XmlSchemaValidationException>(() => CheckSchemaValidation(
+                @"<igniteConfiguration xmlns='http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection'
invalidAttr='myGrid' />"));
+        }
+
+        /// <summary>
+        /// Checks the schema validation.
+        /// </summary>
+        /// <param name="xml">The XML.</param>
+        private static void CheckSchemaValidation(string xml)
+        {
+            var document = new XmlDocument();
+
+            document.Schemas.Add("http://ignite.apache.org/schema/dotnet/IgniteConfigurationSection",
+                XmlReader.Create("IgniteConfigurationSection.xsd"));
+
+            document.Load(new StringReader(xml));
+
+            document.Validate(null);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc58eb0d/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/install-package.ps1
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/install-package.ps1 b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/install-package.ps1
index 01c0be4..3289918 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/install-package.ps1
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/install-package.ps1
@@ -4,16 +4,19 @@ if (!(Test-Path $ng)) {
     $ng = 'nuget'
 }
 
+$cfg = 'Release'
+$ver = (gi ..\Apache.Ignite.Core\bin\$cfg\Apache.Ignite.Core.dll).VersionInfo.ProductVersion
+
 rmdir nupkg -Force -Recurse
 rmdir pkg -Force -Recurse
 
 mkdir nupkg
 mkdir pkg
 
-& $ng pack ..\Apache.Ignite.Core\Apache.Ignite.Core.csproj -Prop Configuration=Release
-OutputDirectory nupkg
-& $ng pack ..\Apache.Ignite.Linq\Apache.Ignite.Linq.csproj -Prop Configuration=Release
-OutputDirectory nupkg
-
-$ver = (Get-ChildItem nupkg\Apache.Ignite.Linq*)[0].Name -replace '\D+([\d.]+)\.\D+','$1'
+# Find all nuspec files and run 'nuget pack' either directly, or on corresponding csproj
files (if present).
+ls ..\*.nuspec -Recurse  `
+    | % { If (Test-Path ([io.path]::ChangeExtension($_.FullName, ".csproj"))){[io.path]::ChangeExtension($_.FullName,
".csproj")} Else {$_.FullName}  } `
+    | % { & $ng pack $_ -Prop Configuration=$cfg -Version $ver -Prop Platform=AnyCPU
-OutputDirectory nupkg }
 
 # Replace versions in project files
 (Get-Content packages.config) `
@@ -21,5 +24,11 @@ $ver = (Get-ChildItem nupkg\Apache.Ignite.Linq*)[0].Name -replace '\D+([\d.]+)\.
     | Out-File packages.config -Encoding utf8
 
 (Get-Content Apache.Ignite.Core.Tests.NuGet.csproj) `
-    -replace '<HintPath>packages\\Apache.Ignite(.*?)\.[\d.]+\\', ('<HintPath>packages\Apache.Ignite$1.'
+ "$ver\") `
-    | Out-File Apache.Ignite.Core.Tests.NuGet.csproj  -Encoding utf8
\ No newline at end of file
+    -replace 'packages\\Apache.Ignite(.*?)\.\d.*?\\', ('packages\Apache.Ignite$1.' + "$ver\")
`
+    | Out-File Apache.Ignite.Core.Tests.NuGet.csproj  -Encoding utf8
+
+# restore packages
+& $ng restore
+
+# refresh content files
+ls packages\*\content | % {copy ($_.FullName + "\*.*") .\ }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc58eb0d/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
index de80824..edf80de 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests.NuGet/packages.config
@@ -20,5 +20,6 @@
 <packages>
   <package id="Apache.Ignite" version="1.6.0" targetFramework="net40" />
   <package id="Apache.Ignite.Linq" version="1.6.0" targetFramework="net40" />
+  <package id="Apache.Ignite.Schema" version="1.6.0" targetFramework="net40" />
   <package id="Remotion.Linq" version="2.0.1" targetFramework="net40" />
 </packages>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc58eb0d/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
new file mode 100644
index 0000000..367bdd5
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.Schema.nuspec
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- 
+
+Creating NuGet package:
+nuget pack Apache.Ignite.Schema.nuspec -Version 1.6.1
+
+-->
+
+<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
+    <metadata>
+        <id>Apache.Ignite.Schema</id>
+        <title>Apache Ignite Configuration XML Schema</title>
+        <!-- -->
+        <version>$version$</version>
+        <authors>Apache Ignite</authors>
+        <owners>Apache Software Foundation</owners>
+        <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+        <projectUrl>https://ignite.apache.org/</projectUrl>
+        <iconUrl>https://ignite.apache.org/images/logo_ignite_32_32.png</iconUrl>
+        <requireLicenseAcceptance>false</requireLicenseAcceptance>
+        <summary>Enables Intellisense(TM) when editing IgniteConfigurationSection in
app.config and web.config.</summary>
+        <description>
+XSD file describes the structure of IgniteConfigurationSection and enables Intellisense(TM)
when editing IgniteConfigurationSection in app.config and web.config in Visual Studio.
+
+More info on Apache Ignite.NET: https://apacheignite-net.readme.io/
+        </description>
+        <releaseNotes></releaseNotes>
+        <copyright>Copyright 2016</copyright>
+        <tags>Apache Ignite XSD Intellisense</tags>
+    </metadata>
+    <files>
+        <!-- Other files should go to Content folder to be automatically included in project.
-->
+        <file src="IgniteConfigurationSection.xsd" target="content" />
+    </files>
+</package>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc58eb0d/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 649de2e..10971d9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -484,6 +484,7 @@
   <ItemGroup>
     <None Include="Apache.Ignite.Core.ruleset" />
     <None Include="Apache.Ignite.Core.nuspec" />
+    <None Include="Apache.Ignite.Core.Schema.nuspec" />
     <None Include="build-common.ps1" />
     <None Include="NuGet\Uninstall.ps1" />
     <None Include="NuGet\PostBuild.ps1" />


Mime
View raw message