Added conditional to VS ItemGroup
This commit is contained in:
parent
1c1304637f
commit
cd276f8971
@ -35,7 +35,9 @@
|
||||
function suite.emptyGroup_onNoLinks()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@ -49,7 +51,10 @@
|
||||
links { "System" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
@ -64,7 +69,12 @@
|
||||
links { "../Libraries/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
@ -82,10 +92,37 @@
|
||||
links { "%{path.getdirectory(os.getcwd())}/Libraries/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Add configuration condition to VS csproj references ItemGroup
|
||||
--
|
||||
|
||||
function suite.assemblyRef_onConfigurationCondition()
|
||||
links { "%{path.getdirectory(os.getcwd())}/Libraries/%{cfg.buildcfg}/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\Debug\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\Release\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
@ -101,7 +138,13 @@
|
||||
flags { "NoCopyLocal" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -121,7 +164,13 @@
|
||||
copylocal { "SomeOtherProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -135,7 +184,12 @@
|
||||
copylocal { "../Libraries/nunit.framework" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
@ -154,7 +208,13 @@ if _OPTIONS["test-all"] then
|
||||
nuget { "Newtonsoft.Json:10.0.2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -168,7 +228,13 @@ if _OPTIONS["test-all"] then
|
||||
nuget { "Newtonsoft.Json:10.0.2" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -190,7 +256,17 @@ if _OPTIONS["test-all"] then
|
||||
nuget { "NUnit:3.6.1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -216,7 +292,17 @@ if _OPTIONS["test-all"] then
|
||||
flags { "NoCopyLocal" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -235,7 +321,17 @@ if _OPTIONS["test-all"] then
|
||||
copylocal { "SomeOtherProject" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -254,7 +350,17 @@ if _OPTIONS["test-all"] then
|
||||
copylocal { "NUnit:3.6.1" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@ -280,7 +386,21 @@ if _OPTIONS["test-all"] then
|
||||
nuget { "MetroModernUI:1.4.0" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<Reference Include="MetroFramework.Design">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework.Fonts">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Reference Include="MetroFramework.Design">
|
||||
<HintPath>packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@ -328,7 +328,7 @@
|
||||
-- Write out the references item group.
|
||||
--
|
||||
|
||||
dotnetbase.elements.references = function(prj)
|
||||
dotnetbase.elements.references = function(cfg)
|
||||
return {
|
||||
dotnetbase.assemblyReferences,
|
||||
dotnetbase.nuGetReferences,
|
||||
@ -336,9 +336,11 @@
|
||||
end
|
||||
|
||||
function dotnetbase.references(prj)
|
||||
_p(1,'<ItemGroup>')
|
||||
p.callArray(dotnetbase.elements.references, prj)
|
||||
_p(1,'</ItemGroup>')
|
||||
for cfg in project.eachconfig(prj) do
|
||||
_p(1,'<ItemGroup %s>', dotnetbase.condition(cfg))
|
||||
p.callArray(dotnetbase.elements.references, cfg)
|
||||
_p(1,'</ItemGroup>')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -346,11 +348,8 @@
|
||||
-- Write the list of assembly (system, or non-sibling) references.
|
||||
--
|
||||
|
||||
function dotnetbase.assemblyReferences(prj)
|
||||
-- C# doesn't support per-configuration links (does it?) so just use
|
||||
-- the settings from the first available config instead
|
||||
local cfg = project.getfirstconfig(prj)
|
||||
|
||||
function dotnetbase.assemblyReferences(cfg)
|
||||
local prj = cfg.project
|
||||
config.getlinks(cfg, "system", function(original, decorated)
|
||||
local name = path.getname(decorated)
|
||||
if path.getextension(name) == ".dll" then
|
||||
@ -421,13 +420,13 @@
|
||||
-- Write the list of NuGet references.
|
||||
--
|
||||
|
||||
function dotnetbase.nuGetReferences(prj)
|
||||
function dotnetbase.nuGetReferences(cfg)
|
||||
local prj = cfg.project
|
||||
if _ACTION >= "vs2010" and not vstudio.nuget2010.supportsPackageReferences(prj) then
|
||||
for _, package in ipairs(prj.nuget) do
|
||||
local id = vstudio.nuget2010.packageId(package)
|
||||
local packageAPIInfo = vstudio.nuget2010.packageAPIInfo(prj, package)
|
||||
|
||||
local cfg = p.project.getfirstconfig(prj)
|
||||
local action = p.action.current()
|
||||
local targetFramework = cfg.dotnetframework or action.vstudio.targetFramework
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user