Skip to content

Commit 9314684

Browse files
committed
Merge branch 'master' into 3.6
2 parents 3d26a8b + 1196691 commit 9314684

121 files changed

Lines changed: 1554 additions & 952 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,3 @@ dotnet_diagnostic.CA5350.severity = suggestion # CA5350: Do Not Use Weak Crypto
9393
dotnet_diagnostic.CA5351.severity = suggestion # CA5351: Do Not Use Broken Cryptographic Algorithms
9494
dotnet_diagnostic.CA5359.severity = suggestion # CA5359: Do Not Disable Certificate Validation
9595
dotnet_diagnostic.CA5372.severity = suggestion # CA5372: Use XmlReader For XPathDocument
96-
97-
# TODO: remove this
98-
dotnet_diagnostic.CA1825.severity = suggestion # CA1825: Avoid zero-length array allocations

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [windows-2022, ubuntu-latest, macos-latest]
13+
os: [windows-latest, ubuntu-20.04, macos-latest]
1414

1515
steps:
1616
- name: Install tools
17-
if: matrix.os == 'ubuntu-latest'
17+
if: matrix.os == 'ubuntu-20.04'
1818
run: sudo apt-get -yq install mono-vbnc dos2unix
1919
- uses: actions/checkout@v2
2020
with:

.vsts-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
displayName: Windows
77
timeoutInMinutes: 180
88
pool:
9-
vmImage: windows-2022
9+
vmImage: windows-latest
1010
steps:
1111
- template: Build/steps.yml
1212
parameters:
@@ -18,7 +18,7 @@ jobs:
1818
displayName: Linux (Ubuntu)
1919
timeoutInMinutes: 180
2020
pool:
21-
vmImage: ubuntu-latest
21+
vmImage: ubuntu-20.04
2222
steps:
2323
- template: Build/steps.yml
2424
parameters:

Build.proj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@
100100
DestinationFolder="$(StageDir)\%(RecursiveDir)" />
101101
</Target>
102102

103+
<Target Name="_CopyMonoUnixReferences" DependsOnTargets="_MakeStageDir">
104+
<ItemGroup>
105+
<MonoUnixReferenceFiles
106+
Include="$(BinDir)\$(Configuration)\*\Mono.Unix.dll" />
107+
<MonoUnixReferenceFiles
108+
Include="$(BinDir)\$(Configuration)\*\runtimes\**" />
109+
</ItemGroup>
110+
111+
<Copy SourceFiles="@(MonoUnixReferenceFiles)"
112+
DestinationFolder="$(StageDir)\%(RecursiveDir)" />
113+
</Target>
114+
103115
<Target Name="_CopyMainStageFiles" DependsOnTargets="_MakeStageDir">
104116
<Copy SourceFiles="@(MainStageFiles)" DestinationFolder="$(StageDir)" />
105117
</Target>
@@ -115,6 +127,7 @@
115127
_MakeStageDir;
116128
_PlatformStage;
117129
_CopyDlrMainReferences;
130+
_CopyMonoUnixReferences;
118131
_CopyMainStageFiles;
119132
_CopyStdLib;
120133
</StageDependsOn>

Build/After.targets

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Choose>
4-
<When Condition=" '$(OutputType)' == 'Library' ">
4+
<When Condition=" '$(OutputType)' == 'Library' AND '$(PreventStaging)' != 'true' ">
55
<ItemGroup>
66
<StageItem Include="$(TargetPath)" />
77
<StageItem Include="$(DocumentationFile)" />
@@ -10,7 +10,7 @@
1010
<StageItem Include="$(TargetDir)$(TargetName).pdb" Condition=" Exists('$(TargetDir)$(TargetName).pdb') " />
1111
</ItemGroup>
1212
</When>
13-
<When Condition=" '$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe' ">
13+
<When Condition=" ('$(OutputType)' == 'Exe' OR '$(OutputType)' == 'WinExe') AND '$(PreventStaging)' != 'true' ">
1414
<ItemGroup>
1515
<StageItem Include="$(TargetPath)" />
1616
<StageItem Include="$(TargetPath).config" Condition=" Exists('$(TargetPath).config') " />
@@ -29,7 +29,7 @@
2929

3030
<Target Name="_LateStage"
3131
DependsOnTargets="CoreBuild"
32-
Condition=" '$(Staging)' == 'true' ">
32+
Condition=" '$(Staging)' == 'true' AND '$(PreventStaging)' != 'true' ">
3333
<CreateItem Include="@(LateStageItem)">
3434
<Output TaskParameter="Include" ItemName="StageItem" />
3535
</CreateItem>
@@ -50,4 +50,3 @@
5050

5151
<Target Name="Stage" DependsOnTargets="_LateStage;_MainStage;_StoreInDLLs" />
5252
</Project>
53-

