Skip to content

Commit d342aa4

Browse files
Peter Jasarfon
authored andcommitted
Classify builds, pkgproj, resx and sfproj as XML (github-linguist#2954)
* Classify builds, pkgproj, resx and sfproj as XML * Disambiguate .builds for XML and Text
1 parent 5c655e3 commit d342aa4

6 files changed

Lines changed: 159 additions & 0 deletions

File tree

lib/linguist/heuristics.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ def call(data)
8686
end
8787
end
8888

89+
disambiguate ".builds" do |data|
90+
if /^(\s*)(<Project|<Import|<Property|<?xml|xmlns)/i.match(data)
91+
Language["XML"]
92+
else
93+
Language["Text"]
94+
end
95+
end
96+
8997
disambiguate ".ch" do |data|
9098
if /^\s*#\s*(if|ifdef|ifndef|define|command|xcommand|translate|xtranslate|include|pragma|undef)\b/i.match(data)
9199
Language["xBase"]

lib/linguist/languages.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3859,6 +3859,7 @@ XML:
38593859
- .xml
38603860
- .ant
38613861
- .axml
3862+
- .builds
38623863
- .ccxml
38633864
- .clixml
38643865
- .cproject
@@ -3890,15 +3891,18 @@ XML:
38903891
- .nuspec
38913892
- .odd
38923893
- .osm
3894+
- .pkgproj
38933895
- .plist
38943896
- .pluginspec
38953897
- .props
38963898
- .ps1xml
38973899
- .psc1
38983900
- .pt
38993901
- .rdf
3902+
- .resx
39003903
- .rss
39013904
- .scxml
3905+
- .sfproj
39023906
- .srdf
39033907
- .storyboard
39043908
- .stTheme

samples/XML/Demo.sfproj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Service Fabric Tools\Microsoft.VisualStudio.Azure.Fabric.ApplicationProject.props" />
4+
<PropertyGroup Label="Globals">
5+
<ProjectGuid>93d81507-bccc-43d6-8667-2d42473f0c32</ProjectGuid>
6+
<ProjectVersion>1.0</ProjectVersion>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<None Include="Scripts\Deploy-FabricApplication.ps1" />
10+
</ItemGroup>
11+
<ItemGroup>
12+
<ProjectReference Include="..\ChaosTest.ChaosService\ChaosTest.ChaosService.csproj" />
13+
<ProjectReference Include="..\ChaosTest.WebService\ChaosTest.WebService.csproj" />
14+
</ItemGroup>
15+
<ItemGroup>
16+
<Content Include="ApplicationPackageRoot\ApplicationManifest.xml" />
17+
<Content Include="ApplicationParameters\Cloud.xml" />
18+
<Content Include="ApplicationParameters\Local.xml" />
19+
<Content Include="PublishProfiles\Cloud.xml" />
20+
<Content Include="PublishProfiles\Local.xml" />
21+
</ItemGroup>
22+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Service Fabric Tools\Microsoft.VisualStudio.Azure.Fabric.ApplicationProject.targets" />
23+
</Project>

samples/XML/Strings.resx

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 1.3
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">1.3</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1">this is my long string</data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
[base64 mime encoded serialized .NET Framework object]
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
[base64 mime encoded string representing a byte array form of the .NET Framework object]
27+
</data>
28+
29+
There are any number of "resheader" rows that contain simple
30+
name/value pairs.
31+
32+
Each data row contains a name, and value. The row also contains a
33+
type or mimetype. Type corresponds to a .NET class that support
34+
text/value conversion through the TypeConverter architecture.
35+
Classes that don't support this are serialized and stored with the
36+
mimetype set.
37+
38+
The mimetype is used for serialized objects, and tells the
39+
ResXResourceReader how to depersist the object. This is currently not
40+
extensible. For a given mimetype the value must be set accordingly:
41+
42+
Note - application/x-microsoft.net.object.binary.base64 is the format
43+
that the ResXResourceWriter will generate, however the reader can
44+
read any of the formats listed below.
45+
46+
mimetype: application/x-microsoft.net.object.binary.base64
47+
value : The object must be serialized with
48+
: System.Serialization.Formatters.Binary.BinaryFormatter
49+
: and then encoded with base64 encoding.
50+
51+
mimetype: application/x-microsoft.net.object.soap.base64
52+
value : The object must be serialized with
53+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
54+
: and then encoded with base64 encoding.
55+
56+
mimetype: application/x-microsoft.net.object.bytearray.base64
57+
value : The object must be serialized into a byte array
58+
: using a System.ComponentModel.TypeConverter
59+
: and then encoded with base64 encoding.
60+
-->
61+
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:element name="root" msdata:IsDataSet="true">
64+
<xsd:complexType>
65+
<xsd:choice maxOccurs="unbounded">
66+
<xsd:element name="data">
67+
<xsd:complexType>
68+
<xsd:sequence>
69+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
70+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
73+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
74+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
75+
</xsd:complexType>
76+
</xsd:element>
77+
<xsd:element name="resheader">
78+
<xsd:complexType>
79+
<xsd:sequence>
80+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
81+
</xsd:sequence>
82+
<xsd:attribute name="name" type="xsd:string" use="required" />
83+
</xsd:complexType>
84+
</xsd:element>
85+
</xsd:choice>
86+
</xsd:complexType>
87+
</xsd:element>
88+
</xsd:schema>
89+
<resheader name="resmimetype">
90+
<value>text/microsoft-resx</value>
91+
</resheader>
92+
<resheader name="version">
93+
<value>1.3</value>
94+
</resheader>
95+
<resheader name="reader">
96+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
97+
</resheader>
98+
<resheader name="writer">
99+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
100+
</resheader>
101+
<data name="Argument_InvalidPathChars" xml:space="preserve">
102+
<value>Illegal characters in path.</value>
103+
</data>
104+
</root>

samples/XML/System.Buffers.pkgproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
5+
<ItemGroup>
6+
<ProjectReference Include="..\src\System.Buffers.builds">
7+
<SupportedFramework>net45;netcore45;netstandardapp1.5;wpa81</SupportedFramework>
8+
</ProjectReference>
9+
</ItemGroup>
10+
11+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
12+
</Project>

samples/XML/src.builds

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
<ItemGroup>
5+
<Project Include="*\src\*.builds" />
6+
</ItemGroup>
7+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
8+
</Project>

0 commit comments

Comments
 (0)