2012-09-27 14:15:27 +00:00
|
|
|
--
|
|
|
|
-- tests/actions/vstudio/cs2005/test_assembly_refs.lua
|
|
|
|
-- Test the assembly linking block of a Visual Studio 2005+ C# project.
|
2015-08-30 15:38:35 +00:00
|
|
|
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
2012-09-27 14:15:27 +00:00
|
|
|
--
|
|
|
|
|
2015-08-30 15:38:35 +00:00
|
|
|
local suite = test.declare("vstudio_cs2005_assembly_refs")
|
|
|
|
|
2012-09-27 14:15:27 +00:00
|
|
|
local cs2005 = premake.vstudio.cs2005
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup and teardown
|
|
|
|
--
|
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
local wks, prj
|
2013-01-10 16:09:34 +00:00
|
|
|
|
2012-09-27 14:15:27 +00:00
|
|
|
function suite.setup()
|
2016-03-19 18:19:39 +00:00
|
|
|
premake.action.set("vs2010")
|
2015-08-28 20:16:14 +00:00
|
|
|
wks = test.createWorkspace()
|
2012-09-27 14:15:27 +00:00
|
|
|
language "C#"
|
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare(platform)
|
2015-08-30 15:38:35 +00:00
|
|
|
prj = test.getproject(wks, 1)
|
2016-03-21 09:12:25 +00:00
|
|
|
cs2005.references(prj)
|
2012-09-27 14:15:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Block should be empty if the project has no links.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.emptyGroup_onNoLinks()
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Check handling of system assemblies.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.assemblyRef_onSystemAssembly()
|
|
|
|
links { "System" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="System" />
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Assemblies referenced by a path should get a hint.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.assemblyRef_onPath()
|
|
|
|
links { "../Libraries/nunit.framework" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
2013-01-10 16:09:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Assemblies referenced via a token that expands to an absolute
|
|
|
|
-- path should still end up with a relative hint path.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.assemblyRef_onAbsoluteToken()
|
|
|
|
links { "%{path.getdirectory(os.getcwd())}/Libraries/nunit.framework" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
2013-08-11 13:51:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- The assembly should not be copied to the target directory if the
|
|
|
|
-- NoCopyLocal flag has been set for the configuration.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.markedPrivate_onNoCopyLocal()
|
|
|
|
links { "../Libraries/nunit.framework" }
|
|
|
|
flags { "NoCopyLocal" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
|
|
|
<Private>False</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If there are entries in the copylocal() list, then only those
|
|
|
|
-- specific libraries should be copied.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.markedPrivate_onCopyLocalListExclusion()
|
|
|
|
links { "../Libraries/nunit.framework" }
|
|
|
|
copylocal { "SomeOtherProject" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
|
|
|
<Private>False</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.notMarkedPrivate_onCopyLocalListInclusion()
|
|
|
|
links { "../Libraries/nunit.framework" }
|
|
|
|
copylocal { "../Libraries/nunit.framework" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2016-03-19 18:19:39 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- NuGet packages should get references.
|
|
|
|
--
|
|
|
|
|
2017-04-07 14:39:11 +00:00
|
|
|
function suite.nuGetPackages_net45()
|
2016-03-19 18:19:39 +00:00
|
|
|
dotnetframework "4.5"
|
2017-04-07 14:39:11 +00:00
|
|
|
nuget { "Newtonsoft.Json:10.0.2" }
|
2016-03-19 18:19:39 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="Newtonsoft.Json">
|
2017-04-07 14:39:11 +00:00
|
|
|
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
2016-03-19 18:19:39 +00:00
|
|
|
<Private>True</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
2017-04-07 14:39:11 +00:00
|
|
|
function suite.nuGetPackages_net30()
|
2016-03-19 18:19:39 +00:00
|
|
|
dotnetframework "3.0"
|
2017-04-07 14:39:11 +00:00
|
|
|
nuget { "Newtonsoft.Json:10.0.2" }
|
2016-03-19 18:19:39 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="Newtonsoft.Json">
|
2017-04-07 14:39:11 +00:00
|
|
|
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll</HintPath>
|
2016-03-19 18:19:39 +00:00
|
|
|
<Private>True</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
2017-04-07 14:43:03 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- If there are multiple assemblies in the NuGet package, they all should be
|
|
|
|
-- referenced.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.nuGetPackages_multipleAssemblies()
|
|
|
|
dotnetframework "2.0"
|
|
|
|
nuget { "NUnit:3.6.1" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
|
|
|
<Private>True</Private>
|
|
|
|
</Reference>
|
|
|
|
<Reference Include="NUnit.System.Linq">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
|
|
|
<Private>True</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
2017-04-13 10:44:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- NuGet packages should respect copylocal() and the NoCopyLocal flag.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.nugetPackages_onNoCopyLocal()
|
|
|
|
dotnetframework "2.0"
|
|
|
|
nuget { "NUnit:3.6.1" }
|
|
|
|
flags { "NoCopyLocal" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
|
|
|
<Private>False</Private>
|
|
|
|
</Reference>
|
|
|
|
<Reference Include="NUnit.System.Linq">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
|
|
|
<Private>False</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.nugetPackages_onCopyLocalListExclusion()
|
|
|
|
dotnetframework "2.0"
|
|
|
|
nuget { "NUnit:3.6.1" }
|
|
|
|
copylocal { "SomeOtherProject" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
|
|
|
<Private>False</Private>
|
|
|
|
</Reference>
|
|
|
|
<Reference Include="NUnit.System.Linq">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
|
|
|
<Private>False</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.nugetPackages_onCopyLocalListInclusion()
|
|
|
|
dotnetframework "2.0"
|
|
|
|
nuget { "NUnit:3.6.1" }
|
|
|
|
copylocal { "NUnit:3.6.1" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<ItemGroup>
|
|
|
|
<Reference Include="nunit.framework">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
|
|
|
<Private>True</Private>
|
|
|
|
</Reference>
|
|
|
|
<Reference Include="NUnit.System.Linq">
|
|
|
|
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
|
|
|
|
<Private>True</Private>
|
|
|
|
</Reference>
|
|
|
|
</ItemGroup>
|
|
|
|
]]
|
|
|
|
end
|