-
Notifications
You must be signed in to change notification settings - Fork 370
Improve performance of XmlDependencies IsDependenciesFile #602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrisyarbrough
wants to merge
10
commits into
googlesamples:master
from
chrisyarbrough:improve-performance-of-xmldependencies-isdependenciesfile
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
85fa4e7
Add test for XmlDependencies.IsDependenciesFile
chrisyarbrough 8b3b7fb
Improve XmlDependencies.IsDependenciesFile performance
chrisyarbrough dcae0f9
Remove XmlDependencies.fileRegularExpressions
chrisyarbrough 84074ef
Move AndroidResolver tests into unit_tests directory
chrisyarbrough 717d53d
Add TODO item to build.gradle to fix Nunit tests for #602
chrisyarbrough 87f25bf
Remove FileMatchPattern delegate and replace with System.Func
chrisyarbrough 22d1a09
Refactor IsDependenciesFile
chrisyarbrough 167a3ce
Use NUnit 2.6.3 instead of 3.5.0 in AndroidResolverTests because the ...
chrisyarbrough 62b4583
Rename AndroidResolverTests assembly to Google.AndroidResolverTests t...
chrisyarbrough 2bad7a8
Add comment to IsDependenciesFile
chrisyarbrough File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
source/AndroidResolver/unit_tests/AndroidResolverTests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
| <PropertyGroup> | ||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
| <ProjectGuid>{12F40968-4B80-4DCF-8D51-4C8E06F9CC4B}</ProjectGuid> | ||
| <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
| <OutputType>Library</OutputType> | ||
| <AppDesignerFolder>Properties</AppDesignerFolder> | ||
| <RootNamespace>Google</RootNamespace> | ||
| <AssemblyName>Google.AndroidResolverTests</AssemblyName> | ||
| <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
| <FileAlignment>512</FileAlignment> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
| <PlatformTarget>AnyCPU</PlatformTarget> | ||
| <DebugSymbols>true</DebugSymbols> | ||
| <DebugType>full</DebugType> | ||
| <Optimize>false</Optimize> | ||
| <OutputPath>bin\Debug\</OutputPath> | ||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
| <ErrorReport>prompt</ErrorReport> | ||
| <WarningLevel>4</WarningLevel> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
| <PlatformTarget>AnyCPU</PlatformTarget> | ||
| <DebugType>pdbonly</DebugType> | ||
| <Optimize>true</Optimize> | ||
| <OutputPath>bin\Release\</OutputPath> | ||
| <DefineConstants>TRACE</DefineConstants> | ||
| <ErrorReport>prompt</ErrorReport> | ||
| <WarningLevel>4</WarningLevel> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <Reference Include="System" /> | ||
| <Reference Include="System.Core" /> | ||
| <Reference Include="System.Data" /> | ||
| <Reference Include="System.Xml" /> | ||
| <Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <Compile Include="XmlDependenciesTests.cs" /> | ||
| <Compile Include="Properties\AssemblyInfo.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ProjectReference Include="..\AndroidResolver.csproj"> | ||
| <Project>{82eedfbe-afe4-4def-99d9-bc929747dd9a}</Project> | ||
| <Name>AndroidResolver</Name> | ||
| </ProjectReference> | ||
| </ItemGroup> | ||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
| Other similar extension points exist, see Microsoft.Common.targets. | ||
| <Target Name="BeforeBuild"> | ||
| </Target> | ||
| <Target Name="AfterBuild"> | ||
| </Target> | ||
| --> | ||
|
|
||
| </Project> |
35 changes: 35 additions & 0 deletions
source/AndroidResolver/unit_tests/Properties/AssemblyInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| using System.Reflection; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| // 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("AndroidResolverTests")] | ||
| [assembly: AssemblyDescription("")] | ||
| [assembly: AssemblyConfiguration("")] | ||
| [assembly: AssemblyCompany("")] | ||
| [assembly: AssemblyProduct("AndroidResolverTests")] | ||
| [assembly: AssemblyCopyright("Copyright © 2023")] | ||
| [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("12F40968-4B80-4DCF-8D51-4C8E06F9CC4B")] | ||
|
|
||
| // 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("1.0.*")] | ||
| [assembly: AssemblyVersion("1.0.0.0")] | ||
| [assembly: AssemblyFileVersion("1.0.0.0")] |
28 changes: 28 additions & 0 deletions
source/AndroidResolver/unit_tests/XmlDependenciesTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using System.Text.RegularExpressions; | ||
|
|
||
| namespace GooglePlayServices.Tests { | ||
| using System; | ||
| using NUnit.Framework; | ||
|
|
||
| [TestFixture] | ||
| public class XmlDependenciesTests | ||
| { | ||
| [TestCase("Assets/Editor/Dependencies.xml")] | ||
| [TestCase("Assets/Editor/MyFolder/Dependencies.xml")] | ||
| [TestCase("Editor/Dependencies.xml")] | ||
| [TestCase("Editor/MyFolder/Dependencies.xml")] | ||
| [TestCase("Assets/Editor/SomeDependencies.xml")] | ||
| [TestCase("Assets/MyEditorCode/Dependencies.xml")] | ||
| [TestCase("Assets/MyEditorCode/SomeDependencies.xml")] | ||
| [TestCase("Assets/Editor/")] | ||
| [TestCase("Assets/Editor/Dependendencies")] | ||
| public void IsDependenciesFileReturnsExpected(string path) { | ||
| bool actualResult = XmlDependencies.IsDependenciesFile(path); | ||
|
|
||
| // This was the previous implementation before the optimization attempt and acts as a test reference. | ||
| bool expectedResult = Regex.IsMatch(input: path, pattern: @".*[/\\]Editor[/\\].*Dependencies\.xml$"); | ||
|
|
||
| Assert.AreEqual(expectedResult, actualResult); | ||
| } | ||
| } | ||
| } |
4 changes: 4 additions & 0 deletions
source/AndroidResolver/unit_tests/packages.config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <packages> | ||
| <package id="NUnit" version="2.6.3" targetFramework="net45" /> | ||
| </packages> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.