Build/Tasks.Targets

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current">
33
<UsingTask TaskName="Zip" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
44
<ParameterGroup>
55
<ZipFileName ParameterType="System.String" Required="true" />
@@ -10,40 +10,55 @@
1010
<Using Namespace="System.IO.Compression" />
1111
<Code Type="Fragment" Language="cs">
1212
<![CDATA[
13-
string cwd = null;
14-
try {
15-
var di = new DirectoryInfo(WorkingDirectory);
16-
if (!di.Exists) {
17-
Log.LogError(string.Format("{0} doesn't exist", WorkingDirectory));
18-
return false;
19-
}
20-
cwd = Environment.CurrentDirectory;
21-
Environment.CurrentDirectory = di.FullName;
13+
string cwd = null;
14+
try {
15+
var di = new DirectoryInfo(WorkingDirectory);
16+
if (!di.Exists) {
17+
Log.LogError(string.Format("{0} doesn't exist", WorkingDirectory));
18+
return (Success = false);
19+
}
20+
cwd = Environment.CurrentDirectory;
21+
Environment.CurrentDirectory = di.FullName;
22+
// rw-r--r-- file BSD
23+
const int regAttr = (0b110100100 + 0x8000) << 16;
24+
// rwxr-xr-x file BSD
25+
const int exeAttr = (0b111101101 + 0x8000) << 16;
26+
var propExternalAttributes = typeof(ZipArchiveEntry).GetProperty("ExternalAttributes");
27+
28+
using Stream zipStream = new FileStream(Path.GetFullPath(ZipFileName), FileMode.Create, FileAccess.Write);
29+
using ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Create);
2230
23-
using (Stream zipStream = new FileStream(Path.GetFullPath(ZipFileName), FileMode.Create, FileAccess.Write))
24-
using (ZipArchive archive = new ZipArchive(zipStream, ZipArchiveMode.Create)) {
25-
foreach (ITaskItem fileItem in Files) {
26-
var filename = fileItem.ItemSpec;
27-
FileInfo fi = new FileInfo(filename);
28-
if (!fi.FullName.StartsWith(di.FullName)) {
29-
Log.LogError(string.Format("{0} not in {1}", filename, WorkingDirectory));
30-
return false;
31-
}
32-
var archivename = fi.FullName.Substring(di.FullName.Length).Replace('\\', '/').TrimStart(new char [] { '/' });
33-
using (Stream fileStream = new FileStream(fi.FullName, FileMode.Open, FileAccess.Read))
34-
using (Stream fileStreamInZip = archive.CreateEntry(archivename).Open())
35-
fileStream.CopyTo(fileStreamInZip);
31+
foreach (ITaskItem fileItem in Files) {
32+
string evaluatedInclude = fileItem.ItemSpec;
33+
var fi = new FileInfo(evaluatedInclude);
34+
if (!fi.FullName.StartsWith(di.FullName)) {
35+
Log.LogError(string.Format("{0} not in {1}", evaluatedInclude, WorkingDirectory));
36+
return (Success = false);
37+
}
38+
string filename = fileItem.GetMetadata("Link");
39+
if (string.IsNullOrEmpty(filename)) {
40+
filename = fi.FullName;
41+
}
42+
var archivename = fi.FullName.Substring(di.FullName.Length).Replace('\\', '/').TrimStart(new char [] { '/' });
43+
bool isExe = archivename.EndsWith(".ps1") || archivename.EndsWith(".sh");
44+
45+
ZipArchiveEntry entry = archive.CreateEntry(archivename);
46+
using Stream fileStreamInZip = entry.Open();
47+
using Stream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
48+
49+
fileStream.CopyTo(fileStreamInZip);
50+
//entry.ExternalAttributes = isExe ? exeAttr : regAttr;
51+
propExternalAttributes.SetValue(entry, isExe ? exeAttr : regAttr);
52+
}
53+
Success = true;
54+
} catch (Exception ex) {
55+
Success = false;
56+
Log.LogErrorFromException(ex);
57+
} finally {
58+
if (cwd != null) {
59+
Environment.CurrentDirectory = cwd;
60+
}
3661
}
37-
}
38-
Success = true;
39-
} catch (Exception ex) {
40-
Success = false;
41-
Log.LogErrorFromException(ex);
42-
} finally {
43-
if (cwd != null) {
44-
Environment.CurrentDirectory = cwd;
45-
}
46-
}
4762
]]>
4863
</Code>
4964
</Task>

Build/net462.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
<Features>$(Features);FEATURE_CONFIGURATION</Features>
1717
<Features>$(Features);FEATURE_CTYPES</Features>
1818
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
19-
<Features>$(Features);FEATURE_DYNAMIC_EXPRESSION_VISITOR</Features>
2019
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
2120
<Features>$(Features);FEATURE_FILESYSTEM</Features>
2221
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>

Build/net6.0.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<Features>$(Features);FEATURE_CONFIGURATION</Features>
1616
<Features>$(Features);FEATURE_CTYPES</Features>
1717
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
18-
<Features>$(Features);FEATURE_DYNAMIC_EXPRESSION_VISITOR</Features>
1918
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
2019
<Features>$(Features);FEATURE_FILESYSTEM</Features>
2120
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>

Build/netcoreapp2.1.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
<Features>$(Features);FEATURE_CONFIGURATION</Features>
1515
<Features>$(Features);FEATURE_CTYPES</Features>
1616
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
17-
<Features>$(Features);FEATURE_DYNAMIC_EXPRESSION_VISITOR</Features>
1817
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
1918
<Features>$(Features);FEATURE_FILESYSTEM</Features>
2019
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>

Build/netcoreapp3.1.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<Features>$(Features);FEATURE_CONFIGURATION</Features>
1616
<Features>$(Features);FEATURE_CTYPES</Features>
1717
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
18-
<Features>$(Features);FEATURE_DYNAMIC_EXPRESSION_VISITOR</Features>
1918
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
2019
<Features>$(Features);FEATURE_FILESYSTEM</Features>
2120
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>

0 commit comments

Comments
 (0)