Skip to content

Commit 48576e3

Browse files
committed
Deprecate NoLocalCopy flag
1 parent a004201 commit 48576e3

File tree

9 files changed

+121
-10
lines changed

9 files changed

+121
-10
lines changed

modules/vstudio/_preload.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@
727727
p.api.addAllowed("vectorextensions", { "NEON", "MXU" })
728728
p.api.addAllowed("exceptionhandling", {"UnwindTables"})
729729
p.api.addAllowed("kind", p.PACKAGING)
730-
p.api.addAllowed("flags", { "NoImplicitLink" })
730+
p.api.addAllowed("flags", { "NoImplicitLink", "NoCopyLocal" })
731731

732732
p.api.register {
733733
name = "implicitlink",
@@ -748,6 +748,24 @@
748748
implicitlink("Default")
749749
end)
750750

751+
p.api.register {
752+
name = "allowcopylocal",
753+
scope = "config",
754+
kind = "string",
755+
allowed = {
756+
"Default",
757+
"On",
758+
"Off"
759+
}
760+
}
761+
762+
p.api.deprecateValue("flags", "NoCopyLocal", "Use `allowcopylocal {}` instead.", function(value)
763+
allowcopylocal("Off")
764+
end,
765+
function(value)
766+
allowcopylocal("Default")
767+
end)
768+
751769
--
752770
-- Decide when the full module should be loaded.
753771
--

modules/vstudio/tests/cs2005/test_assembly_refs.lua

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
-- NoCopyLocal flag has been set for the configuration.
134134
--
135135

136-
function suite.markedPrivate_onNoCopyLocal()
136+
function suite.markedPrivate_onNoCopyLocal_ViaFlag()
137137
links { "../Libraries/nunit.framework" }
138138
flags { "NoCopyLocal" }
139139
prepare()
@@ -153,6 +153,26 @@
153153
]]
154154
end
155155

156+
function suite.markedPrivate_onNoCopyLocal_ViaAPI()
157+
links { "../Libraries/nunit.framework" }
158+
allowcopylocal "Off"
159+
prepare()
160+
test.capture [[
161+
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
162+
<Reference Include="nunit.framework">
163+
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
164+
<Private>False</Private>
165+
</Reference>
166+
</ItemGroup>
167+
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
168+
<Reference Include="nunit.framework">
169+
<HintPath>..\Libraries\nunit.framework.dll</HintPath>
170+
<Private>False</Private>
171+
</Reference>
172+
</ItemGroup>
173+
]]
174+
end
175+
156176

157177
--
158178
-- If there are entries in the copylocal() list, then only those
@@ -286,7 +306,7 @@ end
286306
--
287307

288308
if http ~= nil and _OPTIONS["test-all"] then
289-
function suite.nugetPackages_onNoCopyLocal()
309+
function suite.nugetPackages_onNoCopyLocal_ViaFlag()
290310
dotnetframework "2.0"
291311
nuget { "NUnit:3.6.1" }
292312
flags { "NoCopyLocal" }
@@ -315,6 +335,35 @@ if http ~= nil and _OPTIONS["test-all"] then
315335
]]
316336
end
317337

338+
function suite.nugetPackages_onNoCopyLocal_ViaAPI()
339+
dotnetframework "2.0"
340+
nuget { "NUnit:3.6.1" }
341+
allowcopylocal "Off"
342+
prepare()
343+
test.capture [[
344+
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
345+
<Reference Include="nunit.framework">
346+
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
347+
<Private>False</Private>
348+
</Reference>
349+
<Reference Include="NUnit.System.Linq">
350+
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
351+
<Private>False</Private>
352+
</Reference>
353+
</ItemGroup>
354+
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
355+
<Reference Include="nunit.framework">
356+
<HintPath>packages\NUnit.3.6.1\lib\net20\nunit.framework.dll</HintPath>
357+
<Private>False</Private>
358+
</Reference>
359+
<Reference Include="NUnit.System.Linq">
360+
<HintPath>packages\NUnit.3.6.1\lib\net20\NUnit.System.Linq.dll</HintPath>
361+
<Private>False</Private>
362+
</Reference>
363+
</ItemGroup>
364+
]]
365+
end
366+
318367
function suite.nugetPackages_onCopyLocalListExclusion()
319368
dotnetframework "2.0"
320369
nuget { "NUnit:3.6.1" }

modules/vstudio/tests/cs2005/test_project_refs.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
-- NoCopyLocal flag has been set for the configuration.
9797
--
9898

99-
function suite.markedPrivate_onNoCopyLocal()
99+
function suite.markedPrivate_onNoCopyLocal_ViaFlag()
100100
links { "MyProject" }
101101
flags { "NoCopyLocal" }
102102
prepare()
@@ -111,6 +111,21 @@
111111
]]
112112
end
113113

