2011-02-09 16:22:02 +00:00
|
|
|
--
|
2012-01-09 20:35:28 +00:00
|
|
|
-- tests/actions/vstudio/cs2005/test_files.lua
|
2011-02-09 16:22:02 +00:00
|
|
|
-- Validate generation of <Files/> block in Visual Studio 2005 .csproj
|
2012-01-09 20:35:28 +00:00
|
|
|
-- Copyright (c) 2009-2012 Jason Perkins and the Premake project
|
2011-02-09 16:22:02 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
T.vstudio_cs2005_files = { }
|
|
|
|
local suite = T.vstudio_cs2005_files
|
|
|
|
local cs2005 = premake.vstudio.cs2005
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2013-03-10 19:56:56 +00:00
|
|
|
-- Setup
|
2011-02-09 16:22:02 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
local sln, prj
|
2013-03-10 19:56:56 +00:00
|
|
|
|
2011-02-09 16:22:02 +00:00
|
|
|
function suite.setup()
|
|
|
|
sln = test.createsolution()
|
|
|
|
end
|
2013-03-10 19:56:56 +00:00
|
|
|
|
2011-02-09 16:22:02 +00:00
|
|
|
local function prepare()
|
2013-09-13 15:52:00 +00:00
|
|
|
prj = premake.solution.getproject(sln, 1)
|
2011-02-16 20:16:07 +00:00
|
|
|
cs2005.files(prj)
|
2011-02-09 16:22:02 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test grouping and nesting
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.SimpleSourceFile()
|
|
|
|
files { "Hello.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2012-08-07 21:03:23 +00:00
|
|
|
<Compile Include="Hello.cs" />
|
2011-02-09 16:22:02 +00:00
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.NestedSourceFile()
|
|
|
|
files { "Src/Hello.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2012-08-07 21:03:23 +00:00
|
|
|
<Compile Include="Src\Hello.cs" />
|
2011-02-09 16:22:02 +00:00
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Test file dependencies
|
|
|
|
--
|
|
|
|
|
2013-10-30 18:22:53 +00:00
|
|
|
function suite.resourceDesignerDependency()
|
2011-02-09 16:22:02 +00:00
|
|
|
files { "Resources.resx", "Resources.Designer.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2012-08-07 21:03:23 +00:00
|
|
|
<Compile Include="Resources.Designer.cs">
|
|
|
|
<AutoGen>True</AutoGen>
|
|
|
|
<DependentUpon>Resources.resx</DependentUpon>
|
|
|
|
</Compile>
|
|
|
|
<EmbeddedResource Include="Resources.resx">
|
|
|
|
<SubType>Designer</SubType>
|
|
|
|
<Generator>ResXFileCodeGenerator</Generator>
|
|
|
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
|
|
</EmbeddedResource>
|
2011-02-09 16:22:02 +00:00
|
|
|
]]
|
|
|
|
end
|
2012-10-23 21:12:25 +00:00
|
|
|
|
|
|
|
|
2013-10-30 18:22:53 +00:00
|
|
|
--
|
|
|
|
-- File associations should always be made relative to the file
|
|
|
|
-- which is doing the associating.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.resourceDependency_inSubfolder()
|
|
|
|
files { "Forms/TreeListView.resx", "Forms/TreeListView.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="Forms\TreeListView.cs" />
|
|
|
|
<EmbeddedResource Include="Forms\TreeListView.resx">
|
|
|
|
<DependentUpon>TreeListView.cs</DependentUpon>
|
|
|
|
</EmbeddedResource>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2012-10-23 21:12:25 +00:00
|
|
|
--
|
2013-06-17 15:46:53 +00:00
|
|
|
-- Test build actions.
|
2012-10-23 21:12:25 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
function suite.copyAction()
|
|
|
|
files { "Hello.txt" }
|
|
|
|
configuration "**.txt"
|
|
|
|
buildaction "Copy"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Content Include="Hello.txt">
|
|
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
|
|
</Content>
|
|
|
|
]]
|
|
|
|
end
|
2013-03-10 19:56:56 +00:00
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
function suite.componentAction()
|
|
|
|
files { "Hello.cs" }
|
|
|
|
configuration "Hello.cs"
|
|
|
|
buildaction "Component"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="Hello.cs">
|
|
|
|
<SubType>Component</SubType>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-11-16 16:53:48 +00:00
|
|
|
function suite.embeddedResourceAction()
|
|
|
|
files { "Hello.ico" }
|
|
|
|
configuration "*.ico"
|
|
|
|
buildaction "Embed"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<EmbeddedResource Include="Hello.ico" />
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
function suite.formAction()
|
|
|
|
files { "HelloForm.cs" }
|
|
|
|
configuration "HelloForm.cs"
|
|
|
|
buildaction "Form"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="HelloForm.cs">
|
|
|
|
<SubType>Form</SubType>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.userControlAction()
|
|
|
|
files { "Hello.cs" }
|
|
|
|
configuration "Hello.cs"
|
|
|
|
buildaction "UserControl"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="Hello.cs">
|
|
|
|
<SubType>UserControl</SubType>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-11-16 16:53:48 +00:00
|
|
|
function suite.resourceAction()
|
|
|
|
files { "Hello.ico" }
|
|
|
|
configuration "*.ico"
|
|
|
|
buildaction "Resource"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Resource Include="Hello.ico" />
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-06-17 15:46:53 +00:00
|
|
|
|
2013-03-10 19:56:56 +00:00
|
|
|
--
|
|
|
|
-- Files that exist outside the project folder should be added as
|
|
|
|
-- links, with a relative path. Weird but true.
|
|
|
|
--
|
|
|
|
|
2013-03-27 11:43:20 +00:00
|
|
|
function suite.usesLink_onExternalSourceCode()
|
|
|
|
files { "../Hello.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="..\Hello.cs">
|
|
|
|
<Link>Hello.cs</Link>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.usesLinkInFolder_onExternalSourceCode()
|
2013-03-10 19:56:56 +00:00
|
|
|
files { "../Src/Hello.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="..\Src\Hello.cs">
|
2013-03-27 11:43:20 +00:00
|
|
|
<Link>Src\Hello.cs</Link>
|
2013-03-10 19:56:56 +00:00
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2013-03-27 11:43:20 +00:00
|
|
|
function suite.usesLinkInFolder_onExternalContent()
|
2013-03-10 19:56:56 +00:00
|
|
|
files { "../Resources/Hello.txt" }
|
|
|
|
configuration "**.txt"
|
|
|
|
buildaction "Copy"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Content Include="..\Resources\Hello.txt">
|
2013-03-27 11:43:20 +00:00
|
|
|
<Link>Resources\Hello.txt</Link>
|
2013-03-10 19:56:56 +00:00
|
|
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
|
|
</Content>
|
|
|
|
]]
|
|
|
|
end
|
2013-03-27 11:43:20 +00:00
|
|
|
|
|
|
|
function suite.usesLinkInFolder_onExternalReference()
|
|
|
|
files { "../Resources/Hello.txt" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<None Include="..\Resources\Hello.txt">
|
|
|
|
<Link>Resources\Hello.txt</Link>
|
|
|
|
</None>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Files that exist outside the project's folder are allowed to be
|
|
|
|
-- placed into a folder using a virtual path, which is better than
|
|
|
|
-- dropping them at the root. Files within the project folder cannot
|
|
|
|
-- use virtual paths, because Visual Studio won't allow it.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.usesLinks_onVpath_onLocalSourceFile()
|
|
|
|
files { "Hello.cs" }
|
|
|
|
vpaths { ["Sources"] = "**.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="Hello.cs" />
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.usesLinks_onVpath_onExternalSourceFile()
|
|
|
|
files { "../Src/Hello.cs" }
|
|
|
|
vpaths { ["Sources"] = "../**.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Compile Include="..\Src\Hello.cs">
|
|
|
|
<Link>Sources\Hello.cs</Link>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
2013-11-15 22:17:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check WPF XAML handling.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.associatesFiles_onXamlForm()
|
|
|
|
files { "MainWindow.xaml", "MainWindow.xaml.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<Page Include="MainWindow.xaml">
|
|
|
|
<SubType>Designer</SubType>
|
|
|
|
<Generator>MSBuild:Compile</Generator>
|
|
|
|
</Page>
|
|
|
|
<Compile Include="MainWindow.xaml.cs">
|
|
|
|
<SubType>Code</SubType>
|
|
|
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.xamlApp_onAppXaml()
|
|
|
|
files { "App.xaml", "App.xaml.cs" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ApplicationDefinition Include="App.xaml">
|
|
|
|
<SubType>Designer</SubType>
|
|
|
|
<Generator>MSBuild:Compile</Generator>
|
|
|
|
</ApplicationDefinition>
|
|
|
|
<Compile Include="App.xaml.cs">
|
|
|
|
<SubType>Code</SubType>
|
|
|
|
<DependentUpon>App.xaml</DependentUpon>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.xamlApp_onBuildAction()
|
|
|
|
files { "MyApp.xaml", "MyApp.xaml.cs" }
|
|
|
|
configuration "MyApp.xaml"
|
|
|
|
buildaction "Application"
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ApplicationDefinition Include="MyApp.xaml">
|
|
|
|
<SubType>Designer</SubType>
|
|
|
|
<Generator>MSBuild:Compile</Generator>
|
|
|
|
</ApplicationDefinition>
|
|
|
|
<Compile Include="MyApp.xaml.cs">
|
|
|
|
<SubType>Code</SubType>
|
|
|
|
<DependentUpon>MyApp.xaml</DependentUpon>
|
|
|
|
</Compile>
|
|
|
|
]]
|
|
|
|
end
|