diff --git a/GVFS.sln b/GVFS.sln index 2cee10493b..b79f30d251 100644 --- a/GVFS.sln +++ b/GVFS.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2015 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30509.20 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DCE11095-DA5F-4878-B58D-2702765560F5}" ProjectSection(SolutionItems) = preProject @@ -58,8 +58,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Service.Windows", "GVF {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535} EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Service.Mac", "GVFS\GVFS.Service\GVFS.Service.Mac.csproj", "{03769A07-F216-456B-886B-E07CAF6C5E81}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.ReadObjectHook.Windows", "GVFS\GVFS.ReadObjectHook\GVFS.ReadObjectHook.Windows.vcxproj", "{5A6656D5-81C7-472C-9DC8-32D071CB2258}" ProjectSection(ProjectDependencies) = postProject {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} @@ -92,23 +90,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Installer.Windows", "G {2F63B22B-EE26-4266-BF17-28A9146483A1} = {2F63B22B-EE26-4266-BF17-28A9146483A1} EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Installer.Mac", "GVFS\GVFS.Installer.Mac\GVFS.Installer.Mac.csproj", "{25229A04-6554-49B1-A95A-3F3B76C5B0C8}" - ProjectSection(ProjectDependencies) = postProject - {03769A07-F216-456B-886B-E07CAF6C5E81} = {03769A07-F216-456B-886B-E07CAF6C5E81} - {4CC2A90D-D240-4382-B4BF-5E175515E492} = {4CC2A90D-D240-4382-B4BF-5E175515E492} - {28939122-7263-41E7-A7E2-CBFB01AD6A04} = {28939122-7263-41E7-A7E2-CBFB01AD6A04} - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - {F468B05A-95E5-46BC-8C67-B80A78527B7D} = {F468B05A-95E5-46BC-8C67-B80A78527B7D} - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A} = {1DAC3DA6-3D21-4917-B9A8-D60C8712252A} - {FAC6EFC5-A890-4CB2-8C80-6358E358C637} = {FAC6EFC5-A890-4CB2-8C80-6358E358C637} - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} = {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} - {AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970} - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS.SignFiles\GVFS.SignFiles.csproj", "{2F63B22B-EE26-4266-BF17-28A9146483A1}" ProjectSection(ProjectDependencies) = postProject {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} + {AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970} {1118B427-7063-422F-83B9-5023C8EC5A7A} = {1118B427-7063-422F-83B9-5023C8EC5A7A} {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} {F468B05A-95E5-46BC-8C67-B80A78527B7D} = {F468B05A-95E5-46BC-8C67-B80A78527B7D} @@ -121,7 +106,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS {4CE404E7-D3FC-471C-993C-64615861EA63} = {4CE404E7-D3FC-471C-993C-64615861EA63} {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535} {93B403FD-DAFB-46C5-9636-B122792A548A} = {93B403FD-DAFB-46C5-9636-B122792A548A} - {AECEC217-2499-403D-B0BB-2962B9BE5970} = {AECEC217-2499-403D-B0BB-2962B9BE5970} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook.Windows", "GVFS\GVFS.VirtualFileSystemHook\GVFS.VirtualFileSystemHook.Windows.vcxproj", "{2D23AB54-541F-4ABC-8DCA-08C199E97ABB}" @@ -131,18 +115,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Virtualization", "GVFS\GVFS.Virtualization\GVFS.Virtualization.csproj", "{F468B05A-95E5-46BC-8C67-B80A78527B7D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrjFSLib.Mac.Managed", "ProjFS.Mac\PrjFSLib.Mac.Managed\PrjFSLib.Mac.Managed.csproj", "{FAC6EFC5-A890-4CB2-8C80-6358E358C637}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Platform.Mac", "GVFS\GVFS.Platform.Mac\GVFS.Platform.Mac.csproj", "{1DAC3DA6-3D21-4917-B9A8-D60C8712252A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Platform.POSIX", "GVFS\GVFS.Platform.POSIX\GVFS.Platform.POSIX.csproj", "{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.UnitTests", "GVFS\GVFS.UnitTests\GVFS.UnitTests.csproj", "{0D434FA7-6D8C-481E-B0CE-779B59EAEF53}" + ProjectSection(ProjectDependencies) = postProject + {93B403FD-DAFB-46C5-9636-B122792A548A} = {93B403FD-DAFB-46C5-9636-B122792A548A} + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Platform.Windows", "GVFS\GVFS.Platform.Windows\GVFS.Platform.Windows.csproj", "{4CE404E7-D3FC-471C-993C-64615861EA63}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mac", "GVFS\GVFS\GVFS.Mac.csproj", "{28939122-7263-41E7-A7E2-CBFB01AD6A04}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Windows", "GVFS\GVFS\GVFS.Windows.csproj", "{32220664-594C-4425-B9A0-88E0BE2F3D2A}" ProjectSection(ProjectDependencies) = postProject {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} @@ -160,8 +141,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Mount.Windows", "GVFS\ {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535} EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mount.Mac", "GVFS\GVFS.Mount\GVFS.Mount.Mac.csproj", "{35CA4DFB-1320-4055-B8F6-F12E0F252FF0}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.FunctionalTests.Windows", "GVFS\GVFS.FunctionalTests.Windows\GVFS.FunctionalTests.Windows.csproj", "{0F0A008E-AB12-40EC-A671-37A541B08C7F}" ProjectSection(ProjectDependencies) = postProject {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} @@ -176,22 +155,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests", "GVF ProjectSection(ProjectDependencies) = postProject {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} {07F2A520-2AB7-46DD-97C0-75D8E988D55B} = {07F2A520-2AB7-46DD-97C0-75D8E988D55B} - {28939122-7263-41E7-A7E2-CBFB01AD6A04} = {28939122-7263-41E7-A7E2-CBFB01AD6A04} {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} = {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} {32220664-594C-4425-B9A0-88E0BE2F3D2A} = {32220664-594C-4425-B9A0-88E0BE2F3D2A} {FA273F69-5762-43D8-AEA1-B4F08090D624} = {FA273F69-5762-43D8-AEA1-B4F08090D624} {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} = {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests.LockHolder", "GVFS\GVFS.FunctionalTests.LockHolder\GVFS.FunctionalTests.LockHolder.csproj", "{FA273F69-5762-43D8-AEA1-B4F08090D624}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Hooks.Mac", "GVFS\GVFS.Hooks\GVFS.Hooks.Mac.csproj", "{4CC2A90D-D240-4382-B4BF-5E175515E492}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Upgrader", "GVFS\GVFS.Upgrader\GVFS.Upgrader.csproj", "{AECEC217-2499-403D-B0BB-2962B9BE5970}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.PostIndexChangedHook.Windows", "GVFS\GVFS.PostIndexChangedHook\GVFS.PostIndexChangedHook.Windows.vcxproj", "{24D161E9-D1F0-4299-BBD3-5D940BEDD535}" @@ -261,14 +233,6 @@ Global {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Release.Mac|x64.ActiveCfg = Release|x64 {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Release.Windows|x64.ActiveCfg = Release|x64 {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Release.Windows|x64.Build.0 = Release|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Mac|x64.Build.0 = Debug|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Debug.Windows|x64.Build.0 = Debug|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Mac|x64.ActiveCfg = Release|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Mac|x64.Build.0 = Release|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Windows|x64.ActiveCfg = Release|x64 - {03769A07-F216-456B-886B-E07CAF6C5E81}.Release.Windows|x64.Build.0 = Release|x64 {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Mac|x64.ActiveCfg = Debug|x64 {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Windows|x64.ActiveCfg = Debug|x64 {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug.Windows|x64.Build.0 = Debug|x64 @@ -305,12 +269,6 @@ Global {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Release.Mac|x64.ActiveCfg = Release|x64 {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Release.Windows|x64.ActiveCfg = Release|x64 {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Release.Windows|x64.Build.0 = Release|x64 - {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Debug.Mac|x64.Build.0 = Debug|x64 - {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Release.Mac|x64.ActiveCfg = Release|x64 - {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Release.Mac|x64.Build.0 = Release|x64 - {25229A04-6554-49B1-A95A-3F3B76C5B0C8}.Release.Windows|x64.ActiveCfg = Release|x64 {2F63B22B-EE26-4266-BF17-28A9146483A1}.Debug.Mac|x64.ActiveCfg = Debug|x64 {2F63B22B-EE26-4266-BF17-28A9146483A1}.Debug.Windows|x64.ActiveCfg = Debug|x64 {2F63B22B-EE26-4266-BF17-28A9146483A1}.Debug.Windows|x64.Build.0 = Debug|x64 @@ -331,22 +289,6 @@ Global {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Mac|x64.Build.0 = Release|x64 {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Windows|x64.ActiveCfg = Release|x64 {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Windows|x64.Build.0 = Release|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Mac|x64.Build.0 = Debug|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Debug.Windows|x64.Build.0 = Debug|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Mac|x64.ActiveCfg = Release|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Mac|x64.Build.0 = Release|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Windows|x64.ActiveCfg = Release|x64 - {FAC6EFC5-A890-4CB2-8C80-6358E358C637}.Release.Windows|x64.Build.0 = Release|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Mac|x64.Build.0 = Debug|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Debug.Windows|x64.Build.0 = Debug|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Mac|x64.ActiveCfg = Release|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Mac|x64.Build.0 = Release|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Windows|x64.ActiveCfg = Release|x64 - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A}.Release.Windows|x64.Build.0 = Release|x64 {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Mac|x64.ActiveCfg = Debug|x64 {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Mac|x64.Build.0 = Debug|x64 {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Windows|x64.ActiveCfg = Debug|x64 @@ -369,14 +311,6 @@ Global {4CE404E7-D3FC-471C-993C-64615861EA63}.Release.Mac|x64.ActiveCfg = Release|x64 {4CE404E7-D3FC-471C-993C-64615861EA63}.Release.Windows|x64.ActiveCfg = Release|x64 {4CE404E7-D3FC-471C-993C-64615861EA63}.Release.Windows|x64.Build.0 = Release|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Mac|x64.Build.0 = Debug|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Debug.Windows|x64.Build.0 = Debug|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Mac|x64.ActiveCfg = Release|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Mac|x64.Build.0 = Release|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Windows|x64.ActiveCfg = Release|x64 - {28939122-7263-41E7-A7E2-CBFB01AD6A04}.Release.Windows|x64.Build.0 = Release|x64 {32220664-594C-4425-B9A0-88E0BE2F3D2A}.Debug.Mac|x64.ActiveCfg = Debug|x64 {32220664-594C-4425-B9A0-88E0BE2F3D2A}.Debug.Windows|x64.ActiveCfg = Debug|x64 {32220664-594C-4425-B9A0-88E0BE2F3D2A}.Debug.Windows|x64.Build.0 = Debug|x64 @@ -389,14 +323,6 @@ Global {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Release.Mac|x64.ActiveCfg = Release|x64 {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Release.Windows|x64.ActiveCfg = Release|x64 {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Release.Windows|x64.Build.0 = Release|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Mac|x64.Build.0 = Debug|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Debug.Windows|x64.Build.0 = Debug|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Mac|x64.ActiveCfg = Release|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Mac|x64.Build.0 = Release|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Windows|x64.ActiveCfg = Release|x64 - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0}.Release.Windows|x64.Build.0 = Release|x64 {0F0A008E-AB12-40EC-A671-37A541B08C7F}.Debug.Mac|x64.ActiveCfg = Debug|x64 {0F0A008E-AB12-40EC-A671-37A541B08C7F}.Debug.Windows|x64.ActiveCfg = Debug|x64 {0F0A008E-AB12-40EC-A671-37A541B08C7F}.Debug.Windows|x64.Build.0 = Debug|x64 @@ -419,22 +345,14 @@ Global {FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Mac|x64.Build.0 = Release|x64 {FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Windows|x64.ActiveCfg = Release|x64 {FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Windows|x64.Build.0 = Release|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Mac|x64.Build.0 = Debug|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Debug.Windows|x64.Build.0 = Debug|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Mac|x64.ActiveCfg = Release|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Mac|x64.Build.0 = Release|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Windows|x64.ActiveCfg = Release|x64 - {4CC2A90D-D240-4382-B4BF-5E175515E492}.Release.Windows|x64.Build.0 = Release|x64 {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.ActiveCfg = Debug|x64 + {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.Build.0 = Debug|x64 {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Windows|x64.ActiveCfg = Debug|x64 {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Windows|x64.Build.0 = Debug|x64 {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.ActiveCfg = Release|x64 + {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.Build.0 = Release|x64 {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Windows|x64.ActiveCfg = Release|x64 {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Windows|x64.Build.0 = Release|x64 - {AECEC217-2499-403D-B0BB-2962B9BE5970}.Debug.Mac|x64.Build.0 = Debug|x64 - {AECEC217-2499-403D-B0BB-2962B9BE5970}.Release.Mac|x64.Build.0 = Release|x64 {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Mac|x64.ActiveCfg = Debug|x64 {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Windows|x64.ActiveCfg = Debug|x64 {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug.Windows|x64.Build.0 = Debug|x64 @@ -454,30 +372,23 @@ Global {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {03769A07-F216-456B-886B-E07CAF6C5E81} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {28674A4B-1223-4633-A460-C8CC39B09318} = {DCE11095-DA5F-4878-B58D-2702765560F5} {C5D3CA26-562F-4CA4-A378-B93E97A730E3} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} {93B403FD-DAFB-46C5-9636-B122792A548A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {A4984251-840E-4622-AD0C-66DFCE2B2574} = {AB0D9230-3893-4486-8899-F9C871FB5D5F} {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {25229A04-6554-49B1-A95A-3F3B76C5B0C8} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {2F63B22B-EE26-4266-BF17-28A9146483A1} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {F468B05A-95E5-46BC-8C67-B80A78527B7D} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {FAC6EFC5-A890-4CB2-8C80-6358E358C637} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {1DAC3DA6-3D21-4917-B9A8-D60C8712252A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {0D434FA7-6D8C-481E-B0CE-779B59EAEF53} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} {4CE404E7-D3FC-471C-993C-64615861EA63} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {28939122-7263-41E7-A7E2-CBFB01AD6A04} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {32220664-594C-4425-B9A0-88E0BE2F3D2A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {35CA4DFB-1320-4055-B8F6-F12E0F252FF0} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {0F0A008E-AB12-40EC-A671-37A541B08C7F} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} {FA273F69-5762-43D8-AEA1-B4F08090D624} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} - {4CC2A90D-D240-4382-B4BF-5E175515E492} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {AECEC217-2499-403D-B0BB-2962B9BE5970} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} EndGlobalSection diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs b/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs index a1e47f35d5..2a64fdeadc 100644 --- a/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs +++ b/GVFS/GVFS.FunctionalTests.LockHolder/AcquireGVFSLock.cs @@ -1,7 +1,6 @@ using CommandLine; using GVFS.Common; using GVFS.Common.NamedPipes; -using GVFS.Platform.Mac; using GVFS.Platform.Windows; using System; using System.Diagnostics; @@ -43,11 +42,6 @@ public void Execute() private static bool TryGetGVFSEnlistmentRootImplementation(string directory, out string enlistmentRoot, out string errorMessage) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage); - } - // Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll). enlistmentRoot = null; @@ -70,11 +64,6 @@ private static bool TryGetGVFSEnlistmentRootImplementation(string directory, out private static string GetNamedPipeNameImplementation(string enlistmentRoot) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return MacPlatform.GetNamedPipeNameImplementation(enlistmentRoot); - } - // Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll). return "GVFS_" + enlistmentRoot.ToUpper().Replace(':', '_'); } diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj b/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj index 82a673437f..837fd98698 100644 --- a/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj +++ b/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj @@ -25,7 +25,6 @@ - diff --git a/GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj b/GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj deleted file mode 100644 index 9cf4b76519..0000000000 --- a/GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj +++ /dev/null @@ -1,112 +0,0 @@ - - - - Exe - GVFS.Hooks - netcoreapp2.1 - x64 - osx-x64 - false - - - - GVFS.Hooks - GVFS.Hooks - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - - - - - Common\ConsoleHelper.cs - - - Common\Git\GitConfigHelper.cs - - - Common\Git\GitConfigSetting.cs - - - Common\Git\GitVersion.cs - - - Common\GVFSConstants.cs - - - Common\GVFSEnlistment.Shared.cs - - - Common\GVFSLock.Shared.cs - - - Common\NamedPipes\BrokenPipeException.cs - - - Common\NamedPipes\LockNamedPipeMessages.cs - - - Common\NamedPipes\NamedPipeClient.cs - - - Common\NamedPipes\NamedPipeStreamReader.cs - - - Common\NamedPipes\NamedPipeStreamWriter.cs - - - Common\NativeMethods.Shared.cs - - - Common\Paths.Shared.cs - - - Common\ProcessHelper.cs - - - Common\ProcessResult.cs - - - - Common\Tracing\EventLevel.cs - - - Common\Tracing\EventMetadata.cs - - - Common\Tracing\EventOpcode.cs - - - Common\Tracing\ITracer.cs - - - Common\Tracing\Keywords.cs - - - POSIX\POSIXFileSystem.Shared.cs - - - POSIX\POSIXPlatform.Shared.cs - - - Mac\MacPlatform.Shared.cs - - - - - - all - - - diff --git a/GVFS/GVFS.Installer.Mac/GVFS.Installer.Mac.csproj b/GVFS/GVFS.Installer.Mac/GVFS.Installer.Mac.csproj deleted file mode 100644 index 5c05fceb38..0000000000 --- a/GVFS/GVFS.Installer.Mac/GVFS.Installer.Mac.csproj +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - GVFS.Installer.Mac - GVFS.Installer.Mac - netcoreapp2.1 - x64 - osx-x64 - - - - $(GVFSVersion) - - - - $(GVFSVersion) - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Mount/GVFS.Mount.Mac.csproj b/GVFS/GVFS.Mount/GVFS.Mount.Mac.csproj deleted file mode 100644 index 11d456863f..0000000000 --- a/GVFS/GVFS.Mount/GVFS.Mount.Mac.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - Exe - gvfs.mount - netcoreapp2.1 - x64 - osx-x64 - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - PlatformLoader.Mac.cs - - - - - - - - - - - all - - - - diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/contents.xcworkspacedata b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 790b6419be..0000000000 --- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings deleted file mode 100644 index 08de0be8d3..0000000000 --- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded - - - diff --git a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/xcschemes/GVFS.Native.Mac.xcscheme b/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/xcschemes/GVFS.Native.Mac.xcscheme deleted file mode 100644 index c6476e6593..0000000000 --- a/GVFS/GVFS.Native.Mac/GVFS.Native.Mac.xcworkspace/xcshareddata/xcschemes/GVFS.Native.Mac.xcscheme +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/DiskLayout18to19Upgrade_SqlitePlacholders.cs b/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/DiskLayout18to19Upgrade_SqlitePlacholders.cs deleted file mode 100644 index f844b235b8..0000000000 --- a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/DiskLayout18to19Upgrade_SqlitePlacholders.cs +++ /dev/null @@ -1,9 +0,0 @@ -using GVFS.Common.DiskLayoutUpgrades; - -namespace GVFS.Platform.Mac.DiskLayoutUpgrades -{ - public class DiskLayout18to19Upgrade_SqlitePlacholders : DiskLayoutUpgrade_SqlitePlaceholders - { - protected override int SourceMajorVersion => 18; - } -} diff --git a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs b/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs deleted file mode 100644 index bd257b313c..0000000000 --- a/GVFS/GVFS.Platform.Mac/DiskLayoutUpgrades/MacDiskLayoutUpgradeData.cs +++ /dev/null @@ -1,31 +0,0 @@ -using GVFS.Common; -using GVFS.DiskLayoutUpgrades; -using GVFS.Platform.Mac.DiskLayoutUpgrades; - -namespace GVFS.Platform.Mac -{ - public class MacDiskLayoutUpgradeData : IDiskLayoutUpgradeData - { - public DiskLayoutUpgrade[] Upgrades - { - get - { - return new DiskLayoutUpgrade[] - { - new DiskLayout18to19Upgrade_SqlitePlacholders(), - }; - } - } - - public DiskLayoutVersion Version => new DiskLayoutVersion( - currentMajorVersion: 19, - currentMinorVersion: 0, - minimumSupportedMajorVersion: 18); - - public bool TryParseLegacyDiskLayoutVersion(string dotGVFSPath, out int majorVersion) - { - majorVersion = 0; - return false; - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/GVFS.Platform.Mac.csproj b/GVFS/GVFS.Platform.Mac/GVFS.Platform.Mac.csproj deleted file mode 100644 index d702269054..0000000000 --- a/GVFS/GVFS.Platform.Mac/GVFS.Platform.Mac.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - netcoreapp2.1;netstandard2.0 - x64 - true - true - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - $(GVFSVersion) - - - - - - - - - - - - - all - - - - - - - diff --git a/GVFS/GVFS.Platform.Mac/MacDaemonController.cs b/GVFS/GVFS.Platform.Mac/MacDaemonController.cs deleted file mode 100644 index a54e9a38dc..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacDaemonController.cs +++ /dev/null @@ -1,74 +0,0 @@ -using GVFS.Common; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace GVFS.Platform.Mac -{ - /// - /// Class to query the configured services on macOS - /// - public class MacDaemonController - { - private const string LaunchCtlPath = @"/bin/launchctl"; - private const string LaunchCtlArg = @"list"; - - private IProcessRunner processRunner; - - public MacDaemonController(IProcessRunner processRunner) - { - this.processRunner = processRunner; - } - - public bool TryGetDaemons(string currentUser, out List daemons, out string error) - { - // Consider for future improvement: - // Use Launchtl to run Launchctl as the "real" user, so we can get the process list from the user. - ProcessResult result = this.processRunner.Run(LaunchCtlPath, "asuser " + currentUser + " " + LaunchCtlPath + " " + LaunchCtlArg, true); - - if (result.ExitCode != 0) - { - error = result.Output; - daemons = null; - return false; - } - - return this.TryParseOutput(result.Output, out daemons, out error); - } - - private bool TryParseOutput(string output, out List daemonInfos, out string error) - { - daemonInfos = new List(); - - // 1st line is the header, skip it - foreach (string line in output.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).Skip(1)) - { - // The expected output is a list of tab delimited entried: - // PID\tSTATUS\tLABEL - string[] tokens = line.Split('\t'); - - if (tokens.Length != 3) - { - daemonInfos = null; - error = $"Unexpected number of tokens in line: {line}"; - return false; - } - - string label = tokens[2]; - bool isRunning = int.TryParse(tokens[0], out _); - - daemonInfos.Add(new DaemonInfo() { Name = label, IsRunning = isRunning }); - } - - error = null; - return true; - } - - public class DaemonInfo - { - public string Name { get; set; } - public bool IsRunning { get; set; } - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/MacFileBasedLock.cs b/GVFS/GVFS.Platform.Mac/MacFileBasedLock.cs deleted file mode 100644 index 10451482fe..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacFileBasedLock.cs +++ /dev/null @@ -1,133 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace GVFS.Platform.Mac -{ - public class MacFileBasedLock : FileBasedLock - { - private int lockFileDescriptor; - - public MacFileBasedLock( - PhysicalFileSystem fileSystem, - ITracer tracer, - string lockPath) - : base(fileSystem, tracer, lockPath) - { - this.lockFileDescriptor = NativeMethods.InvalidFileDescriptor; - } - - public override bool TryAcquireLock() - { - if (this.lockFileDescriptor == NativeMethods.InvalidFileDescriptor) - { - this.FileSystem.CreateDirectory(Path.GetDirectoryName(this.LockPath)); - - this.lockFileDescriptor = NativeMethods.Open( - this.LockPath, - NativeMethods.OpenCreate | NativeMethods.OpenWriteOnly, - NativeMethods.FileMode644); - - if (this.lockFileDescriptor == NativeMethods.InvalidFileDescriptor) - { - int errno = Marshal.GetLastWin32Error(); - EventMetadata metadata = this.CreateEventMetadata(errno); - this.Tracer.RelatedWarning( - metadata, - $"{nameof(MacFileBasedLock)}.{nameof(this.TryAcquireLock)}: Failed to open lock file"); - - return false; - } - } - - if (NativeMethods.FLock(this.lockFileDescriptor, NativeMethods.LockEx | NativeMethods.LockNb) != 0) - { - int errno = Marshal.GetLastWin32Error(); - if (errno != NativeMethods.EIntr && errno != NativeMethods.EWouldBlock) - { - EventMetadata metadata = this.CreateEventMetadata(errno); - this.Tracer.RelatedWarning( - metadata, - $"{nameof(MacFileBasedLock)}.{nameof(this.TryAcquireLock)}: Unexpected error when locking file"); - } - - return false; - } - - return true; - } - - public override void Dispose() - { - if (this.lockFileDescriptor != NativeMethods.InvalidFileDescriptor) - { - if (NativeMethods.Close(this.lockFileDescriptor) != 0) - { - // Failures of close() are logged for diagnostic purposes only. - // It's possible that errors from a previous operation (e.g. write(2)) - // are only reported in close(). We should *not* retry the close() if - // it fails since it may cause a re-used file descriptor from another - // thread to be closed. - - int errno = Marshal.GetLastWin32Error(); - EventMetadata metadata = this.CreateEventMetadata(errno); - this.Tracer.RelatedWarning( - metadata, - $"{nameof(MacFileBasedLock)}.{nameof(this.Dispose)}: Error when closing lock fd"); - } - - this.lockFileDescriptor = NativeMethods.InvalidFileDescriptor; - } - } - - private EventMetadata CreateEventMetadata(int errno = 0) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(MacFileBasedLock)); - metadata.Add(nameof(this.LockPath), this.LockPath); - if (errno != 0) - { - metadata.Add(nameof(errno), errno); - } - - return metadata; - } - - private static class NativeMethods - { - // #define O_WRONLY 0x0001 /* open for writing only */ - public const int OpenWriteOnly = 0x0001; - - // #define O_CREAT 0x0200 /* create if nonexistant */ - public const int OpenCreate = 0x0200; - - // #define EINTR 4 /* Interrupted system call */ - public const int EIntr = 4; - - // #define EAGAIN 35 /* Resource temporarily unavailable */ - // #define EWOULDBLOCK EAGAIN /* Operation would block */ - public const int EWouldBlock = 35; - - public const int LockSh = 1; // #define LOCK_SH 1 /* shared lock */ - public const int LockEx = 2; // #define LOCK_EX 2 /* exclusive lock */ - public const int LockNb = 4; // #define LOCK_NB 4 /* don't block when locking */ - public const int LockUn = 8; // #define LOCK_UN 8 /* unlock */ - - public const int InvalidFileDescriptor = -1; - - public static readonly ushort FileMode644 = Convert.ToUInt16("644", 8); - - [DllImport("libc", EntryPoint = "open", SetLastError = true)] - public static extern int Open(string pathname, int flags, ushort mode); - - [DllImport("libc", EntryPoint = "close", SetLastError = true)] - public static extern int Close(int fd); - - [DllImport("libc", EntryPoint = "flock", SetLastError = true)] - public static extern int FLock(int fd, int operation); - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/MacFileSystem.cs b/GVFS/GVFS.Platform.Mac/MacFileSystem.cs deleted file mode 100644 index 39119e30e5..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacFileSystem.cs +++ /dev/null @@ -1,186 +0,0 @@ -using GVFS.Common; -using GVFS.Platform.POSIX; -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace GVFS.Platform.Mac -{ - public class MacFileSystem : POSIXFileSystem - { - public override void ChangeMode(string path, ushort mode) - { - Chmod(path, mode); - } - - public override bool HydrateFile(string fileName, byte[] buffer) - { - return NativeFileReader.TryReadFirstByteOfFile(fileName, buffer); - } - - public override bool IsExecutable(string fileName) - { - NativeStat.StatBuffer statBuffer = this.StatFile(fileName); - return NativeStat.IsExecutable(statBuffer.Mode); - } - - public override bool IsSocket(string fileName) - { - NativeStat.StatBuffer statBuffer = this.StatFile(fileName); - return NativeStat.IsSock(statBuffer.Mode); - } - - public override bool IsFileSystemSupported(string path, out string error) - { - error = null; - - try - { - string lowerCaseFilePath = Path.Combine(path, $"casetest{Guid.NewGuid().ToString()}"); - string upperCaseFilePath = lowerCaseFilePath.ToUpper(); - - File.Create(lowerCaseFilePath); - if (File.Exists(upperCaseFilePath)) - { - File.Delete(lowerCaseFilePath); - return true; - } - - File.Delete(lowerCaseFilePath); - error = "VFS for Git does not support case sensitive filesystems"; - return false; - } - catch (Exception ex) - { - error = $"Exception when performing {nameof(MacFileSystem)}.{nameof(this.IsFileSystemSupported)}: {ex.ToString()}"; - return false; - } - } - - [DllImport("libc", EntryPoint = "chmod", SetLastError = true)] - private static extern int Chmod(string pathname, ushort mode); - - private NativeStat.StatBuffer StatFile(string fileName) - { - if (NativeStat.Stat(fileName, out NativeStat.StatBuffer statBuffer) != 0) - { - NativeMethods.ThrowLastWin32Exception($"Failed to stat {fileName}"); - } - - return statBuffer; - } - - private static class NativeStat - { - // #define S_IFMT 0170000 /* [XSI] type of file mask */ - private static readonly ushort IFMT = Convert.ToUInt16("170000", 8); - - // #define S_IFSOCK 0140000 /* [XSI] socket */ - private static readonly ushort IFSOCK = Convert.ToUInt16("0140000", 8); - - // #define S_IXUSR 0000100 /* [XSI] X for owner */ - private static readonly ushort IXUSR = Convert.ToUInt16("100", 8); - - // #define S_IXGRP 0000010 /* [XSI] X for group */ - private static readonly ushort IXGRP = Convert.ToUInt16("10", 8); - - // #define S_IXOTH 0000001 /* [XSI] X for other */ - private static readonly ushort IXOTH = Convert.ToUInt16("1", 8); - - public static bool IsSock(ushort mode) - { - // #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* socket */ - return (mode & IFMT) == IFSOCK; - } - - public static bool IsExecutable(ushort mode) - { - return (mode & (IXUSR | IXGRP | IXOTH)) != 0; - } - - [DllImport("libc", EntryPoint = "stat$INODE64", SetLastError = true)] - public static extern int Stat(string path, [Out] out StatBuffer statBuffer); - - [StructLayout(LayoutKind.Sequential)] - public struct TimeSpec - { - public long Sec; - public long Nsec; - } - - [StructLayout(LayoutKind.Sequential)] - public struct StatBuffer - { - public int Dev; /* ID of device containing file */ - public ushort Mode; /* Mode of file (see below) */ - public ushort NLink; /* Number of hard links */ - public ulong Ino; /* File serial number */ - public uint UID; /* User ID of the file */ - public uint GID; /* Group ID of the file */ - public int RDev; /* Device ID */ - - public TimeSpec ATimespec; /* time of last access */ - public TimeSpec MTimespec; /* time of last data modification */ - public TimeSpec CTimespec; /* time of last status change */ - public TimeSpec BirthTimespec; /* time of file creation(birth) */ - - public long Size; /* file size, in bytes */ - public long Blocks; /* blocks allocated for file */ - public int BlkSize; /* optimal blocksize for I/O */ - public uint Glags; /* user defined flags for file */ - public uint Gen; /* file generation number */ - public int LSpare; /* RESERVED: DO NOT USE! */ - - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public long[] QSpare; /* RESERVED: DO NOT USE! */ - } - } - - private static class NativeFileReader - { - // #define O_RDONLY 0x0000 /* open for reading only */ - private const int ReadOnly = 0x0000; - - internal static bool TryReadFirstByteOfFile(string fileName, byte[] buffer) - { - int fileDescriptor = -1; - bool readStatus = false; - try - { - fileDescriptor = Open(fileName, ReadOnly); - if (fileDescriptor != -1) - { - readStatus = TryReadOneByte(fileDescriptor, buffer); - } - } - finally - { - Close(fileDescriptor); - } - - return readStatus; - } - - [DllImport("libc", EntryPoint = "open", SetLastError = true)] - private static extern int Open(string path, int flag); - - [DllImport("libc", EntryPoint = "close", SetLastError = true)] - private static extern int Close(int fd); - - [DllImport("libc", EntryPoint = "read", SetLastError = true)] - private static extern int Read(int fd, [Out] byte[] buf, int count); - - private static bool TryReadOneByte(int fileDescriptor, byte[] buffer) - { - int numBytes = Read(fileDescriptor, buffer, 1); - - if (numBytes == -1) - { - return false; - } - - return true; - } - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/MacFileSystemVirtualizer.cs b/GVFS/GVFS.Platform.Mac/MacFileSystemVirtualizer.cs deleted file mode 100644 index 2efb84f2e3..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacFileSystemVirtualizer.cs +++ /dev/null @@ -1,734 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using GVFS.Virtualization.BlobSize; -using GVFS.Virtualization.FileSystem; -using GVFS.Virtualization.Projection; -using PrjFSLib.Mac; -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Threading; - -namespace GVFS.Platform.Mac -{ - public class MacFileSystemVirtualizer : FileSystemVirtualizer - { - public static readonly byte[] PlaceholderVersionId = ToVersionIdByteArray(new byte[] { PlaceholderVersion }); - - private const int SymLinkTargetBufferSize = 4096; - private const long DummyFileSize = -1; - - private const string ClassName = nameof(MacFileSystemVirtualizer); - - private VirtualizationInstance virtualizationInstance; - - public MacFileSystemVirtualizer(GVFSContext context, GVFSGitObjects gitObjects) - : this(context, gitObjects, virtualizationInstance: null) - { - } - - public MacFileSystemVirtualizer( - GVFSContext context, - GVFSGitObjects gitObjects, - VirtualizationInstance virtualizationInstance) - : base(context, gitObjects) - { - this.virtualizationInstance = virtualizationInstance ?? new VirtualizationInstance(); - } - - protected override string EtwArea => ClassName; - - public static FSResult ResultToFSResult(Result result) - { - switch (result) - { - case Result.Invalid: - return FSResult.IOError; - - case Result.Success: - return FSResult.Ok; - - case Result.EFileNotFound: - case Result.EPathNotFound: - return FSResult.FileOrPathNotFound; - - case Result.EDirectoryNotEmpty: - return FSResult.DirectoryNotEmpty; - - case Result.EVirtualizationInvalidOperation: - return FSResult.VirtualizationInvalidOperation; - - default: - return FSResult.IOError; - } - } - - public override FileSystemResult ClearNegativePathCache(out uint totalEntryCount) - { - totalEntryCount = 0; - return new FileSystemResult(FSResult.Ok, rawResult: unchecked((int)Result.Success)); - } - - public override FileSystemResult DeleteFile(string relativePath, UpdatePlaceholderType updateFlags, out UpdateFailureReason failureReason) - { - UpdateFailureCause failureCause; - Result result = this.virtualizationInstance.DeleteFile(relativePath, (UpdateType)updateFlags, out failureCause); - failureReason = (UpdateFailureReason)failureCause; - return new FileSystemResult(ResultToFSResult(result), unchecked((int)result)); - } - - public override void Stop() - { - this.Context.Tracer.RelatedEvent(EventLevel.Informational, $"{nameof(this.Stop)}_StopRequested", metadata: null); - } - - /// - /// Writes a placeholder file. - /// - /// Placeholder's path relative to the root of the repo - /// Length of the file (ignored on this platform) - /// The SHA of the placeholder's contents, stored as the content ID in the placeholder - public override FileSystemResult WritePlaceholderFile( - string relativePath, - long endOfFile, - string sha) - { - // TODO(#223): Add functional tests that validate file mode is set correctly - GitIndexProjection.FileType fileType; - ushort fileMode; - this.FileSystemCallbacks.GitIndexProjection.GetFileTypeAndMode(relativePath, out fileType, out fileMode); - - if (fileType == GitIndexProjection.FileType.Regular) - { - Result result = this.virtualizationInstance.WritePlaceholderFile( - relativePath, - PlaceholderVersionId, - ToVersionIdByteArray(FileSystemVirtualizer.ConvertShaToContentId(sha)), - fileMode); - - return new FileSystemResult(ResultToFSResult(result), unchecked((int)result)); - } - else if (fileType == GitIndexProjection.FileType.SymLink) - { - string symLinkTarget; - if (this.TryGetSymLinkTarget(sha, out symLinkTarget)) - { - Result result = this.virtualizationInstance.WriteSymLink(relativePath, symLinkTarget); - - this.FileSystemCallbacks.OnFileSymLinkCreated(relativePath); - - return new FileSystemResult(ResultToFSResult(result), unchecked((int)result)); - } - - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(sha), sha); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.WritePlaceholderFile)}: Failed to read contents of symlink object"); - return new FileSystemResult(FSResult.IOError, 0); - } - else - { - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(fileType), fileType); - metadata.Add(nameof(fileMode), fileMode); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.WritePlaceholderFile)}: Unsupported fileType"); - return new FileSystemResult(FSResult.IOError, 0); - } - } - - public override FileSystemResult WritePlaceholderDirectory(string relativePath) - { - Result result = this.virtualizationInstance.WritePlaceholderDirectory(relativePath); - return new FileSystemResult(ResultToFSResult(result), unchecked((int)result)); - } - - /// Length of the file, not required on the Mac platform - public override FileSystemResult UpdatePlaceholderIfNeeded( - string relativePath, - DateTime creationTime, - DateTime lastAccessTime, - DateTime lastWriteTime, - DateTime changeTime, - FileAttributes fileAttributes, - long endOfFile, - string shaContentId, - UpdatePlaceholderType updateFlags, - out UpdateFailureReason failureReason) - { - UpdateFailureCause failureCause = UpdateFailureCause.NoFailure; - - // TODO(#223): Add functional tests that include: - // - Mode + content changes between commits - // - Mode only changes (without any change to content, see issue #223) - GitIndexProjection.FileType fileType; - ushort fileMode; - this.FileSystemCallbacks.GitIndexProjection.GetFileTypeAndMode(relativePath, out fileType, out fileMode); - - if (fileType == GitIndexProjection.FileType.Regular) - { - Result result = this.virtualizationInstance.UpdatePlaceholderIfNeeded( - relativePath, - PlaceholderVersionId, - ToVersionIdByteArray(ConvertShaToContentId(shaContentId)), - fileMode, - (UpdateType)updateFlags, - out failureCause); - - failureReason = (UpdateFailureReason)failureCause; - return new FileSystemResult(ResultToFSResult(result), unchecked((int)result)); - } - else if (fileType == GitIndexProjection.FileType.SymLink) - { - string symLinkTarget; - if (this.TryGetSymLinkTarget(shaContentId, out symLinkTarget)) - { - Result result = this.virtualizationInstance.ReplacePlaceholderFileWithSymLink( - relativePath, - symLinkTarget, - (UpdateType)updateFlags, - out failureCause); - - this.FileSystemCallbacks.OnFileSymLinkCreated(relativePath); - - failureReason = (UpdateFailureReason)failureCause; - return new FileSystemResult(ResultToFSResult(result), unchecked((int)result)); - } - - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(shaContentId), shaContentId); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.UpdatePlaceholderIfNeeded)}: Failed to read contents of symlink object"); - failureReason = UpdateFailureReason.NoFailure; - return new FileSystemResult(FSResult.IOError, 0); - } - else - { - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(fileType), fileType); - metadata.Add(nameof(fileMode), fileMode); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.UpdatePlaceholderIfNeeded)}: Unsupported fileType"); - failureReason = UpdateFailureReason.NoFailure; - return new FileSystemResult(FSResult.IOError, 0); - } - } - - public override FileSystemResult DehydrateFolder(string relativePath) - { - FileSystemResult result = new FileSystemResult(FSResult.Ok, 0); - GitIndexProjection.PathSparseState sparseState = this.FileSystemCallbacks.GitIndexProjection.GetFolderPathSparseState(relativePath); - - if (sparseState == GitIndexProjection.PathSparseState.Included) - { - // When the folder is included we need to create the placeholder to make sure it is on disk for enumeration - result = this.WritePlaceholderDirectory(relativePath); - if (result.Result == FSResult.Ok) - { - this.FileSystemCallbacks.OnPlaceholderFolderCreated(relativePath, string.Empty); - } - else if (result.Result == FSResult.FileOrPathNotFound) - { - // This will happen when the parent folder is also in the dehydrate list and is no longer on disk. - result = new FileSystemResult(FSResult.Ok, 0); - } - else - { - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(result.Result), result.Result); - metadata.Add(nameof(result.RawResult), result.RawResult); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.DehydrateFolder)}: Write placeholder failed"); - } - } - - return result; - } - - public override bool TryStart(out string error) - { - error = string.Empty; - - // Callbacks - this.virtualizationInstance.OnEnumerateDirectory = this.OnEnumerateDirectory; - this.virtualizationInstance.OnGetFileStream = this.OnGetFileStream; - this.virtualizationInstance.OnLogError = this.OnLogError; - this.virtualizationInstance.OnLogWarning = this.OnLogWarning; - this.virtualizationInstance.OnLogInfo = this.OnLogInfo; - this.virtualizationInstance.OnFileModified = this.OnFileModified; - this.virtualizationInstance.OnPreDelete = this.OnPreDelete; - this.virtualizationInstance.OnNewFileCreated = this.OnNewFileCreated; - this.virtualizationInstance.OnFileRenamed = this.OnFileRenamed; - this.virtualizationInstance.OnHardLinkCreated = this.OnHardLinkCreated; - this.virtualizationInstance.OnFilePreConvertToFull = this.NotifyFilePreConvertToFull; - - uint threadCount = (uint)Environment.ProcessorCount * 2; - - Result result = this.virtualizationInstance.StartVirtualizationInstance( - this.Context.Enlistment.WorkingDirectoryRoot, - threadCount); - - if (result != Result.Success) - { - this.Context.Tracer.RelatedError($"{nameof(this.virtualizationInstance.StartVirtualizationInstance)} failed: " + result.ToString("X") + "(" + result.ToString("G") + ")"); - error = "Failed to start virtualization instance (" + result.ToString() + ")"; - return false; - } - - this.Context.Tracer.RelatedEvent(EventLevel.Informational, $"{nameof(this.TryStart)}_StartedVirtualization", metadata: null); - return true; - } - - private static byte[] ToVersionIdByteArray(byte[] version) - { - byte[] bytes = new byte[VirtualizationInstance.PlaceholderIdLength]; - Buffer.BlockCopy(version, 0, bytes, 0, version.Length); - return bytes; - } - - /// - /// Gets the target of the symbolic link. - /// - /// SHA of the loose object containing the target path of the symbolic link - /// Target path of the symbolic link - private bool TryGetSymLinkTarget(string sha, out string symLinkTarget) - { - symLinkTarget = null; - - string symLinkBlobContents = null; - try - { - if (!this.GitObjects.TryCopyBlobContentStream( - sha, - CancellationToken.None, - GVFSGitObjects.RequestSource.SymLinkCreation, - (stream, blobLength) => - { - byte[] buffer = new byte[SymLinkTargetBufferSize]; - uint bufferIndex = 0; - - // TODO(#1361): Find a better solution than reading from the stream one byte at at time - int nextByte = stream.ReadByte(); - while (nextByte != -1) - { - while (bufferIndex < buffer.Length && nextByte != -1) - { - buffer[bufferIndex] = (byte)nextByte; - nextByte = stream.ReadByte(); - ++bufferIndex; - } - - if (bufferIndex < buffer.Length) - { - buffer[bufferIndex] = 0; - symLinkBlobContents = Encoding.UTF8.GetString(buffer); - } - else - { - buffer[bufferIndex - 1] = 0; - - EventMetadata metadata = this.CreateEventMetadata(); - metadata.Add(nameof(sha), sha); - metadata.Add("bufferContents", Encoding.UTF8.GetString(buffer)); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: SymLink target exceeds buffer size"); - - throw new GetSymLinkTargetException("SymLink target exceeds buffer size"); - } - } - })) - { - EventMetadata metadata = this.CreateEventMetadata(); - metadata.Add(nameof(sha), sha); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: TryCopyBlobContentStream failed"); - - return false; - } - } - catch (GetSymLinkTargetException e) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath: null, exception: e); - metadata.Add(nameof(sha), sha); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: TryCopyBlobContentStream caught GetSymLinkTargetException"); - - return false; - } - catch (DecoderFallbackException e) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath: null, exception: e); - metadata.Add(nameof(sha), sha); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.TryGetSymLinkTarget)}: TryCopyBlobContentStream caught DecoderFallbackException"); - - return false; - } - - symLinkTarget = symLinkBlobContents; - - return true; - } - - private Result OnGetFileStream( - ulong commandId, - string relativePath, - byte[] providerId, - byte[] contentId, - int triggeringProcessId, - string triggeringProcessName, - IntPtr fileHandle) - { - try - { - if (contentId == null) - { - this.Context.Tracer.RelatedError($"{nameof(this.OnGetFileStream)} called with null contentId, path: " + relativePath); - return Result.EInvalidOperation; - } - - if (providerId == null) - { - this.Context.Tracer.RelatedError($"{nameof(this.OnGetFileStream)} called with null epochId, path: " + relativePath); - return Result.EInvalidOperation; - } - - string sha = GetShaFromContentId(contentId); - byte placeholderVersion = GetPlaceholderVersionFromProviderId(providerId); - - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(triggeringProcessId), triggeringProcessId); - metadata.Add(nameof(triggeringProcessName), triggeringProcessName); - metadata.Add(nameof(sha), sha); - metadata.Add(nameof(placeholderVersion), placeholderVersion); - metadata.Add(nameof(commandId), commandId); - ITracer activity = this.Context.Tracer.StartActivity("GetFileStream", EventLevel.Verbose, Keywords.Telemetry, metadata); - - if (placeholderVersion != FileSystemVirtualizer.PlaceholderVersion) - { - activity.RelatedError(metadata, nameof(this.OnGetFileStream) + ": Unexpected placeholder version"); - activity.Dispose(); - - // TODO(#1362): Is this the correct Result to return? - return Result.EIOError; - } - - try - { - if (!this.GitObjects.TryCopyBlobContentStream( - sha, - CancellationToken.None, - GVFSGitObjects.RequestSource.FileStreamCallback, - (stream, blobLength) => - { - // TODO(#1361): Find a better solution than reading from the stream one byte at at time - byte[] buffer = new byte[4096]; - uint bufferIndex = 0; - int nextByte = stream.ReadByte(); - int bytesWritten = 0; - while (nextByte != -1) - { - while (bufferIndex < buffer.Length && nextByte != -1) - { - buffer[bufferIndex] = (byte)nextByte; - nextByte = stream.ReadByte(); - ++bufferIndex; - } - - Result result = this.virtualizationInstance.WriteFileContents( - fileHandle, - buffer, - bufferIndex); - if (result != Result.Success) - { - activity.RelatedError(metadata, $"{nameof(this.virtualizationInstance.WriteFileContents)} failed, error: " + result.ToString("X") + "(" + result.ToString("G") + ")"); - throw new GetFileStreamException(result); - } - - if (bufferIndex == buffer.Length) - { - bufferIndex = 0; - bytesWritten += buffer.Length; - } - } - bytesWritten += Convert.ToInt32(bufferIndex); - - if (bytesWritten != blobLength) - { - // If the read size does not match the expected size print an error and add the file to ModifiedPaths.dat - // This allows the user to see that something went wrong with file hydration - // Unfortunitely we must do this check *after* the file is hydrated since the header isn't corrupt for trunctated objects on mac - this.Context.Tracer.RelatedError($"Read {relativePath} to {bytesWritten}, not expected size of {blobLength}"); - this.FileSystemCallbacks.OnFailedFileHydration(relativePath); - } - })) - { - activity.RelatedError(metadata, $"{nameof(this.OnGetFileStream)}: TryCopyBlobContentStream failed"); - - // TODO(#1362): Is this the correct Result to return? - return Result.EFileNotFound; - } - } - catch (GetFileStreamException e) - { - return e.Result; - } - - this.FileSystemCallbacks.OnPlaceholderFileHydrated(triggeringProcessName); - return Result.Success; - } - catch (Exception e) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath, e); - metadata.Add(nameof(triggeringProcessId), triggeringProcessId); - metadata.Add(nameof(triggeringProcessName), triggeringProcessName); - metadata.Add(nameof(commandId), commandId); - this.LogUnhandledExceptionAndExit(nameof(this.OnGetFileStream), metadata); - } - - return Result.EIOError; - } - - private void OnLogError(string errorMessage) - { - this.Context.Tracer.RelatedError($"{nameof(MacFileSystemVirtualizer)}::{nameof(this.OnLogError)}: {errorMessage}"); - } - - private void OnLogWarning(string warningMessage) - { - this.Context.Tracer.RelatedWarning($"{nameof(MacFileSystemVirtualizer)}::{nameof(this.OnLogWarning)}: {warningMessage}"); - } - - private void OnLogInfo(string infoMessage) - { - this.Context.Tracer.RelatedInfo($"{nameof(MacFileSystemVirtualizer)}::{nameof(this.OnLogInfo)}: {infoMessage}"); - } - - private void OnFileModified(string relativePath) - { - try - { - if (Virtualization.FileSystemCallbacks.IsPathInsideDotGit(relativePath)) - { - this.OnDotGitFileOrFolderChanged(relativePath); - } - } - catch (Exception e) - { - this.LogUnhandledExceptionAndExit(nameof(this.OnFileModified), this.CreateEventMetadata(relativePath, e)); - } - } - - private Result NotifyFilePreConvertToFull(string relativePath) - { - this.OnFilePreConvertToFull(relativePath); - return Result.Success; - } - - private Result OnPreDelete(string relativePath, bool isDirectory) - { - try - { - bool pathInsideDotGit = Virtualization.FileSystemCallbacks.IsPathInsideDotGit(relativePath); - if (pathInsideDotGit) - { - if (relativePath.Equals(GVFSConstants.DotGit.Index, GVFSPlatform.Instance.Constants.PathComparison)) - { - string lockedGitCommand = this.Context.Repository.GVFSLock.GetLockedGitCommand(); - if (string.IsNullOrEmpty(lockedGitCommand)) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", this.EtwArea); - metadata.Add(TracingConstants.MessageKey.WarningMessage, "Blocked index delete outside the lock"); - this.Context.Tracer.RelatedEvent(EventLevel.Warning, $"{nameof(this.OnPreDelete)}_BlockedIndexDelete", metadata); - - return Result.EAccessDenied; - } - } - - this.OnDotGitFileOrFolderDeleted(relativePath); - } - else - { - this.OnWorkingDirectoryFileOrFolderDeleteNotification(relativePath, isDirectory, isPreDelete: true); - } - } - catch (Exception e) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath, e); - metadata.Add("isDirectory", isDirectory); - this.LogUnhandledExceptionAndExit(nameof(this.OnPreDelete), metadata); - } - - return Result.Success; - } - - private void OnNewFileCreated(string relativePath, bool isDirectory) - { - try - { - if (!Virtualization.FileSystemCallbacks.IsPathInsideDotGit(relativePath)) - { - if (isDirectory) - { - string lockedGitCommand = this.Context.Repository.GVFSLock.GetLockedGitCommand(); - GitCommandLineParser gitCommand = new GitCommandLineParser(lockedGitCommand); - if (gitCommand.IsValidGitCommand) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath); - metadata.Add(nameof(lockedGitCommand), lockedGitCommand); - metadata.Add(TracingConstants.MessageKey.InfoMessage, "Git command created new folder"); - this.Context.Tracer.RelatedEvent(EventLevel.Informational, $"{nameof(this.OnNewFileCreated)}_GitCreatedFolder", metadata); - - // Record this folder as expanded so that GitIndexProjection will re-expand the folder - // when the projection change completes. - // - // Git creates new folders when there are files that it needs to create. - // However, git will only create files that are in ModifiedPaths.dat. There could - // be other files in the projection (that were not created by git) and so VFS must re-expand the - // newly created folder to ensure that all files are written to disk. - this.FileSystemCallbacks.OnPlaceholderFolderExpanded(relativePath); - } - else - { - this.FileSystemCallbacks.OnFolderCreated(relativePath, out bool sparseFoldersUpdated); - if (sparseFoldersUpdated) - { - // When sparseFoldersUpdated is true it means the folder was previously excluded from the projection and was - // included so it needs to enumerate the directory to get and create placeholders - // for all the directory items that are now included - this.OnEnumerateDirectory(0, relativePath, -1, $"{nameof(this.OnNewFileCreated)}_FolderIncluded"); - } - } - } - else - { - this.FileSystemCallbacks.OnFileCreated(relativePath); - } - } - } - catch (Exception e) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath, e); - metadata.Add("isDirectory", isDirectory); - this.LogUnhandledExceptionAndExit(nameof(this.OnNewFileCreated), metadata); - } - } - - private void OnFileRenamed(string relativeDestinationPath, bool isDirectory) - { - // ProjFS for Mac *could* be updated to provide us with relativeSourcePath as well, - // but because VFSForGit doesn't need the source path on Mac for correct behavior - // the relativeSourcePath is left out of the notification to keep the kext simple - this.OnFileRenamed( - relativeSourcePath: string.Empty, - relativeDestinationPath: relativeDestinationPath, - isDirectory: isDirectory); - } - - private Result OnEnumerateDirectory( - ulong commandId, - string relativePath, - int triggeringProcessId, - string triggeringProcessName) - { - try - { - IEnumerable projectedItems = this.FileSystemCallbacks.GitIndexProjection.GetProjectedItems( - CancellationToken.None, - blobSizesConnection: null, - folderPath: relativePath); - - return this.CreatePlaceholders(relativePath, projectedItems, triggeringProcessName); - } - catch (Exception e) - { - EventMetadata metadata = this.CreateEventMetadata(relativePath, e); - metadata.Add("commandId", commandId); - this.LogUnhandledExceptionAndExit(nameof(this.OnEnumerateDirectory), metadata); - } - - return Result.EIOError; - } - - private Result CreatePlaceholders(string directoryRelativePath, IEnumerable projectedItems, string triggeringProcessName) - { - foreach (ProjectedFileInfo fileInfo in projectedItems) - { - string childRelativePath = Path.Combine(directoryRelativePath, fileInfo.Name); - - string sha; - FileSystemResult fileSystemResult; - if (fileInfo.IsFolder) - { - sha = string.Empty; - fileSystemResult = this.WritePlaceholderDirectory(childRelativePath); - } - else - { - sha = fileInfo.Sha.ToString(); - - // Writing placeholders on Mac does not require a file size - fileSystemResult = this.WritePlaceholderFile(childRelativePath, DummyFileSize, sha); - } - - Result result = (Result)fileSystemResult.RawResult; - if (result != Result.Success) - { - EventMetadata metadata = this.CreateEventMetadata(childRelativePath); - metadata.Add("fileInfo.Name", fileInfo.Name); - metadata.Add("fileInfo.Size", fileInfo.Size); - metadata.Add("fileInfo.IsFolder", fileInfo.IsFolder); - metadata.Add(nameof(result), result.ToString()); - metadata.Add(nameof(sha), sha); - this.Context.Tracer.RelatedError(metadata, $"{nameof(this.CreatePlaceholders)}: Write placeholder failed"); - - if (result == Result.EIOError) - { - // If there is an IO error writing the placeholder then the file might already exist and it needs to - // be added to the modified paths so that git will show any differences or errors when interacting with the file - // This will happen in the include mode when the user creates a file that is already in the files that - // should be projected but we are trying to create the placeholder after it has already been created - this.FileSystemCallbacks.OnFileConvertedToFull(childRelativePath); - } - else - { - return result; - } - } - else - { - if (fileInfo.IsFolder) - { - this.FileSystemCallbacks.OnPlaceholderFolderCreated(childRelativePath, triggeringProcessName); - } - else - { - this.FileSystemCallbacks.OnPlaceholderFileCreated(childRelativePath, sha, triggeringProcessName); - } - } - } - - this.FileSystemCallbacks.OnPlaceholderFolderExpanded(directoryRelativePath); - - return Result.Success; - } - - private class GetFileStreamException : Exception - { - public GetFileStreamException(Result errorCode) - : this("GetFileStreamException exception, error: " + errorCode.ToString(), errorCode) - { - } - - public GetFileStreamException(string message, Result result) - : base(message) - { - this.Result = result; - } - - public Result Result { get; } - } - - private class GetSymLinkTargetException : Exception - { - public GetSymLinkTargetException(string message) - : base(message) - { - } - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/MacPlatform.Shared.cs b/GVFS/GVFS.Platform.Mac/MacPlatform.Shared.cs deleted file mode 100644 index c2dfcf071f..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacPlatform.Shared.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using System.IO; -using GVFS.Common; -using GVFS.Platform.POSIX; - -namespace GVFS.Platform.Mac -{ - public partial class MacPlatform - { - public const string DotGVFSRoot = ".gvfs"; - public const string UpgradeConfirmMessage = "`sudo gvfs upgrade --confirm --no-verify`"; - - public static string GetDataRootForGVFSImplementation() - { - return Path.Combine( - Environment.GetEnvironmentVariable("HOME"), - "Library", - "Application Support", - "GVFS"); - } - - public static string GetDataRootForGVFSComponentImplementation(string componentName) - { - return Path.Combine(GetDataRootForGVFSImplementation(), componentName); - } - - public static bool TryGetGVFSEnlistmentRootImplementation(string directory, out string enlistmentRoot, out string errorMessage) - { - return POSIXPlatform.TryGetGVFSEnlistmentRootImplementation(directory, DotGVFSRoot, out enlistmentRoot, out errorMessage); - } - - public static string GetUpgradeHighestAvailableVersionDirectoryImplementation() - { - return GetUpgradeNonProtectedDirectoryImplementation(); - } - - public static string GetUpgradeNonProtectedDirectoryImplementation() - { - return Path.Combine(GetDataRootForGVFSImplementation(), ProductUpgraderInfo.UpgradeDirectoryName); - } - - public static string GetNamedPipeNameImplementation(string enlistmentRoot) - { - return POSIXPlatform.GetNamedPipeNameImplementation(enlistmentRoot, DotGVFSRoot); - } - - public static string GetUpgradeReminderNotificationImplementation() - { - return $"A new version of VFS for Git is available. Run {UpgradeConfirmMessage} to upgrade."; - } - - private string GetUpgradeNonProtectedDataDirectory() - { - return GetUpgradeNonProtectedDirectoryImplementation(); - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/MacPlatform.cs b/GVFS/GVFS.Platform.Mac/MacPlatform.cs deleted file mode 100644 index 64030cde98..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacPlatform.cs +++ /dev/null @@ -1,273 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using GVFS.Platform.POSIX; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml; -using System.Xml.Linq; -using System.Xml.XPath; - -namespace GVFS.Platform.Mac -{ - public partial class MacPlatform : POSIXPlatform - { - private const string UpgradeProtectedDataDirectory = "/usr/local/vfsforgit_upgrader"; - private const string DiagnosticReportsDirectory = "/Library/Logs/DiagnosticReports"; - private const string PanicFileNamePattern = "*panic"; - private const string SystemInstallerLogPath = "/var/log/install.log"; - - public MacPlatform() : base( - underConstruction: new UnderConstructionFlags( - supportsGVFSUpgrade: true, - supportsGVFSConfig: true, - supportsNuGetEncryption: false, - supportsNuGetVerification: false)) - { - } - - public override IDiskLayoutUpgradeData DiskLayoutUpgrade { get; } = new MacDiskLayoutUpgradeData(); - public override IKernelDriver KernelDriver { get; } = new ProjFSKext(); - public override string Name { get => "macOS"; } - public override GVFSPlatformConstants Constants { get; } = new MacPlatformConstants(); - public override IPlatformFileSystem FileSystem { get; } = new MacFileSystem(); - - public override string GVFSConfigPath - { - get - { - return Path.Combine(this.Constants.GVFSBinDirectoryPath, LocalGVFSConfig.FileName); - } - } - - /// - /// On the Mac VFSForGit installer messages get captured in the system - /// wide installer log file. There is no customized log file specific - /// to VFSForGit installer. - /// - public override bool SupportsSystemInstallLog - { - get - { - return true; - } - } - - public override string GetOSVersionInformation() - { - ProcessResult result = ProcessHelper.Run("sw_vers", args: string.Empty, redirectOutput: true); - return string.IsNullOrWhiteSpace(result.Output) ? result.Errors : result.Output; - } - - public override string GetSecureDataRootForGVFS() - { - // On the Mac, unlike Windows, there is no separate secure data root directory. - return MacPlatform.GetDataRootForGVFSImplementation(); - } - - public override string GetSecureDataRootForGVFSComponent(string componentName) - { - // On the Mac, unlike Windows, there is no separate secure data root directory. - return MacPlatform.GetDataRootForGVFSComponentImplementation(componentName); - } - - public override string GetCommonAppDataRootForGVFS() - { - return this.GetSecureDataRootForGVFS(); - } - - public override string GetLogsDirectoryForGVFSComponent(string componentName) - { - return Path.Combine(this.GetCommonAppDataRootForGVFS(), componentName); - } - - public override bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage) - { - return MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage); - } - - public override string GetNamedPipeName(string enlistmentRoot) - { - return MacPlatform.GetNamedPipeNameImplementation(enlistmentRoot); - } - - public override FileBasedLock CreateFileBasedLock( - PhysicalFileSystem fileSystem, - ITracer tracer, - string lockPath) - { - return new MacFileBasedLock(fileSystem, tracer, lockPath); - } - - public override string GetUpgradeProtectedDataDirectory() - { - return UpgradeProtectedDataDirectory; - } - - public override string GetUpgradeHighestAvailableVersionDirectory() - { - return GetUpgradeHighestAvailableVersionDirectoryImplementation(); - } - - /// - /// This is the directory in which the upgradelogs directory should go. - /// There can be multiple logs directories, so here we return the containing - /// directory. - /// - public override string GetUpgradeLogDirectoryParentDirectory() - { - return this.GetUpgradeNonProtectedDataDirectory(); - } - - public override string GetSystemInstallerLogPath() - { - return SystemInstallerLogPath; - } - - public override Dictionary GetPhysicalDiskInfo(string path, bool sizeStatsOnly) - { - // DiskUtil will return disk statistics in xml format - ProcessResult processResult = ProcessHelper.Run("diskutil", "info -plist /", true); - Dictionary result = new Dictionary(); - if (string.IsNullOrEmpty(processResult.Output)) - { - result.Add("DiskUtilError", processResult.Errors); - return result; - } - - try - { - // Parse the XML looking for FilesystemType - XDocument xmlDoc = XDocument.Parse(processResult.Output); - XElement filesystemTypeValue = xmlDoc.XPathSelectElement("plist/dict/key[text()=\"FilesystemType\"]")?.NextNode as XElement; - result.Add("FileSystemType", filesystemTypeValue != null ? filesystemTypeValue.Value: "Not Found"); - } - catch (XmlException ex) - { - result.Add("DiskUtilError", ex.ToString()); - } - - return result; - } - - public override ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformInteractions( - PhysicalFileSystem fileSystem, - ITracer tracer) - { - return new MacProductUpgraderPlatformStrategy(fileSystem, tracer); - } - - public override void IsServiceInstalledAndRunning(string name, out bool installed, out bool running) - { - string currentUser = this.GetCurrentUser(); - MacDaemonController macDaemonController = new MacDaemonController(new ProcessRunnerImpl()); - List daemons; - if (!macDaemonController.TryGetDaemons(currentUser, out daemons, out string error)) - { - installed = false; - running = false; - } - - MacDaemonController.DaemonInfo gvfsService = daemons.FirstOrDefault(sc => string.Equals(sc.Name, "org.vfsforgit.service")); - installed = gvfsService != null; - running = installed && gvfsService.IsRunning; - } - - public override bool TryCopyPanicLogs(string copyToDir, out string error) - { - error = null; - try - { - if (!Directory.Exists(DiagnosticReportsDirectory)) - { - return true; - } - - string copyToPanicDir = Path.Combine(copyToDir, ProjFSKext.DriverLogDirectory, "panic_logs"); - Directory.CreateDirectory(copyToPanicDir); - - foreach (string filePath in Directory.GetFiles(DiagnosticReportsDirectory, PanicFileNamePattern)) - { - try - { - // We only include panic logs caused by our kext - // Panics caused by our kext will be in the form DriverName(Version) - // We match the minimal requirement here - if (File.ReadAllText(filePath).Contains(ProjFSKext.DriverName + "(")) - { - File.Copy(filePath, Path.Combine(copyToPanicDir, Path.GetFileName(filePath))); - } - } - catch (Exception ex) - { - error = error == null ? string.Empty : error + "\n"; - error += $"{nameof(this.TryCopyPanicLogs)}: Failed to handle log {filePath}: {ex.ToString()}"; - } - } - } - catch (Exception ex) - { - error = error == null ? string.Empty : error + "\n"; - error += $"{nameof(this.TryCopyPanicLogs)}: Failed to copy panic logs: {ex.ToString()}"; - return false; - } - - return error == null; - } - - public class MacPlatformConstants : POSIXPlatformConstants - { - public override string InstallerExtension - { - get { return ".dmg"; } - } - - public override string WorkingDirectoryBackingRootPath - { - get { return GVFSConstants.WorkingDirectoryRootName; } - } - - public override string DotGVFSRoot - { - get { return MacPlatform.DotGVFSRoot; } - } - - public override string GVFSBinDirectoryPath - { - get { return Path.Combine("/usr", "local", this.GVFSBinDirectoryName); } - } - - public override string GVFSBinDirectoryName - { - get { return "vfsforgit"; } - } - - // Documented here (in the addressing section): https://www.unix.com/man-page/mojave/4/unix/ - public override int MaxPipePathLength => 104; - - public override string UpgradeInstallAdviceMessage - { - get { return $"When ready, run {this.UpgradeConfirmCommandMessage} to upgrade."; } - } - - public override string UpgradeConfirmCommandMessage - { - get { return UpgradeConfirmMessage; } - } - - public override string StartServiceCommandMessage - { - get { return "`launchctl load /Library/LaunchAgents/org.vfsforgit.service.plist`"; } - } - - public override string RunUpdateMessage - { - get { return $"Run {UpgradeConfirmMessage}."; } - } - - public override bool CaseSensitiveFileSystem => false; - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/MacProductUpgraderPlatformStrategy.cs b/GVFS/GVFS.Platform.Mac/MacProductUpgraderPlatformStrategy.cs deleted file mode 100644 index 3237caad82..0000000000 --- a/GVFS/GVFS.Platform.Mac/MacProductUpgraderPlatformStrategy.cs +++ /dev/null @@ -1,62 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System; -using System.IO; - -namespace GVFS.Platform.Mac -{ - public class MacProductUpgraderPlatformStrategy : ProductUpgraderPlatformStrategy - { - public MacProductUpgraderPlatformStrategy(PhysicalFileSystem fileSystem, ITracer tracer) - : base(fileSystem, tracer) - { - } - - public override bool TryPrepareLogDirectory(out string error) - { - error = null; - return true; - } - - public override bool TryPrepareApplicationDirectory(out string error) - { - string upgradeApplicationDirectory = ProductUpgraderInfo.GetUpgradeApplicationDirectory(); - - Exception deleteDirectoryException; - if (this.FileSystem.DirectoryExists(upgradeApplicationDirectory) && - !this.FileSystem.TryDeleteDirectory(upgradeApplicationDirectory, out deleteDirectoryException)) - { - error = $"Failed to delete {upgradeApplicationDirectory} - {deleteDirectoryException.Message}"; - - this.TraceException(deleteDirectoryException, nameof(this.TryPrepareApplicationDirectory), $"Error deleting {upgradeApplicationDirectory}."); - return false; - } - - this.FileSystem.CreateDirectory(upgradeApplicationDirectory); - - error = null; - return true; - } - - public override bool TryPrepareDownloadDirectory(out string error) - { - string directory = ProductUpgraderInfo.GetAssetDownloadsPath(); - - Exception deleteDirectoryException; - if (this.FileSystem.DirectoryExists(directory) && - !this.FileSystem.TryDeleteDirectory(directory, out deleteDirectoryException)) - { - error = $"Failed to delete {directory} - {deleteDirectoryException.Message}"; - - this.TraceException(deleteDirectoryException, nameof(this.TryPrepareDownloadDirectory), $"Error deleting {directory}."); - return false; - } - - this.FileSystem.CreateDirectory(directory); - - error = null; - return true; - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/ProjFSKext.cs b/GVFS/GVFS.Platform.Mac/ProjFSKext.cs deleted file mode 100644 index debaf35e6f..0000000000 --- a/GVFS/GVFS.Platform.Mac/ProjFSKext.cs +++ /dev/null @@ -1,137 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using PrjFSLib.Mac; -using System; -using System.IO; -using System.Linq; - -namespace GVFS.Platform.Mac -{ - public class ProjFSKext : IKernelDriver - { - public const string DriverName = "org.vfsforgit.PrjFSKext"; - public const string DriverLogDirectory = "PrjFSKext"; - - private const int LoadKext_ExitCode_Success = 0; - - // This exit code was found in the following article - // https://developer.apple.com/library/archive/technotes/tn2459/_index.html - private const int LoadKext_ExitCode_NotApproved = 27; - - public bool EnumerationExpandsDirectories { get; } = true; - public bool EmptyPlaceholdersRequireFileSize { get; } = false; - - public string LogsFolderPath - { - get - { - return Path.Combine(System.IO.Path.GetTempPath(), DriverLogDirectory); - } - } - - public bool IsGVFSUpgradeSupported() - { - return true; - } - - public bool IsSupported(string normalizedEnlistmentRootPath, out string warning, out string error) - { - warning = null; - error = null; - - string pathRoot = Path.GetPathRoot(normalizedEnlistmentRootPath); - DriveInfo rootDriveInfo = DriveInfo.GetDrives().FirstOrDefault(x => x.Name == pathRoot); - if (rootDriveInfo == null) - { - warning = $"Unable to ensure that '{normalizedEnlistmentRootPath}' is an APFS or HFS+ volume."; - } - else if (!string.Equals(rootDriveInfo.DriveFormat, "APFS", StringComparison.OrdinalIgnoreCase) && - !string.Equals(rootDriveInfo.DriveFormat, "HFS", StringComparison.OrdinalIgnoreCase)) - { - error = $"Error: Currently only APFS and HFS+ volumes are supported. Ensure repo is located into an APFS or HFS+ volume."; - return false; - } - - return true; - } - - public bool TryFlushLogs(out string error) - { - Directory.CreateDirectory(this.LogsFolderPath); - ProcessResult logShowOutput = ProcessHelper.Run("log", args: "show --predicate \"subsystem contains \'org.vfsforgit\'\" --info", redirectOutput: true); - File.WriteAllText(Path.Combine(this.LogsFolderPath, "PrjFSKext.log"), logShowOutput.Output); - error = string.Empty; - - return true; - } - - public bool IsReady(JsonTracer tracer, string enlistmentRoot, TextWriter output, out string error) - { - error = null; - return - this.IsKextLoaded() || - this.TryLoad(tracer, output, out error); - } - - public bool TryPrepareFolderForCallbacks(string folderPath, out string error, out Exception exception) - { - exception = null; - error = string.Empty; - Result result = VirtualizationInstance.ConvertDirectoryToVirtualizationRoot(folderPath); - if (result != Result.Success) - { - error = "Failed to prepare \"" + folderPath + "\" for callbacks, error: " + result.ToString("F"); - return false; - } - - return true; - } - - public bool RegisterForOfflineIO() - { - return PrjFSLib.Mac.Managed.OfflineIO.RegisterForOfflineIO(); - } - - public bool UnregisterForOfflineIO() - { - return PrjFSLib.Mac.Managed.OfflineIO.UnregisterForOfflineIO(); - } - - private bool TryLoad(ITracer tracer, TextWriter output, out string errorMessage) - { - output?.WriteLine("Driver not loaded. Attempting to load. You may be prompted for sudo password..."); - EventMetadata metadata = new EventMetadata(); - ProcessResult loadKext = ProcessHelper.Run("sudo", "/sbin/kextload -b " + DriverName); - if (loadKext.ExitCode == LoadKext_ExitCode_Success) - { - tracer.RelatedWarning(metadata, $"{DriverName} was successfully loaded but should have been autoloaded.", Keywords.Telemetry); - errorMessage = null; - return true; - } - else if (loadKext.ExitCode == LoadKext_ExitCode_NotApproved) - { - tracer.RelatedError("Kext unable to load. Not approved by the user"); - errorMessage = DriverName + @" was unable to load. Please check and make sure you have allowed the extension in -System Preferences -> Security & Privacy"; - } - else - { - metadata.Add("ExitCode", loadKext.ExitCode); - metadata.Add("Output", loadKext.Output); - metadata.Add("Errors", loadKext.Errors); - tracer.RelatedError(metadata, "Failed to load kext"); - - errorMessage = DriverName + " is not loaded. Make sure the kext is loaded and try again."; - } - - return false; - } - - private bool IsKextLoaded() - { - ProcessResult loadedKexts = ProcessHelper.Run("kextstat", args: "-b " + DriverName, redirectOutput: true); - return loadedKexts.Output.Contains(DriverName); - } - } -} diff --git a/GVFS/GVFS.Platform.Mac/Properties/AssemblyInfo.cs b/GVFS/GVFS.Platform.Mac/Properties/AssemblyInfo.cs deleted file mode 100644 index a71456402b..0000000000 --- a/GVFS/GVFS.Platform.Mac/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GVFS.Platform.Mac")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Platform.Mac")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4ce404e7-d3fc-471c-993c-64615861ea63")] diff --git a/GVFS/GVFS.Service/GVFS.Service.Mac.csproj b/GVFS/GVFS.Service/GVFS.Service.Mac.csproj deleted file mode 100644 index 4f34b2c450..0000000000 --- a/GVFS/GVFS.Service/GVFS.Service.Mac.csproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - Exe - GVFS.Service - GVFS.Service - - netcoreapp2.1; netstandard2.0 - x64 - osx-x64 - false - true - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - all - - - diff --git a/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj b/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj index 361446da6f..2150248d73 100644 --- a/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj +++ b/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj @@ -141,10 +141,6 @@ - - {fac6efc5-a890-4cb2-8c80-6358e358c637} - PrjFSLib.Mac.Managed - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} GVFS.Common @@ -153,10 +149,6 @@ {1118b427-7063-422f-83b9-5023c8ec5a7a} GVFS.GVFlt - - {1dac3da6-3d21-4917-b9a8-d60c8712252a} - GVFS.Platform.Mac - {15fae44c-0d21-4312-9fd3-28f05a5ab7a6} GVFS.Platform.POSIX @@ -169,9 +161,9 @@ {93b403fd-dafb-46c5-9636-b122792a548a} GVFS.Service.UI - - {03769a07-f216-456b-886b-e07caf6c5e81} - GVFS.Service.Mac + + {b8c1dfba-cafd-4f7e-a1a3-e11907b5467b} + GVFS.Service.Windows {72701bc3-5da9-4c7a-bf10-9e98c9fc8eac} @@ -194,8 +186,326 @@ - - NetCore\%(RecursiveDir)\%(Filename)%(Extension) + + NetCore\Category\\CategoryConstants.cs + + + NetCore\CommandLine\\HooksInstallerTests.cs + + + NetCore\Common\\AzDevOpsOrgFromNuGetFeedTests.cs + + + NetCore\Common\\BackgroundTaskQueueTests.cs + + + NetCore\Common\\CacheServerResolverTests.cs + + + NetCore\Common\Database\\GVFSDatabaseTests.cs + + + NetCore\Common\Database\\PlaceholderTableTests.cs + + + NetCore\Common\Database\\SparseTableTests.cs + + + NetCore\Common\Database\\TableTests.cs + + + NetCore\Common\\EpochConverterTests.cs + + + NetCore\Common\\FileBasedDictionaryTests.cs + + + NetCore\Common\\GitCommandLineParserTests.cs + + + NetCore\Common\\GitConfigHelperTests.cs + + + NetCore\Common\\GitObjectsTests.cs + + + NetCore\Common\\GitPathConverterTests.cs + + + NetCore\Common\\GitStatusCacheTests.cs + + + NetCore\Common\\GitVersionTests.cs + + + NetCore\Common\Git\\GitSslTests.cs + + + NetCore\Common\Git\\Sha1IdTests.cs + + + NetCore\Common\\GVFSEnlistmentHealthTests.cs + + + NetCore\Common\\GVFSEnlistmentTests.cs + + + NetCore\Common\\GVFSLockTests.cs + + + NetCore\Common\\InstallManifestTests.cs + + + NetCore\Common\\JsonTracerTests.cs + + + NetCore\Common\\LegacyPlaceholderDatabaseTests.cs + + + NetCore\Common\\LibGit2RepoInvokerTests.cs + + + NetCore\Common\\ModifiedPathsDatabaseTests.cs + + + NetCore\Common\\NamedPipeStreamReaderWriterTests.cs + + + NetCore\Common\\NamedPipeTests.cs + + + NetCore\Common\NuGetUpgrade\\NuGetUpgraderTests.cs + + + NetCore\Common\NuGetUpgrade\\OrgNuGetUpgraderTests.cs + + + NetCore\Common\\OrgInfoApiClientTests.cs + + + NetCore\Common\\PathsTests.cs + + + NetCore\Common\\PhysicalFileSystemDeleteTests.cs + + + NetCore\Common\\ProductUpgraderInfoTests.cs + + + NetCore\Common\\RefLogEntryTests.cs + + + NetCore\Common\\RetryBackoffTests.cs + + + NetCore\Common\\RetryConfigTests.cs + + + NetCore\Common\\RetryWrapperTests.cs + + + NetCore\Common\\SHA1UtilTests.cs + + + NetCore\Common\\TryCreateProductUpgraderTests.cs + + + NetCore\Git\\GitAuthenticationTests.cs + + + NetCore\Git\\GitObjectsTests.cs + + + NetCore\Git\\GitProcessTests.cs + + + NetCore\Git\\GVFSGitObjectsTests.cs + + + NetCore\Maintenance\\GitMaintenanceQueueTests.cs + + + NetCore\Maintenance\\GitMaintenanceStepTests.cs + + + NetCore\Maintenance\\LooseObjectStepTests.cs + + + NetCore\Maintenance\\PackfileMaintenanceStepTests.cs + + + NetCore\Maintenance\\PostFetchStepTests.cs + + + NetCore\Mock\Common\\MockFileBasedLock.cs + + + NetCore\Mock\Common\\MockGitStatusCache.cs + + + NetCore\Mock\Common\\MockGVFSEnlistment.cs + + + NetCore\Mock\Common\\MockLocalGVFSConfig.cs + + + NetCore\Mock\Common\\MockLocalGVFSConfigBuilder.cs + + + NetCore\Mock\Common\\MockPhysicalGitObjects.cs + + + NetCore\Mock\Common\\MockPlatform.cs + + + NetCore\Mock\Common\\MockProductUpgraderPlatformStrategy.cs + + + NetCore\Mock\Common\\MockTracer.cs + + + NetCore\Mock\Common\Tracing\\MockListener.cs + + + NetCore\Mock\FileSystem\\ConfigurableFileSystem.cs + + + NetCore\Mock\FileSystem\\MockDirectory.cs + + + NetCore\Mock\FileSystem\\MockFile.cs + + + NetCore\Mock\FileSystem\\MockFileSystem.cs + + + NetCore\Mock\FileSystem\\MockFileSystemCallbacks.cs + + + NetCore\Mock\FileSystem\\MockFileSystemWithCallbacks.cs + + + NetCore\Mock\FileSystem\\MockPlatformFileSystem.cs + + + NetCore\Mock\Git\\MockBatchHttpGitObjects.cs + + + NetCore\Mock\Git\\MockGitInstallation.cs + + + NetCore\Mock\Git\\MockGitProcess.cs + + + NetCore\Mock\Git\\MockGitRepo.cs + + + NetCore\Mock\Git\\MockGVFSGitObjects.cs + + + NetCore\Mock\Git\\MockHttpGitObjects.cs + + + NetCore\Mock\Git\\MockLibGit2Repo.cs + + + NetCore\Mock\\MockCacheServerInfo.cs + + + NetCore\Mock\\MockGitHubUpgrader.cs + + + NetCore\Mock\\MockInstallerPreRunChecker.cs + + + NetCore\Mock\\MockTextWriter.cs + + + NetCore\Mock\\ReusableMemoryStream.cs + + + NetCore\Mock\Virtualization\Background\\MockBackgroundTaskManager.cs + + + NetCore\Mock\Virtualization\BlobSize\\MockBlobSizesDatabase.cs + + + NetCore\Mock\Virtualization\FileSystem\\MockFileSystemVirtualizer.cs + + + NetCore\Mock\Virtualization\Projection\\MockGitIndexProjection.cs + + + NetCore\Prefetch\\BatchObjectDownloadStageTests.cs + + + NetCore\Prefetch\\BlobPrefetcherTests.cs + + + NetCore\Prefetch\\DiffHelperTests.cs + + + NetCore\Prefetch\\DiffTreeResultTests.cs + + + NetCore\Prefetch\\PrefetchPacksDeserializerTests.cs + + + NetCore\Prefetch\\PrefetchTracingTests.cs + + + NetCore\\Program.cs + + + NetCore\Service\\RepoRegistryTests.cs + + + NetCore\\Setup.cs + + + NetCore\Tracing\\EventListenerTests.cs + + + NetCore\Tracing\\QueuedPipeStringWriterTests.cs + + + NetCore\Tracing\\TelemetryDaemonEventListenerTests.cs + + + NetCore\Upgrader\\ProductUpgraderTests.cs + + + NetCore\Upgrader\\UpgradeOrchestratorTests.cs + + + NetCore\Upgrader\\UpgradeOrchestratorWithGitHubUpgraderTests.cs + + + NetCore\Upgrader\\UpgradeTests.cs + + + NetCore\Virtualization\\FileSystemCallbacksTests.cs + + + NetCore\Virtualization\Projection\\GitIndexEntryTests.cs + + + NetCore\Virtualization\Projection\\LazyUTF8StringTests.cs + + + NetCore\Virtualization\Projection\\ObjectPoolTests.cs + + + NetCore\Virtualization\Projection\\SortedFolderEntriesTests.cs + + + NetCore\Virtual\\CommonRepoSetup.cs + + + NetCore\Virtual\\FileSystemVirtualizerTester.cs + + + NetCore\Virtual\\TestsWithCommonRepo.cs Data\%(RecursiveDir)\%(Filename)%(Extension) @@ -230,4 +540,4 @@ --> - + \ No newline at end of file diff --git a/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj b/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj index 786009ac60..8013af848b 100644 --- a/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj +++ b/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj @@ -1,4 +1,4 @@ - + Exe @@ -51,10 +51,9 @@ - - - + + diff --git a/GVFS/GVFS.UnitTests/Mock/Mac/MacFileSystemVirtualizerTester.cs b/GVFS/GVFS.UnitTests/Mock/Mac/MacFileSystemVirtualizerTester.cs deleted file mode 100644 index 6877ae0dcd..0000000000 --- a/GVFS/GVFS.UnitTests/Mock/Mac/MacFileSystemVirtualizerTester.cs +++ /dev/null @@ -1,68 +0,0 @@ -using GVFS.Platform.Mac; -using GVFS.Tests.Should; -using GVFS.UnitTests.Virtual; -using GVFS.Virtualization.FileSystem; -using PrjFSLib.Mac; -using System; -using System.IO; - -namespace GVFS.UnitTests.Mock.Mac -{ - public class MacFileSystemVirtualizerTester : FileSystemVirtualizerTester - { - public MacFileSystemVirtualizerTester(CommonRepoSetup repo) - : base(repo) - { - } - - public MacFileSystemVirtualizerTester(CommonRepoSetup repo, string[] projectedFiles) - : base(repo, projectedFiles) - { - } - - public MockVirtualizationInstance MockVirtualization { get; private set; } - public MacFileSystemVirtualizer MacVirtualizer { get; private set; } - - public void InvokeOnGetFileStream(Result expectedResult = Result.Pending, byte[] providerId = null) - { - if (providerId == null) - { - providerId = MacFileSystemVirtualizer.PlaceholderVersionId; - } - - this.MockVirtualization.OnGetFileStream( - commandId: 1, - relativePath: "test.txt", - providerId: MacFileSystemVirtualizer.PlaceholderVersionId, - contentId: CommonRepoSetup.DefaultContentId, - triggeringProcessId: 2, - triggeringProcessName: "UnitTest", - fileHandle: IntPtr.Zero).ShouldEqual(expectedResult); - } - - public void InvokeUpdatePlaceholderIfNeeded(string fileName, FileSystemResult expectedResult, UpdateFailureCause expectedFailureCause) - { - UpdateFailureReason failureReason = UpdateFailureReason.NoFailure; - this.MacVirtualizer.UpdatePlaceholderIfNeeded( - fileName, - DateTime.Now, - DateTime.Now, - DateTime.Now, - DateTime.Now, - 0, - 15, - string.Empty, - UpdatePlaceholderType.AllowReadOnly, - out failureReason) - .ShouldEqual(expectedResult); - failureReason.ShouldEqual((UpdateFailureReason)expectedFailureCause); - } - - protected override FileSystemVirtualizer CreateVirtualizer(CommonRepoSetup repo) - { - this.MockVirtualization = new MockVirtualizationInstance(); - this.MacVirtualizer = new MacFileSystemVirtualizer(repo.Context, repo.GitObjects, this.MockVirtualization); - return this.MacVirtualizer; - } - } -} diff --git a/GVFS/GVFS.UnitTests/Mock/Mac/MockVirtualizationInstance.cs b/GVFS/GVFS.UnitTests/Mock/Mac/MockVirtualizationInstance.cs deleted file mode 100644 index f53aca9c74..0000000000 --- a/GVFS/GVFS.UnitTests/Mock/Mac/MockVirtualizationInstance.cs +++ /dev/null @@ -1,152 +0,0 @@ -using GVFS.Common; -using GVFS.Tests.Should; -using PrjFSLib.Mac; -using System; -using System.Collections.Concurrent; -using System.Threading; - -namespace GVFS.UnitTests.Mock.Mac -{ - public class MockVirtualizationInstance : VirtualizationInstance, IDisposable - { - private AutoResetEvent commandCompleted; - - public MockVirtualizationInstance() - { - this.commandCompleted = new AutoResetEvent(false); - this.CreatedPlaceholders = new ConcurrentDictionary(); - this.UpdatedPlaceholders = new ConcurrentDictionary(); - this.CreatedSymLinks = new ConcurrentHashSet(); - this.WriteFileReturnResult = Result.Success; - } - - public Result CompletionResult { get; set; } - public uint BytesWritten { get; private set; } - public Result WriteFileReturnResult { get; set; } - public Result UpdatePlaceholderIfNeededResult { get; set; } - public UpdateFailureCause UpdatePlaceholderIfNeededFailureCause { get; set; } - public Result DeleteFileResult { get; set; } - public UpdateFailureCause DeleteFileUpdateFailureCause { get; set; } - - public ConcurrentDictionary CreatedPlaceholders { get; private set; } - public ConcurrentDictionary UpdatedPlaceholders { get; private set; } - - public ConcurrentHashSet CreatedSymLinks { get; } - - public override EnumerateDirectoryCallback OnEnumerateDirectory { get; set; } - public override GetFileStreamCallback OnGetFileStream { get; set; } - - public override Result StartVirtualizationInstance( - string virtualizationRootFullPath, - uint poolThreadCount) - { - poolThreadCount.ShouldBeAtLeast(1U, "poolThreadCount must be greater than 0"); - return Result.Success; - } - - public override Result StopVirtualizationInstance() - { - return Result.Success; - } - - public override Result WriteFileContents( - IntPtr fileHandle, - byte[] bytes, - uint byteCount) - { - this.BytesWritten = byteCount; - return this.WriteFileReturnResult; - } - - public override Result DeleteFile( - string relativePath, - UpdateType updateFlags, - out UpdateFailureCause failureCause) - { - failureCause = this.DeleteFileUpdateFailureCause; - return this.DeleteFileResult; - } - - public override Result WritePlaceholderDirectory( - string relativePath) - { - throw new NotImplementedException(); - } - - public override Result WritePlaceholderFile( - string relativePath, - byte[] providerId, - byte[] contentId, - ushort fileMode) - { - this.CreatedPlaceholders.TryAdd(relativePath, fileMode); - return Result.Success; - } - - public override Result WriteSymLink( - string relativePath, - string symLinkTarget) - { - this.CreatedSymLinks.Add(relativePath); - return Result.Success; - } - - public override Result UpdatePlaceholderIfNeeded( - string relativePath, - byte[] providerId, - byte[] contentId, - ushort fileMode, - UpdateType updateFlags, - out UpdateFailureCause failureCause) - { - failureCause = this.UpdatePlaceholderIfNeededFailureCause; - if (failureCause == UpdateFailureCause.NoFailure) - { - this.UpdatedPlaceholders[relativePath] = fileMode; - } - - return this.UpdatePlaceholderIfNeededResult; - } - - public override Result ReplacePlaceholderFileWithSymLink( - string relativePath, - string symLinkTarget, - UpdateType updateFlags, - out UpdateFailureCause failureCause) - { - this.CreatedSymLinks.Add(relativePath); - failureCause = this.UpdatePlaceholderIfNeededFailureCause; - return this.UpdatePlaceholderIfNeededResult; - } - - public override Result CompleteCommand( - ulong commandId, - Result result) - { - this.CompletionResult = result; - this.commandCompleted.Set(); - return Result.Success; - } - - public Result WaitForCompletionStatus() - { - this.commandCompleted.WaitOne(); - return this.CompletionResult; - } - - public override Result ConvertDirectoryToPlaceholder( - string relativeDirectoryPath) - { - throw new NotImplementedException(); - } - - public void Dispose() - { - if (this.commandCompleted != null) - { - this.commandCompleted.Dispose(); - this.commandCompleted = null; - } - } - } -} diff --git a/GVFS/GVFS.UnitTests/Platform.Mac/MacDaemonControllerTests.cs b/GVFS/GVFS.UnitTests/Platform.Mac/MacDaemonControllerTests.cs deleted file mode 100644 index d8a43e2780..0000000000 --- a/GVFS/GVFS.UnitTests/Platform.Mac/MacDaemonControllerTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -using GVFS.Common; -using GVFS.Platform.Mac; -using GVFS.Tests.Should; -using Moq; -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace GVFS.UnitTests.Platform.Mac -{ - [TestFixture] - public class MacServiceProcessTests - { - [TestCase] - public void CanGetServices() - { - Mock processHelperMock = new Mock(MockBehavior.Strict); - - StringBuilder sb = new StringBuilder(); - sb.AppendLine("PID\tStatus\tLabel"); - sb.AppendLine("1\t0\tcom.apple.process1"); - sb.AppendLine("2\t0\tcom.apple.process2"); - sb.AppendLine("3\t0\tcom.apple.process3"); - sb.AppendLine("-\t0\tcom.apple.process4"); - - ProcessResult processResult = new ProcessResult(sb.ToString(), string.Empty, 0); - - processHelperMock.Setup(m => m.Run("/bin/launchctl", "asuser 521 /bin/launchctl list", true)).Returns(processResult); - - MacDaemonController daemonController = new MacDaemonController(processHelperMock.Object); - bool success = daemonController.TryGetDaemons("521", out List daemons, out string error); - - success.ShouldBeTrue(); - daemons.ShouldNotBeNull(); - daemons.Count.ShouldEqual(4); - processHelperMock.VerifyAll(); - } - } -} diff --git a/GVFS/GVFS.UnitTests/Platform.Mac/MacFileSystemVirtualizerTests.cs b/GVFS/GVFS.UnitTests/Platform.Mac/MacFileSystemVirtualizerTests.cs deleted file mode 100644 index d2bdcb8168..0000000000 --- a/GVFS/GVFS.UnitTests/Platform.Mac/MacFileSystemVirtualizerTests.cs +++ /dev/null @@ -1,390 +0,0 @@ -using GVFS.Common; -using GVFS.Platform.Mac; -using GVFS.Tests.Should; -using GVFS.UnitTests.Category; -using GVFS.UnitTests.Mock.Git; -using GVFS.UnitTests.Mock.Mac; -using GVFS.UnitTests.Virtual; -using GVFS.Virtualization.Background; -using GVFS.Virtualization.FileSystem; -using GVFS.Virtualization.Projection; -using NUnit.Framework; -using PrjFSLib.Mac; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace GVFS.UnitTests.Platform.Mac -{ - [TestFixture] - public class MacFileSystemVirtualizerTests : TestsWithCommonRepo - { - private static readonly Dictionary MappedResults = new Dictionary() - { - { Result.Success, FSResult.Ok }, - { Result.EFileNotFound, FSResult.FileOrPathNotFound }, - { Result.EPathNotFound, FSResult.FileOrPathNotFound }, - { Result.EDirectoryNotEmpty, FSResult.DirectoryNotEmpty }, - { Result.EVirtualizationInvalidOperation, FSResult.VirtualizationInvalidOperation }, - }; - - [TestCase] - public void ResultToFSResultMapsHResults() - { - foreach (Result result in Enum.GetValues(typeof(Result))) - { - if (MappedResults.ContainsKey(result)) - { - MacFileSystemVirtualizer.ResultToFSResult(result).ShouldEqual(MappedResults[result]); - } - else - { - MacFileSystemVirtualizer.ResultToFSResult(result).ShouldEqual(FSResult.IOError); - } - } - } - - [TestCase] - public void DeleteFile() - { - using (MockVirtualizationInstance mockVirtualization = new MockVirtualizationInstance()) - using (MacFileSystemVirtualizer virtualizer = new MacFileSystemVirtualizer(this.Repo.Context, this.Repo.GitObjects, mockVirtualization)) - { - const string DeleteTestFileName = "deleteMe.txt"; - UpdateFailureReason failureReason = UpdateFailureReason.NoFailure; - - mockVirtualization.DeleteFileResult = Result.Success; - mockVirtualization.DeleteFileUpdateFailureCause = UpdateFailureCause.NoFailure; - virtualizer - .DeleteFile(DeleteTestFileName, UpdatePlaceholderType.AllowReadOnly, out failureReason) - .ShouldEqual(new FileSystemResult(FSResult.Ok, (int)mockVirtualization.DeleteFileResult)); - failureReason.ShouldEqual((UpdateFailureReason)mockVirtualization.DeleteFileUpdateFailureCause); - - mockVirtualization.DeleteFileResult = Result.EFileNotFound; - mockVirtualization.DeleteFileUpdateFailureCause = UpdateFailureCause.NoFailure; - virtualizer - .DeleteFile(DeleteTestFileName, UpdatePlaceholderType.AllowReadOnly, out failureReason) - .ShouldEqual(new FileSystemResult(FSResult.FileOrPathNotFound, (int)mockVirtualization.DeleteFileResult)); - failureReason.ShouldEqual((UpdateFailureReason)mockVirtualization.DeleteFileUpdateFailureCause); - - // TODO: What will the result be when the UpdateFailureCause is DirtyData - mockVirtualization.DeleteFileResult = Result.EInvalidOperation; - - // TODO: The result should probably be VirtualizationInvalidOperation but for now it's IOError - mockVirtualization.DeleteFileUpdateFailureCause = UpdateFailureCause.DirtyData; - virtualizer - .DeleteFile(DeleteTestFileName, UpdatePlaceholderType.AllowReadOnly, out failureReason) - .ShouldEqual(new FileSystemResult(FSResult.IOError, (int)mockVirtualization.DeleteFileResult)); - failureReason.ShouldEqual((UpdateFailureReason)mockVirtualization.DeleteFileUpdateFailureCause); - } - } - - [TestCase] - public void UpdatePlaceholderIfNeeded() - { - const string UpdatePlaceholderFileName = "testUpdatePlaceholder.txt"; - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { UpdatePlaceholderFileName })) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - UpdatePlaceholderFileName, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644)); - - tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.Success; - tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.NoFailure; - tester.InvokeUpdatePlaceholderIfNeeded( - UpdatePlaceholderFileName, - expectedResult: new FileSystemResult(FSResult.Ok, (int)Result.Success), - expectedFailureCause: UpdateFailureCause.NoFailure); - - tester.MockVirtualization.UpdatedPlaceholders.ShouldContain(path => path.Key.Equals(UpdatePlaceholderFileName) && path.Value == GitIndexProjection.FileMode644); - tester.MockVirtualization.UpdatedPlaceholders.Clear(); - - tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.EFileNotFound; - tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.NoFailure; - tester.InvokeUpdatePlaceholderIfNeeded( - UpdatePlaceholderFileName, - expectedResult: new FileSystemResult(FSResult.FileOrPathNotFound, (int)Result.EFileNotFound), - expectedFailureCause: UpdateFailureCause.NoFailure); - - // TODO: What will the result be when the UpdateFailureCause is DirtyData - tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.EInvalidOperation; - tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.DirtyData; - - // TODO: The result should probably be VirtualizationInvalidOperation but for now it's IOError - tester.InvokeUpdatePlaceholderIfNeeded( - UpdatePlaceholderFileName, - expectedResult: new FileSystemResult(FSResult.IOError, (int)Result.EInvalidOperation), - expectedFailureCause: UpdateFailureCause.DirtyData); - } - } - - [TestCase] - public void WritePlaceholderForSymLink() - { - const string WriteSymLinkFileName = "testWriteSymLink.txt"; - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { WriteSymLinkFileName })) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - WriteSymLinkFileName, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.SymLink, fileMode: 0)); - - tester.Virtualizer.WritePlaceholderFile( - WriteSymLinkFileName, - endOfFile: 0, - sha: string.Empty).ShouldEqual(new FileSystemResult(FSResult.Ok, (int)Result.Success)); - - tester.MockVirtualization.CreatedPlaceholders.ShouldBeEmpty(); - tester.MockVirtualization.CreatedSymLinks.Count.ShouldEqual(1); - tester.MockVirtualization.CreatedSymLinks.ShouldContain(entry => entry.Equals(WriteSymLinkFileName)); - - tester.BackgroundTaskShouldBeScheduled(WriteSymLinkFileName, FileSystemTask.OperationType.OnFileSymLinkCreated); - } - } - - [TestCase] - public void UpdatePlaceholderToSymLink() - { - const string PlaceholderToLinkFileName = "testUpdatePlaceholderToLink.txt"; - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { PlaceholderToLinkFileName })) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - PlaceholderToLinkFileName, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.SymLink, fileMode: 0)); - - tester.MockVirtualization.UpdatePlaceholderIfNeededResult = Result.Success; - tester.MockVirtualization.UpdatePlaceholderIfNeededFailureCause = UpdateFailureCause.NoFailure; - tester.InvokeUpdatePlaceholderIfNeeded( - PlaceholderToLinkFileName, - expectedResult: new FileSystemResult(FSResult.Ok, (int)Result.Success), - expectedFailureCause: UpdateFailureCause.NoFailure); - - tester.MockVirtualization.UpdatedPlaceholders.Count.ShouldEqual(0, "UpdatePlaceholderIfNeeded should not be called when converting a placeholder to a link"); - tester.MockVirtualization.CreatedSymLinks.Count.ShouldEqual(1); - tester.MockVirtualization.CreatedSymLinks.ShouldContain(entry => entry.Equals(PlaceholderToLinkFileName)); - - tester.BackgroundTaskShouldBeScheduled(PlaceholderToLinkFileName, FileSystemTask.OperationType.OnFileSymLinkCreated); - } - } - - [TestCase] - public void ClearNegativePathCacheIsNoOp() - { - using (MockVirtualizationInstance mockVirtualization = new MockVirtualizationInstance()) - using (MacFileSystemVirtualizer virtualizer = new MacFileSystemVirtualizer(this.Repo.Context, this.Repo.GitObjects, mockVirtualization)) - { - uint totalEntryCount = 0; - virtualizer.ClearNegativePathCache(out totalEntryCount).ShouldEqual(new FileSystemResult(FSResult.Ok, (int)Result.Success)); - totalEntryCount.ShouldEqual(0U); - } - } - - [TestCase] - public void OnEnumerateDirectoryReturnsSuccessWhenResultsNotInMemory() - { - const string TestFileName = "test.txt"; - const string TestFolderName = "testFolder"; - string testFilePath = Path.Combine(TestFolderName, TestFileName); - - // Don't include TestFolderName as MockGitIndexProjection returns the same list of files regardless of what folder name - // it is passed - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - testFilePath, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644)); - - tester.GitIndexProjection.EnumerationInMemory = false; - tester.MockVirtualization.OnEnumerateDirectory(1, TestFolderName, triggeringProcessId: 1, triggeringProcessName: "UnitTests").ShouldEqual(Result.Success); - tester.MockVirtualization.CreatedPlaceholders.ShouldContain( - kvp => kvp.Key.Equals(testFilePath, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644); - } - } - - [TestCase] - public void OnEnumerateDirectoryReturnsSuccessWhenResultsInMemory() - { - const string TestFileName = "test.txt"; - const string TestFolderName = "testFolder"; - string testFilePath = Path.Combine(TestFolderName, TestFileName); - - // Don't include TestFolderName as MockGitIndexProjection returns the same list of files regardless of what folder name - // it is passed - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - testFilePath, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644)); - - tester.GitIndexProjection.EnumerationInMemory = true; - tester.MockVirtualization.OnEnumerateDirectory(1, TestFolderName, triggeringProcessId: 1, triggeringProcessName: "UnitTests").ShouldEqual(Result.Success); - tester.MockVirtualization.CreatedPlaceholders.ShouldContain( - kvp => kvp.Key.Equals(testFilePath, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644); - tester.GitIndexProjection.ExpandedFolders.ShouldMatchInOrder(TestFolderName); - } - } - - [TestCase] - public void OnEnumerateDirectorySetsFileModes() - { - const string TestFile644Name = "test644.txt"; - const string TestFile664Name = "test664.txt"; - const string TestFile755Name = "test755.txt"; - const string TestFolderName = "testFolder"; - string testFile644Path = Path.Combine(TestFolderName, TestFile644Name); - string testFile664Path = Path.Combine(TestFolderName, TestFile664Name); - string testFile755Path = Path.Combine(TestFolderName, TestFile755Name); - - // Don't include TestFolderName as MockGitIndexProjection returns the same list of files regardless of what folder name - // it is passed - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo, new[] { TestFile644Name, TestFile664Name, TestFile755Name })) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - testFile644Path, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644)); - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - testFile664Path, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode664)); - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - testFile755Path, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode755)); - - tester.GitIndexProjection.EnumerationInMemory = true; - tester.MockVirtualization.OnEnumerateDirectory(1, TestFolderName, triggeringProcessId: 1, triggeringProcessName: "UnitTests").ShouldEqual(Result.Success); - tester.MockVirtualization.CreatedPlaceholders.ShouldContain( - kvp => kvp.Key.Equals(testFile644Path, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644); - tester.MockVirtualization.CreatedPlaceholders.ShouldContain( - kvp => kvp.Key.Equals(testFile664Path, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode664); - tester.MockVirtualization.CreatedPlaceholders.ShouldContain( - kvp => kvp.Key.Equals(testFile755Path, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode755); - } - } - - [TestCase] - public void OnGetFileStreamReturnsSuccessWhenFileStreamAvailable() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.MockVirtualization.WriteFileReturnResult = Result.Success; - tester.InvokeOnGetFileStream(expectedResult: Result.Success); - tester.MockVirtualization.BytesWritten.ShouldEqual(MockGVFSGitObjects.DefaultFileLength); - } - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public void OnGetFileStreamReturnsErrorWhenWriteFileContentsFails() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.MockVirtualization.WriteFileReturnResult = Result.EIOError; - tester.InvokeOnGetFileStream(expectedResult: Result.EIOError); - } - } - - [TestCase] - public void OnNewFileCreatedInsideDotGitDirectoryShouldNotScheduleBackgroundTask() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.MockVirtualization.OnNewFileCreated(Path.Combine(".git", "testing.txt"), isDirectory: false); - tester.BackgroundTaskRunner.Count.ShouldEqual(0); - } - } - - [TestCase] - public void OnNewFileCreatedFileShouldScheduleBackgroundTask() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.MockVirtualization.OnNewFileCreated("testing.txt", isDirectory: false); - tester.BackgroundTaskShouldBeScheduled("testing.txt", FileSystemTask.OperationType.OnFileCreated); - tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0); - } - } - - [TestCase] - public void OnNewFileCreatedDirectoryIncludedShouldScheduleBackgroundTask() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.Included; - tester.MockVirtualization.OnNewFileCreated("testing", isDirectory: true); - tester.BackgroundTaskShouldBeScheduled("testing", FileSystemTask.OperationType.OnFolderCreated); - tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0); - } - } - - [TestCase] - public void OnNewFileCreatedDirectoryExcludedShouldNotScheduleBackgroundTask() - { - const string TestFileName = "test.txt"; - const string TestFolderName = "testFolder"; - string testFilePath = Path.Combine(TestFolderName, TestFileName); - - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.GitIndexProjection.MockFileTypesAndModes.TryAdd( - testFilePath, - ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType.Regular, GitIndexProjection.FileMode644)); - - tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.Excluded; - tester.MockVirtualization.OnNewFileCreated(TestFolderName, isDirectory: true); - tester.BackgroundTaskRunner.Count.ShouldEqual(0); - tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(1); - tester.GitIndexProjection.SparseEntries.First().ShouldEqual(TestFolderName); - tester.MockVirtualization.CreatedPlaceholders.ShouldContain( - kvp => kvp.Key.Equals(testFilePath, GVFSPlatform.Instance.Constants.PathComparison) && kvp.Value == GitIndexProjection.FileMode644); - } - } - - [TestCase] - public void OnNewFileCreatedDirectoryNotFoundShouldScheduleBackgroundTask() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.NotFound; - tester.MockVirtualization.OnNewFileCreated("testing", isDirectory: true); - tester.BackgroundTaskShouldBeScheduled("testing", FileSystemTask.OperationType.OnFolderCreated); - tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0); - } - } - - [TestCase] - public void OnNewFileCreatedDirectoryExcludedTryAddSparseFolderFailureShouldScheduleBackgroundTask() - { - using (MacFileSystemVirtualizerTester tester = new MacFileSystemVirtualizerTester(this.Repo)) - { - tester.GitIndexProjection.GetFolderPathSparseStateValue = GitIndexProjection.PathSparseState.Excluded; - tester.GitIndexProjection.TryAddSparseFolderReturnValue = false; - tester.MockVirtualization.OnNewFileCreated("testing", isDirectory: true); - tester.BackgroundTaskShouldBeScheduled("testing", FileSystemTask.OperationType.OnFolderCreated); - tester.GitIndexProjection.SparseEntries.Count.ShouldEqual(0); - } - } - - private static ushort ConvertFileTypeAndModeToIndexFormat(GitIndexProjection.FileType fileType, ushort fileMode) - { - // Values used in the index file to indicate the type of the file - const ushort RegularFileIndexEntry = 0x8000; - const ushort SymLinkFileIndexEntry = 0xA000; - const ushort GitLinkFileIndexEntry = 0xE000; - - switch (fileType) - { - case GitIndexProjection.FileType.Regular: - return (ushort)(RegularFileIndexEntry | fileMode); - - case GitIndexProjection.FileType.SymLink: - return (ushort)(SymLinkFileIndexEntry | fileMode); - - case GitIndexProjection.FileType.GitLink: - return (ushort)(GitLinkFileIndexEntry | fileMode); - - default: - Assert.Fail($"Invalid fileType {fileType}"); - return 0; - } - } - } -} diff --git a/GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs b/GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs deleted file mode 100644 index 5dffa80a49..0000000000 --- a/GVFS/GVFS.UnitTests/Service/Mac/MacServiceTests.cs +++ /dev/null @@ -1,137 +0,0 @@ -using GVFS.Common; -using GVFS.Common.NamedPipes; -using GVFS.Service; -using GVFS.Service.Handlers; -using GVFS.UnitTests.Mock.Common; -using GVFS.UnitTests.Mock.FileSystem; -using Moq; -using NUnit.Framework; -using System.IO; - -namespace GVFS.UnitTests.Service.Mac -{ - [TestFixture] - public class MacServiceTests - { - private const string GVFSServiceName = "GVFS.Service"; - private const int ExpectedActiveUserId = 502; - private const int ExpectedSessionId = 502; - private static readonly string ExpectedActiveRepoPath = Path.Combine("mock:", "code", "repo2"); - private static readonly string ServiceDataLocation = Path.Combine("mock:", "registryDataFolder"); - - private MockFileSystem fileSystem; - private MockTracer tracer; - private MockPlatform gvfsPlatform; - - [SetUp] - public void SetUp() - { - this.tracer = new MockTracer(); - this.fileSystem = new MockFileSystem(new MockDirectory(ServiceDataLocation, null, null)); - this.gvfsPlatform = (MockPlatform)GVFSPlatform.Instance; - this.gvfsPlatform.MockCurrentUser = ExpectedActiveUserId.ToString(); - } - - [TestCase] - public void ServiceStartTriggersAutoMountForCurrentUser() - { - Mock repoRegistry = new Mock(MockBehavior.Strict); - repoRegistry.Setup(r => r.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId, true)); - repoRegistry.Setup(r => r.TraceStatus()); - - GVFSService service = new GVFSService( - this.tracer, - serviceName: null, - repoRegistry: repoRegistry.Object); - - service.Run(); - - repoRegistry.VerifyAll(); - } - - [TestCase] - public void ServiceHandlesEnablePrjfsRequest() - { - string expectedServiceResponse = "TRequestResponse|{\"State\":1,\"ErrorMessage\":null}"; - Mock connectionMock = new Mock( - MockBehavior.Strict, - null, // serverStream - this.tracer, // tracer - null); // isStopping - connectionMock.Setup(mp => mp.TrySendResponse(expectedServiceResponse)).Returns(true); - - NamedPipeMessages.EnableAndAttachProjFSRequest request = new NamedPipeMessages.EnableAndAttachProjFSRequest(); - request.EnlistmentRoot = string.Empty; - - RequestHandler serviceRequestHandler = new RequestHandler(this.tracer, etwArea: string.Empty, repoRegistry: null); - serviceRequestHandler.HandleRequest(this.tracer, request.ToMessage().ToString(), connectionMock.Object); - - connectionMock.VerifyAll(); - } - - [TestCase] - public void RepoRegistryMountsOnlyRegisteredRepos() - { - Mock repoMounterMock = new Mock(MockBehavior.Strict); - repoMounterMock.Setup(mp => mp.MountRepository(ExpectedActiveRepoPath, ExpectedActiveUserId)).Returns(true); - - this.CreateTestRepos(ServiceDataLocation); - - RepoRegistry repoRegistry = new RepoRegistry( - this.tracer, - this.fileSystem, - ServiceDataLocation, - repoMounterMock.Object, - null); - - repoRegistry.AutoMountRepos(ExpectedActiveUserId.ToString(), ExpectedSessionId, checkDirectoryExists: false); - - repoMounterMock.VerifyAll(); - } - - [TestCase] - public void MountProcessLaunchedUsingCorrectArgs() - { - string executable = @"/bin/launchctl"; - string gvfsBinPath = Path.Combine(this.gvfsPlatform.Constants.GVFSBinDirectoryPath, this.gvfsPlatform.Constants.GVFSExecutableName); - string expectedArgs = $"asuser {ExpectedActiveUserId} {gvfsBinPath} mount {ExpectedActiveRepoPath}"; - - Mock mountLauncherMock = new Mock(MockBehavior.Strict, this.tracer); - mountLauncherMock.Setup(mp => mp.LaunchProcess( - executable, - expectedArgs, - ExpectedActiveRepoPath)) - .Returns(true); - - string errorString = null; - mountLauncherMock.Setup(mp => mp.WaitUntilMounted( - this.tracer, - ExpectedActiveRepoPath, - It.IsAny(), - out errorString)) - .Returns(true); - - GVFSMountProcess mountProcess = new GVFSMountProcess(this.tracer, mountLauncherMock.Object); - mountProcess.MountRepository(ExpectedActiveRepoPath, ExpectedActiveUserId); - - mountLauncherMock.VerifyAll(); - } - - private void CreateTestRepos(string dataLocation) - { - string repo1 = Path.Combine("mock:", "code", "repo1"); - string repo2 = ExpectedActiveRepoPath; - string repo3 = Path.Combine("mock:", "code", "repo3"); - string repo4 = Path.Combine("mock:", "code", "repo4"); - - this.fileSystem.WriteAllText( - Path.Combine(dataLocation, RepoRegistry.RegistryName), - $@"1 - {{""EnlistmentRoot"":""{repo1.Replace("\\", "\\\\")}"",""OwnerSID"":502,""IsActive"":false}} - {{""EnlistmentRoot"":""{repo2.Replace("\\", "\\\\")}"",""OwnerSID"":502,""IsActive"":true}} - {{""EnlistmentRoot"":""{repo3.Replace("\\", "\\\\")}"",""OwnerSID"":501,""IsActive"":false}} - {{""EnlistmentRoot"":""{repo4.Replace("\\", "\\\\")}"",""OwnerSID"":501,""IsActive"":true}} - "); - } - } -} diff --git a/GVFS/GVFS/GVFS.Mac.csproj b/GVFS/GVFS/GVFS.Mac.csproj deleted file mode 100644 index 50dd74a110..0000000000 --- a/GVFS/GVFS/GVFS.Mac.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - Exe - gvfs - netcoreapp2.1 - x64 - osx-x64 - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - all - - - - - - - - - \ No newline at end of file diff --git a/MirrorProvider/MirrorProvider.Mac/MirrorProvider.Mac.csproj b/MirrorProvider/MirrorProvider.Mac/MirrorProvider.Mac.csproj deleted file mode 100644 index 11e84c84e3..0000000000 --- a/MirrorProvider/MirrorProvider.Mac/MirrorProvider.Mac.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - Exe - netcoreapp2.1 - osx.10.12-x64 - x64 - Debug;Release - - - - ..\..\..\BuildOutput - - - - $(BuildOutputDir)\MirrorProvider.Mac\obj\$(Configuration)\$(Platform) - $(BuildOutputDir)\MirrorProvider.Mac\bin\$(Configuration)\$(Platform) - true - - - - true - full - false - TRACE;DEBUG - - - - true - TRACE;RELEASE - - - - - - - - - - - diff --git a/Scripts/Mac/BuildGVFSForMac.sh b/Scripts/Mac/BuildGVFSForMac.sh deleted file mode 100755 index 64f109751f..0000000000 --- a/Scripts/Mac/BuildGVFSForMac.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -CONFIGURATION=$1 -if [ -z $CONFIGURATION ]; then - CONFIGURATION=Debug -fi - -runVersionUpdater="yes" -VERSION=$2 -if [ -z $VERSION ]; then - VERSION="0.2.173.2" - - # don't update version number for developer builds - runVersionUpdater="no" -fi - -if [ ! -d $VFS_OUTPUTDIR ]; then - mkdir $VFS_OUTPUTDIR -fi - -echo 'Building ProjFS kext and libraries...' -$VFS_SRCDIR/ProjFS.Mac/Scripts/Build.sh $CONFIGURATION || exit 1 - -# Create the directory where we'll do pre build tasks -BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build -if [ ! -d $BUILDDIR ]; then - mkdir $BUILDDIR || exit 1 -fi - -echo 'Downloading a VFS-enabled version of Git...' -$VFS_SCRIPTDIR/DownloadGVFSGit.sh || exit 1 -GITVERSION="$($VFS_SCRIPTDIR/GetGitVersionNumber.sh)" -GITPATH="$(find $VFS_PACKAGESDIR/gitformac.gvfs.installer/$GITVERSION -type f -name *.dmg)" || exit 1 -echo "Downloaded Git $GITVERSION" -# Now that we have a path containing the version number, generate GVFSConstants.GitVersion.cs -$VFS_SCRIPTDIR/GenerateGitVersionConstants.sh "$GITPATH" $BUILDDIR || exit 1 - -# If we're building the Profiling(Release) configuration, remove Profiling() for building .NET code -if [ "$CONFIGURATION" == "Profiling(Release)" ]; then - CONFIGURATION=Release -fi - -echo "Generating CommonAssemblyVersion.cs as $VERSION..." -$VFS_SCRIPTDIR/GenerateCommonAssemblyVersion.sh $VERSION || exit 1 - -# /warnasmessage:MSB4011. Reference: https://bugzilla.xamarin.com/show_bug.cgi?id=58564 -# Visual Studio Mac does not support explicit import of Sdks. GVFS.Installer.Mac.csproj -# does need this ability to override "Build" and "Publish" targets. As a workaround the -# project implicitly imports "Microsoft.Net.Sdk" in the beginning of its csproj (because -# otherwise Visual Studio Mac IDE will not be able to open the GVFS.Install.Mac project) -# and explicitly imports Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" later, before -# overriding build targets. The duplicate import generates warning MSB4011 that is ignored -# by this switch. -echo 'Restoring packages...' -dotnet restore $VFS_SRCDIR/GVFS.sln /p:Configuration=$CONFIGURATION.Mac --packages $VFS_PACKAGESDIR /warnasmessage:MSB4011 || exit 1 -dotnet build $VFS_SRCDIR/GVFS.sln --runtime osx-x64 --framework netcoreapp2.1 --configuration $CONFIGURATION.Mac -p:CopyPrjFS=true /maxcpucount:1 /warnasmessage:MSB4011 || exit 1 - -NATIVEDIR=$VFS_SRCDIR/GVFS/GVFS.Native.Mac -xcodebuild -configuration $CONFIGURATION -workspace $NATIVEDIR/GVFS.Native.Mac.xcworkspace build -scheme GVFS.Native.Mac -derivedDataPath $VFS_OUTPUTDIR/GVFS.Native.Mac || exit 1 - -USERNOTIFICATIONDIR=$VFS_SRCDIR/GVFS/GVFS.Notifications/VFSForGit.Mac -USERNOTIFICATIONPROJECT="$USERNOTIFICATIONDIR/VFSForGit.xcodeproj" -USERNOTIFICATIONSCHEME="VFS For Git" -if [ "$runVersionUpdater" == "yes" ]; then - updateAppVersionCmd="(cd \"$USERNOTIFICATIONDIR\" && /usr/bin/xcrun agvtool new-marketing-version \"$VERSION\")" - echo $updateAppVersionCmd - eval $updateAppVersionCmd || exit 1 -fi -# Build user notification app -xcodebuild -configuration $CONFIGURATION -project "$USERNOTIFICATIONPROJECT" build -scheme "$USERNOTIFICATIONSCHEME" -derivedDataPath $VFS_OUTPUTDIR/GVFS.Notifications/VFSForGit.Mac || exit 1 - -# Build the tests in a separate directory, so the binary for distribution does not contain -# test plugins created and injected by the test build. -xcodebuild -configuration $CONFIGURATION -project "$USERNOTIFICATIONPROJECT" test -scheme "$USERNOTIFICATIONSCHEME" -derivedDataPath $VFS_OUTPUTDIR/GVFS.Notifications/VFSForGit.Mac/Tests || exit 1 - -if [ ! -d $VFS_PUBLISHDIR ]; then - mkdir $VFS_PUBLISHDIR || exit 1 -fi - -echo 'Copying native binaries to Publish directory...' -cp $VFS_OUTPUTDIR/GVFS.Native.Mac/Build/Products/$CONFIGURATION/GVFS.ReadObjectHook $VFS_PUBLISHDIR || exit 1 -cp $VFS_OUTPUTDIR/GVFS.Native.Mac/Build/Products/$CONFIGURATION/GVFS.VirtualFileSystemHook $VFS_PUBLISHDIR || exit 1 -cp $VFS_OUTPUTDIR/GVFS.Native.Mac/Build/Products/$CONFIGURATION/GVFS.PostIndexChangedHook $VFS_PUBLISHDIR || exit 1 - -# Publish after native build, so installer package can include the native binaries. -dotnet publish $VFS_SRCDIR/GVFS.sln /p:Configuration=$CONFIGURATION.Mac /p:Platform=x64 -p:CopyPrjFS=true --runtime osx-x64 --framework netcoreapp2.1 --self-contained --output $VFS_PUBLISHDIR /maxcpucount:1 /warnasmessage:MSB4011 || exit 1 - -echo 'Copying Git installer to the output directory...' -$VFS_SCRIPTDIR/PublishGit.sh $GITPATH || exit 1 - -echo 'Installing shared data queue stall workaround...' -# We'll generate a temporary project if and only if we don't find the correct dylib already in place. -BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build -if [ ! -e $BUILDDIR/libSharedDataQueue.dylib ]; then - cp $VFS_SRCDIR/nuget.config $BUILDDIR - dotnet new classlib -n Restore.SharedDataQueueStallWorkaround -o $BUILDDIR --force - dotnet add $BUILDDIR/Restore.SharedDataQueueStallWorkaround.csproj package --package-directory $VFS_PACKAGESDIR SharedDataQueueStallWorkaround --version '1.0.0' - cp $VFS_PACKAGESDIR/shareddataqueuestallworkaround/1.0.0/libSharedDataQueue.dylib $BUILDDIR/libSharedDataQueue.dylib -fi - -echo 'Running VFS for Git unit tests...' -$VFS_PUBLISHDIR/GVFS.UnitTests || exit 1 diff --git a/Scripts/Mac/CI/CreateBuildDrop.sh b/Scripts/Mac/CI/CreateBuildDrop.sh deleted file mode 100755 index b02188ab31..0000000000 --- a/Scripts/Mac/CI/CreateBuildDrop.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -. "$(dirname ${BASH_SOURCE[0]})/../InitializeEnvironment.sh" - -CONFIGURATION=$1 -BUILDDROP_ROOT=$2 -if [ -z $BUILDDROP_ROOT ] || [ -z $CONFIGURATION ]; then - echo 'ERROR: Usage: CreateBuildDrop.sh [configuration] [build drop root directory]' - exit 1 -fi - -# Set up some paths -BUILDDROP_BUILDOUTPUT=$BUILDDROP_ROOT/BuildOutput -BUILDDROP_SRC=$BUILDDROP_ROOT/src -BUILDDROP_PROJFS=$BUILDDROP_SRC/ProjFS.Mac -BUILDDROP_KEXT=$BUILDDROP_BUILDOUTPUT/ProjFS.Mac/Native - -# Set up the build drop directory structure -rm -rf $BUILDDROP_ROOT -mkdir -p $BUILDDROP_BUILDOUTPUT -mkdir -p $BUILDDROP_SRC -mkdir -p $BUILDDROP_PROJFS -mkdir -p $BUILDDROP_KEXT - -# Copy to the build drop, retaining directory structure. -rsync -avm $VFS_OUTPUTDIR/Git $BUILDDROP_BUILDOUTPUT -rsync -avm $VFS_PUBLISHDIR $BUILDDROP_ROOT -rsync -avm $VFS_SCRIPTDIR $BUILDDROP_SRC/Scripts -rsync -avm $VFS_SRCDIR/ProjFS.Mac/Scripts $BUILDDROP_PROJFS -rsync -avm $VFS_OUTPUTDIR/ProjFS.Mac/Native/$CONFIGURATION $BUILDDROP_KEXT -cp $VFS_SRCDIR/nuget.config $BUILDDROP_SRC diff --git a/Scripts/Mac/CleanupFunctionalTests.sh b/Scripts/Mac/CleanupFunctionalTests.sh deleted file mode 100755 index 40653b8910..0000000000 --- a/Scripts/Mac/CleanupFunctionalTests.sh +++ /dev/null @@ -1,13 +0,0 @@ -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -pkill -9 -l GVFS.FunctionalTests -pkill -9 -l git -pkill -9 -l gvfs -pkill -9 -l GVFS.Mount -pkill -9 -l prjfs-log - -$VFS_SRCDIR/ProjFS.Mac/Scripts/UnloadPrjFSKext.sh - -if [ -d /GVFS.FT ]; then - sudo rm -r /GVFS.FT -fi diff --git a/Scripts/Mac/Common-Functions.ps1 b/Scripts/Mac/Common-Functions.ps1 deleted file mode 100644 index a8124c1801..0000000000 --- a/Scripts/Mac/Common-Functions.ps1 +++ /dev/null @@ -1,159 +0,0 @@ -<# -.SYNOPSIS -Generates the text for GVFS.Installer.Mac nuspec file from the provided inputs -#> -function Write-Nuspec -{ - param - ( - [Parameter(Mandatory)] - [string] - $PackageVersion, - - [Parameter(Mandatory)] - [string] - $GvfsInstallerPkg, - - [Parameter(Mandatory)] - [string] - $GitInstallerPkg, - - [Parameter(Mandatory)] - [string] - $GcmInstallerPkg - ) - - $template = - " - - - GVFS.Installers.Mac - $PackageVersion - Microsoft - false - GVFS and G4M Mac installers - - - - - - - " - - return $template -} - -<# -.DESCRIPTION -Downloads the specified version of GCM Core to the specified DownloadLocation -#> -function Download-GCM -{ - param - ( - [Parameter(Mandatory)] - [string] - $GcmReleaseVersion, - - [Parameter(Mandatory)] - [string] - $GcmPackageName, - - [Parameter(Mandatory)] - [string] - $DownloadLocation - ) - - $url = "https://github.com/microsoft/Git-Credential-Manager-Core/releases/download/$GcmReleaseVersion/$GcmPackageName" - $outfile = $DownloadLocation + "/" + $GcmPackageName - - Invoke-WebRequest -Uri $url -Outfile $outfile - - return $outfile -} - -<# -.SYNOPSIS -Parses the version of the NuGet package that contains the Git installer from a props file. -#> -function Get-GitPackageVersionFromProps -{ - param - ( - [Parameter(Mandatory)] - [string] - $GvfsPropsPath - ) - - $gitPackageVersionLine = Get-ChildItem -Path $GvfsPropsPath | Select-String -Pattern 'GitPackageVersion' - $matchFount = $gitPackageVersionLine -match '(.*?)' - return $matches[1] -} - -<# -.SYNOPSIS -Given a path to where NuGet packages are located, find the GitForMac NuGetPackage version and extract the Git version. -#> -function Get-GitVersionFromNuGetPackage -{ - param - ( - [Parameter(Mandatory)] - [string] - $NuGetPackagesDir, - - [Parameter(Mandatory)] - [string] - $GitPackageVersion - ) - - # Find the git version number (looking through packages directory) - $gitInstallerPath = $NuGetPackagesDir + "/gitformac.gvfs.installer/" + $GitPackageVersion + "/tools" - $toolsContents = Get-ChildItem -Path ($NuGetPackagesDir + "/gitformac.gvfs.installer/" + $GitPackageVersion + "/tools") -Include *.pkg - - $gitInstallerPkgName = $toolsContents[0].Name - return $gitInstallerPkgName -} - -<# -.DESCRIPTION -Generate and write a GVFS.Installers.Mac NuSpec from given -parameters. This function orchestrates finding the various packages -required for generating the installer assuming the behavior for how -the current CI/CD Release pipleline lays out artifacts. It will also -download GCM core. -#> -function Generate-NuSpec -{ - param - ( - [Parameter(Mandatory)] - [string] - $PackageDir, - - [Parameter(Mandatory)] - [string] - $GvfsVersion, - - [Parameter(Mandatory)] - [string] - $GcmReleaseVersion, - - [Parameter(Mandatory)] - [string] - $GcmPackageName - ) - - # Git installer pkg: Look throuhg the packages directory to find the git installer pkg - $gitInstallers = Get-ChildItem -Path ($PackageDir + "/*") -Include 'git-*.pkg' - $gitInstallerPkg = $gitInstallers[0] - - # Gcm installer pkg: Download - $GcmInstallerPkg = Download-GCM -GcmReleaseVersion $GcmReleaseVersion -GcmPackageName $GcmPackageName -DownloadLocation $PackageDir - - # GVFS installer pkg - $GvfsInstallerPkg = $PackageDir + "/" + "VFSForGit.$GvfsVersion.pkg" - - $template = Write-Nuspec -PackageVersion $GvfsVersion -GvfsInstallerPkg $GvfsInstallerPkg -GitInstallerPkg $gitInstallerPkg -GcmInstallerPkg $GcmInstallerPkg - return $template -} diff --git a/Scripts/Mac/DownloadGVFSGit.sh b/Scripts/Mac/DownloadGVFSGit.sh deleted file mode 100755 index 54a742b906..0000000000 --- a/Scripts/Mac/DownloadGVFSGit.sh +++ /dev/null @@ -1,7 +0,0 @@ -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -BUILDDIR=$VFS_OUTPUTDIR/GVFS.Build -GITVERSION="$($VFS_SCRIPTDIR/GetGitVersionNumber.sh)" -cp $VFS_SRCDIR/nuget.config $BUILDDIR -dotnet new classlib -n Restore.GitInstaller -o $BUILDDIR --force -dotnet add $BUILDDIR/Restore.GitInstaller.csproj package --package-directory $VFS_PACKAGESDIR GitForMac.GVFS.Installer --version $GITVERSION \ No newline at end of file diff --git a/Scripts/Mac/GVFS_Clone.sh b/Scripts/Mac/GVFS_Clone.sh deleted file mode 100755 index 250d3aa9a1..0000000000 --- a/Scripts/Mac/GVFS_Clone.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -REPOURL=$1 - -CONFIGURATION=$2 -if [ -z $CONFIGURATION ]; then - CONFIGURATION=Debug -fi - -$VFS_PUBLISHDIR/gvfs clone $REPOURL ~/GVFSTest --local-cache-path ~/GVFSTest/.gvfsCache --no-mount --no-prefetch diff --git a/Scripts/Mac/GVFS_Mount.sh b/Scripts/Mac/GVFS_Mount.sh deleted file mode 100755 index 78e6f946ac..0000000000 --- a/Scripts/Mac/GVFS_Mount.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -CONFIGURATION=$1 -if [ -z $CONFIGURATION ]; then - CONFIGURATION=Debug -fi - -$VFS_PUBLISHDIR/gvfs mount ~/GVFSTest diff --git a/Scripts/Mac/GVFS_Unmount.sh b/Scripts/Mac/GVFS_Unmount.sh deleted file mode 100755 index 36d7460d2b..0000000000 --- a/Scripts/Mac/GVFS_Unmount.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -CONFIGURATION=$1 -if [ -z $CONFIGURATION ]; then - CONFIGURATION=Debug -fi - -$VFS_PUBLISHDIR/gvfs unmount ~/GVFSTest diff --git a/Scripts/Mac/GenerateCommonAssemblyVersion.sh b/Scripts/Mac/GenerateCommonAssemblyVersion.sh deleted file mode 100755 index b8a08a8845..0000000000 --- a/Scripts/Mac/GenerateCommonAssemblyVersion.sh +++ /dev/null @@ -1,16 +0,0 @@ -. "$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh" - -if [ -z $1 ]; then - echo "Version Number not defined for CommonAssemblyVersion.cs" -fi - -# Update the version number in GVFS.props for other consumers of GVFSVersion -sed -i "" -E "s@[0-9]+(\.[0-9]+)*@$1@g" $VFS_SRCDIR/GVFS/GVFS.Build/GVFS.props - -# Then generate CommonAssemblyVersion.cs -cat >$VFS_OUTPUTDIR/CommonAssemblyVersion.cs <