114+
function suite.markedPrivate_onNoLocalCopy_ViaAPI()
115+
links { "MyProject" }
116+
allowcopylocal "Off"
117+
prepare()
118+
test.capture [[
119+
<ItemGroup>
120+
<ProjectReference Include="MyProject.vcproj">
121+
<Project>{00112233-4455-6677-8888-99AABBCCDDEE}</Project>
122+
<Name>MyProject</Name>
123+
<Private>False</Private>
124+
</ProjectReference>
125+
</ItemGroup>
126+
]]
127+
end
128+
114129

115130
--
116131
-- If there are entries in the copylocal() list, then only those

src/_premake_init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@
341341
"Maps",
342342
"MultiProcessorCompile",
343343
"No64BitChecks",
344-
"NoCopyLocal",
345344
"NoImportLib", -- DEPRECATED
346345
"NoIncrementalLink",
347346
"NoManifest",

src/base/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@
446446
--
447447

448448
function config.isCopyLocal(cfg, linkname, default)
449-
if cfg.flags.NoCopyLocal then
449+
if cfg.allowcopylocal == p.OFF then
450450
return false
451451
end
452452

website/docs/allowcopylocal.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Specifies whether or not to allow for copy local of assemblies.
2+
3+
```lua
4+
allowcopylocal "value"
5+
```
6+
7+
### Parameters ###
8+
9+
`value` specifies the desired copy mode:
10+
11+
| Value | Description |
12+
|-------------|-------------------------------------------------------------------|
13+
| Default | Perform the default copy local mechanism for the exporter. |
14+
| Off | Do not copy local assemblies to the output directory. |
15+
| On | Allow the local assemblies to be copied to the output directory. |
16+
17+
### Applies To ###
18+
19+
Project configurations.
20+
21+
### Availability ###
22+
23+
Premake 5.0-beta8 or later for Visual Studio C# Projects.
24+
25+
### See Also ###
26+
27+
* [copylocal](copylocal.md)

website/docs/copylocal.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ copylocal { "libraries" }
66

77
If a project includes multiple calls to `copylocal` the lists are concatenated, in the order in which they appear in the script.
88

9-
Note that, by default, all referenced non-system assemblies in a C# project are copied. This function only needs to called when a subset of the referenced assemblies should be copied. To disable copying of *all* references, use the `NoLocalCopy` build flag instead (see Examples, below).
9+
Note that, by default, all referenced non-system assemblies in a C# project are copied. This function only needs to called when a subset of the referenced assemblies should be copied. To disable copying of *all* references, use the `allowcopylocal` API.
1010

1111
### Parameters ###
1212

@@ -36,8 +36,8 @@ links { "Renderer", "../ThirdParty/nunit.framework" }
3636
copylocal { "../ThirdParty/nunit.framework" }
3737
```
3838

39-
If you want to prevent any assemblies from being copied, use the **NoLocalCopy** flag instead.
39+
If you want to prevent any assemblies from being copied, use the **allowcopylocal** API instead.
4040

4141
```lua
42-
flags { "NoCopyLocal" }
42+
allowcopylocal "Off"
4343
```

website/docs/flags.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ flags { "flag_list" }
2020
| MultiProcessorCompile | Enable Visual Studio to use multiple compiler processes when building. Deprecated in Premake 5.0.0-beta8. Use `multiprocessorcompile` API instead. |
2121
| No64BitChecks | Disable 64-bit portability warnings. Deprecated in Premake 5.0.0-beta8. Use `enable64bitchecks` API instead. |
2222
| NoBufferSecurityCheck | Turn off stack protection checks. Deprecated in Premake 5.0.0-beta8. Use `buffersecuritycheck` API instead. |
23-
| NoCopyLocal | Prevent referenced assemblies from being copied to the target directory (C#) |
23+
| NoCopyLocal | Prevent referenced assemblies from being copied to the target directory (C#). Deprecated in Premake 5.0.0-beta8. Use `copylocal` API instead. |
2424
| NoImplicitLink | Disable Visual Studio's default behavior of automatically linking dependent projects. Deprecated in Premake 5.0.0-beta8. Use `implicitlink` API instead. |
2525
| NoImportLib | Prevent the generation of an import library for a Windows DLL. |
2626
| NoIncrementalLink | Disable support for Visual Studio's incremental linking feature. |
@@ -57,7 +57,9 @@ flags { "LinkTimeOptimization" }
5757

5858
### See Also ###
5959

60+
* [allowcopylocal](allowcopylocal.md)
6061
* [buffersecuritycheck](buffersecuritycheck.md)
62+
* [copylocal](copylocal.md)
6163
* [fatalwarnings](fatalwarnings.md)
6264
* [implicitlink](implicitlink.md)
6365
* [linktimeoptimization](linktimeoptimization.md)

website/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ module.exports = {
6363
label: 'Project Settings',
6464
items: [
6565
'allmodulespublic',
66+
'allowcopylocal',
6667
'androidapilevel',
6768
'androidapplibname',
6869
'architecture',

0 commit comments

Comments
 (0)