diff --git a/.azure-pipelines/continuous-integration.yml b/.azure-pipelines/continuous-integration.yml deleted file mode 100644 index a3f0d5c48b..0000000000 --- a/.azure-pipelines/continuous-integration.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: $(date:yy)$(DayOfYear)$(rev:.r) - -trigger: - - master - - releases/shipped - -variables: - majorAndMinorVersion: '0.5' - revision: '$(Build.BuildNumber)' - -jobs: - - job: Build_Windows - variables: - platformFriendlyName: Windows - strategy: - maxParallel: 2 - matrix: - debug: - configuration: Debug - release: - configuration: Release - pool: - vmImage: vs2017-win2016 - steps: - - template: templates/windows-build-and-unit-test.yml - - - job: Build_macOS - variables: - platformFriendlyName: macOS - strategy: - maxParallel: 2 - matrix: - debug: - configuration: Debug - release: - configuration: Release - pool: - vmImage: macOS 10.13 - steps: - - template: templates/macos-build-and-unit-test.yml - - - job: FunctionalTests_Windows - timeoutInMinutes: 240 - variables: - platformFriendlyName: Windows - configuration: Release - pool: - name: FunctionalTests - dependsOn: Build_Windows - condition: succeeded() - steps: - - checkout: none # We'll get the build drop from Build_Windows job - - template: templates/windows-functional-test.yml - - - job: FunctionalTests_macOS - timeoutInMinutes: 240 - variables: - platformFriendlyName: macOS - configuration: Release - pool: - name: MacFunctionalTests - dependsOn: Build_macOS - condition: succeeded() - steps: - - checkout: none # Use the drop from Build_macOS job - - template: templates/macos-functional-test.yml diff --git a/.azure-pipelines/pull-request.yml b/.azure-pipelines/pull-request.yml deleted file mode 100644 index 719ab58f62..0000000000 --- a/.azure-pipelines/pull-request.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: $(date:yy)$(DayOfYear)$(rev:.r) - -trigger: none - -variables: - majorAndMinorVersion: '0.4' - revision: '$(Build.BuildNumber)' - platform: 'x64' - configuration: release - -jobs: - - job: Windows - pool: - vmImage: vs2017-win2016 - steps: - - template: templates/windows-build-and-unit-test.yml - - - job: macOS - pool: - vmImage: macOS 10.13 - steps: - - template: templates/macos-build-and-unit-test.yml diff --git a/.azure-pipelines/release.yml b/.azure-pipelines/release.yml new file mode 100644 index 0000000000..d098c5a70f --- /dev/null +++ b/.azure-pipelines/release.yml @@ -0,0 +1,93 @@ +# NOTE: this pipeline definition is not currently used to build releases of VFS for Git. +# This is still done in the GVFS-Release-RealSign "classic" pipeline. + +name: $(date:yy)$(DayOfYear)$(rev:.r) + +variables: + signType: test + teamName: GVFS + configuration: Release + signPool: VSEng-MicroBuildVS2019 + GVFSMajorAndMinorVersion: 1.0 + GVFSRevision: $(Build.BuildNumber) + +jobs: +- job: build + displayName: Windows Build and Sign + + pool: + name: $(signPool) + + steps: + - task: ms-vseng.MicroBuildTasks.30666190-6959-11e5-9f96-f56098202fef.MicroBuildSigningPlugin@2 + displayName: Install signing plugin + inputs: + signType: '$(SignType)' + + - task: UseDotNet@2 + displayName: Install .NET SDK + inputs: + packageType: sdk + version: 5.0.201 + + - task: CmdLine@2 + displayName: Build VFS for Git + inputs: + script: $(Build.Repository.LocalPath)\scripts\Build.bat $(configuration) $(GVFSMajorAndMinorVersion).$(GVFSRevision) detailed + + - task: CmdLine@2 + displayName: Run unit tests + inputs: + script: $(Build.Repository.LocalPath)\scripts\RunUnitTests.bat $(configuration) + + - task: CmdLine@2 + displayName: Create build artifacts + inputs: + script: $(Build.Repository.LocalPath)\scripts\CreateBuildArtifacts.bat $(configuration) $(Build.ArtifactStagingDirectory) + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: Installer' + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)\NuGetPackages + ArtifactName: Installer + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: FastFetch' + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)\FastFetch + ArtifactName: FastFetch + + - task: PublishSymbols@1 + displayName: Enable Source Server + condition: eq(succeeded(), eq(variables['signType'], 'real')) + inputs: + SearchPattern: '**\*.pdb' + SymbolsFolder: $(Build.ArtifactStagingDirectory)\Symbols + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: Symbols' + inputs: + PathtoPublish: $(Build.ArtifactStagingDirectory)\Symbols + ArtifactName: Symbols + + - task: ms-vscs-artifact.build-tasks.artifactSymbolTask-1.artifactSymbolTask@0 + displayName: Publish to Symbols on Symweb + condition: eq(succeeded(), eq(variables['signType'], 'real')) + inputs: + symbolServiceURI: https://microsoft.artifacts.visualstudio.com/DefaultCollection + sourcePath: $(Build.ArtifactStagingDirectory)/Symbols + expirationInDays: 2065 + usePat: false + + - task: NuGetCommand@2 + displayName: Push GVFS.Installers package + condition: eq(succeeded(), eq(variables['signType'], 'real')) + inputs: + command: push + packagesToPush: $(Build.ArtifactStagingDirectory)\NuGetPackages\GVFS.Installers.*.nupkg + nuGetFeedType: external + publishFeedCredentials: '1essharedassets GVFS [PUBLISH]' + + - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 + displayName: Send MicroBuild Telemetry + condition: always() diff --git a/.azure-pipelines/templates/windows-build-and-unit-test.yml b/.azure-pipelines/templates/windows-build-and-unit-test.yml deleted file mode 100644 index 80cfc30b0a..0000000000 --- a/.azure-pipelines/templates/windows-build-and-unit-test.yml +++ /dev/null @@ -1,40 +0,0 @@ -steps: - - - script: $(Build.Repository.LocalPath)\\Scripts\\NukeBuildOutputs.bat - displayName: Delete previous build outputs - continueOnError: true - - - powershell: | - & 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\sn.exe' -Vr *,31bf3856ad364e35 - & 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64\sn.exe' -Vr *,31bf3856ad364e35 - displayName: Disable strong name validation for MS delay-signed assemblies - - - script: $(Build.Repository.LocalPath)\Scripts\BuildGVFSForWindows.bat $(configuration) $(majorAndMinorVersion).$(revision) - displayName: Run VFSForGit build script ($(configuration)) - - - script: $(Build.Repository.LocalPath)\MirrorProvider\Scripts\Windows\Build.bat $(configuration) - displayName: Build MirrorProvider ($(configuration)) - - - script: $(Build.Repository.LocalPath)\Scripts\RunUnitTests.bat $(configuration) - displayName: Run unit tests - - - task: PublishTestResults@2 - displayName: Publish unit test results - inputs: - testRunner: NUnit - testResultsFiles: "**\\TestResult.xml" - searchFolder: $(System.DefaultWorkingDirectory) - testRunTitle: Windows $(configuration) Unit Tests - publishRunAttachments: true - - - script: $(Build.Repository.LocalPath)\Scripts\CI\CreateBuildDrop.bat $(configuration) $(Build.ArtifactStagingDirectory)\Tests - displayName: Create functional test drop. - - - task: PublishBuildArtifacts@1 - displayName: Publish functional test drop artifact. - inputs: - pathtoPublish: $(Build.ArtifactStagingDirectory)\Tests - artifactName: "FunctionalTests_$(platformFriendlyName)_$(configuration)" - parallel: true - parallelCount: 8 - condition: succeededOrFailed() diff --git a/.azure-pipelines/templates/windows-functional-test.yml b/.azure-pipelines/templates/windows-functional-test.yml deleted file mode 100644 index e221ddfc67..0000000000 --- a/.azure-pipelines/templates/windows-functional-test.yml +++ /dev/null @@ -1,28 +0,0 @@ -steps: - - - task: DownloadBuildArtifacts@0 - displayName: Download functional test drop - inputs: - buildType: current - downloadType: specific - artifactName: FunctionalTests_$(platformFriendlyName)_$(configuration) - downloadPath: $(Build.BinariesDirectory) - - - script: $(Build.BinariesDirectory)/FunctionalTests_$(platformFriendlyName)_$(configuration)/src/Scripts/ReinstallGVFS.bat $(configuration) - displayName: Run VFSForGit and G4W installers - - - script: git config --global credential.interactive never - displayName: Disable interactive auth - - - script: $(Build.BinariesDirectory)/FunctionalTests_$(platformFriendlyName)_$(configuration)/src/Scripts/RunFunctionalTests.bat $(configuration) --test-gvfs-on-path --replace-inbox-projfs - displayName: Run functional tests - - - task: PublishTestResults@2 - displayName: Publish functional test results - inputs: - testRunner: NUnit - testResultsFiles: "**\\TestResult*.xml" - searchFolder: $(System.DefaultWorkingDirectory) - testRunTitle: Windows $(configuration) Functional Tests - publishRunAttachments: true - condition: succeededOrFailed() diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000000..8dca590066 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,133 @@ +name: VFS for Git + +on: + pull_request: + branches: [ master, releases/shipped ] + push: + branches: [ master, releases/shipped ] + +jobs: + build: + runs-on: windows-2019 + name: Build and Unit Test + + strategy: + matrix: + configuration: [ Debug, Release ] + + steps: + - name: Checkout source + uses: actions/checkout@v2 + with: + path: src + + - name: Install .NET SDK + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.201 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Build VFS for Git + shell: cmd + run: src\scripts\Build.bat ${{ matrix.configuration }} + + - name: Run unit tests + shell: cmd + run: src\scripts\RunUnitTests.bat ${{ matrix.configuration }} + + - name: Create build artifacts + shell: cmd + run: src\scripts\CreateBuildArtifacts.bat ${{ matrix.configuration }} artifacts + + - name: Upload functional tests drop + uses: actions/upload-artifact@v2 + with: + name: FunctionalTests_${{ matrix.configuration }} + path: artifacts\GVFS.FunctionalTests + + - name: Upload FastFetch drop + uses: actions/upload-artifact@v2 + with: + name: FastFetch_${{ matrix.configuration }} + path: artifacts\FastFetch + + - name: Upload installers + uses: actions/upload-artifact@v2 + with: + name: Installers_${{ matrix.configuration }} + path: artifacts\GVFS.Installers + + - name: Upload NuGet packages + uses: actions/upload-artifact@v2 + with: + name: NuGetPackages_${{ matrix.configuration }} + path: artifacts\NuGetPackages + + functional_test: + runs-on: windows-2019 + name: Functional Tests + needs: build + + strategy: + matrix: + configuration: [ Debug, Release ] + + steps: + - name: Download installers + uses: actions/download-artifact@v2 + with: + name: Installers_${{ matrix.configuration }} + path: install + + - name: Download functional tests drop + uses: actions/download-artifact@v2 + with: + name: FunctionalTests_${{ matrix.configuration }} + path: ft + + - name: ProjFS details (pre-install) + shell: cmd + run: install\info.bat + + - name: Install product + shell: cmd + run: install\install.bat + + - name: ProjFS details (post-install) + shell: cmd + run: install\info.bat + + - name: Upload installation logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: InstallationLogs_${{ matrix.configuration }} + path: install\logs + + - name: Run functional tests + shell: cmd + run: | + SET PATH=C:\Program Files\GVFS;%PATH% + SET GIT_TRACE2_PERF=C:\temp\git-trace2.log + ft\GVFS.FunctionalTests.exe /result:TestResult.xml --ci + + - name: Upload functional test results + if: always() + uses: actions/upload-artifact@v2 + with: + name: FunctionalTests_Results_${{ matrix.configuration }} + path: TestResult.xml + + - name: Upload Git trace2 output + if: always() + uses: actions/upload-artifact@v2 + with: + name: GitTrace2_${{ matrix.configuration }} + path: C:\temp\git-trace2.log + + - name: ProjFS details (post-test) + if: always() + shell: cmd + run: install\info.bat diff --git a/.github/workflows/release-winget.yaml b/.github/workflows/release-winget.yaml new file mode 100644 index 0000000000..710bc94e70 --- /dev/null +++ b/.github/workflows/release-winget.yaml @@ -0,0 +1,39 @@ +name: "release-winget" +on: + release: + types: [released] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - id: update-winget + name: Update winget repository + uses: mjcheetham/update-winget@v1.2.2 + with: + id: Microsoft.VFSforGit + token: ${{ secrets.WINGET_TOKEN }} + releaseAsset: SetupGVFS.([0-9.]*)\.exe + manifestText: | + PackageIdentifier: {{id}} + PackageVersion: {{version}} + PackageName: VFS for Git + Publisher: Microsoft Corporation + Moniker: vfs-for-git + PackageUrl: https://aka.ms/vfs-for-git + Tags: + - vfs for git + - vfs-for-git + - vfsforgit + - gvfs + License: Copyright (C) Microsoft Corporation + ShortDescription: Virtual File System for Git - a tool to scale Git for monorepo scenarios. + Installers: + - Architecture: x64 + InstallerUrl: {{url}} + InstallerType: inno + InstallerSha256: {{sha256}} + PackageLocale: en-US + ManifestType: singleton + ManifestVersion: 1.0.0 + alwaysUsePullRequest: true \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000000..61e42400d6 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,39 @@ + + + + + + + + $(MSBuildThisFileDirectory) + $(RepoPath) + $(RepoPath)..\out\ + $(RepoOutPath)$(MSBuildProjectName)\ + $(RepoPath)..\packages\ + + + true + + + + + win-x64 + x64 + $(ProjectOutPath)bin\ + $(ProjectOutPath)obj\ + + + + + x64 + $(ProjectOutPath)bin\$(Platform)\$(Configuration)\ + $(ProjectOutPath)intermediate\$(Platform)\$(Configuration)\ + $(IntDir)include\ + + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..94263857eb --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,11 @@ + + + + + $(GVFSVersion) + + + + + + diff --git a/Directory.Solution.props b/Directory.Solution.props new file mode 100644 index 0000000000..6ec70d7ef3 --- /dev/null +++ b/Directory.Solution.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/GVFS.sln b/GVFS.sln index b79f30d251..80a2cbf0e8 100644 --- a/GVFS.sln +++ b/GVFS.sln @@ -1,398 +1,157 @@ + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 -VisualStudioVersion = 16.0.30509.20 +VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DCE11095-DA5F-4878-B58D-2702765560F5}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - .gitattributes = .gitattributes - .gitignore = .gitignore - AuthoringTests.md = AuthoringTests.md - nuget.config = nuget.config - Protocol.md = Protocol.md - Readme.md = Readme.md - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastFetch", "GVFS\FastFetch\FastFetch.csproj", "{642D14C3-0332-4C95-8EE0-0EAC54CBF918}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GVFS", "GVFS", "{2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C}" - ProjectSection(SolutionItems) = preProject - GVFS\LibGit2Sharp.NativeBinaries.props = GVFS\LibGit2Sharp.NativeBinaries.props - GVFS\ProjectedFSLib.NativeBinaries.props = GVFS\ProjectedFSLib.NativeBinaries.props - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS", "GVFS\GVFS\GVFS.csproj", "{DADCDF10-E38D-432E-9684-CE029DEE1D07}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.GVFlt", "GVFS\GVFS.GVFlt\GVFS.GVFlt.csproj", "{1118B427-7063-422F-83B9-5023C8EC5A7A}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Common", "GVFS\GVFS.Common\GVFS.Common.csproj", "{77C8EC7B-4166-4F01-81C4-D9AB924021C0}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Common", "GVFS\GVFS.Common\GVFS.Common.csproj", "{374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests", "GVFS\GVFS.FunctionalTests\GVFS.FunctionalTests.csproj", "{963F33D0-09EE-42CB-9E5A-37A4F4F1BFAB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastFetch", "GVFS\FastFetch\FastFetch.csproj", "{07F2A520-2AB7-46DD-97C0-75D8E988D55B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests.LockHolder", "GVFS\GVFS.FunctionalTests.LockHolder\GVFS.FunctionalTests.LockHolder.csproj", "{B26985C3-250A-4805-AA97-AD0604331AC7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Tests", "GVFS\GVFS.Tests\GVFS.Tests.csproj", "{72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.GVFlt", "GVFS\GVFS.GVFlt\GVFS.GVFlt.csproj", "{B366D3B6-1E85-4015-8DB0-D5FA4331ECE4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GVFS Tests", "GVFS Tests", "{C41F10F9-1163-4CFA-A465-EA728F75E9FA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Hooks", "GVFS\GVFS.Hooks\GVFS.Hooks.csproj", "{EDB4A40E-CFC9-486A-BDC5-AB2951FD8EDC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.UnitTests.Windows", "GVFS\GVFS.UnitTests.Windows\GVFS.UnitTests.Windows.csproj", "{8E0D0989-21F6-4DD8-946C-39F992523CC6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mount", "GVFS\GVFS.Mount\GVFS.Mount.csproj", "{F96089C2-6D09-4349-B65D-9CCA6160C6A5}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.NativeTests", "GVFS\GVFS.NativeTests\GVFS.NativeTests.vcxproj", "{3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Hooks.Windows", "GVFS\GVFS.Hooks\GVFS.Hooks.Windows.csproj", "{BDA91EE5-C684-4FC5-A90A-B7D677421917}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Service.Windows", "GVFS\GVFS.Service\GVFS.Service.Windows.csproj", "{B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}" - ProjectSection(ProjectDependencies) = postProject - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} - {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258} - {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} - {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535} - EndProjectSection -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} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{28674A4B-1223-4633-A460-C8CC39B09318}" - ProjectSection(SolutionItems) = preProject - Scripts\CreateCommonAssemblyVersion.bat = Scripts\CreateCommonAssemblyVersion.bat - Scripts\CreateCommonCliAssemblyVersion.bat = Scripts\CreateCommonCliAssemblyVersion.bat - Scripts\CreateCommonVersionHeader.bat = Scripts\CreateCommonVersionHeader.bat - Scripts\RunFunctionalTests.bat = Scripts\RunFunctionalTests.bat - Scripts\RunUnitTests.bat = Scripts\RunUnitTests.bat - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.PerfProfiling", "GVFS\GVFS.PerfProfiling\GVFS.PerfProfiling.csproj", "{C5D3CA26-562F-4CA4-A378-B93E97A730E3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.MSBuild", "GVFS\GVFS.MSBuild\GVFS.MSBuild.csproj", "{39361E20-C7D3-43E5-A90E-5135457EABC0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Service.UI", "GVFS\GVFS.Service.UI\GVFS.Service.UI.csproj", "{93B403FD-DAFB-46C5-9636-B122792A548A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.PreBuild", "GVFS\GVFS.Build\GVFS.PreBuild.csproj", "{A4984251-840E-4622-AD0C-66DFCE2B2574}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{AB0D9230-3893-4486-8899-F9C871FB5D5F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GitHooksLoader", "GitHooksLoader\GitHooksLoader.vcxproj", "{798DE293-6EDA-4DC4-9395-BE7A71C563E3}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Installer.Windows", "GVFS\GVFS.Installer.Windows\GVFS.Installer.Windows.csproj", "{3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}" - ProjectSection(ProjectDependencies) = postProject - {2F63B22B-EE26-4266-BF17-28A9146483A1} = {2F63B22B-EE26-4266-BF17-28A9146483A1} - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.NativeTests", "GVFS\GVFS.NativeTests\GVFS.NativeTests.vcxproj", "{3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}" 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} - {32220664-594C-4425-B9A0-88E0BE2F3D2A} = {32220664-594C-4425-B9A0-88E0BE2F3D2A} - {798DE293-6EDA-4DC4-9395-BE7A71C563E3} = {798DE293-6EDA-4DC4-9395-BE7A71C563E3} - {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} = {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} - {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258} - {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} = {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} - {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} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.PerfProfiling", "GVFS\GVFS.PerfProfiling\GVFS.PerfProfiling.csproj", "{26B5D74F-972B-4B54-98C3-15958616E56D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook.Windows", "GVFS\GVFS.VirtualFileSystemHook\GVFS.VirtualFileSystemHook.Windows.vcxproj", "{2D23AB54-541F-4ABC-8DCA-08C199E97ABB}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Platform.Windows", "GVFS\GVFS.Platform.Windows\GVFS.Platform.Windows.csproj", "{41A25DAD-698D-47AB-8BB1-7E622FE6FAAC}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Virtualization", "GVFS\GVFS.Virtualization\GVFS.Virtualization.csproj", "{F468B05A-95E5-46BC-8C67-B80A78527B7D}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.PostIndexChangedHook", "GVFS\GVFS.PostIndexChangedHook\GVFS.PostIndexChangedHook.vcxproj", "{24D161E9-D1F0-4299-BBD3-5D940BEDD535}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Platform.POSIX", "GVFS\GVFS.Platform.POSIX\GVFS.Platform.POSIX.csproj", "{15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.ReadObjectHook", "GVFS\GVFS.ReadObjectHook\GVFS.ReadObjectHook.vcxproj", "{5A6656D5-81C7-472C-9DC8-32D071CB2258}" 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 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Service", "GVFS\GVFS.Service\GVFS.Service.csproj", "{5E236AF3-31D7-4313-A129-F080FF058283}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Platform.Windows", "GVFS\GVFS.Platform.Windows\GVFS.Platform.Windows.csproj", "{4CE404E7-D3FC-471C-993C-64615861EA63}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Service.UI", "GVFS\GVFS.Service.UI\GVFS.Service.UI.csproj", "{D8FB16E2-EAE0-4E05-A993-940062CD7CA7}" 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} - {798DE293-6EDA-4DC4-9395-BE7A71C563E3} = {798DE293-6EDA-4DC4-9395-BE7A71C563E3} - {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258} - {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} - {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Tests", "GVFS\GVFS.Tests\GVFS.Tests.csproj", "{FE70E0D6-B0A6-421D-AA12-F28F822F09A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Mount.Windows", "GVFS\GVFS.Mount\GVFS.Mount.Windows.csproj", "{17498502-AEFF-4E70-90CC-1D0B56A8ADF5}" - ProjectSection(ProjectDependencies) = postProject - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} = {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} - {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258} - {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} - {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {24D161E9-D1F0-4299-BBD3-5D940BEDD535} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.UnitTests", "GVFS\GVFS.UnitTests\GVFS.UnitTests.csproj", "{1A46C414-7F39-4EF0-B216-A88033D18678}" 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} - {07F2A520-2AB7-46DD-97C0-75D8E988D55B} = {07F2A520-2AB7-46DD-97C0-75D8E988D55B} - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} = {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} - {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} - EndProjectSection +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.VirtualFileSystemHook", "GVFS\GVFS.VirtualFileSystemHook\GVFS.VirtualFileSystemHook.vcxproj", "{2D23AB54-541F-4ABC-8DCA-08C199E97ABB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests", "GVFS\GVFS.FunctionalTests\GVFS.FunctionalTests.csproj", "{BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}" - ProjectSection(ProjectDependencies) = postProject - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} - {07F2A520-2AB7-46DD-97C0-75D8E988D55B} = {07F2A520-2AB7-46DD-97C0-75D8E988D55B} - {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} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Virtualization", "GVFS\GVFS.Virtualization\GVFS.Virtualization.csproj", "{EC90AF5D-E018-4248-85D6-9DB1898D710E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.FunctionalTests.LockHolder", "GVFS\GVFS.FunctionalTests.LockHolder\GVFS.FunctionalTests.LockHolder.csproj", "{FA273F69-5762-43D8-AEA1-B4F08090D624}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GitHooksLoader", "GVFS\GitHooksLoader\GitHooksLoader.vcxproj", "{798DE293-6EDA-4DC4-9395-BE7A71C563E3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Upgrader", "GVFS\GVFS.Upgrader\GVFS.Upgrader.csproj", "{AECEC217-2499-403D-B0BB-2962B9BE5970}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Payload", "GVFS\GVFS.Payload\GVFS.Payload.csproj", "{A40DD1DC-2D35-4215-9FA0-3990FB7182FD}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GVFS.PostIndexChangedHook.Windows", "GVFS\GVFS.PostIndexChangedHook\GVFS.PostIndexChangedHook.Windows.vcxproj", "{24D161E9-D1F0-4299-BBD3-5D940BEDD535}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Installers", "GVFS\GVFS.Installers\GVFS.Installers.csproj", "{258FEAC0-5E2D-408A-9652-9E9653219F3B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug.Mac|x64 = Debug.Mac|x64 - Debug.Windows|x64 = Debug.Windows|x64 - Release.Mac|x64 = Release.Mac|x64 - Release.Windows|x64 = Release.Windows|x64 + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1118B427-7063-422F-83B9-5023C8EC5A7A}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {1118B427-7063-422F-83B9-5023C8EC5A7A}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {1118B427-7063-422F-83B9-5023C8EC5A7A}.Debug.Windows|x64.Build.0 = Debug|x64 - {1118B427-7063-422F-83B9-5023C8EC5A7A}.Release.Mac|x64.ActiveCfg = Release|x64 - {1118B427-7063-422F-83B9-5023C8EC5A7A}.Release.Windows|x64.ActiveCfg = Release|x64 - {1118B427-7063-422F-83B9-5023C8EC5A7A}.Release.Windows|x64.Build.0 = Release|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Debug.Mac|x64.Build.0 = Debug|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Debug.Windows|x64.Build.0 = Debug|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Release.Mac|x64.ActiveCfg = Release|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Release.Mac|x64.Build.0 = Release|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Release.Windows|x64.ActiveCfg = Release|x64 - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09}.Release.Windows|x64.Build.0 = Release|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Debug.Mac|x64.Build.0 = Debug|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Debug.Windows|x64.Build.0 = Debug|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Release.Mac|x64.ActiveCfg = Release|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Release.Mac|x64.Build.0 = Release|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Release.Windows|x64.ActiveCfg = Release|x64 - {07F2A520-2AB7-46DD-97C0-75D8E988D55B}.Release.Windows|x64.Build.0 = Release|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Debug.Mac|x64.Build.0 = Debug|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Debug.Windows|x64.Build.0 = Debug|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Release.Mac|x64.ActiveCfg = Release|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Release.Mac|x64.Build.0 = Release|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Release.Windows|x64.ActiveCfg = Release|x64 - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC}.Release.Windows|x64.Build.0 = Release|x64 - {8E0D0989-21F6-4DD8-946C-39F992523CC6}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {8E0D0989-21F6-4DD8-946C-39F992523CC6}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {8E0D0989-21F6-4DD8-946C-39F992523CC6}.Debug.Windows|x64.Build.0 = Debug|x64 - {8E0D0989-21F6-4DD8-946C-39F992523CC6}.Release.Mac|x64.ActiveCfg = Release|x64 - {8E0D0989-21F6-4DD8-946C-39F992523CC6}.Release.Windows|x64.ActiveCfg = Release|x64 - {8E0D0989-21F6-4DD8-946C-39F992523CC6}.Release.Windows|x64.Build.0 = Release|x64 - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Debug.Windows|x64.Build.0 = Debug|x64 - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Release.Mac|x64.ActiveCfg = Release|x64 - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Release.Windows|x64.ActiveCfg = Release|x64 - {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Release.Windows|x64.Build.0 = Release|x64 - {BDA91EE5-C684-4FC5-A90A-B7D677421917}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {BDA91EE5-C684-4FC5-A90A-B7D677421917}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {BDA91EE5-C684-4FC5-A90A-B7D677421917}.Debug.Windows|x64.Build.0 = Debug|x64 - {BDA91EE5-C684-4FC5-A90A-B7D677421917}.Release.Mac|x64.ActiveCfg = Release|x64 - {BDA91EE5-C684-4FC5-A90A-B7D677421917}.Release.Windows|x64.ActiveCfg = Release|x64 - {BDA91EE5-C684-4FC5-A90A-B7D677421917}.Release.Windows|x64.Build.0 = Release|x64 - {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B}.Debug.Windows|x64.Build.0 = Debug|x64 - {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 - {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 - {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Release.Mac|x64.ActiveCfg = Release|x64 - {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Release.Windows|x64.ActiveCfg = Release|x64 - {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Release.Windows|x64.Build.0 = Release|x64 - {C5D3CA26-562F-4CA4-A378-B93E97A730E3}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {C5D3CA26-562F-4CA4-A378-B93E97A730E3}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {C5D3CA26-562F-4CA4-A378-B93E97A730E3}.Debug.Windows|x64.Build.0 = Debug|x64 - {C5D3CA26-562F-4CA4-A378-B93E97A730E3}.Release.Mac|x64.ActiveCfg = Release|x64 - {C5D3CA26-562F-4CA4-A378-B93E97A730E3}.Release.Windows|x64.ActiveCfg = Release|x64 - {C5D3CA26-562F-4CA4-A378-B93E97A730E3}.Release.Windows|x64.Build.0 = Release|x64 - {93B403FD-DAFB-46C5-9636-B122792A548A}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {93B403FD-DAFB-46C5-9636-B122792A548A}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {93B403FD-DAFB-46C5-9636-B122792A548A}.Debug.Windows|x64.Build.0 = Debug|x64 - {93B403FD-DAFB-46C5-9636-B122792A548A}.Release.Mac|x64.ActiveCfg = Release|x64 - {93B403FD-DAFB-46C5-9636-B122792A548A}.Release.Windows|x64.ActiveCfg = Release|x64 - {93B403FD-DAFB-46C5-9636-B122792A548A}.Release.Windows|x64.Build.0 = Release|x64 - {A4984251-840E-4622-AD0C-66DFCE2B2574}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {A4984251-840E-4622-AD0C-66DFCE2B2574}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {A4984251-840E-4622-AD0C-66DFCE2B2574}.Debug.Windows|x64.Build.0 = Debug|x64 - {A4984251-840E-4622-AD0C-66DFCE2B2574}.Release.Mac|x64.ActiveCfg = Release|x64 - {A4984251-840E-4622-AD0C-66DFCE2B2574}.Release.Windows|x64.ActiveCfg = Release|x64 - {A4984251-840E-4622-AD0C-66DFCE2B2574}.Release.Windows|x64.Build.0 = Release|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug.Windows|x64.Build.0 = Debug|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release.Mac|x64.ActiveCfg = Release|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release.Windows|x64.ActiveCfg = Release|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release.Windows|x64.Build.0 = Release|x64 - {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Debug.Windows|x64.Build.0 = Debug|x64 - {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 - {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 - {2F63B22B-EE26-4266-BF17-28A9146483A1}.Release.Mac|x64.ActiveCfg = Release|x64 - {2F63B22B-EE26-4266-BF17-28A9146483A1}.Release.Windows|x64.ActiveCfg = Release|x64 - {2F63B22B-EE26-4266-BF17-28A9146483A1}.Release.Windows|x64.Build.0 = Release|x64 - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Debug.Windows|x64.Build.0 = Debug|x64 - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Release.Mac|x64.ActiveCfg = Release|x64 - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Release.Windows|x64.ActiveCfg = Release|x64 - {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Release.Windows|x64.Build.0 = Release|x64 - {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Debug.Mac|x64.Build.0 = Debug|x64 - {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Debug.Windows|x64.Build.0 = Debug|x64 - {F468B05A-95E5-46BC-8C67-B80A78527B7D}.Release.Mac|x64.ActiveCfg = Release|x64 - {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 - {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 - {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Debug.Windows|x64.Build.0 = Debug|x64 - {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Release.Mac|x64.ActiveCfg = Release|x64 - {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Release.Mac|x64.Build.0 = Release|x64 - {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Release.Windows|x64.ActiveCfg = Release|x64 - {15FAE44C-0D21-4312-9FD3-28F05A5AB7A6}.Release.Windows|x64.Build.0 = Release|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Debug.Mac|x64.Build.0 = Debug|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Debug.Windows|x64.Build.0 = Debug|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Release.Mac|x64.ActiveCfg = Release|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Release.Mac|x64.Build.0 = Release|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Release.Windows|x64.ActiveCfg = Release|x64 - {0D434FA7-6D8C-481E-B0CE-779B59EAEF53}.Release.Windows|x64.Build.0 = Release|x64 - {4CE404E7-D3FC-471C-993C-64615861EA63}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {4CE404E7-D3FC-471C-993C-64615861EA63}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {4CE404E7-D3FC-471C-993C-64615861EA63}.Debug.Windows|x64.Build.0 = Debug|x64 - {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 - {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 - {32220664-594C-4425-B9A0-88E0BE2F3D2A}.Release.Mac|x64.ActiveCfg = Release|x64 - {32220664-594C-4425-B9A0-88E0BE2F3D2A}.Release.Windows|x64.ActiveCfg = Release|x64 - {32220664-594C-4425-B9A0-88E0BE2F3D2A}.Release.Windows|x64.Build.0 = Release|x64 - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5}.Debug.Windows|x64.Build.0 = Debug|x64 - {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 - {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 - {0F0A008E-AB12-40EC-A671-37A541B08C7F}.Release.Mac|x64.ActiveCfg = Release|x64 - {0F0A008E-AB12-40EC-A671-37A541B08C7F}.Release.Windows|x64.ActiveCfg = Release|x64 - {0F0A008E-AB12-40EC-A671-37A541B08C7F}.Release.Windows|x64.Build.0 = Release|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Debug.Mac|x64.Build.0 = Debug|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Debug.Windows|x64.Build.0 = Debug|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Release.Mac|x64.ActiveCfg = Release|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Release.Mac|x64.Build.0 = Release|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Release.Windows|x64.ActiveCfg = Release|x64 - {BD7C5776-82F2-40C6-AF01-B3CC1E2D83AF}.Release.Windows|x64.Build.0 = Release|x64 - {FA273F69-5762-43D8-AEA1-B4F08090D624}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {FA273F69-5762-43D8-AEA1-B4F08090D624}.Debug.Mac|x64.Build.0 = Debug|x64 - {FA273F69-5762-43D8-AEA1-B4F08090D624}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {FA273F69-5762-43D8-AEA1-B4F08090D624}.Debug.Windows|x64.Build.0 = Debug|x64 - {FA273F69-5762-43D8-AEA1-B4F08090D624}.Release.Mac|x64.ActiveCfg = Release|x64 - {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 - {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 - {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 - {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Release.Mac|x64.ActiveCfg = Release|x64 - {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Release.Windows|x64.ActiveCfg = Release|x64 - {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Release.Windows|x64.Build.0 = Release|x64 + {642D14C3-0332-4C95-8EE0-0EAC54CBF918}.Debug|x64.ActiveCfg = Debug|Any CPU + {642D14C3-0332-4C95-8EE0-0EAC54CBF918}.Debug|x64.Build.0 = Debug|Any CPU + {642D14C3-0332-4C95-8EE0-0EAC54CBF918}.Release|x64.ActiveCfg = Release|Any CPU + {642D14C3-0332-4C95-8EE0-0EAC54CBF918}.Release|x64.Build.0 = Release|Any CPU + {DADCDF10-E38D-432E-9684-CE029DEE1D07}.Debug|x64.ActiveCfg = Debug|Any CPU + {DADCDF10-E38D-432E-9684-CE029DEE1D07}.Debug|x64.Build.0 = Debug|Any CPU + {DADCDF10-E38D-432E-9684-CE029DEE1D07}.Release|x64.ActiveCfg = Release|Any CPU + {DADCDF10-E38D-432E-9684-CE029DEE1D07}.Release|x64.Build.0 = Release|Any CPU + {77C8EC7B-4166-4F01-81C4-D9AB924021C0}.Debug|x64.ActiveCfg = Debug|Any CPU + {77C8EC7B-4166-4F01-81C4-D9AB924021C0}.Debug|x64.Build.0 = Debug|Any CPU + {77C8EC7B-4166-4F01-81C4-D9AB924021C0}.Release|x64.ActiveCfg = Release|Any CPU + {77C8EC7B-4166-4F01-81C4-D9AB924021C0}.Release|x64.Build.0 = Release|Any CPU + {963F33D0-09EE-42CB-9E5A-37A4F4F1BFAB}.Debug|x64.ActiveCfg = Debug|Any CPU + {963F33D0-09EE-42CB-9E5A-37A4F4F1BFAB}.Debug|x64.Build.0 = Debug|Any CPU + {963F33D0-09EE-42CB-9E5A-37A4F4F1BFAB}.Release|x64.ActiveCfg = Release|Any CPU + {963F33D0-09EE-42CB-9E5A-37A4F4F1BFAB}.Release|x64.Build.0 = Release|Any CPU + {B26985C3-250A-4805-AA97-AD0604331AC7}.Debug|x64.ActiveCfg = Debug|Any CPU + {B26985C3-250A-4805-AA97-AD0604331AC7}.Debug|x64.Build.0 = Debug|Any CPU + {B26985C3-250A-4805-AA97-AD0604331AC7}.Release|x64.ActiveCfg = Release|Any CPU + {B26985C3-250A-4805-AA97-AD0604331AC7}.Release|x64.Build.0 = Release|Any CPU + {B366D3B6-1E85-4015-8DB0-D5FA4331ECE4}.Debug|x64.ActiveCfg = Debug|Any CPU + {B366D3B6-1E85-4015-8DB0-D5FA4331ECE4}.Debug|x64.Build.0 = Debug|Any CPU + {B366D3B6-1E85-4015-8DB0-D5FA4331ECE4}.Release|x64.ActiveCfg = Release|Any CPU + {B366D3B6-1E85-4015-8DB0-D5FA4331ECE4}.Release|x64.Build.0 = Release|Any CPU + {EDB4A40E-CFC9-486A-BDC5-AB2951FD8EDC}.Debug|x64.ActiveCfg = Debug|Any CPU + {EDB4A40E-CFC9-486A-BDC5-AB2951FD8EDC}.Debug|x64.Build.0 = Debug|Any CPU + {EDB4A40E-CFC9-486A-BDC5-AB2951FD8EDC}.Release|x64.ActiveCfg = Release|Any CPU + {EDB4A40E-CFC9-486A-BDC5-AB2951FD8EDC}.Release|x64.Build.0 = Release|Any CPU + {F96089C2-6D09-4349-B65D-9CCA6160C6A5}.Debug|x64.ActiveCfg = Debug|Any CPU + {F96089C2-6D09-4349-B65D-9CCA6160C6A5}.Debug|x64.Build.0 = Debug|Any CPU + {F96089C2-6D09-4349-B65D-9CCA6160C6A5}.Release|x64.ActiveCfg = Release|Any CPU + {F96089C2-6D09-4349-B65D-9CCA6160C6A5}.Release|x64.Build.0 = Release|Any CPU + {39361E20-C7D3-43E5-A90E-5135457EABC0}.Debug|x64.ActiveCfg = Debug|Any CPU + {39361E20-C7D3-43E5-A90E-5135457EABC0}.Debug|x64.Build.0 = Debug|Any CPU + {39361E20-C7D3-43E5-A90E-5135457EABC0}.Release|x64.ActiveCfg = Release|Any CPU + {39361E20-C7D3-43E5-A90E-5135457EABC0}.Release|x64.Build.0 = Release|Any CPU + {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Debug|x64.ActiveCfg = Debug|x64 + {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Debug|x64.Build.0 = Debug|x64 + {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Release|x64.ActiveCfg = Release|x64 + {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5}.Release|x64.Build.0 = Release|x64 + {26B5D74F-972B-4B54-98C3-15958616E56D}.Debug|x64.ActiveCfg = Debug|Any CPU + {26B5D74F-972B-4B54-98C3-15958616E56D}.Debug|x64.Build.0 = Debug|Any CPU + {26B5D74F-972B-4B54-98C3-15958616E56D}.Release|x64.ActiveCfg = Release|Any CPU + {26B5D74F-972B-4B54-98C3-15958616E56D}.Release|x64.Build.0 = Release|Any CPU + {41A25DAD-698D-47AB-8BB1-7E622FE6FAAC}.Debug|x64.ActiveCfg = Debug|Any CPU + {41A25DAD-698D-47AB-8BB1-7E622FE6FAAC}.Debug|x64.Build.0 = Debug|Any CPU + {41A25DAD-698D-47AB-8BB1-7E622FE6FAAC}.Release|x64.ActiveCfg = Release|Any CPU + {41A25DAD-698D-47AB-8BB1-7E622FE6FAAC}.Release|x64.Build.0 = Release|Any CPU + {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug|x64.ActiveCfg = Debug|x64 + {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Debug|x64.Build.0 = Debug|x64 + {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Release|x64.ActiveCfg = Release|x64 + {24D161E9-D1F0-4299-BBD3-5D940BEDD535}.Release|x64.Build.0 = Release|x64 + {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug|x64.ActiveCfg = Debug|x64 + {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Debug|x64.Build.0 = Debug|x64 + {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Release|x64.ActiveCfg = Release|x64 + {5A6656D5-81C7-472C-9DC8-32D071CB2258}.Release|x64.Build.0 = Release|x64 + {5E236AF3-31D7-4313-A129-F080FF058283}.Debug|x64.ActiveCfg = Debug|Any CPU + {5E236AF3-31D7-4313-A129-F080FF058283}.Debug|x64.Build.0 = Debug|Any CPU + {5E236AF3-31D7-4313-A129-F080FF058283}.Release|x64.ActiveCfg = Release|Any CPU + {5E236AF3-31D7-4313-A129-F080FF058283}.Release|x64.Build.0 = Release|Any CPU + {D8FB16E2-EAE0-4E05-A993-940062CD7CA7}.Debug|x64.ActiveCfg = Debug|Any CPU + {D8FB16E2-EAE0-4E05-A993-940062CD7CA7}.Debug|x64.Build.0 = Debug|Any CPU + {D8FB16E2-EAE0-4E05-A993-940062CD7CA7}.Release|x64.ActiveCfg = Release|Any CPU + {D8FB16E2-EAE0-4E05-A993-940062CD7CA7}.Release|x64.Build.0 = Release|Any CPU + {FE70E0D6-B0A6-421D-AA12-F28F822F09A0}.Debug|x64.ActiveCfg = Debug|Any CPU + {FE70E0D6-B0A6-421D-AA12-F28F822F09A0}.Debug|x64.Build.0 = Debug|Any CPU + {FE70E0D6-B0A6-421D-AA12-F28F822F09A0}.Release|x64.ActiveCfg = Release|Any CPU + {FE70E0D6-B0A6-421D-AA12-F28F822F09A0}.Release|x64.Build.0 = Release|Any CPU + {1A46C414-7F39-4EF0-B216-A88033D18678}.Debug|x64.ActiveCfg = Debug|Any CPU + {1A46C414-7F39-4EF0-B216-A88033D18678}.Debug|x64.Build.0 = Debug|Any CPU + {1A46C414-7F39-4EF0-B216-A88033D18678}.Release|x64.ActiveCfg = Release|Any CPU + {1A46C414-7F39-4EF0-B216-A88033D18678}.Release|x64.Build.0 = Release|Any CPU + {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Debug|x64.ActiveCfg = Debug|x64 + {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Debug|x64.Build.0 = Debug|x64 + {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Release|x64.ActiveCfg = Release|x64 + {2D23AB54-541F-4ABC-8DCA-08C199E97ABB}.Release|x64.Build.0 = Release|x64 + {EC90AF5D-E018-4248-85D6-9DB1898D710E}.Debug|x64.ActiveCfg = Debug|Any CPU + {EC90AF5D-E018-4248-85D6-9DB1898D710E}.Debug|x64.Build.0 = Debug|Any CPU + {EC90AF5D-E018-4248-85D6-9DB1898D710E}.Release|x64.ActiveCfg = Release|Any CPU + {EC90AF5D-E018-4248-85D6-9DB1898D710E}.Release|x64.Build.0 = Release|Any CPU + {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug|x64.ActiveCfg = Debug|x64 + {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug|x64.Build.0 = Debug|x64 + {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release|x64.ActiveCfg = Release|x64 + {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release|x64.Build.0 = Release|x64 + {A40DD1DC-2D35-4215-9FA0-3990FB7182FD}.Debug|x64.ActiveCfg = Debug|Any CPU + {A40DD1DC-2D35-4215-9FA0-3990FB7182FD}.Debug|x64.Build.0 = Debug|Any CPU + {A40DD1DC-2D35-4215-9FA0-3990FB7182FD}.Release|x64.ActiveCfg = Release|Any CPU + {A40DD1DC-2D35-4215-9FA0-3990FB7182FD}.Release|x64.Build.0 = Release|Any CPU + {258FEAC0-5E2D-408A-9652-9E9653219F3B}.Debug|x64.ActiveCfg = Debug|Any CPU + {258FEAC0-5E2D-408A-9652-9E9653219F3B}.Debug|x64.Build.0 = Debug|Any CPU + {258FEAC0-5E2D-408A-9652-9E9653219F3B}.Release|x64.ActiveCfg = Release|Any CPU + {258FEAC0-5E2D-408A-9652-9E9653219F3B}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {1118B427-7063-422F-83B9-5023C8EC5A7A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {374BF1E5-0B2D-4D4A-BD5E-4212299DEF09} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {07F2A520-2AB7-46DD-97C0-75D8E988D55B} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} - {8E0D0989-21F6-4DD8-946C-39F992523CC6} = {C41F10F9-1163-4CFA-A465-EA728F75E9FA} - {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} - {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} - {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} - {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} - {32220664-594C-4425-B9A0-88E0BE2F3D2A} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {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} - {AECEC217-2499-403D-B0BB-2962B9BE5970} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - {24D161E9-D1F0-4299-BBD3-5D940BEDD535} = {2EF2EC94-3A68-4ED7-9A58-B7057ADBA01C} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A025908B-DAB1-46CB-83A3-56F3B863D8FA} + SolutionGuid = {C506C09B-011F-491F-9D17-D0E2BA0B3467} EndGlobalSection EndGlobal diff --git a/GVFS/Directory.Build.props b/GVFS/Directory.Build.props deleted file mode 100644 index 42fff15fbd..0000000000 --- a/GVFS/Directory.Build.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - - $(MSBuildThisFileDirectory)\..\..\BuildOutput\$(MSBuildProjectName)\obj - - \ No newline at end of file diff --git a/GVFS/FastFetch/FastFetch.csproj b/GVFS/FastFetch/FastFetch.csproj index 90aac7cc48..52bb94654f 100644 --- a/GVFS/FastFetch/FastFetch.csproj +++ b/GVFS/FastFetch/FastFetch.csproj @@ -1,55 +1,31 @@ - - - - - Exe - FastFetch - netcoreapp2.1 - x64 - osx-x64;win-x64 - true - true - true - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - - - - - - - - - - PlatformLoader.Windows.cs - - - - - - - - PlatformLoader.Mac.cs - - - - - - - - - - all - - - + + + + Exe + net461 + x64 + true + + + + + + + + + + + + + + Microsoft400 + false + + + + diff --git a/GVFS/FastFetch/NativeMethods.cs b/GVFS/FastFetch/NativeMethods.cs index a8f0ebc746..c71c2907b4 100644 --- a/GVFS/FastFetch/NativeMethods.cs +++ b/GVFS/FastFetch/NativeMethods.cs @@ -1,4 +1,8 @@ using GVFS.Common.Tracing; +using Microsoft.Win32.SafeHandles; +using System; +using System.ComponentModel; +using System.IO; using System.IO.MemoryMappedFiles; using System.Runtime.InteropServices; @@ -6,30 +10,115 @@ namespace FastFetch { internal static class NativeMethods { - public static bool isUnixOS = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + private const int AccessDeniedWin32Error = 5; public static unsafe void WriteFile(ITracer tracer, byte* originalData, long originalSize, string destination, ushort mode) { - if (isUnixOS) + try { - NativeUnixMethods.WriteFile(tracer, originalData, originalSize, destination, mode); + using (SafeFileHandle fileHandle = OpenForWrite(tracer, destination)) + { + if (fileHandle.IsInvalid) + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } + + byte* data = originalData; + long size = originalSize; + uint written = 0; + while (size > 0) + { + uint toWrite = size < uint.MaxValue ? (uint)size : uint.MaxValue; + if (!WriteFile(fileHandle, data, toWrite, out written, IntPtr.Zero)) + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } + + size -= written; + data = data + written; + } + } } - else + catch (Exception e) { - NativeWindowsMethods.WriteFile(tracer, originalData, originalSize, destination); + EventMetadata metadata = new EventMetadata(); + metadata.Add("destination", destination); + metadata.Add("exception", e.ToString()); + tracer.RelatedError(metadata, "Error writing file."); + throw; } } public static bool TryStatFileAndUpdateIndex(ITracer tracer, string path, MemoryMappedViewAccessor indexView, long offset) { - if (isUnixOS) + try + { + FileInfo file = new FileInfo(path); + if (file.Exists) + { + Index.IndexEntry indexEntry = new Index.IndexEntry(indexView, offset); + indexEntry.Mtime = file.LastWriteTimeUtc; + indexEntry.Ctime = file.CreationTimeUtc; + indexEntry.Size = (uint)file.Length; + return true; + } + } + catch (System.Security.SecurityException) { - return NativeUnixMethods.TryStatFileAndUpdateIndex(tracer, path, indexView, offset); + // Skip these. } - else + catch (System.UnauthorizedAccessException) { - return NativeWindowsMethods.TryStatFileAndUpdateIndex(tracer, path, indexView, offset); + // Skip these. } + + return false; } + + private static SafeFileHandle OpenForWrite(ITracer tracer, string fileName) + { + SafeFileHandle handle = CreateFile(fileName, FileAccess.Write, FileShare.None, IntPtr.Zero, FileMode.Create, FileAttributes.Normal, IntPtr.Zero); + if (handle.IsInvalid) + { + // If we get a access denied, try reverting the acls to defaults inherited by parent + if (Marshal.GetLastWin32Error() == AccessDeniedWin32Error) + { + tracer.RelatedEvent( + EventLevel.Warning, + "FailedOpenForWrite", + new EventMetadata + { + { TracingConstants.MessageKey.WarningMessage, "Received access denied. Attempting to delete." }, + { "FileName", fileName } + }); + + File.SetAttributes(fileName, FileAttributes.Normal); + File.Delete(fileName); + + handle = CreateFile(fileName, FileAccess.Write, FileShare.None, IntPtr.Zero, FileMode.Create, FileAttributes.Normal, IntPtr.Zero); + } + } + + return handle; + } + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern SafeFileHandle CreateFile( + [MarshalAs(UnmanagedType.LPTStr)] string filename, + [MarshalAs(UnmanagedType.U4)] FileAccess access, + [MarshalAs(UnmanagedType.U4)] FileShare share, + IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero + [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, + [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, + IntPtr templateFile); + + [DllImport("kernel32.dll", SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static unsafe extern bool WriteFile( + SafeFileHandle file, + byte* buffer, + uint numberOfBytesToWrite, + out uint numberOfBytesWritten, + IntPtr overlapped); } } diff --git a/GVFS/FastFetch/NativeUnixMethods.cs b/GVFS/FastFetch/NativeUnixMethods.cs deleted file mode 100644 index 1cf33db32e..0000000000 --- a/GVFS/FastFetch/NativeUnixMethods.cs +++ /dev/null @@ -1,153 +0,0 @@ -using GVFS.Common.Tracing; -using System; -using System.ComponentModel; -using System.IO.MemoryMappedFiles; -using System.Runtime.InteropServices; - -namespace FastFetch -{ - public class NativeUnixMethods - { - public const int ReadOnly = 0x0000; - public const int WriteOnly = 0x0001; - - public const int Create = 0x0200; - public const int Truncate = 0x0400; - private const int InvalidFileDescriptor = -1; - private const ushort SymLinkMode = 0xA000; - - public static unsafe void WriteFile(ITracer tracer, byte* originalData, long originalSize, string destination, ushort mode) - { - int fileDescriptor = InvalidFileDescriptor; - try - { - if (mode == SymLinkMode) - { - string linkTarget = Marshal.PtrToStringUTF8(new IntPtr(originalData)); - int result = CreateSymLink(linkTarget, destination); - if (result == -1) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), $"Failed to create symlink({linkTarget}, {destination})."); - } - } - else - { - fileDescriptor = Open(destination, WriteOnly | Create | Truncate, mode); - if (fileDescriptor == InvalidFileDescriptor) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), $"Failed to open({destination}.)"); - } - - IntPtr result = Write(fileDescriptor, originalData, (IntPtr)originalSize); - if (result.ToInt32() == -1) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), $"Failed to write contents into {destination}."); - } - } - } - catch (Win32Exception e) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("filemode", mode); - metadata.Add("destination", destination); - metadata.Add("exception", e.ToString()); - tracer.RelatedError(metadata, $"Failed to properly create {destination}"); - throw; - } - finally - { - Close(fileDescriptor); - } - } - - public static bool TryStatFileAndUpdateIndex(ITracer tracer, string path, MemoryMappedViewAccessor indexView, long offset) - { - try - { - NativeStat.StatBuffer st = StatFile(path); - Index.IndexEntry indexEntry = new Index.IndexEntry(indexView, offset); - indexEntry.MtimeSeconds = (uint)st.MTimespec.Sec; - indexEntry.MtimeNanosecondFraction = (uint)st.MTimespec.Nsec; - indexEntry.CtimeSeconds = (uint)st.CTimespec.Sec; - indexEntry.CtimeNanosecondFraction = (uint)st.CTimespec.Nsec; - indexEntry.Size = (uint)st.Size; - indexEntry.Dev = (uint)st.Dev; - indexEntry.Ino = (uint)st.Ino; - indexEntry.Uid = st.UID; - indexEntry.Gid = st.GID; - return true; - } - catch (Win32Exception e) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("path", path); - metadata.Add("exception", e.ToString()); - tracer.RelatedError(metadata, "Error stat-ing file."); - return false; - } - } - - [DllImport("libc", EntryPoint = "open", SetLastError = true)] - public static extern int Open(string path, int flag, ushort creationMode); - - [DllImport("libc", EntryPoint = "close", SetLastError = true)] - public static extern int Close(int fd); - - [DllImport("libc", EntryPoint = "write", SetLastError = true)] - private static unsafe extern IntPtr Write(int fileDescriptor, void* buf, IntPtr count); - - [DllImport("libc", EntryPoint = "symlink", SetLastError = true)] - private static extern int CreateSymLink(string linkTarget, string newLinkPath); - - private static NativeStat.StatBuffer StatFile(string fileName) - { - NativeStat.StatBuffer statBuffer = new NativeStat.StatBuffer(); - if (NativeStat.Stat(fileName, out statBuffer) != 0) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), $"Failed to stat {fileName}"); - } - - return statBuffer; - } - - private static class NativeStat - { - [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! */ - } - } - } -} diff --git a/GVFS/FastFetch/NativeWindowsMethods.cs b/GVFS/FastFetch/NativeWindowsMethods.cs deleted file mode 100644 index 321abf3124..0000000000 --- a/GVFS/FastFetch/NativeWindowsMethods.cs +++ /dev/null @@ -1,124 +0,0 @@ -using GVFS.Common.Tracing; -using Microsoft.Win32.SafeHandles; -using System; -using System.ComponentModel; -using System.IO; -using System.IO.MemoryMappedFiles; -using System.Runtime.InteropServices; - -namespace FastFetch -{ - public class NativeWindowsMethods - { - private const int AccessDeniedWin32Error = 5; - - public static unsafe void WriteFile(ITracer tracer, byte* originalData, long originalSize, string destination) - { - try - { - using (SafeFileHandle fileHandle = OpenForWrite(tracer, destination)) - { - if (fileHandle.IsInvalid) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - - byte* data = originalData; - long size = originalSize; - uint written = 0; - while (size > 0) - { - uint toWrite = size < uint.MaxValue ? (uint)size : uint.MaxValue; - if (!WriteFile(fileHandle, data, toWrite, out written, IntPtr.Zero)) - { - throw new Win32Exception(Marshal.GetLastWin32Error()); - } - - size -= written; - data = data + written; - } - } - } - catch (Exception e) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("destination", destination); - metadata.Add("exception", e.ToString()); - tracer.RelatedError(metadata, "Error writing file."); - throw; - } - } - - public static bool TryStatFileAndUpdateIndex(ITracer tracer, string path, MemoryMappedViewAccessor indexView, long offset) - { - try - { - FileInfo file = new FileInfo(path); - if (file.Exists) - { - Index.IndexEntry indexEntry = new Index.IndexEntry(indexView, offset); - indexEntry.Mtime = file.LastWriteTimeUtc; - indexEntry.Ctime = file.CreationTimeUtc; - indexEntry.Size = (uint)file.Length; - return true; - } - } - catch (System.Security.SecurityException) - { - // Skip these. - } - catch (System.UnauthorizedAccessException) - { - // Skip these. - } - - return false; - } - - private static SafeFileHandle OpenForWrite(ITracer tracer, string fileName) - { - SafeFileHandle handle = CreateFile(fileName, FileAccess.Write, FileShare.None, IntPtr.Zero, FileMode.Create, FileAttributes.Normal, IntPtr.Zero); - if (handle.IsInvalid) - { - // If we get a access denied, try reverting the acls to defaults inherited by parent - if (Marshal.GetLastWin32Error() == AccessDeniedWin32Error) - { - tracer.RelatedEvent( - EventLevel.Warning, - "FailedOpenForWrite", - new EventMetadata - { - { TracingConstants.MessageKey.WarningMessage, "Received access denied. Attempting to delete." }, - { "FileName", fileName } - }); - - File.SetAttributes(fileName, FileAttributes.Normal); - File.Delete(fileName); - - handle = CreateFile(fileName, FileAccess.Write, FileShare.None, IntPtr.Zero, FileMode.Create, FileAttributes.Normal, IntPtr.Zero); - } - } - - return handle; - } - - [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] - private static extern SafeFileHandle CreateFile( - [MarshalAs(UnmanagedType.LPTStr)] string filename, - [MarshalAs(UnmanagedType.U4)] FileAccess access, - [MarshalAs(UnmanagedType.U4)] FileShare share, - IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero - [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, - [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, - IntPtr templateFile); - - [DllImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - private static unsafe extern bool WriteFile( - SafeFileHandle file, - byte* buffer, - uint numberOfBytesToWrite, - out uint numberOfBytesWritten, - IntPtr overlapped); - } -} diff --git a/GVFS/FastFetch/Properties/AssemblyInfo.cs b/GVFS/FastFetch/Properties/AssemblyInfo.cs deleted file mode 100644 index b4aa706f75..0000000000 --- a/GVFS/FastFetch/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("FastFetch")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FastFetch")] -[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("07f2a520-2ab7-46dd-97c0-75d8e988d55b")] diff --git a/GVFS/FastFetch/package.nuspec b/GVFS/FastFetch/package.nuspec deleted file mode 100644 index ec291a94c0..0000000000 --- a/GVFS/FastFetch/package.nuspec +++ /dev/null @@ -1,19 +0,0 @@ - - - - FastFetch - 0.1.0 - Microsoft - https://github.com/Microsoft/GVFS - false - - An internal tool for quickly pulling large git repos from a GVFS-enabled git server. - This application will be deprecated once this same functionality is added to the gvfs prefetch verb. - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Build/.gitignore b/GVFS/GVFS.Build/.gitignore deleted file mode 100644 index 761f8ceb83..0000000000 --- a/GVFS/GVFS.Build/.gitignore +++ /dev/null @@ -1 +0,0 @@ -packages.config \ No newline at end of file diff --git a/GVFS/GVFS.Build/GVFS.PreBuild.csproj b/GVFS/GVFS.Build/GVFS.PreBuild.csproj deleted file mode 100644 index 6f66a14dda..0000000000 --- a/GVFS/GVFS.Build/GVFS.PreBuild.csproj +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - {A4984251-840E-4622-AD0C-66DFCE2B2574} - Library - Properties - GVFS.PreBuild - GVFS.PreBuild - v4.6.1 - 512 - - - true - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - true - - - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - - - - - - - - - - Designer - - - Designer - - - Designer - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SetupGVFS.$(GVFSVersion).exe - $(BuildOutputDir)\GVFS.Installer.Windows\bin\x64\$(Configuration)\SetupGVFS.$(GVFSVersion).exe - $(BuildOutputDir)\GVFS.Build\ - $(OutDir)GVFSConstants.GitVersion.cs - $(OutDir)InstallG4W.bat - $(OutDir)InstallGVFS.bat - $(OutDir)InstallProduct.bat - $(OutDir)GVFS.Installers.nuspec - $(BuildOutputDir)\CommonAssemblyVersion.cs - $(BuildOutputDir)\CommonVersionHeader.h - $(BuildOutputDir)\restore.timestamp - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Build/GVFS.cpp.props b/GVFS/GVFS.Build/GVFS.cpp.props deleted file mode 100644 index b299c87266..0000000000 --- a/GVFS/GVFS.Build/GVFS.cpp.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - $(BuildOutputDir)\$(MSBuildProjectName)\bin\$(Platform)\$(Configuration)\ - $(BuildOutputDir)\$(MSBuildProjectName)\intermediate\$(Platform)\$(Configuration)\ - - - diff --git a/GVFS/GVFS.Build/GVFS.cs.props b/GVFS/GVFS.Build/GVFS.cs.props deleted file mode 100644 index 6b7cf63d88..0000000000 --- a/GVFS/GVFS.Build/GVFS.cs.props +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - $(BuildOutputDir)\$(MSBuildProjectName)\bin\$(Platform)\$(Configuration)\ - $(BuildOutputDir)\$(MSBuildProjectName)\obj\$(Platform)\$(Configuration)\ - $(BuildOutputDir)\$(MSBuildProjectName)\intermediate\$(Platform)\$(Configuration)\ - - - - true - $(MSBuildThisFileDirectory)\GVFS.ruleset - false - - - - - CommonAssemblyVersion.cs - - - - - $(DefaultItemExcludes);StyleCop.Cache;TestResults.xml - - - - NU1603 - NU1603 - - diff --git a/GVFS/GVFS.Build/GVFS.props b/GVFS/GVFS.Build/GVFS.props deleted file mode 100644 index fec1183cbc..0000000000 --- a/GVFS/GVFS.Build/GVFS.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - - 0.2.173.2 - 2.20210322.1 - - - - Debug - x64 - ..\..\ - $(SolutionDir)..\BuildOutput - $(SolutionDir)..\packages - - - diff --git a/GVFS/GVFS.Build/GVFS.ruleset b/GVFS/GVFS.Build/GVFS.ruleset deleted file mode 100644 index 67842e3104..0000000000 --- a/GVFS/GVFS.Build/GVFS.ruleset +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Build/GenerateG4WNugetReference.cs b/GVFS/GVFS.Build/GenerateG4WNugetReference.cs deleted file mode 100644 index 448654dcb7..0000000000 --- a/GVFS/GVFS.Build/GenerateG4WNugetReference.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System; -using System.IO; - -namespace GVFS.PreBuild -{ - public class GenerateG4WNugetReference : Task - { - [Required] - public string GitPackageVersion { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating packages.config for G4W package version " + this.GitPackageVersion); - - File.WriteAllText( - Path.Combine(Environment.CurrentDirectory, "packages.config"), - string.Format( -@" - - - - -", - this.GitPackageVersion)); - - return true; - } - } -} diff --git a/GVFS/GVFS.Build/GenerateGVFSInstallersNuspec.cs b/GVFS/GVFS.Build/GenerateGVFSInstallersNuspec.cs deleted file mode 100644 index 4813866b5a..0000000000 --- a/GVFS/GVFS.Build/GenerateGVFSInstallersNuspec.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.IO; - -namespace GVFS.PreBuild -{ - public class GenerateGVFSInstallersNuspec : Task - { - [Required] - public string GVFSSetupPath { get; set; } - - [Required] - public string GitPackageVersion { get; set; } - - [Required] - public string PackagesPath { get; set; } - - [Required] - public string OutputFile { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Generating GVFS.Installers.nuspec"); - - this.GVFSSetupPath = Path.GetFullPath(this.GVFSSetupPath); - this.PackagesPath = Path.GetFullPath(this.PackagesPath); - - File.WriteAllText( - this.OutputFile, - string.Format( -@" - - - GVFS.Installers - $GVFSVersion$ - Microsoft - false - GVFS and G4W installers - - - - - - -", - this.GVFSSetupPath, - this.PackagesPath, - this.GitPackageVersion)); - - return true; - } - } -} diff --git a/GVFS/GVFS.Build/GenerateGitVersionConstants.cs b/GVFS/GVFS.Build/GenerateGitVersionConstants.cs deleted file mode 100644 index 71caf79c7c..0000000000 --- a/GVFS/GVFS.Build/GenerateGitVersionConstants.cs +++ /dev/null @@ -1,190 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System; -using System.IO; -using System.Linq; - -namespace GVFS.PreBuild -{ - public class GenerateGitVersionConstants : Task - { - [Required] - public string GitPackageVersion { get; set; } - - [Required] - public string PackagesPath { get; set; } - - [Required] - public string OutputFile {get; set; } - - [Output] - public string LatestInstaller { get; set; } - - [Output] - public string LatestInstallerFilename { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating constants for Git package " + this.GitPackageVersion); - - string installerDirectory = Path.Combine( - this.PackagesPath, - "GitForWindows.GVFS.Installer." + this.GitPackageVersion, - "tools"); - - if (!Directory.Exists(installerDirectory)) - { - this.Log.LogError("Git package not found. Re-run your build to allow the package to be downloaded by Visual Studio."); - return false; - } - - this.LatestInstaller = Path.GetFullPath(Directory.EnumerateFiles(installerDirectory).Single()); - this.LatestInstallerFilename = Path.GetFileName(this.LatestInstaller); - GitVersion version; - if (!GitVersion.TryParseInstallerName(this.LatestInstallerFilename, out version)) - { - this.Log.LogError("Unable to parse git version: " + this.LatestInstallerFilename); - return false; - } - - this.Log.LogMessage(MessageImportance.High, "Found Git version " + version.ToString()); - - string projectOutputPath = Path.GetDirectoryName(this.OutputFile); - if (!Directory.Exists(projectOutputPath)) - { - Directory.CreateDirectory(projectOutputPath); - } - - File.WriteAllText( - this.OutputFile, - string.Format( -@"// This file is auto-generated by GVFS.PreBuild.GenerateGitVersionConstants. Any changes made directly in this file will be lost. -using GVFS.Common.Git; - -namespace GVFS.Common -{{ - public static partial class GVFSConstants - {{ - public static readonly GitVersion SupportedGitVersion = new GitVersion({0}, {1}, {2}, ""{3}"", {4}, {5}); - }} -}}", - version.Major, - version.Minor, - version.Build, - version.Platform, - version.Revision, - version.MinorRevision)); - - return true; - } - - // This class was partially copied from GVFS.Common.Git.GitVersion for the parsing - private class GitVersion - { - private GitVersion(int major, int minor, int build, string platform, int revision, int minorRevision) - { - this.Major = major; - this.Minor = minor; - this.Build = build; - this.Platform = platform; - this.Revision = revision; - this.MinorRevision = minorRevision; - } - - public int Major { get; private set; } - public int Minor { get; private set; } - public string Platform { get; private set; } - public int Build { get; private set; } - public int Revision { get; private set; } - public int MinorRevision { get; private set; } - - public static bool TryParseInstallerName(string input, out GitVersion version) - { - // Installer name is of the form - // Git-2.14.1.gvfs.1.1.gb16030b-64-bit.exe - - version = null; - - if (!input.StartsWith("Git-", StringComparison.InvariantCultureIgnoreCase)) - { - return false; - } - - if (!input.EndsWith("-64-bit.exe", StringComparison.InvariantCultureIgnoreCase)) - { - return false; - } - - return TryParseVersion(input.Substring(4, input.Length - 15), out version); - } - - private static bool TryParseVersion(string input, out GitVersion version) - { - version = null; - int major, minor, build, revision, minorRevision; - - if (string.IsNullOrWhiteSpace(input)) - { - return false; - } - - string[] parsedComponents = input.Split(new char[] { '.' }); - int parsedComponentsLength = parsedComponents.Length; - if (parsedComponentsLength < 5) - { - return false; - } - - if (!TryParseComponent(parsedComponents[0], out major)) - { - return false; - } - - if (!TryParseComponent(parsedComponents[1], out minor)) - { - return false; - } - - if (!TryParseComponent(parsedComponents[2], out build)) - { - return false; - } - - if (!TryParseComponent(parsedComponents[4], out revision)) - { - return false; - } - - if (parsedComponentsLength < 6 || !TryParseComponent(parsedComponents[5], out minorRevision)) - { - minorRevision = 0; - } - - string platform = parsedComponents[3]; - - version = new GitVersion(major, minor, build, platform, revision, minorRevision); - return true; - } - - public override string ToString() - { - return string.Format("{0}.{1}.{2}.{3}.{4}.{5}", this.Major, this.Minor, this.Build, this.Platform, this.Revision, this.MinorRevision); - } - - private static bool TryParseComponent(string component, out int parsedComponent) - { - if (!int.TryParse(component, out parsedComponent)) - { - return false; - } - - if (parsedComponent < 0) - { - return false; - } - - return true; - } - } - } -} diff --git a/GVFS/GVFS.Build/GenerateInstallScripts.cs b/GVFS/GVFS.Build/GenerateInstallScripts.cs deleted file mode 100644 index 6ba1129b03..0000000000 --- a/GVFS/GVFS.Build/GenerateInstallScripts.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.IO; -using System.Text; - -namespace GVFS.PreBuild -{ - public class GenerateInstallScripts : Task - { - [Required] - public string GitInstallerFilename { get; set; } - - [Required] - public string VFSForGitSetupFilename { get; set; } - - [Required] - public string GitInstallBatPath { get; set; } - - [Required] - public string VFSForGitInstallBatPath { get; set; } - - [Required] - public string UnifiedInstallBatPath { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating install scripts for " + this.GitInstallerFilename); - - File.WriteAllText( - this.GitInstallBatPath, - this.GetGitInstallCommand()); - - File.WriteAllText( - this.VFSForGitInstallBatPath, - this.GetVFSForGitInstallCommand()); - - StringBuilder sb = new StringBuilder(); - sb.AppendLine("REM AUTOGENERATED DO NOT EDIT"); - sb.AppendLine(); - sb.AppendLine(this.GetGitInstallCommand()); - sb.AppendLine(); - sb.AppendLine(this.GetVFSForGitInstallCommand()); - - File.WriteAllText( - this.UnifiedInstallBatPath, - sb.ToString()); - - return true; - } - - public string GetGitInstallCommand() - { - return "%~dp0\\" + this.GitInstallerFilename + @" /DIR=""C:\Program Files\Git"" /NOICONS /COMPONENTS=""ext,ext\shellhere,ext\guihere,assoc,assoc_sh"" /GROUP=""Git"" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /ALLOWDOWNGRADE=1"; - } - - public string GetVFSForGitInstallCommand() - { - return "%~dp0\\" + this.VFSForGitSetupFilename + " /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"; - } - } -} diff --git a/GVFS/GVFS.Build/GenerateVersionInfo.cs b/GVFS/GVFS.Build/GenerateVersionInfo.cs deleted file mode 100644 index ba69848012..0000000000 --- a/GVFS/GVFS.Build/GenerateVersionInfo.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.Build.Framework; -using Microsoft.Build.Utilities; -using System.IO; - -namespace GVFS.PreBuild -{ - public class GenerateVersionInfo : Task - { - [Required] - public string Version { get; set; } - - [Required] - public string BuildOutputPath { get; set; } - - [Required] - public string AssemblyVersion { get; set; } - - [Required] - public string VersionHeader { get; set; } - - public override bool Execute() - { - this.Log.LogMessage(MessageImportance.High, "Creating version files"); - - EnsureParentDirectoryExistsFor(this.AssemblyVersion); - File.WriteAllText( - this.AssemblyVersion, - string.Format( -@"using System.Reflection; - -[assembly: AssemblyVersion(""{0}"")] -[assembly: AssemblyFileVersion(""{0}"")] -", - this.Version)); - - string commaDelimetedVersion = this.Version.Replace('.', ','); - EnsureParentDirectoryExistsFor(this.VersionHeader); - File.WriteAllText( - this.VersionHeader, - string.Format( -@" -#define GVFS_FILE_VERSION {0} -#define GVFS_FILE_VERSION_STRING ""{1}"" -#define GVFS_PRODUCT_VERSION {0} -#define GVFS_PRODUCT_VERSION_STRING ""{1}"" -", - commaDelimetedVersion, - this.Version)); - - return true; - } - - private void EnsureParentDirectoryExistsFor(string filename) - { - string directory = Path.GetDirectoryName(filename); - if (!Directory.Exists(directory)) - { - Directory.CreateDirectory(directory); - } - - } - } -} diff --git a/GVFS/GVFS.Build/ProjFS.props b/GVFS/GVFS.Build/ProjFS.props deleted file mode 100644 index 0870080599..0000000000 --- a/GVFS/GVFS.Build/ProjFS.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - GVFS.ProjFS.2019.411.1 - Microsoft.Windows.ProjFS.1.1.19156.1 - - diff --git a/GVFS/GVFS.Common/GVFS.Common.csproj b/GVFS/GVFS.Common/GVFS.Common.csproj index 8934376fd6..9cc9a5cb8c 100644 --- a/GVFS/GVFS.Common/GVFS.Common.csproj +++ b/GVFS/GVFS.Common/GVFS.Common.csproj @@ -1,38 +1,32 @@ - - - - + - netcoreapp2.1;netstandard2.0 - x64 + net461 true - true - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - - - all - - - + + - + + + + + + + + + + + + diff --git a/GVFS/GVFS.Common/GVFSPlatform.cs b/GVFS/GVFS.Common/GVFSPlatform.cs index 0e834aaebf..7c252d4934 100644 --- a/GVFS/GVFS.Common/GVFSPlatform.cs +++ b/GVFS/GVFS.Common/GVFSPlatform.cs @@ -78,28 +78,8 @@ public static void Register(GVFSPlatform platform) public abstract bool IsElevated(); public abstract string GetCurrentUser(); public abstract string GetUserIdFromLoginSessionId(int sessionId, ITracer tracer); - - /// - /// Get the directory for upgrades that is permissioned to - /// require elevated privileges to modify. This can be used for - /// data that we don't want normal user accounts to modify. - /// - public abstract string GetUpgradeProtectedDataDirectory(); - - /// - /// Directory that upgrader log directory should be placed - /// in. There can be multiple log directories, so this is the - /// containing directory to place them in. - /// - public abstract string GetUpgradeLogDirectoryParentDirectory(); public abstract string GetSystemInstallerLogPath(); - /// - /// Directory that contains the file indicating that a new - /// version is available. - /// - public abstract string GetUpgradeHighestAvailableVersionDirectory(); - public abstract void ConfigureVisualStudio(string gitBinPath, ITracer tracer); public abstract bool TryCopyPanicLogs(string copyToDir, out string error); @@ -125,10 +105,6 @@ public abstract FileBasedLock CreateFileBasedLock( ITracer tracer, string lockPath); - public abstract ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformInteractions( - PhysicalFileSystem fileSystem, - ITracer tracer); - public bool TryGetNormalizedPathRoot(string path, out string pathRoot, out string errorMessage) { pathRoot = null; @@ -229,11 +205,6 @@ public string MountExecutableName { get { return "GVFS.Mount" + this.ExecutableExtension; } } - - public string GVFSUpgraderExecutableName - { - get { return "GVFS.Upgrader" + this.ExecutableExtension; } - } } public class UnderConstructionFlags diff --git a/GVFS/GVFS.Common/Git/LibGit2Repo.cs b/GVFS/GVFS.Common/Git/LibGit2Repo.cs index 8ea258a9c4..c1056def32 100644 --- a/GVFS/GVFS.Common/Git/LibGit2Repo.cs +++ b/GVFS/GVFS.Common/Git/LibGit2Repo.cs @@ -174,7 +174,7 @@ public static class Native { public const uint SuccessCode = 0; - public const string Git2NativeLibName = "git2"; + public const string Git2NativeLibName = GVFSConstants.LibGit2LibraryName; public enum ObjectTypes { diff --git a/GVFS/GVFS.Common/GitHubUpgrader.cs b/GVFS/GVFS.Common/GitHubUpgrader.cs deleted file mode 100644 index b2543db256..0000000000 --- a/GVFS/GVFS.Common/GitHubUpgrader.cs +++ /dev/null @@ -1,687 +0,0 @@ -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Json; -using System.Threading.Tasks; - -namespace GVFS.Common -{ - public class GitHubUpgrader : ProductUpgrader - { - private const string GitHubReleaseURL = @"https://api.github.com/repos/microsoft/vfsforgit/releases"; - private const string JSONMediaType = @"application/vnd.github.v3+json"; - private const string UserAgent = @"GVFS_Auto_Upgrader"; - private const string CommonInstallerArgs = "/VERYSILENT /CLOSEAPPLICATIONS /SUPPRESSMSGBOXES /NORESTART"; - private const string GVFSInstallerArgs = CommonInstallerArgs + " /REMOUNTREPOS=false"; - private const string GitInstallerArgs = CommonInstallerArgs + " /ALLOWDOWNGRADE=1"; - private const string GitAssetId = "Git"; - private const string GVFSAssetId = "GVFS"; - private const string GitInstallerFileNamePrefix = "Git-"; - private const string GVFSSigner = "Microsoft Corporation"; - private const string GVFSCertIssuer = "Microsoft Code Signing PCA"; - private const string GitSigner = "Johannes Schindelin"; - private const string GitCertIssuer = "COMODO RSA Code Signing CA"; - - private static readonly HashSet GVFSInstallerFileNamePrefixCandidates = new HashSet(GVFSPlatform.Instance.Constants.PathComparer) - { - "SetupGVFS", - "VFSForGit" - }; - - private Version newestVersion; - private Release newestRelease; - - public GitHubUpgrader( - string currentVersion, - ITracer tracer, - PhysicalFileSystem fileSystem, - GitHubUpgraderConfig upgraderConfig, - bool dryRun = false, - bool noVerify = false) - : base(currentVersion, tracer, dryRun, noVerify, fileSystem) - { - this.Config = upgraderConfig; - } - - public GitHubUpgraderConfig Config { get; private set; } - - public override bool SupportsAnonymousVersionQuery { get => true; } - - public static GitHubUpgrader Create( - ITracer tracer, - PhysicalFileSystem fileSystem, - LocalGVFSConfig gvfsConfig, - bool dryRun, - bool noVerify, - out string error) - { - return Create(tracer, fileSystem, dryRun, noVerify, gvfsConfig, out error); - } - - public static GitHubUpgrader Create( - ITracer tracer, - PhysicalFileSystem fileSystem, - bool dryRun, - bool noVerify, - LocalGVFSConfig localConfig, - out string error) - { - GitHubUpgrader upgrader = null; - GitHubUpgraderConfig gitHubUpgraderConfig = new GitHubUpgraderConfig(tracer, localConfig); - - if (!gitHubUpgraderConfig.TryLoad(out error)) - { - return null; - } - - if (gitHubUpgraderConfig.ConfigError()) - { - gitHubUpgraderConfig.ConfigAlertMessage(out error); - return null; - } - - upgrader = new GitHubUpgrader( - ProcessHelper.GetCurrentProcessVersion(), - tracer, - fileSystem, - gitHubUpgraderConfig, - dryRun, - noVerify); - - return upgrader; - } - - public override bool UpgradeAllowed(out string message) - { - return this.Config.UpgradeAllowed(out message); - } - - public override bool TryQueryNewestVersion( - out Version newVersion, - out string message) - { - List releases; - - newVersion = null; - if (this.TryFetchReleases(out releases, out message)) - { - foreach (Release nextRelease in releases) - { - Version releaseVersion = null; - - if (nextRelease.Ring <= this.Config.UpgradeRing && - nextRelease.TryParseVersion(out releaseVersion) && - releaseVersion > this.installedVersion) - { - newVersion = releaseVersion; - this.newestVersion = releaseVersion; - this.newestRelease = nextRelease; - message = $"New GVFS version {newVersion.ToString()} available in ring {this.Config.UpgradeRing}."; - break; - } - } - - if (newVersion == null) - { - message = $"Great news, you're all caught up on upgrades in the {this.Config.UpgradeRing} ring!"; - } - - return true; - } - - return false; - } - - public override bool TryDownloadNewestVersion(out string errorMessage) - { - if (!this.TryCreateAndConfigureDownloadDirectory(this.tracer, out errorMessage)) - { - this.tracer.RelatedError($"{nameof(GitHubUpgrader)}.{nameof(this.TryCreateAndConfigureDownloadDirectory)} failed. {errorMessage}"); - return false; - } - - bool downloadedGit = false; - bool downloadedGVFS = false; - - foreach (Asset asset in this.newestRelease.Assets) - { - bool targetOSMatch = string.Equals(Path.GetExtension(asset.Name), GVFSPlatform.Instance.Constants.InstallerExtension, GVFSPlatform.Instance.Constants.PathComparison); - bool isGitAsset = this.IsGitAsset(asset); - bool isGVFSAsset = isGitAsset ? false : this.IsGVFSAsset(asset); - if (!targetOSMatch || (!isGVFSAsset && !isGitAsset)) - { - continue; - } - - if (!this.TryDownloadAsset(asset, out errorMessage)) - { - errorMessage = $"Could not download {(isGVFSAsset ? GVFSAssetId : GitAssetId)} installer. {errorMessage}"; - return false; - } - else - { - downloadedGit = isGitAsset ? true : downloadedGit; - downloadedGVFS = isGVFSAsset ? true : downloadedGVFS; - } - } - - if (!downloadedGit || !downloadedGVFS) - { - errorMessage = $"Could not find {(!downloadedGit ? GitAssetId : GVFSAssetId)} installer in the latest release."; - return false; - } - - errorMessage = null; - return true; - } - - public override bool TryRunInstaller(InstallActionWrapper installActionWrapper, out string error) - { - string localError; - - this.TryGetGitVersion(out GitVersion newGitVersion, out localError); - - if (!installActionWrapper( - () => - { - if (!this.TryInstallUpgrade(GitAssetId, newGitVersion.ToString(), out localError)) - { - return false; - } - - return true; - }, - $"Installing Git version: {newGitVersion}")) - { - error = localError; - return false; - } - - if (!installActionWrapper( - () => - { - if (!this.TryInstallUpgrade(GVFSAssetId, this.newestVersion.ToString(), out localError)) - { - return false; - } - - return true; - }, - $"Installing GVFS version: {this.newestVersion}")) - { - error = localError; - return false; - } - - this.LogVersionInfo(this.newestVersion, newGitVersion, "Newly Installed Version"); - - error = null; - return true; - } - - public override bool TryCleanup(out string error) - { - error = string.Empty; - if (this.newestRelease == null) - { - return true; - } - - foreach (Asset asset in this.newestRelease.Assets) - { - Exception exception; - if (!this.TryDeleteDownloadedAsset(asset, out exception)) - { - error += $"Could not delete {asset.LocalPath}. {exception.ToString()}." + Environment.NewLine; - } - } - - if (!string.IsNullOrEmpty(error)) - { - error.TrimEnd(Environment.NewLine.ToCharArray()); - return false; - } - - error = null; - return true; - } - - protected virtual bool TryDeleteDownloadedAsset(Asset asset, out Exception exception) - { - return this.fileSystem.TryDeleteFile(asset.LocalPath, out exception); - } - - protected virtual bool TryDownloadAsset(Asset asset, out string errorMessage) - { - errorMessage = null; - - string downloadPath = ProductUpgraderInfo.GetAssetDownloadsPath(); - string localPath = Path.Combine(downloadPath, asset.Name); - WebClient webClient = new WebClient(); - - try - { - webClient.DownloadFile(asset.DownloadURL, localPath); - asset.LocalPath = localPath; - } - catch (WebException webException) - { - errorMessage = "Download error: " + webException.Message; - this.TraceException(webException, nameof(this.TryDownloadAsset), $"Error downloading asset {asset.Name}."); - return false; - } - - return true; - } - - protected virtual bool TryFetchReleases(out List releases, out string errorMessage) - { - HttpClient client = new HttpClient(); - - client.DefaultRequestHeaders.Accept.Clear(); - client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(JSONMediaType)); - client.DefaultRequestHeaders.Add("User-Agent", UserAgent); - - releases = null; - errorMessage = null; - - try - { - Stream result = client.GetStreamAsync(GitHubReleaseURL).GetAwaiter().GetResult(); - - DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List)); - releases = serializer.ReadObject(result) as List; - return true; - } - catch (HttpRequestException exception) - { - errorMessage = string.Format("Network error: could not connect to GitHub({0}). {1}", GitHubReleaseURL, exception.Message); - this.TraceException(exception, nameof(this.TryFetchReleases), $"Error fetching release info."); - } - catch (TaskCanceledException exception) - { - // GetStreamAsync can also throw a TaskCanceledException to indicate a timeout - // https://github.com/dotnet/corefx/issues/20296 - errorMessage = string.Format("Network error: could not connect to GitHub({0}). {1}", GitHubReleaseURL, exception.Message); - this.TraceException(exception, nameof(this.TryFetchReleases), $"Error fetching release info."); - } - catch (SerializationException exception) - { - errorMessage = string.Format("Parse error: could not parse releases info from GitHub({0}). {1}", GitHubReleaseURL, exception.Message); - this.TraceException(exception, nameof(this.TryFetchReleases), $"Error parsing release info."); - } - - return false; - } - - protected virtual void RunInstaller(string path, string args, string certCN, string issuerCN, out int exitCode, out string error) - { - using (Stream stream = this.fileSystem.OpenFileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, false)) - { - string expectedCNPrefix = $"CN={certCN}, "; - string expectecIssuerCNPrefix = $"CN={issuerCN}"; - string subject; - string issuer; - if (!GVFSPlatform.Instance.TryVerifyAuthenticodeSignature(path, out subject, out issuer, out error)) - { - exitCode = -1; - return; - } - - if (!subject.StartsWith(expectedCNPrefix) || !issuer.StartsWith(expectecIssuerCNPrefix)) - { - exitCode = -1; - error = $"Installer {path} is signed by unknown signer."; - this.tracer.RelatedError($"Installer {path} is signed by unknown signer. Signed by {subject}, issued by {issuer} expected signer is {certCN}, issuer {issuerCN}."); - return; - } - - this.RunInstaller(path, args, out exitCode, out error); - } - } - - private bool TryGetGitVersion(out GitVersion gitVersion, out string error) - { - error = null; - - foreach (Asset asset in this.newestRelease.Assets) - { - if (asset.Name.StartsWith(GitInstallerFileNamePrefix) && - GitVersion.TryParseInstallerName(asset.Name, GVFSPlatform.Instance.Constants.InstallerExtension, out gitVersion)) - { - return true; - } - } - - error = "Could not find Git version info in newest release"; - gitVersion = null; - - return false; - } - - private bool TryInstallUpgrade(string assetId, string version, out string consoleError) - { - bool installSuccess = false; - EventMetadata metadata = new EventMetadata(); - metadata.Add("Upgrade Step", nameof(this.TryInstallUpgrade)); - metadata.Add("AssetId", assetId); - metadata.Add("Version", version); - - using (ITracer activity = this.tracer.StartActivity($"{nameof(this.TryInstallUpgrade)}", EventLevel.Informational, metadata)) - { - if (!this.TryRunInstaller(assetId, out installSuccess, out consoleError) || - !installSuccess) - { - this.tracer.RelatedError(metadata, $"{nameof(this.TryInstallUpgrade)} failed. {consoleError}"); - return false; - } - - activity.RelatedInfo("Successfully installed GVFS version: " + version); - } - - return installSuccess; - } - - private bool TryRunInstaller(string assetId, out bool installationSucceeded, out string error) - { - error = null; - installationSucceeded = false; - - int exitCode = 0; - bool launched = this.TryRunInstallerForAsset(assetId, out exitCode, out error); - installationSucceeded = exitCode == 0; - - return launched; - } - - private bool TryRunInstallerForAsset(string assetId, out int installerExitCode, out string error) - { - error = null; - installerExitCode = 0; - - bool installerIsRun = false; - string path; - string installerArgs; - if (this.TryGetLocalInstallerPath(assetId, out path, out installerArgs)) - { - if (!this.dryRun) - { - string logFilePath = GVFSEnlistment.GetNewLogFileName( - ProductUpgraderInfo.GetLogDirectoryPath(), - Path.GetFileNameWithoutExtension(path), - this.UpgradeInstanceId, - this.fileSystem); - - string args = installerArgs + " /Log=" + logFilePath; - string certCN = null; - string issuerCN = null; - switch (assetId) - { - case GVFSAssetId: - { - certCN = GVFSSigner; - issuerCN = GVFSCertIssuer; - break; - } - - case GitAssetId: - { - certCN = GitSigner; - issuerCN = GitCertIssuer; - break; - } - } - - this.RunInstaller(path, args, certCN, issuerCN, out installerExitCode, out error); - - if (installerExitCode != 0 && string.IsNullOrEmpty(error)) - { - error = assetId + " installer failed. Error log: " + logFilePath; - } - } - - installerIsRun = true; - } - else - { - error = "Could not find downloaded installer for " + assetId; - } - - return installerIsRun; - } - - private bool TryGetLocalInstallerPath(string assetId, out string path, out string args) - { - foreach (Asset asset in this.newestRelease.Assets) - { - if (string.Equals(Path.GetExtension(asset.Name), GVFSPlatform.Instance.Constants.InstallerExtension, GVFSPlatform.Instance.Constants.PathComparison)) - { - path = asset.LocalPath; - if (assetId == GitAssetId && this.IsGitAsset(asset)) - { - args = GitInstallerArgs; - return true; - } - - if (assetId == GVFSAssetId && this.IsGVFSAsset(asset)) - { - args = GVFSInstallerArgs; - return true; - } - } - } - - path = null; - args = null; - return false; - } - - private bool IsGVFSAsset(Asset asset) - { - return this.AssetInstallerNameCompare(asset, GVFSInstallerFileNamePrefixCandidates); - } - - private bool IsGitAsset(Asset asset) - { - return this.AssetInstallerNameCompare(asset, new string[] { GitInstallerFileNamePrefix }); - } - - private bool AssetInstallerNameCompare(Asset asset, IEnumerable expectedFileNamePrefixes) - { - foreach (string fileNamePrefix in expectedFileNamePrefixes) - { - if (asset.Name.StartsWith(fileNamePrefix, GVFSPlatform.Instance.Constants.PathComparison)) - { - return true; - } - } - - return false; - } - - private void LogVersionInfo( - Version gvfsVersion, - GitVersion gitVersion, - string message) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add(nameof(gvfsVersion), gvfsVersion.ToString()); - metadata.Add(nameof(gitVersion), gitVersion.ToString()); - - this.tracer.RelatedEvent(EventLevel.Informational, message, metadata); - } - - public class GitHubUpgraderConfig - { - public GitHubUpgraderConfig(ITracer tracer, LocalGVFSConfig localGVFSConfig) - { - this.Tracer = tracer; - this.LocalConfig = localGVFSConfig; - } - - public enum RingType - { - // The values here should be ascending. - // Invalid - User has set an incorrect ring - // NoConfig - User has Not set any ring yet - // None - User has set a valid "None" ring - // (Fast should be greater than Slow, - // Slow should be greater than None, None greater than Invalid.) - // This is required for the correct implementation of Ring based - // upgrade logic. - Invalid = 0, - NoConfig = None - 1, - None = 10, - Slow = None + 1, - Fast = Slow + 1, - } - - public RingType UpgradeRing { get; private set; } - public LocalGVFSConfig LocalConfig { get; private set; } - private ITracer Tracer { get; set; } - - public bool TryLoad(out string error) - { - this.UpgradeRing = RingType.NoConfig; - - string ringConfig = null; - string loadError = "Could not read GVFS Config." + Environment.NewLine + GVFSConstants.UpgradeVerbMessages.SetUpgradeRingCommand; - - if (!this.LocalConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.UpgradeRing, out ringConfig, out error)) - { - error = loadError; - return false; - } - - this.ParseUpgradeRing(ringConfig); - return true; - } - - public void ParseUpgradeRing(string ringConfig) - { - if (string.IsNullOrEmpty(ringConfig)) - { - this.UpgradeRing = RingType.None; - return; - } - - RingType ringType; - if (Enum.TryParse(ringConfig, ignoreCase: true, result: out ringType) && - Enum.IsDefined(typeof(RingType), ringType) && - ringType != RingType.Invalid) - { - this.UpgradeRing = ringType; - } - else - { - this.UpgradeRing = RingType.Invalid; - } - } - - public bool ConfigError() - { - return this.UpgradeRing == RingType.Invalid; - } - - public bool UpgradeAllowed(out string message) - { - if (this.UpgradeRing == RingType.Slow || this.UpgradeRing == RingType.Fast) - { - message = null; - return true; - } - - this.ConfigAlertMessage(out message); - return false; - } - - public void ConfigAlertMessage(out string message) - { - message = null; - - if (this.UpgradeRing == GitHubUpgraderConfig.RingType.None) - { - message = GVFSConstants.UpgradeVerbMessages.NoneRingConsoleAlert + Environment.NewLine + GVFSConstants.UpgradeVerbMessages.SetUpgradeRingCommand; - } - - if (this.UpgradeRing == GitHubUpgraderConfig.RingType.NoConfig) - { - message = GVFSConstants.UpgradeVerbMessages.NoRingConfigConsoleAlert + Environment.NewLine + GVFSConstants.UpgradeVerbMessages.SetUpgradeRingCommand; - } - - if (this.UpgradeRing == GitHubUpgraderConfig.RingType.Invalid) - { - string ring; - string error; - string prefix = string.Empty; - if (this.LocalConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.UpgradeRing, out ring, out error)) - { - prefix = $"Invalid upgrade ring `{ring}` specified in gvfs config. "; - } - - message = prefix + Environment.NewLine + GVFSConstants.UpgradeVerbMessages.SetUpgradeRingCommand; - } - } - } - - [DataContract(Name = "asset")] - protected class Asset - { - [DataMember(Name = "name")] - public string Name { get; set; } - - [DataMember(Name = "size")] - public long Size { get; set; } - - [DataMember(Name = "browser_download_url")] - public Uri DownloadURL { get; set; } - - [IgnoreDataMember] - public string LocalPath { get; set; } - } - - [DataContract(Name = "release")] - protected class Release - { - [DataMember(Name = "name")] - public string Name { get; set; } - - [DataMember(Name = "tag_name")] - public string Tag { get; set; } - - [DataMember(Name = "prerelease")] - public bool PreRelease { get; set; } - - [DataMember(Name = "assets")] - public List Assets { get; set; } - - [IgnoreDataMember] - public GitHubUpgraderConfig.RingType Ring - { - get - { - return this.PreRelease == true ? GitHubUpgraderConfig.RingType.Fast : GitHubUpgraderConfig.RingType.Slow; - } - } - - public bool TryParseVersion(out Version version) - { - version = null; - - if (this.Tag.StartsWith("v", StringComparison.CurrentCultureIgnoreCase)) - { - return Version.TryParse(this.Tag.Substring(1), out version); - } - - return false; - } - } - } -} diff --git a/GVFS/GVFS.Common/InstallerPreRunChecker.cs b/GVFS/GVFS.Common/InstallerPreRunChecker.cs deleted file mode 100644 index 021f48f06e..0000000000 --- a/GVFS/GVFS.Common/InstallerPreRunChecker.cs +++ /dev/null @@ -1,218 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; - -namespace GVFS.Upgrader -{ - public class InstallerPreRunChecker - { - private ITracer tracer; - - public InstallerPreRunChecker(ITracer tracer, string commandToRerun) - { - this.tracer = tracer; - this.CommandToRerun = commandToRerun; - } - - protected string CommandToRerun { private get; set; } - - public virtual bool TryRunPreUpgradeChecks(out string consoleError) - { - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryRunPreUpgradeChecks), EventLevel.Informational)) - { - if (this.IsUnattended()) - { - consoleError = $"{GVFSConstants.UpgradeVerbMessages.GVFSUpgrade} is not supported in unattended mode"; - this.tracer.RelatedWarning($"{nameof(this.TryRunPreUpgradeChecks)}: {consoleError}"); - return false; - } - - if (!this.IsGVFSUpgradeAllowed(out consoleError)) - { - return false; - } - - activity.RelatedInfo($"Successfully finished pre upgrade checks. Okay to run {GVFSConstants.UpgradeVerbMessages.GVFSUpgrade}."); - } - - consoleError = null; - return true; - } - - // TODO: Move repo mount calls to GVFS.Upgrader project. - // https://github.com/Microsoft/VFSForGit/issues/293 - public virtual bool TryMountAllGVFSRepos(out string consoleError) - { - return this.TryRunGVFSWithArgs("service --mount-all", out consoleError); - } - - public virtual bool TryUnmountAllGVFSRepos(out string consoleError) - { - consoleError = null; - this.tracer.RelatedInfo("Unmounting any mounted GVFS repositories."); - - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryUnmountAllGVFSRepos), EventLevel.Informational)) - { - if (!this.TryRunGVFSWithArgs("service --unmount-all", out consoleError)) - { - this.tracer.RelatedError($"{nameof(this.TryUnmountAllGVFSRepos)}: {consoleError}"); - return false; - } - - activity.RelatedInfo("Successfully unmounted repositories."); - } - - return true; - } - - public virtual bool IsInstallationBlockedByRunningProcess(out string consoleError) - { - consoleError = null; - - // While checking for blocking processes like GVFS.Mount immediately after un-mounting, - // then sometimes GVFS.Mount shows up as running. But if the check is done after waiting - // for some time, then eventually GVFS.Mount goes away. The retry loop below is to help - // account for this delay between the time un-mount call returns and when GVFS.Mount - // actually quits. - this.tracer.RelatedInfo("Checking if GVFS or dependent processes are running."); - int retryCount = 10; - HashSet processList = null; - while (retryCount > 0) - { - if (!this.IsBlockingProcessRunning(out processList)) - { - break; - } - - Thread.Sleep(TimeSpan.FromMilliseconds(250)); - retryCount--; - } - - if (processList.Count > 0) - { - consoleError = string.Join( - Environment.NewLine, - "Blocking processes are running.", - $"Run {this.CommandToRerun} again after quitting these processes - " + string.Join(", ", processList.ToArray())); - this.tracer.RelatedWarning($"{nameof(this.IsInstallationBlockedByRunningProcess)}: {consoleError}"); - return false; - } - - return true; - } - - protected virtual bool IsElevated() - { - return GVFSPlatform.Instance.IsElevated(); - } - - protected virtual bool IsGVFSUpgradeSupported() - { - return GVFSPlatform.Instance.KernelDriver.IsGVFSUpgradeSupported(); - } - - protected virtual bool IsServiceInstalledAndNotRunning() - { - GVFSPlatform.Instance.IsServiceInstalledAndRunning(GVFSConstants.Service.ServiceName, out bool isInstalled, out bool isRunning); - - return isInstalled && !isRunning; - } - - protected virtual bool IsUnattended() - { - return GVFSEnlistment.IsUnattended(this.tracer); - } - - protected virtual bool IsBlockingProcessRunning(out HashSet processes) - { - int currentProcessId = Process.GetCurrentProcess().Id; - Process[] allProcesses = Process.GetProcesses(); - HashSet matchingNames = new HashSet(); - - foreach (Process process in allProcesses) - { - if (process.Id == currentProcessId || !GVFSPlatform.Instance.Constants.UpgradeBlockingProcesses.Contains(process.ProcessName)) - { - continue; - } - - matchingNames.Add(process.ProcessName + " pid:" + process.Id); - } - - processes = matchingNames; - return processes.Count > 0; - } - - protected virtual bool TryRunGVFSWithArgs(string args, out string consoleError) - { - string gvfsDirectory = ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GVFSPlatform.Instance.Constants.GVFSExecutableName); - if (!string.IsNullOrEmpty(gvfsDirectory)) - { - string gvfsPath = Path.Combine(gvfsDirectory, GVFSPlatform.Instance.Constants.GVFSExecutableName); - - ProcessResult processResult = ProcessHelper.Run(gvfsPath, args); - if (processResult.ExitCode == 0) - { - consoleError = null; - return true; - } - else - { - consoleError = string.IsNullOrEmpty(processResult.Errors) ? $"`gvfs {args}` failed." : processResult.Errors; - return false; - } - } - else - { - consoleError = $"Could not locate {GVFSPlatform.Instance.Constants.GVFSExecutableName}"; - return false; - } - } - - private bool IsGVFSUpgradeAllowed(out string consoleError) - { - bool isConfirmed = string.Equals(this.CommandToRerun, GVFSPlatform.Instance.Constants.UpgradeConfirmCommandMessage, StringComparison.OrdinalIgnoreCase); - string adviceText = null; - if (!this.IsElevated()) - { - adviceText = GVFSPlatform.Instance.Constants.RunUpdateMessage; - consoleError = string.Join( - Environment.NewLine, - "The installer needs to be run with elevated permissions.", - adviceText); - this.tracer.RelatedWarning($"{nameof(this.IsGVFSUpgradeAllowed)}: Upgrade is not installable. {consoleError}"); - return false; - } - - if (!this.IsGVFSUpgradeSupported()) - { - consoleError = string.Join( - Environment.NewLine, - $"{GVFSConstants.UpgradeVerbMessages.GVFSUpgrade} is only supported after the \"Windows Projected File System\" optional feature has been enabled by a manual installation of VFS for Git, and only on versions of Windows that support this feature.", - "Check your team's documentation for how to upgrade."); - this.tracer.RelatedWarning(metadata: null, message:$"{nameof(this.IsGVFSUpgradeAllowed)}: Upgrade is not installable. {consoleError}", keywords: Keywords.Telemetry); - return false; - } - - if (this.IsServiceInstalledAndNotRunning()) - { - adviceText = $"To install, run {GVFSPlatform.Instance.Constants.StartServiceCommandMessage} and run {GVFSPlatform.Instance.Constants.UpgradeConfirmCommandMessage}."; - consoleError = string.Join( - Environment.NewLine, - "GVFS Service is not running.", - adviceText); - this.tracer.RelatedWarning($"{nameof(this.IsGVFSUpgradeAllowed)}: Upgrade is not installable. {consoleError}"); - return false; - } - - consoleError = null; - return true; - } - } -} diff --git a/GVFS/GVFS.Common/AssemblyInfo.cs b/GVFS/GVFS.Common/InternalsVisibleTo.cs similarity index 60% rename from GVFS/GVFS.Common/AssemblyInfo.cs rename to GVFS/GVFS.Common/InternalsVisibleTo.cs index a19d69f781..0ba48d81be 100644 --- a/GVFS/GVFS.Common/AssemblyInfo.cs +++ b/GVFS/GVFS.Common/InternalsVisibleTo.cs @@ -1,4 +1,3 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("GVFS.UnitTests")] -[assembly: InternalsVisibleTo("GVFS.UnitTests.Windows")] diff --git a/GVFS/GVFS.Common/NuGetUpgrade/InstallActionInfo.cs b/GVFS/GVFS.Common/NuGetUpgrade/InstallActionInfo.cs deleted file mode 100644 index 10a247b124..0000000000 --- a/GVFS/GVFS.Common/NuGetUpgrade/InstallActionInfo.cs +++ /dev/null @@ -1,49 +0,0 @@ -namespace GVFS.Common.NuGetUpgrade -{ - public class InstallActionInfo - { - /// - /// Well known tokens that will be replaced when encountered in an Arguments field. - /// - public const string ManifestEntryInstallationIdToken = "installation_id"; - public const string ManifestEntryLogDirectoryToken = "log_directory"; - public const string ManifestEntryInstallerBaseDirectoryToken = "installer_base_path"; - - public InstallActionInfo(string name, string version, string args, string installerRelativePath, string command) - { - this.Name = name; - this.Version = version; - this.Args = args; - this.InstallerRelativePath = installerRelativePath; - this.Command = command; - } - - /// - /// The arguments that should be passed to the install command - /// - public string Args { get; } - - /// - /// User friendly name for the install action - /// - public string Name { get; } - - /// - /// The path to the application or document to start. The path - /// is relative to the content directory of the NuGet package. - /// - public string InstallerRelativePath { get; } - - /// - /// The version of the component that this entry installs - /// - public string Version { get; } - - /// - /// The command to run. If this is present, the command is run - /// directly (with the processed args), and the - /// InstallerRelativePath property is ignored. - /// - public string Command { get; } - } -} diff --git a/GVFS/GVFS.Common/NuGetUpgrade/InstallManifest.cs b/GVFS/GVFS.Common/NuGetUpgrade/InstallManifest.cs deleted file mode 100644 index 4592a07469..0000000000 --- a/GVFS/GVFS.Common/NuGetUpgrade/InstallManifest.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Newtonsoft.Json; -using System.Collections.Generic; -using System.IO; - -namespace GVFS.Common.NuGetUpgrade -{ - /// - /// Details on the upgrade included in this package, including information - /// on what packages are included and how to install them. - /// - public class InstallManifest - { - public const string WindowsPlatformKey = "Windows"; - - public InstallManifest() - { - this.PlatformInstallManifests = new Dictionary(); - } - - /// - /// Install manifests for different platforms. - /// - public Dictionary PlatformInstallManifests { get; private set; } - - public static InstallManifest FromJsonFile(string path) - { - using (StreamReader streamReader = File.OpenText(path)) - { - return InstallManifest.FromJson(streamReader); - } - } - - public static InstallManifest FromJsonString(string json) - { - return JsonConvert.DeserializeObject(json); - } - - public static InstallManifest FromJson(StreamReader stream) - { - JsonSerializer serializer = new JsonSerializer(); - return (InstallManifest)serializer.Deserialize(stream, typeof(InstallManifest)); - } - - public void AddPlatformInstallManifest(string platform, IEnumerable entries) - { - InstallManifestPlatform platformManifest = new InstallManifestPlatform(entries); - this.PlatformInstallManifests.Add(platform, platformManifest); - } - } -} diff --git a/GVFS/GVFS.Common/NuGetUpgrade/InstallManifestPlatform.cs b/GVFS/GVFS.Common/NuGetUpgrade/InstallManifestPlatform.cs deleted file mode 100644 index a5ebfaf3f5..0000000000 --- a/GVFS/GVFS.Common/NuGetUpgrade/InstallManifestPlatform.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace GVFS.Common.NuGetUpgrade -{ - public class InstallManifestPlatform - { - public InstallManifestPlatform() - { - this.InstallActions = new List(); - } - - public InstallManifestPlatform(IEnumerable entries) - { - this.InstallActions = entries?.ToList() ?? new List(); - } - - public List InstallActions { get; } - } -} diff --git a/GVFS/GVFS.Common/NuGetUpgrade/NuGetFeed.cs b/GVFS/GVFS.Common/NuGetUpgrade/NuGetFeed.cs deleted file mode 100644 index ccfffa6542..0000000000 --- a/GVFS/GVFS.Common/NuGetUpgrade/NuGetFeed.cs +++ /dev/null @@ -1,278 +0,0 @@ -using GVFS.Common.Tracing; -using NuGet.Commands; -using NuGet.Common; -using NuGet.Configuration; -using NuGet.Packaging.Core; -using NuGet.Protocol; -using NuGet.Protocol.Core.Types; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace GVFS.Common.NuGetUpgrade -{ - /// - /// Handles interactions with a NuGet Feed. - /// - public class NuGetFeed : IDisposable - { - // This is the SHA256 Certificate Thumbrint we expect packages from Microsoft to be signed with - private const string TrustedMicrosoftCertFingerprintOld = "3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE"; - private const string TrustedMicrosoftCertFingerprintNew = "AA12DA22A49BCE7D5C1AE64CC1F3D892F150DA76140F210ABD2CBFFCA2C18A27"; - - private readonly ITracer tracer; - private readonly string feedUrl; - private readonly string feedName; - private readonly string downloadFolder; - private readonly bool platformSupportsEncryption; - - private SourceRepository sourceRepository; - private string personalAccessToken; - private SourceCacheContext sourceCacheContext; - private ILogger nuGetLogger; - - public NuGetFeed( - string feedUrl, - string feedName, - string downloadFolder, - string personalAccessToken, - bool platformSupportsEncryption, - ITracer tracer) - { - this.feedUrl = feedUrl; - this.feedName = feedName; - this.downloadFolder = downloadFolder; - this.personalAccessToken = personalAccessToken; - this.tracer = tracer; - - // Configure the NuGet SourceCacheContext - - // - Direct download packages - do not download to global - // NuGet cache. This is set in NullSourceCacheContext.Instance - // - NoCache - Do not cache package version lists - this.sourceCacheContext = NullSourceCacheContext.Instance.Clone(); - this.sourceCacheContext.NoCache = true; - this.platformSupportsEncryption = platformSupportsEncryption; - - this.nuGetLogger = new Logger(this.tracer); - this.SetSourceRepository(); - } - - public void Dispose() - { - this.sourceRepository = null; - this.sourceCacheContext?.Dispose(); - this.sourceCacheContext = null; - } - - public virtual void SetCredentials(string credential) - { - this.personalAccessToken = credential; - - this.SetSourceRepository(); - } - - /// - /// Query a NuGet feed for list of packages that match the packageId. - /// - /// - /// List of packages that match query parameters - public virtual async Task> QueryFeedAsync(string packageId) - { - PackageMetadataResource packageMetadataResource = await this.sourceRepository.GetResourceAsync(); - IEnumerable queryResults = await packageMetadataResource.GetMetadataAsync( - packageId, - includePrerelease: false, - includeUnlisted: false, - sourceCacheContext: this.sourceCacheContext, - log: this.nuGetLogger, - token: CancellationToken.None); - - return queryResults.ToList(); - } - - /// - /// Download the specified packageId from the NuGet feed. - /// - /// PackageIdentity to download. - /// Path to the downloaded package. - public virtual async Task DownloadPackageAsync(PackageIdentity packageId) - { - string downloadPath = Path.Combine(this.downloadFolder, $"{this.feedName}.zip"); - PackageDownloadContext packageDownloadContext = new PackageDownloadContext( - this.sourceCacheContext, - this.downloadFolder, - true); - - DownloadResource downloadResource = await this.sourceRepository.GetResourceAsync(); - - using (DownloadResourceResult downloadResourceResult = await downloadResource.GetDownloadResourceResultAsync( - packageId, - packageDownloadContext, - globalPackagesFolder: string.Empty, - logger : this.nuGetLogger, - token: CancellationToken.None)) - { - if (downloadResourceResult.Status != DownloadResourceResultStatus.Available) - { - throw new Exception($"Download of NuGet package failed. DownloadResult Status: {downloadResourceResult.Status}"); - } - - using (FileStream fileStream = File.Create(downloadPath)) - { - downloadResourceResult.PackageStream.CopyTo(fileStream); - } - } - - return downloadPath; - } - - public virtual bool VerifyPackage(string packagePath) - { - VerifyArgs verifyArgs = new VerifyArgs() - { - Verifications = new VerifyArgs.Verification[] { VerifyArgs.Verification.All }, - PackagePath = packagePath, - CertificateFingerprint = new List - { - TrustedMicrosoftCertFingerprintOld, - TrustedMicrosoftCertFingerprintNew, - }, - Logger = this.nuGetLogger - }; - - VerifyCommandRunner verifyCommandRunner = new VerifyCommandRunner(); - int result = verifyCommandRunner.ExecuteCommandAsync(verifyArgs).Result; - return result == 0; - } - - protected static EventMetadata CreateEventMetadata(Exception e = null) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(NuGetFeed)); - if (e != null) - { - metadata.Add("Exception", e.ToString()); - } - - return metadata; - } - - private static PackageSourceCredential BuildCredentialsFromPAT(string personalAccessToken, bool storePasswordInClearText) - { - // The storePasswordInClearText property is used to control whether the password - // is written to NuGet config files in clear text or not. It also controls whether the - // password is stored encrypted in memory or not. The ability to encrypt / decrypt the password - // is not supported in non-windows platforms at this point. - // We do not actually write out config files or store the password (except in memory). As in our - // usage of NuGet functionality we do not write out config files, it is OK to not set this property - // (with the tradeoff being the password is not encrypted in memory, and we need to make sure that new code - // does not start to write out config files). - return PackageSourceCredential.FromUserInput( - "VfsForGitNugetUpgrader", - "PersonalAccessToken", - personalAccessToken, - storePasswordInClearText: storePasswordInClearText); - } - - private void SetSourceRepository() - { - this.sourceRepository = Repository.Factory.GetCoreV3(this.feedUrl); - if (!string.IsNullOrEmpty(this.personalAccessToken)) - { - this.sourceRepository.PackageSource.Credentials = BuildCredentialsFromPAT(this.personalAccessToken, !this.platformSupportsEncryption); - } - } - - /// - /// Implementation of logger used by NuGet library. It takes all output - /// and redirects it to the GVFS logger. - /// - private class Logger : ILogger - { - private ITracer tracer; - - public Logger(ITracer tracer) - { - this.tracer = tracer; - } - - public void Log(LogLevel level, string data) - { - string message = $"NuGet Logger: ({level}): {data}"; - switch (level) - { - case LogLevel.Debug: - case LogLevel.Verbose: - case LogLevel.Minimal: - case LogLevel.Information: - this.tracer.RelatedInfo(message); - break; - case LogLevel.Warning: - this.tracer.RelatedWarning(message); - break; - case LogLevel.Error: - this.tracer.RelatedWarning(message); - break; - default: - this.tracer.RelatedWarning(message); - break; - } - } - - public void Log(ILogMessage message) - { - this.Log(message.Level, message.Message); - } - - public Task LogAsync(LogLevel level, string data) - { - this.Log(level, data); - return Task.CompletedTask; - } - - public Task LogAsync(ILogMessage message) - { - this.Log(message); - return Task.CompletedTask; - } - - public void LogDebug(string data) - { - this.Log(LogLevel.Debug, data); - } - - public void LogError(string data) - { - this.Log(LogLevel.Error, data); - } - - public void LogInformation(string data) - { - this.Log(LogLevel.Information, data); - } - - public void LogInformationSummary(string data) - { - this.Log(LogLevel.Information, data); - } - - public void LogMinimal(string data) - { - this.Log(LogLevel.Minimal, data); - } - - public void LogVerbose(string data) - { - this.Log(LogLevel.Verbose, data); - } - - public void LogWarning(string data) - { - this.Log(LogLevel.Warning, data); - } - } - } -} diff --git a/GVFS/GVFS.Common/NuGetUpgrade/NuGetUpgrader.cs b/GVFS/GVFS.Common/NuGetUpgrade/NuGetUpgrader.cs deleted file mode 100644 index ff724ec6aa..0000000000 --- a/GVFS/GVFS.Common/NuGetUpgrade/NuGetUpgrader.cs +++ /dev/null @@ -1,799 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using NuGet.Packaging.Core; -using NuGet.Protocol.Core.Types; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.IO.Compression; -using System.Threading; - -namespace GVFS.Common.NuGetUpgrade -{ - public class NuGetUpgrader : ProductUpgrader - { - protected readonly NuGetUpgraderConfig nuGetUpgraderConfig; - protected Version highestVersionAvailable; - - private const string ContentDirectoryName = "content"; - private const string InstallManifestFileName = "install-manifest.json"; - private const string ExtractedInstallerDirectoryName = "InstallerTemp"; - - private InstallManifest installManifest; - private NuGetFeed nuGetFeed; - private ICredentialStore credentialStore; - private bool isNuGetFeedInitialized; - - public NuGetUpgrader( - string currentVersion, - ITracer tracer, - PhysicalFileSystem fileSystem, - bool dryRun, - bool noVerify, - NuGetUpgraderConfig config, - string downloadFolder, - ICredentialStore credentialStore) - : this( - currentVersion, - tracer, - dryRun, - noVerify, - fileSystem, - config, - new NuGetFeed( - config.FeedUrl, - config.PackageFeedName, - downloadFolder, - null, - GVFSPlatform.Instance.UnderConstruction.SupportsNuGetEncryption, - tracer), - credentialStore, - GVFSPlatform.Instance.CreateProductUpgraderPlatformInteractions(fileSystem, tracer)) - { - } - - internal NuGetUpgrader( - string currentVersion, - ITracer tracer, - bool dryRun, - bool noVerify, - PhysicalFileSystem fileSystem, - NuGetUpgraderConfig config, - NuGetFeed nuGetFeed, - ICredentialStore credentialStore, - ProductUpgraderPlatformStrategy productUpgraderPlatformStrategy) - : base( - currentVersion, - tracer, - dryRun, - noVerify, - fileSystem, - productUpgraderPlatformStrategy) - { - this.nuGetUpgraderConfig = config; - - this.nuGetFeed = nuGetFeed; - this.credentialStore = credentialStore; - - // Extract the folder inside ProductUpgraderInfo.GetAssetDownloadsPath to ensure the - // correct ACLs are in place - this.ExtractedInstallerPath = Path.Combine( - ProductUpgraderInfo.GetAssetDownloadsPath(), - ExtractedInstallerDirectoryName); - } - - public string DownloadedPackagePath { get; private set; } - - public override bool SupportsAnonymousVersionQuery { get => false; } - - /// - /// Path to unzip the downloaded upgrade package - /// - private string ExtractedInstallerPath { get; } - - /// - /// Try to load a NuGetUpgrader from config settings. - /// Flag to indicate whether the system is configured to use a NuGetUpgrader. - /// A NuGetUpgrader can be set as the Upgrader to use, but it might not be properly configured. - /// - /// True if able to load a properly configured NuGetUpgrader - /// - public static bool TryCreate( - ITracer tracer, - PhysicalFileSystem fileSystem, - LocalGVFSConfig gvfsConfig, - ICredentialStore credentialStore, - bool dryRun, - bool noVerify, - out NuGetUpgrader nuGetUpgrader, - out bool isConfigured, - out string error) - { - NuGetUpgraderConfig upgraderConfig = new NuGetUpgraderConfig(tracer, gvfsConfig); - nuGetUpgrader = null; - isConfigured = false; - - if (!upgraderConfig.TryLoad(out error)) - { - nuGetUpgrader = null; - return false; - } - - if (!(isConfigured = upgraderConfig.IsConfigured(out error))) - { - return false; - } - - // At this point, we have determined that the system is set up to use - // the NuGetUpgrader - - if (!upgraderConfig.IsReady(out error)) - { - return false; - } - - nuGetUpgrader = new NuGetUpgrader( - ProcessHelper.GetCurrentProcessVersion(), - tracer, - fileSystem, - dryRun, - noVerify, - upgraderConfig, - ProductUpgraderInfo.GetAssetDownloadsPath(), - credentialStore); - - return true; - } - - /// - /// Performs a replacement on well known strings in the arguments field of a manifest entry. - /// - /// The unprocessed string to use as arguments to an install command - /// A unique installer ID to replace the installer_id token with. - /// The argument string with tokens replaced. - public static string ReplaceArgTokens(string src, string installationId, string logsDirectory, string installerBaseDirectory) - { - string dst = src - .Replace(NuGetUpgrader.ReplacementToken(InstallActionInfo.ManifestEntryLogDirectoryToken), logsDirectory) - .Replace(NuGetUpgrader.ReplacementToken(InstallActionInfo.ManifestEntryInstallationIdToken), installationId) - .Replace(NuGetUpgrader.ReplacementToken(InstallActionInfo.ManifestEntryInstallerBaseDirectoryToken), installerBaseDirectory); - return dst; - } - - public override void Dispose() - { - this.nuGetFeed?.Dispose(); - this.nuGetFeed = null; - base.Dispose(); - } - - public override bool UpgradeAllowed(out string message) - { - if (string.IsNullOrEmpty(this.nuGetUpgraderConfig.FeedUrl)) - { - message = "Nuget Feed URL has not been configured"; - return false; - } - else if (string.IsNullOrEmpty(this.nuGetUpgraderConfig.PackageFeedName)) - { - message = "NuGet package feed has not been configured"; - return false; - } - - message = null; - return true; - } - - public override bool TryQueryNewestVersion(out Version newVersion, out string message) - { - try - { - if (!this.EnsureNuGetFeedInitialized(out message)) - { - newVersion = null; - return false; - } - - IList queryResults = this.QueryFeed(firstAttempt: true); - - // Find the package with the highest version - IPackageSearchMetadata newestPackage = null; - foreach (IPackageSearchMetadata result in queryResults) - { - if (newestPackage == null || result.Identity.Version > newestPackage.Identity.Version) - { - newestPackage = result; - } - } - - if (newestPackage != null && - newestPackage.Identity.Version.Version > this.installedVersion) - { - this.highestVersionAvailable = newestPackage.Identity.Version.Version; - } - - newVersion = this.highestVersionAvailable; - - if (newVersion != null) - { - this.tracer.RelatedInfo($"{nameof(this.TryQueryNewestVersion)} - new version available: installedVersion: {this.installedVersion}, highestVersionAvailable: {newVersion}"); - message = $"New version {newestPackage.Identity.Version} is available."; - return true; - } - else if (newestPackage != null) - { - this.tracer.RelatedInfo($"{nameof(this.TryQueryNewestVersion)} - up-to-date"); - message = $"highest version available is {newestPackage.Identity.Version}, you are up-to-date"; - return true; - } - else - { - this.tracer.RelatedInfo($"{nameof(this.TryQueryNewestVersion)} - no versions available from feed."); - message = $"No versions available via feed."; - } - } - catch (Exception ex) - { - this.TraceException( - ex, - nameof(this.TryQueryNewestVersion), - "Exception encountered querying for newest version of upgrade package."); - message = ex.Message; - newVersion = null; - } - - return false; - } - - public override bool TryDownloadNewestVersion(out string errorMessage) - { - if (this.highestVersionAvailable == null) - { - // If we hit this code path, it indicates there was a - // programmer error. The expectation is that this - // method will only be called after - // TryQueryNewestVersion has been called, and - // indicates that a newer version is available. - errorMessage = "No new version to download. Query for newest version to ensure a new version is available before downloading."; - return false; - } - - if (!this.EnsureNuGetFeedInitialized(out errorMessage)) - { - return false; - } - - if (!this.TryCreateAndConfigureDownloadDirectory(this.tracer, out errorMessage)) - { - this.tracer.RelatedError($"{nameof(NuGetUpgrader)}.{nameof(this.TryCreateAndConfigureDownloadDirectory)} failed. {errorMessage}"); - return false; - } - - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryDownloadNewestVersion), EventLevel.Informational)) - { - try - { - PackageIdentity packageId = this.GetPackageForVersion(this.highestVersionAvailable); - - if (packageId == null) - { - errorMessage = $"The specified version {this.highestVersionAvailable} was not found in the NuGet feed. Please check with your administrator to make sure the feed is set up correctly."; - return false; - } - - this.DownloadedPackagePath = this.nuGetFeed.DownloadPackageAsync(packageId).GetAwaiter().GetResult(); - } - catch (Exception ex) - { - this.TraceException( - activity, - ex, - nameof(this.TryDownloadNewestVersion), - "Exception encountered downloading newest version of upgrade package."); - errorMessage = ex.Message; - return false; - } - } - - if (!this.noVerify) - { - if (!this.nuGetFeed.VerifyPackage(this.DownloadedPackagePath)) - { - errorMessage = "Package signature validation failed. Check the upgrade logs for more details."; - this.tracer.RelatedError(errorMessage); - this.fileSystem.DeleteFile(this.DownloadedPackagePath); - return false; - } - } - - errorMessage = null; - return true; - } - - public override bool TryCleanup(out string error) - { - return this.TryRecursivelyDeleteInstallerDirectory(out error); - } - - public override bool TryRunInstaller(InstallActionWrapper installActionWrapper, out string error) - { - string localError = null; - int installerExitCode; - bool installSuccessful = true; - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryRunInstaller), EventLevel.Informational)) - { - InstallActionInfo currentInstallAction = null; - try - { - string platformKey = GVFSPlatform.Instance.Name; - - if (!this.TryRecursivelyDeleteInstallerDirectory(out error)) - { - return false; - } - - if (!this.noVerify) - { - if (!this.nuGetFeed.VerifyPackage(this.DownloadedPackagePath)) - { - error = "Package signature validation failed. Check the upgrade logs for more details."; - activity.RelatedError(error); - this.fileSystem.DeleteFile(this.DownloadedPackagePath); - return false; - } - } - - this.UnzipPackage(); - this.installManifest = InstallManifest.FromJsonFile(Path.Combine(this.ExtractedInstallerPath, ContentDirectoryName, InstallManifestFileName)); - if (!this.installManifest.PlatformInstallManifests.TryGetValue(platformKey, out InstallManifestPlatform platformInstallManifest) || - platformInstallManifest == null) - { - activity.RelatedError($"Extracted InstallManifest from JSON, but there was no entry for {platformKey}."); - error = $"No entry in the manifest for the current platform ({platformKey}). Please verify the upgrade package."; - return false; - } - - activity.RelatedInfo($"Extracted InstallManifest from JSON. InstallActions: {platformInstallManifest.InstallActions.Count}"); - - foreach (InstallActionInfo entry in platformInstallManifest.InstallActions) - { - currentInstallAction = entry; - string installerBasePath = Path.Combine(this.ExtractedInstallerPath, ContentDirectoryName); - - string args = entry.Args ?? string.Empty; - - // Replace tokens on args - string processedArgs = NuGetUpgrader.ReplaceArgTokens(args, this.UpgradeInstanceId, ProductUpgraderInfo.GetLogDirectoryPath(), $"\"{installerBasePath}\""); - - activity.RelatedInfo( - "Running install action: Name: {0}, Version: {1}, InstallerPath: {2}, Command: {3}, RawArgs: {4}, ProcessedArgs: {5}", - entry.Name, - entry.Version, - entry.InstallerRelativePath ?? string.Empty, - entry.Command ?? string.Empty, - args, - processedArgs); - - string progressMessage = string.IsNullOrWhiteSpace(entry.Version) ? - $"Running {entry.Name}" : - $"Running {entry.Name} (version {entry.Version})"; - - installActionWrapper( - () => - { - if (!this.dryRun) - { - if (!string.IsNullOrEmpty(entry.Command)) - { - this.RunInstaller(entry.Command, processedArgs, out installerExitCode, out localError); - } - else - { - string installerPath = Path.Combine(installerBasePath, entry.InstallerRelativePath); - this.RunInstaller(installerPath, processedArgs, out installerExitCode, out localError); - } - } - else - { - // We add a sleep here to ensure - // the message for this install - // action is written to the - // console. Even though the - // message is written with a delay - // of 0, the messages are not - // always written out. If / when - // we can ensure that the message - // is written out to console, then - // we can remove this sleep. - Thread.Sleep(1500); - installerExitCode = 0; - } - - installSuccessful = installerExitCode == 0; - - return installSuccessful; - }, - progressMessage); - - if (!installSuccessful) - { - break; - } - } - } - catch (Exception ex) - { - localError = ex.Message; - installSuccessful = false; - } - - if (!installSuccessful) - { - this.SaveSystemInstallerLogs(); - - string installActionName = string.IsNullOrEmpty(currentInstallAction?.Name) ? - "installer" : - currentInstallAction.Name; - - error = string.IsNullOrEmpty(localError) ? - $"The {installActionName} failed, but no error message was provided by the failing command." : - $"The {installActionName} failed with the following error: {localError}"; - - activity.RelatedError($"Could not complete all install actions. The following error was encountered: {error}"); - return false; - } - else - { - activity.RelatedInfo($"Install actions completed successfully."); - error = null; - return true; - } - } - } - - protected static EventMetadata CreateEventMetadata(Exception e = null) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(NuGetFeed)); - if (e != null) - { - metadata.Add("Exception", e.ToString()); - } - - return metadata; - } - - private static string ReplacementToken(string tokenString) - { - return "{" + tokenString + "}"; - } - - private PackageIdentity GetPackageForVersion(Version version) - { - IList queryResults = this.QueryFeed(firstAttempt: true); - - IPackageSearchMetadata packageForVersion = null; - foreach (IPackageSearchMetadata result in queryResults) - { - if (result.Identity.Version.Version == version) - { - packageForVersion = result; - break; - } - } - - return packageForVersion?.Identity; - } - - private bool TryGetPersonalAccessToken(string credentialUrl, ITracer tracer, out string token, out string error) - { - return this.credentialStore.TryGetCredential(this.tracer, credentialUrl, out string username, out token, out error); - } - - private bool TryReacquirePersonalAccessToken(string credentialUrl, ITracer tracer, out string token, out string error) - { - if (!this.credentialStore.TryDeleteCredential(this.tracer, credentialUrl, username: null, password: null, error: out error)) - { - token = null; - return false; - } - - return this.TryGetPersonalAccessToken(credentialUrl, tracer, out token, out error); - } - - private void UnzipPackage() - { - ZipFile.ExtractToDirectory(this.DownloadedPackagePath, this.ExtractedInstallerPath); - } - - private bool TryRecursivelyDeleteInstallerDirectory(out string error) - { - error = null; - Exception e; - if (!this.fileSystem.TryDeleteDirectory(this.ExtractedInstallerPath, out e)) - { - if (e != null) - { - this.TraceException( - e, - nameof(this.TryRecursivelyDeleteInstallerDirectory), - $"Exception encountered while deleting {this.ExtractedInstallerPath}."); - } - - error = e?.Message ?? "Failed to delete directory, but no error was specified."; - return false; - } - - return true; - } - - private IList QueryFeed(bool firstAttempt) - { - try - { - return this.nuGetFeed.QueryFeedAsync(this.nuGetUpgraderConfig.PackageFeedName).GetAwaiter().GetResult(); - } - catch (Exception ex) when (firstAttempt && - this.IsAuthRelatedException(ex)) - { - // If we fail to query the feed due to an authorization error, then it is possible we have stale - // credentials, or credentials without the correct scope. Re-aquire fresh credentials and try again. - EventMetadata data = CreateEventMetadata(ex); - this.tracer.RelatedWarning(data, "Failed to query feed due to unauthorized error. Re-acquiring new credentials and trying again."); - - if (!this.TryRefreshCredentials(out string error)) - { - // If we were unable to re-acquire credentials, throw a new exception indicating that we tried to handle this, but were unable to. - throw new Exception($"Failed to query the feed for upgrade packages due to: {ex.Message}, and was not able to re-acquire new credentials due to: {error}", ex); - } - - // Now that we have re-acquired credentials, try again - but with the retry flag set to false. - return this.QueryFeed(firstAttempt: false); - } - catch (Exception ex) - { - EventMetadata data = CreateEventMetadata(ex); - string message = $"Error encountered when querying NuGet feed. Is first attempt: {firstAttempt}."; - this.tracer.RelatedWarning(data, message); - throw new Exception($"Failed to query the NuGet package feed due to error: {ex.Message}", ex); - } - } - - private bool IsAuthRelatedException(Exception ex) - { - // In observation, we have seen either an HttpRequestException directly, or - // a FatalProtocolException wrapping an HttpRequestException when we are not able - // to auth against the NuGet feed. - System.Net.Http.HttpRequestException httpRequestException = null; - if (ex is System.Net.Http.HttpRequestException) - { - httpRequestException = ex as System.Net.Http.HttpRequestException; - } - else if (ex is FatalProtocolException && - ex.InnerException is System.Net.Http.HttpRequestException) - { - httpRequestException = ex.InnerException as System.Net.Http.HttpRequestException; - } - - if (httpRequestException != null && - (httpRequestException.Message.Contains("401") || httpRequestException.Message.Contains("403"))) - { - return true; - } - - return false; - } - - private bool TryRefreshCredentials(out string error) - { - try - { - string authUrl; - if (!AzDevOpsOrgFromNuGetFeed.TryCreateCredentialQueryUrl(this.nuGetUpgraderConfig.FeedUrl, out authUrl, out error)) - { - return false; - } - - if (!this.TryReacquirePersonalAccessToken(authUrl, this.tracer, out string token, out error)) - { - return false; - } - - this.nuGetFeed.SetCredentials(token); - return true; - } - catch (Exception ex) - { - error = ex.Message; - this.TraceException(ex, nameof(this.TryRefreshCredentials), "Failed to refresh credentials."); - return false; - } - } - - private bool EnsureNuGetFeedInitialized(out string error) - { - if (!this.isNuGetFeedInitialized) - { - if (this.credentialStore == null) - { - throw new InvalidOperationException("Attempted to call method that requires authentication but no CredentialStore is configured."); - } - - string authUrl; - if (!AzDevOpsOrgFromNuGetFeed.TryCreateCredentialQueryUrl(this.nuGetUpgraderConfig.FeedUrl, out authUrl, out error)) - { - return false; - } - - if (!this.TryGetPersonalAccessToken(authUrl, this.tracer, out string token, out error)) - { - return false; - } - - this.nuGetFeed.SetCredentials(token); - this.isNuGetFeedInitialized = true; - } - - error = null; - return true; - } - - /// - /// Saves a copy of installer log from platform native installer in the - /// upgrader diagnose logs directory. On the Mac, it is not possible to - /// specify custom log file path as command line arg to the installer. - /// - private void SaveSystemInstallerLogs() - { - if (GVFSPlatform.Instance.SupportsSystemInstallLog) - { - string systemInstallerLog = GVFSPlatform.Instance.GetSystemInstallerLogPath(); - if (!string.IsNullOrEmpty(systemInstallerLog)) - { - string destinationPath = GVFSEnlistment.GetNewGVFSLogFileName( - ProductUpgraderInfo.GetLogDirectoryPath(), - GVFSConstants.LogFileTypes.UpgradeSystemInstaller, - this.UpgradeInstanceId); - - try - { - using (Stream sourceStream = this.fileSystem.OpenFileStream( - systemInstallerLog, - FileMode.Open, - FileAccess.Read, - FileShare.ReadWrite, - callFlushFileBuffers: false)) - using (Stream destStream = this.fileSystem.OpenFileStream( - destinationPath, - FileMode.Create, - FileAccess.Write, - FileShare.None, - callFlushFileBuffers: false)) - { - // Copy the last 100K from the system wide installer log. - // System wide installer log (/var/log/install.log) holds - // all messages from installd, including the ones that - // it generated while installing VFSForGit. We don't - // need to capture the whole file, which can be lengthy. - // From my testing, the last 100K captured immediately - // after upgrade, is found to be lengthy enough to - // contain all of Git + GCM + Service + VFSForGit - // installer log messages. - long hundredKB = 100 * 1024; - long copyFromOffset = sourceStream.Length > hundredKB ? sourceStream.Length - hundredKB : 0; - - sourceStream.Seek(copyFromOffset, SeekOrigin.Begin); - sourceStream.CopyTo(destStream); - } - } - catch (Exception ex) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Exception", ex.ToString()); - this.tracer.RelatedError( - metadata, - $"{nameof(this.SaveSystemInstallerLogs)} - Error saving native installer log file."); - } - } - else - { - this.tracer.RelatedError($"{nameof(this.SaveSystemInstallerLogs)} - Error getting native installer log file path."); - } - } - } - - public class NuGetUpgraderConfig - { - protected readonly ITracer tracer; - protected readonly LocalGVFSConfig localConfig; - - public NuGetUpgraderConfig(ITracer tracer, LocalGVFSConfig localGVFSConfig) - { - this.tracer = tracer; - this.localConfig = localGVFSConfig; - } - - public NuGetUpgraderConfig( - ITracer tracer, - LocalGVFSConfig localGVFSConfig, - string feedUrl, - string packageFeedName) - : this(tracer, localGVFSConfig) - { - this.FeedUrl = feedUrl; - this.PackageFeedName = packageFeedName; - } - - public string FeedUrl { get; private set; } - public string PackageFeedName { get; private set; } - public string CertificateFingerprint { get; private set; } - - /// - /// Check if the NuGetUpgrader is ready for use. A - /// NuGetUpgrader is considered ready if all required - /// config settings are present. - /// - public virtual bool IsReady(out string error) - { - if (string.IsNullOrEmpty(this.FeedUrl) || - string.IsNullOrEmpty(this.PackageFeedName)) - { - error = string.Join( - Environment.NewLine, - "One or more required settings for NuGetUpgrader are missing.", - $"Use `gvfs config [{GVFSConstants.LocalGVFSConfig.UpgradeFeedUrl} | {GVFSConstants.LocalGVFSConfig.UpgradeFeedPackageName}] ` to set the config."); - return false; - } - - error = null; - return true; - } - - /// - /// Check if the NuGetUpgrader is configured. - /// - public virtual bool IsConfigured(out string error) - { - if (string.IsNullOrEmpty(this.FeedUrl) && - string.IsNullOrEmpty(this.PackageFeedName)) - { - error = string.Join( - Environment.NewLine, - "NuGet upgrade server is not configured.", - $"Use `gvfs config [ {GVFSConstants.LocalGVFSConfig.UpgradeFeedUrl} | {GVFSConstants.LocalGVFSConfig.UpgradeFeedPackageName}] ` to set the config."); - return false; - } - - error = null; - return true; - } - - /// - /// Try to load the config for a NuGet upgrader. Returns false if there was an error reading the config. - /// - public virtual bool TryLoad(out string error) - { - string configValue; - if (!this.localConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.UpgradeFeedUrl, out configValue, out error)) - { - this.tracer.RelatedError(error); - return false; - } - - this.FeedUrl = configValue; - - if (!this.localConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.UpgradeFeedPackageName, out configValue, out error)) - { - this.tracer.RelatedError(error); - return false; - } - - this.PackageFeedName = configValue; - return true; - } - } - } -} diff --git a/GVFS/GVFS.Common/NuGetUpgrade/OrgNuGetUpgrader.cs b/GVFS/GVFS.Common/NuGetUpgrade/OrgNuGetUpgrader.cs deleted file mode 100644 index dd7f4852b8..0000000000 --- a/GVFS/GVFS.Common/NuGetUpgrade/OrgNuGetUpgrader.cs +++ /dev/null @@ -1,244 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using System; -using System.Net.Http; -using System.Runtime.Serialization; -using System.Threading.Tasks; - -namespace GVFS.Common.NuGetUpgrade -{ - public class OrgNuGetUpgrader : NuGetUpgrader - { - private HttpClient httpClient; - private string platform; - - public OrgNuGetUpgrader( - string currentVersion, - ITracer tracer, - PhysicalFileSystem fileSystem, - HttpClient httpClient, - bool dryRun, - bool noVerify, - OrgNuGetUpgraderConfig config, - string downloadFolder, - string platform, - ICredentialStore credentialStore) - : base( - currentVersion, - tracer, - fileSystem, - dryRun, - noVerify, - config, - downloadFolder, - credentialStore) - { - this.httpClient = httpClient; - this.platform = platform; - } - - public OrgNuGetUpgrader( - string currentVersion, - ITracer tracer, - PhysicalFileSystem fileSystem, - HttpClient httpClient, - bool dryRun, - bool noVerify, - OrgNuGetUpgraderConfig config, - string platform, - NuGetFeed nuGetFeed, - ICredentialStore credentialStore) - : base( - currentVersion, - tracer, - dryRun, - noVerify, - fileSystem, - config, - nuGetFeed, - credentialStore, - GVFSPlatform.Instance.CreateProductUpgraderPlatformInteractions(fileSystem, tracer)) - { - this.httpClient = httpClient; - this.platform = platform; - } - - public override bool SupportsAnonymousVersionQuery { get => true; } - - private OrgNuGetUpgraderConfig Config { get => this.nuGetUpgraderConfig as OrgNuGetUpgraderConfig; } - private string OrgInfoServerUrl { get => this.Config.OrgInfoServer; } - private string Ring { get => this.Config.UpgradeRing; } - - public static bool TryCreate( - ITracer tracer, - PhysicalFileSystem fileSystem, - LocalGVFSConfig gvfsConfig, - HttpClient httpClient, - ICredentialStore credentialStore, - bool dryRun, - bool noVerify, - out OrgNuGetUpgrader upgrader, - out string error) - { - OrgNuGetUpgraderConfig upgraderConfig = new OrgNuGetUpgraderConfig(tracer, gvfsConfig); - upgrader = null; - - if (!upgraderConfig.TryLoad(out error)) - { - upgrader = null; - return false; - } - - if (!upgraderConfig.IsConfigured(out error)) - { - return false; - } - - if (!upgraderConfig.IsReady(out error)) - { - return false; - } - - string platform = GVFSPlatform.Instance.Name; - - upgrader = new OrgNuGetUpgrader( - ProcessHelper.GetCurrentProcessVersion(), - tracer, - fileSystem, - httpClient, - dryRun, - noVerify, - upgraderConfig, - ProductUpgraderInfo.GetAssetDownloadsPath(), - platform, - credentialStore); - - return true; - } - - public override bool TryQueryNewestVersion(out Version newVersion, out string message) - { - newVersion = null; - - if (!AzDevOpsOrgFromNuGetFeed.TryParseOrg(this.Config.FeedUrl, out string orgName)) - { - message = "OrgNuGetUpgrader is not able to parse org name from NuGet Package Feed URL"; - return false; - } - - OrgInfoApiClient infoServer = new OrgInfoApiClient(this.httpClient, this.OrgInfoServerUrl); - - try - { - this.highestVersionAvailable = infoServer.QueryNewestVersion(orgName, this.platform, this.Ring); - } - catch (Exception exception) when (exception is HttpRequestException || - exception is TaskCanceledException) - { - // GetStringAsync can also throw a TaskCanceledException to indicate a timeout - // https://github.com/dotnet/corefx/issues/20296 - message = string.Format("Network error: could not connect to server ({0}). {1}", this.OrgInfoServerUrl, exception.Message); - this.TraceException(exception, nameof(this.TryQueryNewestVersion), "Error connecting to server."); - - return false; - } - catch (SerializationException exception) - { - message = string.Format("Parse error: could not parse response from server({0}). {1}", this.OrgInfoServerUrl, exception.Message); - this.TraceException(exception, nameof(this.TryQueryNewestVersion), "Error parsing response from server."); - - return false; - } - catch (Exception exception) when (exception is ArgumentException || - exception is FormatException || - exception is OverflowException) - { - message = string.Format("Unexpected response from server: could nor parse version({0}). {1}", this.OrgInfoServerUrl, exception.Message); - this.TraceException(exception, nameof(this.TryQueryNewestVersion), "Error parsing response from server."); - - return false; - } - - if (this.highestVersionAvailable != null && - this.highestVersionAvailable > this.installedVersion) - { - newVersion = this.highestVersionAvailable; - } - - if (newVersion != null) - { - this.tracer.RelatedInfo($"{nameof(this.TryQueryNewestVersion)} - new version available: installedVersion: {this.installedVersion}, highestVersionAvailable: {newVersion}"); - message = $"New version {newVersion} is available."; - return true; - } - else if (this.highestVersionAvailable != null) - { - this.tracer.RelatedInfo($"{nameof(this.TryQueryNewestVersion)} - up-to-date"); - message = $"Highest version available is {this.highestVersionAvailable}, you are up-to-date"; - return true; - } - else - { - this.tracer.RelatedInfo($"{nameof(this.TryQueryNewestVersion)} - no versions available from feed."); - message = "No versions available via endpoint."; - return true; - } - } - - public class OrgNuGetUpgraderConfig : NuGetUpgraderConfig - { - public OrgNuGetUpgraderConfig(ITracer tracer, LocalGVFSConfig localGVFSConfig) - : base(tracer, localGVFSConfig) - { - } - - public string OrgInfoServer { get; set; } - - public string UpgradeRing { get; set; } - - public override bool TryLoad(out string error) - { - if (!base.TryLoad(out error)) - { - return false; - } - - if (!this.localConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.OrgInfoServerUrl, out string orgInfoServerUrl, out error)) - { - this.tracer.RelatedError(error); - return false; - } - - this.OrgInfoServer = orgInfoServerUrl; - - if (!this.localConfig.TryGetConfig(GVFSConstants.LocalGVFSConfig.UpgradeRing, out string upgradeRing, out error)) - { - this.tracer.RelatedError(error); - return false; - } - - this.UpgradeRing = upgradeRing; - - return true; - } - - public override bool IsReady(out string error) - { - if (!base.IsReady(out error) || - string.IsNullOrEmpty(this.UpgradeRing) || - string.IsNullOrEmpty(this.OrgInfoServer)) - { - error = string.Join( - Environment.NewLine, - "One or more required settings for OrgNuGetUpgrader are missing.", - "Use `gvfs config [{GVFSConstants.LocalGVFSConfig.UpgradeFeedUrl} | {GVFSConstants.LocalGVFSConfig.UpgradeFeedPackageName} | {GVFSConstants.LocalGVFSConfig.UpgradeRing} | {GVFSConstants.LocalGVFSConfig.OrgInfoServerUrl}] ` to set the config."); - return false; - } - - return true; - } - } - } -} diff --git a/GVFS/GVFS.Common/Prefetch/Git/DiffHelper.cs b/GVFS/GVFS.Common/Prefetch/Git/DiffHelper.cs index 963efe9227..f55d47d5f6 100644 --- a/GVFS/GVFS.Common/Prefetch/Git/DiffHelper.cs +++ b/GVFS/GVFS.Common/Prefetch/Git/DiffHelper.cs @@ -166,37 +166,45 @@ public void ParseDiffFile(string filename) private void FlushStagedQueues() { - List deletedPaths = new List(); - foreach (DiffTreeResult result in this.stagedDirectoryOperations) + using (ITracer activity = this.tracer.StartActivity("FlushStagedQueues", EventLevel.Informational)) { - // Don't enqueue deletes that will be handled by recursively deleting their parent. - // Git traverses diffs in pre-order, so we are guaranteed to ignore child deletes here. - if (result.Operation == DiffTreeResult.Operations.Delete) + HashSet deletedDirectories = + new HashSet( + this.stagedDirectoryOperations + .Where(d => d.Operation == DiffTreeResult.Operations.Delete) + .Select(d => d.TargetPath.TrimEnd(Path.DirectorySeparatorChar)), + GVFSPlatform.Instance.Constants.PathComparer); + + foreach (DiffTreeResult result in this.stagedDirectoryOperations) { - if (deletedPaths.Any(path => result.TargetPath.StartsWith(path, GVFSPlatform.Instance.Constants.PathComparison))) + string parentPath = Path.GetDirectoryName(result.TargetPath.TrimEnd(Path.DirectorySeparatorChar)); + if (deletedDirectories.Contains(parentPath)) { - continue; + if (result.Operation != DiffTreeResult.Operations.Delete) + { + EventMetadata metadata = new EventMetadata(); + metadata.Add(nameof(result.TargetPath), result.TargetPath); + metadata.Add(TracingConstants.MessageKey.WarningMessage, "An operation is intended to go inside of a deleted folder"); + activity.RelatedError("InvalidOperation", metadata); + } + } + else + { + this.DirectoryOperations.Enqueue(result); } - - deletedPaths.Add(result.TargetPath); } - this.DirectoryOperations.Enqueue(result); - } - - foreach (string filePath in this.stagedFileDeletes) - { - if (deletedPaths.Any(path => filePath.StartsWith(path, GVFSPlatform.Instance.Constants.PathComparison))) + foreach (string filePath in this.stagedFileDeletes) { - continue; + string parentPath = Path.GetDirectoryName(filePath); + if (!deletedDirectories.Contains(parentPath)) + { + this.FileDeleteOperations.Enqueue(filePath); + } } - deletedPaths.Add(filePath); - - this.FileDeleteOperations.Enqueue(filePath); + this.RequiredBlobs.CompleteAdding(); } - - this.RequiredBlobs.CompleteAdding(); } private void EnqueueOperationsFromLsTreeLine(ITracer activity, string line) diff --git a/GVFS/GVFS.Common/Prefetch/Pipeline/BatchObjectDownloadStage.cs b/GVFS/GVFS.Common/Prefetch/Pipeline/BatchObjectDownloadStage.cs index d9080f1467..81fcee6cef 100644 --- a/GVFS/GVFS.Common/Prefetch/Pipeline/BatchObjectDownloadStage.cs +++ b/GVFS/GVFS.Common/Prefetch/Pipeline/BatchObjectDownloadStage.cs @@ -213,7 +213,7 @@ public bool TryTake(out BlobDownloadRequest request) { List blobsInChunk = new List(); - for (int i = 0; i < this.chunkSize; ++i) + for (int i = 0; i < this.chunkSize;) { // Only wait a short while for new work to show up, otherwise go ahead and download what we have accumulated so far const int TimeoutMs = 100; @@ -222,6 +222,10 @@ public bool TryTake(out BlobDownloadRequest request) if (this.missingBlobs.TryTake(out blobId, TimeoutMs)) { blobsInChunk.Add(blobId); + + // Only increment if a blob was added. Otherwise, if no blobs are added during TimeoutMs * chunkSize, + // this will exit early and blobs added later will not be downloaded. + ++i; } else if (blobsInChunk.Count > 0 || this.missingBlobs.IsAddingCompleted) diff --git a/GVFS/GVFS.Common/ProductUpgrader.cs b/GVFS/GVFS.Common/ProductUpgrader.cs deleted file mode 100644 index b28330cc25..0000000000 --- a/GVFS/GVFS.Common/ProductUpgrader.cs +++ /dev/null @@ -1,258 +0,0 @@ -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.NuGetUpgrade; -using GVFS.Common.Tracing; -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Http; - -namespace GVFS.Common -{ - /// - /// Delegate to wrap install action steps in. - /// This can be used to report the beginning / end of each install step. - /// - /// The method to run inside wrapper - /// The message to display - /// success or failure return from the method run. - public delegate bool InstallActionWrapper(Func method, string message); - - public abstract class ProductUpgrader : IDisposable - { - protected readonly Version installedVersion; - protected readonly ITracer tracer; - protected readonly PhysicalFileSystem fileSystem; - - protected bool noVerify; - protected bool dryRun; - protected ProductUpgraderPlatformStrategy productUpgraderPlatformStrategy; - - protected ProductUpgrader( - string currentVersion, - ITracer tracer, - bool dryRun, - bool noVerify, - PhysicalFileSystem fileSystem) - : this( - currentVersion, - tracer, - dryRun, - noVerify, - fileSystem, - GVFSPlatform.Instance.CreateProductUpgraderPlatformInteractions(fileSystem, tracer)) - { - } - - protected ProductUpgrader( - string currentVersion, - ITracer tracer, - bool dryRun, - bool noVerify, - PhysicalFileSystem fileSystem, - ProductUpgraderPlatformStrategy productUpgraderPlatformStrategy) - { - this.installedVersion = new Version(currentVersion); - this.dryRun = dryRun; - this.noVerify = noVerify; - this.tracer = tracer; - this.fileSystem = fileSystem; - this.productUpgraderPlatformStrategy = productUpgraderPlatformStrategy; - } - - /// - /// For mocking purposes only - /// - protected ProductUpgrader() - { - } - - public abstract bool SupportsAnonymousVersionQuery { get; } - - public string UpgradeInstanceId { get; set; } = DateTime.Now.ToString("yyyyMMdd_HHmmss"); - - public static bool TryCreateUpgrader( - ITracer tracer, - PhysicalFileSystem fileSystem, - LocalGVFSConfig gvfsConfig, - ICredentialStore credentialStore, - bool dryRun, - bool noVerify, - out ProductUpgrader newUpgrader, - out string error) - { - Dictionary entries; - if (!gvfsConfig.TryGetAllConfig(out entries, out error)) - { - newUpgrader = null; - return false; - } - - bool containsUpgradeFeedUrl = entries.ContainsKey(GVFSConstants.LocalGVFSConfig.UpgradeFeedUrl); - bool containsUpgradePackageName = entries.ContainsKey(GVFSConstants.LocalGVFSConfig.UpgradeFeedPackageName); - bool containsOrgInfoServerUrl = entries.ContainsKey(GVFSConstants.LocalGVFSConfig.OrgInfoServerUrl); - - if (containsUpgradeFeedUrl || containsUpgradePackageName) - { - // We are configured for NuGet - determine if we are using OrgNuGetUpgrader or not - if (containsOrgInfoServerUrl) - { - if (OrgNuGetUpgrader.TryCreate( - tracer, - fileSystem, - gvfsConfig, - new HttpClient(), - credentialStore, - dryRun, - noVerify, - out OrgNuGetUpgrader orgNuGetUpgrader, - out error)) - { - // We were successfully able to load a NuGetUpgrader - use that. - newUpgrader = orgNuGetUpgrader; - return true; - } - else - { - tracer.RelatedError($"{nameof(TryCreateUpgrader)}: Could not create organization based upgrader. {error}"); - newUpgrader = null; - return false; - } - } - else - { - if (NuGetUpgrader.TryCreate( - tracer, - fileSystem, - gvfsConfig, - credentialStore, - dryRun, - noVerify, - out NuGetUpgrader nuGetUpgrader, - out bool isConfigured, - out error)) - { - // We were successfully able to load a NuGetUpgrader - use that. - newUpgrader = nuGetUpgrader; - return true; - } - else - { - tracer.RelatedError($"{nameof(TryCreateUpgrader)}: Could not create NuGet based upgrader. {error}"); - newUpgrader = null; - return false; - } - } - } - else - { - newUpgrader = GitHubUpgrader.Create(tracer, fileSystem, gvfsConfig, dryRun, noVerify, out error); - if (newUpgrader == null) - { - tracer.RelatedError($"{nameof(TryCreateUpgrader)}: Could not create GitHub based upgrader. {error}"); - return false; - } - - return true; - } - } - - public abstract bool UpgradeAllowed(out string message); - - public abstract bool TryQueryNewestVersion(out Version newVersion, out string message); - - public abstract bool TryDownloadNewestVersion(out string errorMessage); - - public abstract bool TryRunInstaller(InstallActionWrapper installActionWrapper, out string error); - - public virtual bool TrySetupUpgradeApplicationDirectory(out string upgradeApplicationPath, out string error) - { - string upgradeApplicationDirectory = ProductUpgraderInfo.GetUpgradeApplicationDirectory(); - - if (!this.productUpgraderPlatformStrategy.TryPrepareApplicationDirectory(out error)) - { - upgradeApplicationPath = null; - return false; - } - - string currentPath = ProcessHelper.GetCurrentProcessLocation(); - error = null; - try - { - // Copying C:\Program Files\GVFS to inside of C:\Program Files\GVFS\ProgramData\GVFS.Upgrade\Tools - // directory causes a cycle(at some point we start copying C:\Program Files\GVFS\ProgramData\GVFS.Upgrade - // and its contents into C:\Program Files\GVFS\ProgramData\GVFS.Upgrade\Tools). The exclusion below is - // added to avoid this loop. - HashSet directoriesToExclude = new HashSet(GVFSPlatform.Instance.Constants.PathComparer); - - string secureDataRoot = GVFSPlatform.Instance.GetSecureDataRootForGVFS(); - directoriesToExclude.Add(secureDataRoot); - directoriesToExclude.Add(upgradeApplicationDirectory); - - this.tracer.RelatedInfo($"Copying contents of '{currentPath}' to '{upgradeApplicationDirectory}'," - + $"excluding '{upgradeApplicationDirectory}' and '{secureDataRoot}'"); - - this.fileSystem.CopyDirectoryRecursive(currentPath, upgradeApplicationDirectory, directoriesToExclude); - } - catch (UnauthorizedAccessException e) - { - error = string.Join( - Environment.NewLine, - "File copy error - " + e.Message, - $"Make sure you have write permissions to directory {upgradeApplicationDirectory} and run {GVFSPlatform.Instance.Constants.UpgradeConfirmCommandMessage} again."); - } - catch (IOException e) - { - error = "File copy error - " + e.Message; - this.TraceException(e, nameof(this.TrySetupUpgradeApplicationDirectory), $"Error copying {currentPath} to {upgradeApplicationDirectory}."); - } - - if (string.IsNullOrEmpty(error)) - { - // There was no error - set upgradeToolPath and return success. - upgradeApplicationPath = Path.Combine( - upgradeApplicationDirectory, - GVFSPlatform.Instance.Constants.GVFSUpgraderExecutableName); - return true; - } - else - { - // Encountered error - do not set upgrade tool path and return failure. - upgradeApplicationPath = null; - return false; - } - } - - public abstract bool TryCleanup(out string error); - - public void TraceException(Exception exception, string method, string message) - { - this.TraceException(this.tracer, exception, method, message); - } - - public void TraceException(ITracer tracer, Exception exception, string method, string message) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Method", method); - metadata.Add("Exception", exception.ToString()); - tracer.RelatedError(metadata, message); - } - - public virtual void Dispose() - { - } - - protected virtual bool TryCreateAndConfigureDownloadDirectory(ITracer tracer, out string error) - { - return this.productUpgraderPlatformStrategy.TryPrepareDownloadDirectory(out error); - } - - protected virtual void RunInstaller(string path, string args, out int exitCode, out string error) - { - ProcessResult processResult = ProcessHelper.Run(path, args); - - exitCode = processResult.ExitCode; - error = processResult.Errors; - } - } -} diff --git a/GVFS/GVFS.Common/ProductUpgraderInfo.Shared.cs b/GVFS/GVFS.Common/ProductUpgraderInfo.Shared.cs deleted file mode 100644 index 9a8fd367e4..0000000000 --- a/GVFS/GVFS.Common/ProductUpgraderInfo.Shared.cs +++ /dev/null @@ -1,59 +0,0 @@ -using GVFS.Common.Tracing; -using System; -using System.IO; - -namespace GVFS.Common -{ - public partial class ProductUpgraderInfo - { - public const string UpgradeDirectoryName = "GVFS.Upgrade"; - public const string LogDirectory = "UpgraderLogs"; - public const string DownloadDirectory = "Downloads"; - - /// - /// This is the name of the directory that the Upgrader Application is copied to - /// when running upgrade. It is called "Tools", as this is what the directory was - /// originally named, but has since been renamed in code to be more descriptive. - /// - public const string ApplicationDirectory = "Tools"; - public const string HighestAvailableVersionFileName = "HighestAvailableVersion"; - - public static bool IsLocalUpgradeAvailable(ITracer tracer, string highestAvailableVersionDirectory) - { - try - { - return File.Exists(GetHighestAvailableVersionFilePath(highestAvailableVersionDirectory)); - } - catch (Exception ex) when ( - ex is IOException || - ex is UnauthorizedAccessException || - ex is NotSupportedException) - { - if (tracer != null) - { - tracer.RelatedError( - CreateEventMetadata(ex), - "Exception encountered when determining if an upgrade is available."); - } - } - - return false; - } - - private static string GetHighestAvailableVersionFilePath(string highestAvailableVersionDirectory) - { - return Path.Combine(highestAvailableVersionDirectory, HighestAvailableVersionFileName); - } - - private static EventMetadata CreateEventMetadata(Exception e) - { - EventMetadata metadata = new EventMetadata(); - if (e != null) - { - metadata.Add("Exception", e.ToString()); - } - - return metadata; - } - } -} diff --git a/GVFS/GVFS.Common/ProductUpgraderInfo.cs b/GVFS/GVFS.Common/ProductUpgraderInfo.cs deleted file mode 100644 index ed097c733a..0000000000 --- a/GVFS/GVFS.Common/ProductUpgraderInfo.cs +++ /dev/null @@ -1,102 +0,0 @@ -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System; -using System.IO; - -namespace GVFS.Common -{ - public partial class ProductUpgraderInfo - { - private ITracer tracer; - private PhysicalFileSystem fileSystem; - - public ProductUpgraderInfo(ITracer tracer, PhysicalFileSystem fileSystem) - { - this.tracer = tracer; - this.fileSystem = fileSystem; - } - - public static string CurrentGVFSVersion() - { - return ProcessHelper.GetCurrentProcessVersion(); - } - - public static string GetUpgradeProtectedDataDirectory() - { - return GVFSPlatform.Instance.GetUpgradeProtectedDataDirectory(); - } - - public static string GetUpgradeApplicationDirectory() - { - return Path.Combine( - GetUpgradeProtectedDataDirectory(), - ProductUpgraderInfo.ApplicationDirectory); - } - - public static string GetParentLogDirectoryPath() - { - return GVFSPlatform.Instance.GetUpgradeLogDirectoryParentDirectory(); - } - - public static string GetLogDirectoryPath() - { - return Path.Combine( - GVFSPlatform.Instance.GetUpgradeLogDirectoryParentDirectory(), - ProductUpgraderInfo.LogDirectory); - } - - public static string GetAssetDownloadsPath() - { - return Path.Combine( - GVFSPlatform.Instance.GetUpgradeProtectedDataDirectory(), - ProductUpgraderInfo.DownloadDirectory); - } - - public static string GetHighestAvailableVersionDirectory() - { - return GVFSPlatform.Instance.GetUpgradeHighestAvailableVersionDirectory(); - } - - public void DeleteAllInstallerDownloads() - { - try - { - this.fileSystem.DeleteDirectory(GetAssetDownloadsPath()); - } - catch (Exception ex) - { - if (this.tracer != null) - { - this.tracer.RelatedError($"{nameof(this.DeleteAllInstallerDownloads)}: Could not remove directory: {ProductUpgraderInfo.GetAssetDownloadsPath()}.{ex.ToString()}"); - } - } - } - - public void RecordHighestAvailableVersion(Version highestAvailableVersion) - { - string highestAvailableVersionFile = GetHighestAvailableVersionFilePath(GetHighestAvailableVersionDirectory()); - - if (highestAvailableVersion == null) - { - if (this.fileSystem.FileExists(highestAvailableVersionFile)) - { - this.fileSystem.DeleteFile(highestAvailableVersionFile); - - if (this.tracer != null) - { - this.tracer.RelatedInfo($"{nameof(this.RecordHighestAvailableVersion)}: Deleted upgrade reminder marker file"); - } - } - } - else - { - this.fileSystem.WriteAllText(highestAvailableVersionFile, highestAvailableVersion.ToString()); - - if (this.tracer != null) - { - this.tracer.RelatedInfo($"{nameof(this.RecordHighestAvailableVersion)}: Created upgrade reminder marker file"); - } - } - } - } -} diff --git a/GVFS/GVFS.Common/ProductUpgraderPlatformStrategy.cs b/GVFS/GVFS.Common/ProductUpgraderPlatformStrategy.cs deleted file mode 100644 index 776adeaa84..0000000000 --- a/GVFS/GVFS.Common/ProductUpgraderPlatformStrategy.cs +++ /dev/null @@ -1,38 +0,0 @@ -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System; -using System.IO; - -namespace GVFS.Common -{ - public abstract class ProductUpgraderPlatformStrategy - { - public ProductUpgraderPlatformStrategy(PhysicalFileSystem fileSystem, ITracer tracer) - { - this.FileSystem = fileSystem; - this.Tracer = tracer; - } - - protected PhysicalFileSystem FileSystem { get; } - protected ITracer Tracer { get; } - - public abstract bool TryPrepareLogDirectory(out string error); - - public abstract bool TryPrepareApplicationDirectory(out string error); - - public abstract bool TryPrepareDownloadDirectory(out string error); - - protected void TraceException(Exception exception, string method, string message) - { - this.TraceException(this.Tracer, exception, method, message); - } - - protected void TraceException(ITracer tracer, Exception exception, string method, string message) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Method", method); - metadata.Add("Exception", exception.ToString()); - tracer.RelatedError(metadata, message); - } - } -} diff --git a/GVFS/GVFS.Common/Properties/AssemblyInfo.cs b/GVFS/GVFS.Common/Properties/AssemblyInfo.cs deleted file mode 100644 index 6acb6e0e51..0000000000 --- a/GVFS/GVFS.Common/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.Common")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Common")] -[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("9ea6ff63-6bb0-4440-9bfb-0ae79a8f9ba9")] diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/App.config b/GVFS/GVFS.FunctionalTests.LockHolder/App.config deleted file mode 100644 index 00bfd114af..0000000000 --- a/GVFS/GVFS.FunctionalTests.LockHolder/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj b/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj index 837fd98698..9a1615fbf3 100644 --- a/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj +++ b/GVFS/GVFS.FunctionalTests.LockHolder/GVFS.FunctionalTests.LockHolder.csproj @@ -1,42 +1,18 @@  - + + net461 Exe - netcoreapp2.1 - x64 - - true - true - win-x64;osx-x64 - - - - GVFS.FunctionalTests.LockHolder - GVFS.FunctionalTests.LockHolder - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - + - + - - - - - - - all - + + + diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/Properties/AssemblyInfo.cs b/GVFS/GVFS.FunctionalTests.LockHolder/Properties/AssemblyInfo.cs deleted file mode 100644 index 80fc7a26a1..0000000000 --- a/GVFS/GVFS.FunctionalTests.LockHolder/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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.FunctionalTests.LockHolder")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.FunctionalTests.LockHolder")] -[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("fa273f69-5762-43d8-aea1-b4f08090d624")] diff --git a/GVFS/GVFS.FunctionalTests.LockHolder/packages.config b/GVFS/GVFS.FunctionalTests.LockHolder/packages.config deleted file mode 100644 index 4dfb30949a..0000000000 --- a/GVFS/GVFS.FunctionalTests.LockHolder/packages.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.FunctionalTests.Windows/GVFS.FunctionalTests.Windows.csproj b/GVFS/GVFS.FunctionalTests.Windows/GVFS.FunctionalTests.Windows.csproj deleted file mode 100644 index 3f69c0d626..0000000000 --- a/GVFS/GVFS.FunctionalTests.Windows/GVFS.FunctionalTests.Windows.csproj +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - {0F0A008E-AB12-40EC-A671-37A541B08C7F} - Exe - Properties - GVFS.FunctionalTests.Windows - GVFS.FunctionalTests.Windows - v4.6.1 - 512 - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - true - - - - - true - DEBUG;TRACE - full - x64 - prompt - - - TRACE - true - pdbonly - x64 - prompt - - - GVFS.FunctionalTests.Program - - - Always - - - - False - ..\..\..\packages\Microsoft.Database.Collections.Generic.1.9.4\lib\net40\Esent.Collections.dll - True - - - False - ..\..\..\packages\ManagedEsent.1.9.4\lib\net40\Esent.Interop.dll - True - - - False - ..\..\..\packages\Microsoft.Database.Isam.1.9.4\lib\net40\Esent.Isam.dll - True - - - ..\..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - False - ..\..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - False - ..\..\..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll - True - - - ..\..\..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll - - - ..\..\..\packages\NUnitLite.3.12.0\lib\net45\nunitlite.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - NetCore\%(RecursiveDir)\%(Filename)%(Extension) - - - - - - - - {72701BC3-5DA9-4C7A-BF10-9E98C9FC8EAC} - GVFS.Tests - - - - - - - - - - - False - - - False - - - False - - - False - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - xcopy /Y $(BuildOutputDir)\GVFS.Windows\bin\$(Platform)\$(Configuration)\* $(TargetDir) - xcopy /Y $(BuildOutputDir)\GVFS.Windows\bin\$(Platform)\$(Configuration)\$(Platform)\* $(TargetDir) - xcopy /Y $(BuildOutputDir)\GVFS.Service.Windows\bin\$(Platform)\$(Configuration)\* $(TargetDir) - xcopy /Y $(BuildOutputDir)\GVFS.Mount.Windows\bin\$(Platform)\$(Configuration)\* $(TargetDir) - xcopy /Y $(BuildOutputDir)\GVFS.NativeTests\bin\$(Platform)\$(Configuration)\* $(TargetDir) - xcopy /Y $(BuildOutputDir)\GVFS.Hooks.Windows\bin\$(Platform)\$(Configuration)\* $(TargetDir) - mkdir $(TargetDir)\netcoreapp2.1 - xcopy /Y $(BuildOutputDir)\FastFetch\bin\$(Platform)\$(Configuration)\netcoreapp2.1\* $(TargetDir)\netcoreapp2.1 - xcopy /Y $(BuildOutputDir)\GVFS.FunctionalTests.LockHolder\bin\$(Platform)\$(Configuration)\netcoreapp2.1\* $(TargetDir)\netcoreapp2.1 - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.FunctionalTests.Windows/Properties/AssemblyInfo.cs b/GVFS/GVFS.FunctionalTests.Windows/Properties/AssemblyInfo.cs deleted file mode 100644 index 313350adff..0000000000 --- a/GVFS/GVFS.FunctionalTests.Windows/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -using NUnit.Framework; -using System.Reflection; -using System.Runtime.CompilerServices; -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.FunctionalTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.FunctionalTests")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2015")] -[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("0f0a008e-ab12-40ec-a671-37a541b08c7f")] diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epc.log b/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epc.log deleted file mode 100644 index 0b2ef2f5a3..0000000000 Binary files a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epc.log and /dev/null differ diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epctmp.log b/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epctmp.log deleted file mode 100644 index 9e0f96a2a2..0000000000 Binary files a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epctmp.log and /dev/null differ diff --git a/GVFS/GVFS.FunctionalTests.Windows/packages.config b/GVFS/GVFS.FunctionalTests.Windows/packages.config deleted file mode 100644 index 066c75f4e0..0000000000 --- a/GVFS/GVFS.FunctionalTests.Windows/packages.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.FunctionalTests/Categories.cs b/GVFS/GVFS.FunctionalTests/Categories.cs index 613938c57c..7a55e9b687 100644 --- a/GVFS/GVFS.FunctionalTests/Categories.cs +++ b/GVFS/GVFS.FunctionalTests/Categories.cs @@ -5,30 +5,6 @@ public static class Categories public const string ExtraCoverage = "ExtraCoverage"; public const string FastFetch = "FastFetch"; public const string GitCommands = "GitCommands"; - - // Linux uses a separate device mount for its repository, and so is unable to rename(2) inodes - // in or out of the repository filesystem; attempts to do so fail with errno set to EXDEV. - // Therefore, tests which move files or directories across the repository boundary should - // be flagged with this category so they will be excluded on Linux. - public const string RepositoryMountsSameFileSystem = "RepositoryMountsSameFileSystem"; - - public const string WindowsOnly = "WindowsOnly"; - public const string MacOnly = "MacOnly"; - public const string POSIXOnly = "POSIXOnly"; - - public static class MacTODO - { - // Tests that require #360 (detecting/handling new empty folders) - public const string NeedsNewFolderCreateNotification = "NeedsNewFolderCreateNotification"; - - // Tests that require the Status Cache to be built - public const string NeedsStatusCache = "NeedsStatusCache"; - - // Tests that require Config to be built - public const string NeedsGVFSConfig = "NeedsConfig"; - - // Tests requires code updates so that we lock the file instead of looking for a .lock file - public const string TestNeedsToLockFile = "TestNeedsToLockFile"; - } + public const string NeedsReactionInCI = "NeedsReactionInCI"; } } diff --git a/GVFS/GVFS.FunctionalTests/FileSystemRunners/BashRunner.cs b/GVFS/GVFS.FunctionalTests/FileSystemRunners/BashRunner.cs index d3456d0da7..e0d75f013f 100644 --- a/GVFS/GVFS.FunctionalTests/FileSystemRunners/BashRunner.cs +++ b/GVFS/GVFS.FunctionalTests/FileSystemRunners/BashRunner.cs @@ -299,15 +299,7 @@ public override long FileSize(string path) { string bashPath = this.ConvertWinPathToBashPath(path); - string statCommand = null; - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - statCommand = string.Format("-c \"stat -f \"%z\" '{0}'\"", bashPath); - } - else - { - statCommand = string.Format("-c \"stat --format \"%s\" '{0}'\"", bashPath); - } + string statCommand = string.Format("-c \"stat --format \"%s\" '{0}'\"", bashPath); return long.Parse(this.RunProcess(statCommand)); } diff --git a/GVFS/GVFS.FunctionalTests/GVFS.FunctionalTests.csproj b/GVFS/GVFS.FunctionalTests/GVFS.FunctionalTests.csproj index 06ee65c93c..eb0a937ccb 100644 --- a/GVFS/GVFS.FunctionalTests/GVFS.FunctionalTests.csproj +++ b/GVFS/GVFS.FunctionalTests/GVFS.FunctionalTests.csproj @@ -1,54 +1,37 @@ - - - - Exe - netcoreapp2.1 - x64 - - true - true - win-x64;osx-x64 - + - GVFS.FunctionalTests - GVFS.FunctionalTests - - - $(GVFSVersion) - - - $(GVFSVersion) + net461 + Exe + + + - - - all - + + + false + Content + PreserveNewest + + + false + + + PreserveNewest + + + PreserveNewest + - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.FunctionalTests/GVFSTestConfig.cs b/GVFS/GVFS.FunctionalTests/GVFSTestConfig.cs index 52c8ffb7f0..aee3f2df82 100644 --- a/GVFS/GVFS.FunctionalTests/GVFSTestConfig.cs +++ b/GVFS/GVFS.FunctionalTests/GVFSTestConfig.cs @@ -14,18 +14,13 @@ public static class GVFSTestConfig public static object[] GitRepoTestsValidateWorkTree { get; set; } - public static bool TestGVFSOnPath { get; set; } - public static bool ReplaceInboxProjFS { get; set; } public static string PathToGVFS { get { - return - TestGVFSOnPath ? - Properties.Settings.Default.PathToGVFS : - Path.Combine(Properties.Settings.Default.CurrentDirectory, Properties.Settings.Default.PathToGVFS); + return Properties.Settings.Default.PathToGVFS; } } diff --git a/GVFS/GVFS.FunctionalTests/Program.cs b/GVFS/GVFS.FunctionalTests/Program.cs index 07aa380151..276a7d7011 100644 --- a/GVFS/GVFS.FunctionalTests/Program.cs +++ b/GVFS/GVFS.FunctionalTests/Program.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Runtime.InteropServices; namespace GVFS.FunctionalTests { @@ -14,6 +13,11 @@ public class Program public static void Main(string[] args) { Properties.Settings.Default.Initialize(); + Console.WriteLine("Settings.Default.CurrentDirectory: {0}", Settings.Default.CurrentDirectory); + Console.WriteLine("Settings.Default.PathToGit: {0}", Settings.Default.PathToGit); + Console.WriteLine("Settings.Default.PathToGVFS: {0}", Settings.Default.PathToGVFS); + Console.WriteLine("Settings.Default.PathToGVFSService: {0}", Settings.Default.PathToGVFSService); + NUnitRunner runner = new NUnitRunner(args); runner.AddGlobalSetupIfNeeded("GVFS.FunctionalTests.GlobalSetup"); @@ -23,12 +27,6 @@ public static void Main(string[] args) GVFSTestConfig.NoSharedCache = true; } - if (runner.HasCustomArg("--test-gvfs-on-path")) - { - Console.WriteLine("Running tests against GVFS on path"); - GVFSTestConfig.TestGVFSOnPath = true; - } - if (runner.HasCustomArg("--replace-inbox-projfs")) { Console.WriteLine("Tests will replace inbox ProjFS"); @@ -51,15 +49,7 @@ public static void Main(string[] args) } GVFSTestConfig.GitRepoTestsValidateWorkTree = modes.ToArray(); - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.AllWindowsRunners; - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.AllMacRunners; - } + GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.AllWindowsRunners; } else { @@ -89,34 +79,17 @@ public static void Main(string[] args) excludeCategories.Add(Categories.ExtraCoverage); } - GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.DefaultRunners; - } - - if (runner.HasCustomArg("--windows-only")) - { - includeCategories.Add(Categories.WindowsOnly); - - // RunTests unions all includeCategories. Remove ExtraCoverage to - // ensure that we only run tests flagged as WindowsOnly - includeCategories.Remove(Categories.ExtraCoverage); - } + // If we're running in CI exclude tests that are currently + // flakey or broken when run in a CI environment. + if (runner.HasCustomArg("--ci")) + { + excludeCategories.Add(Categories.NeedsReactionInCI); + } - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - excludeCategories.Add(Categories.MacTODO.NeedsNewFolderCreateNotification); - excludeCategories.Add(Categories.MacTODO.NeedsGVFSConfig); - excludeCategories.Add(Categories.MacTODO.NeedsStatusCache); - excludeCategories.Add(Categories.MacTODO.TestNeedsToLockFile); - excludeCategories.Add(Categories.WindowsOnly); - } - else - { - // Windows excludes. - excludeCategories.Add(Categories.MacOnly); - excludeCategories.Add(Categories.POSIXOnly); + GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.DefaultRunners; } - GVFSTestConfig.DotGVFSRoot = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? ".vfsforgit" : ".gvfs"; + GVFSTestConfig.DotGVFSRoot = ".gvfs"; GVFSTestConfig.RepoToClone = runner.GetCustomArgWithParam("--repo-to-clone") @@ -134,26 +107,26 @@ public static void Main(string[] args) private static void RunBeforeAnyTests() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + if (GVFSTestConfig.ReplaceInboxProjFS) { - if (GVFSTestConfig.ReplaceInboxProjFS) - { - ProjFSFilterInstaller.ReplaceInboxProjFS(); - } + ProjFSFilterInstaller.ReplaceInboxProjFS(); + } - GVFSServiceProcess.InstallService(); + GVFSServiceProcess.InstallService(); - string statusCacheVersionTokenPath = Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.Create), - "GVFS", - "ProgramData", - "GVFS.Service", - "EnableGitStatusCacheToken.dat"); + string serviceProgramDataDir = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.Create), + "GVFS", + "ProgramData", + "GVFS.Service"); - if (!File.Exists(statusCacheVersionTokenPath)) - { - File.WriteAllText(statusCacheVersionTokenPath, string.Empty); - } + string statusCacheVersionTokenPath = Path.Combine( + serviceProgramDataDir, "EnableGitStatusCacheToken.dat"); + + if (!File.Exists(statusCacheVersionTokenPath)) + { + Directory.CreateDirectory(serviceProgramDataDir); + File.WriteAllText(statusCacheVersionTokenPath, string.Empty); } } } diff --git a/GVFS/GVFS.FunctionalTests/Settings.cs b/GVFS/GVFS.FunctionalTests/Settings.cs index 953d09f765..a2b2871632 100644 --- a/GVFS/GVFS.FunctionalTests/Settings.cs +++ b/GVFS/GVFS.FunctionalTests/Settings.cs @@ -32,7 +32,8 @@ public static class Default public static void Initialize() { - CurrentDirectory = Path.GetFullPath(Path.GetDirectoryName(Environment.GetCommandLineArgs()[0])); + string testExec = System.Reflection.Assembly.GetEntryAssembly().Location; + CurrentDirectory = Path.GetFullPath(Path.GetDirectoryName(testExec)); RepoToClone = @"https://gvfs.visualstudio.com/ci/_git/ForTests"; @@ -43,35 +44,17 @@ public static void Initialize() // ProjFS is fixed and deployed to our build machines. Commitish = @"FunctionalTests/20201014"; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - EnlistmentRoot = @"C:\Repos\GVFSFunctionalTests\enlistment"; - PathToGVFS = @"GVFS.exe"; - PathToGit = @"C:\Program Files\Git\cmd\git.exe"; - PathToBash = @"C:\Program Files\Git\bin\bash.exe"; - - ControlGitRepoRoot = @"C:\Repos\GVFSFunctionalTests\ControlRepo"; - FastFetchBaseRoot = @"C:\Repos\GVFSFunctionalTests\FastFetch"; - FastFetchRoot = Path.Combine(FastFetchBaseRoot, "test"); - FastFetchControl = Path.Combine(FastFetchBaseRoot, "control"); - PathToGVFSService = @"GVFS.Service.exe"; - BinaryFileNameExtension = ".exe"; - } - else - { - string root = Path.Combine( - Environment.GetEnvironmentVariable("HOME"), - "GVFS.FT"); - EnlistmentRoot = Path.Combine(root, "test"); - ControlGitRepoRoot = Path.Combine(root, "control"); - FastFetchBaseRoot = Path.Combine(root, "FastFetch"); - FastFetchRoot = Path.Combine(FastFetchBaseRoot, "test"); - FastFetchControl = Path.Combine(FastFetchBaseRoot, "control"); - PathToGVFS = "gvfs"; - PathToGit = "/usr/local/bin/git"; - PathToBash = "/bin/bash"; - BinaryFileNameExtension = string.Empty; - } + EnlistmentRoot = @"C:\Repos\GVFSFunctionalTests\enlistment"; + PathToGVFS = @"C:\Program Files\GVFS\GVFS.exe"; + PathToGit = @"C:\Program Files\Git\cmd\git.exe"; + PathToBash = @"C:\Program Files\Git\bin\bash.exe"; + + ControlGitRepoRoot = @"C:\Repos\GVFSFunctionalTests\ControlRepo"; + FastFetchBaseRoot = @"C:\Repos\GVFSFunctionalTests\FastFetch"; + FastFetchRoot = Path.Combine(FastFetchBaseRoot, "test"); + FastFetchControl = Path.Combine(FastFetchBaseRoot, "control"); + PathToGVFSService = @"C:\Program Files\GVFS\GVFS.Service.exe"; + BinaryFileNameExtension = ".exe"; } } } diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/BasicFileSystemTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/BasicFileSystemTests.cs index 57f491c9fc..1a8925ed1b 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/BasicFileSystemTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/BasicFileSystemTests.cs @@ -81,7 +81,6 @@ public void FilesAreBufferedAndCanBeFlushed(FileSystemRunner fileSystem, string } [TestCaseSource(typeof(FileRunnersAndFolders), nameof(FileRunnersAndFolders.Folders))] - [Category(Categories.WindowsOnly)] public void NewFileAttributesAreUpdated(string parentFolder) { string filename = Path.Combine(parentFolder, "FileAttributesAreUpdated"); @@ -109,7 +108,6 @@ public void NewFileAttributesAreUpdated(string parentFolder) } [TestCaseSource(typeof(FileRunnersAndFolders), nameof(FileRunnersAndFolders.Folders))] - [Category(Categories.WindowsOnly)] public void NewFolderAttributesAreUpdated(string parentFolder) { string folderName = Path.Combine(parentFolder, "FolderAttributesAreUpdated"); @@ -136,7 +134,6 @@ public void NewFolderAttributesAreUpdated(string parentFolder) } [TestCase] - [Category(Categories.WindowsOnly)] public void ExpandedFileAttributesAreUpdated() { FileSystemRunner fileSystem = FileSystemRunner.DefaultRunner; @@ -182,7 +179,6 @@ public void ExpandedFileAttributesAreUpdated() } [TestCase] - [Category(Categories.WindowsOnly)] public void UnhydratedFolderAttributesAreUpdated() { FileSystemRunner fileSystem = FileSystemRunner.DefaultRunner; @@ -509,10 +505,7 @@ public void CanDeleteHydratedFilesWhileTheyAreOpenForWrite() virtualPath.ShouldNotExistOnDisk(fileSystem); } - // WindowsOnly because file timestamps on Mac are set to the time at which - // placeholders are written [TestCase] - [Category(Categories.WindowsOnly)] public void ProjectedBlobFileTimesMatchHead() { // TODO: 467539 - Update all runners to support getting create/modify/access times @@ -536,7 +529,6 @@ public void ProjectedBlobFileTimesMatchHead() } [TestCase] - [Category(Categories.WindowsOnly)] public void ProjectedBlobFolderTimesMatchHead() { // TODO: 467539 - Update all runners to support getting create/modify/access times @@ -814,23 +806,6 @@ public void DeleteIndexFileFails(FileSystemRunner fileSystem) indexFilePath.ShouldBeAFile(fileSystem); } - // On some platforms, a pre-rename event may be delivered prior to a - // file rename rather than a pre-delete event, so we check this - // separately from the DeleteIndexFileFails() test case - // This test is failing on Windows because the CmdRunner succeeds in moving the index file - [TestCaseSource(typeof(FileSystemRunner), nameof(FileSystemRunner.Runners))] - [Category(Categories.POSIXOnly)] - public void MoveIndexFileFails(FileSystemRunner fileSystem) - { - string indexFilePath = this.Enlistment.GetVirtualPathTo(Path.Combine(".git", "index")); - string indexTargetFilePath = this.Enlistment.GetVirtualPathTo(Path.Combine(".git", "index_target")); - indexFilePath.ShouldBeAFile(fileSystem); - indexTargetFilePath.ShouldNotExistOnDisk(fileSystem); - fileSystem.ReplaceFile_AccessShouldBeDenied(indexFilePath, indexTargetFilePath); - indexFilePath.ShouldBeAFile(fileSystem); - indexTargetFilePath.ShouldNotExistOnDisk(fileSystem); - } - [TestCaseSource(typeof(FileRunnersAndFolders), nameof(FileRunnersAndFolders.Runners))] public void MoveVirtualNTFSFolderIntoInvalidFolder(FileSystemRunner fileSystem, string parentFolder) { @@ -880,7 +855,6 @@ public void MoveVirtualNTFSFolderIntoInvalidFolder(FileSystemRunner fileSystem, } [TestCaseSource(typeof(FileRunnersAndFolders), nameof(FileRunnersAndFolders.Folders))] - [Category(Categories.WindowsOnly)] public void CreateFileInheritsParentDirectoryAttributes(string parentFolder) { string parentDirectoryPath = this.Enlistment.GetVirtualPathTo(Path.Combine(parentFolder, "CreateFileInheritsParentDirectoryAttributes")); @@ -897,7 +871,6 @@ public void CreateFileInheritsParentDirectoryAttributes(string parentFolder) } [TestCaseSource(typeof(FileRunnersAndFolders), nameof(FileRunnersAndFolders.Folders))] - [Category(Categories.WindowsOnly)] public void CreateDirectoryInheritsParentDirectoryAttributes(string parentFolder) { string parentDirectoryPath = this.Enlistment.GetVirtualPathTo(Path.Combine(parentFolder, "CreateDirectoryInheritsParentDirectoryAttributes")); @@ -913,30 +886,6 @@ public void CreateDirectoryInheritsParentDirectoryAttributes(string parentFolder FileSystemRunner.DefaultRunner.DeleteDirectory(parentDirectoryPath); } - [TestCase] - [Category(Categories.POSIXOnly)] - public void RunPythonExecutable() - { - GitProcess.Invoke(this.Enlistment.RepoRoot, "checkout FunctionalTests/PythonExecutable"); - - // Found an issue on Mac where running a python executable that is a placeholder, fails - // The fix was to always hydrate executables (no placeholders for this mode) - // To repro this issue in the C# framework the python executable must be run via a wrapper - string pythonDirectory = Path.Combine(this.Enlistment.RepoRoot, "Test_Executable"); - string pythonExecutable = Path.Combine(pythonDirectory, "python_wrapper.sh"); - - ProcessStartInfo startInfo = new ProcessStartInfo(pythonExecutable); - startInfo.RedirectStandardOutput = true; - startInfo.RedirectStandardError = true; - startInfo.WorkingDirectory = pythonDirectory; - - ProcessResult result = ProcessHelper.Run(startInfo); - result.ExitCode.ShouldEqual(0); - result.Output.ShouldContain("3.14"); - - GitProcess.Invoke(this.Enlistment.RepoRoot, "checkout " + this.Enlistment.Commitish); - } - private void VerifyExistenceAfterDeleteWhileOpen(string filePath, FileSystemRunner fileSystem) { if (this.SupportsPosixDelete()) diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs index d67ce5d56a..b554cfb591 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/CloneTests.cs @@ -3,7 +3,7 @@ using GVFS.FunctionalTests.Tools; using GVFS.Tests.Should; using NUnit.Framework; -using System; +using System; using System.Diagnostics; using System.IO; @@ -46,62 +46,30 @@ public void CloneWithLocalCachePathWithinSrc() result.Output.ShouldContain("'--local-cache-path' cannot be inside the src folder"); } - [TestCase] - [Category(Categories.POSIXOnly)] - public void CloneWithDefaultLocalCacheLocation() - { - FileSystemRunner fileSystem = FileSystemRunner.DefaultRunner; - string homeDirectory = Environment.GetEnvironmentVariable("HOME"); - homeDirectory.ShouldBeADirectory(fileSystem); - - string newEnlistmentRoot = GVFSFunctionalTestEnlistment.GetUniqueEnlistmentRoot(); - - ProcessStartInfo processInfo = new ProcessStartInfo(GVFSTestConfig.PathToGVFS); - processInfo.Arguments = $"clone {Properties.Settings.Default.RepoToClone} {newEnlistmentRoot} --no-mount --no-prefetch"; - processInfo.WindowStyle = ProcessWindowStyle.Hidden; - processInfo.CreateNoWindow = true; - processInfo.UseShellExecute = false; - processInfo.RedirectStandardOutput = true; - - ProcessResult result = ProcessHelper.Run(processInfo); - result.ExitCode.ShouldEqual(0, result.Errors); - - string dotGVFSRoot = Path.Combine(newEnlistmentRoot, GVFSTestConfig.DotGVFSRoot); - dotGVFSRoot.ShouldBeADirectory(fileSystem); - string localCacheRoot = GVFSHelpers.GetPersistedLocalCacheRoot(dotGVFSRoot); - string gitObjectsRoot = GVFSHelpers.GetPersistedGitObjectsRoot(dotGVFSRoot); - - string defaultGVFSCacheRoot = Path.Combine(homeDirectory, ".gvfsCache"); - localCacheRoot.StartsWith(defaultGVFSCacheRoot, StringComparison.Ordinal).ShouldBeTrue($"Local cache root did not default to using {homeDirectory}"); - gitObjectsRoot.StartsWith(defaultGVFSCacheRoot, StringComparison.Ordinal).ShouldBeTrue($"Git objects root did not default to using {homeDirectory}"); - - RepositoryHelpers.DeleteTestDirectory(newEnlistmentRoot); - } - [TestCase] public void CloneToPathWithSpaces() { GVFSFunctionalTestEnlistment enlistment = GVFSFunctionalTestEnlistment.CloneAndMountEnlistmentWithSpacesInPath(GVFSTestConfig.PathToGVFS); enlistment.UnmountAndDeleteAll(); - } - + } + [TestCase] public void CloneCreatesCorrectFilesInRoot() { GVFSFunctionalTestEnlistment enlistment = GVFSFunctionalTestEnlistment.CloneAndMount(GVFSTestConfig.PathToGVFS); - try - { - string[] files = Directory.GetFiles(enlistment.EnlistmentRoot); - files.Length.ShouldEqual(1); - files.ShouldContain(x => Path.GetFileName(x).Equals("git.cmd", StringComparison.Ordinal)); - string[] directories = Directory.GetDirectories(enlistment.EnlistmentRoot); - directories.Length.ShouldEqual(2); - directories.ShouldContain(x => Path.GetFileName(x).Equals(GVFSTestConfig.DotGVFSRoot, StringComparison.Ordinal)); - directories.ShouldContain(x => Path.GetFileName(x).Equals("src", StringComparison.Ordinal)); + try + { + string[] files = Directory.GetFiles(enlistment.EnlistmentRoot); + files.Length.ShouldEqual(1); + files.ShouldContain(x => Path.GetFileName(x).Equals("git.cmd", StringComparison.Ordinal)); + string[] directories = Directory.GetDirectories(enlistment.EnlistmentRoot); + directories.Length.ShouldEqual(2); + directories.ShouldContain(x => Path.GetFileName(x).Equals(GVFSTestConfig.DotGVFSRoot, StringComparison.Ordinal)); + directories.ShouldContain(x => Path.GetFileName(x).Equals("src", StringComparison.Ordinal)); } finally - { - enlistment.UnmountAndDeleteAll(); + { + enlistment.UnmountAndDeleteAll(); } } diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs index ca9a4fe4d9..f896825fed 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/DehydrateTests.cs @@ -36,16 +36,7 @@ public void TearDown() string backupFolder = Path.Combine(this.Enlistment.EnlistmentRoot, "dehydrate_backup"); if (this.fileSystem.DirectoryExists(backupFolder)) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - // Mac gets permission denied when using the System.IO DeleteDirectory - BashRunner runner = new BashRunner(); - runner.DeleteDirectory(backupFolder); - } - else - { - this.fileSystem.DeleteDirectory(backupFolder); - } + this.fileSystem.DeleteDirectory(backupFolder); } if (!this.Enlistment.IsMounted()) @@ -271,7 +262,6 @@ public void FolderDehydrateFolderThatWasDeleted() } [TestCase] - [Category(Categories.WindowsOnly)] public void FolderDehydrateFolderThatIsLocked() { const string folderToDehydrate = "GVFS"; @@ -420,7 +410,7 @@ public void FolderDehydrateCannotDehydrateDotGitFolder() this.DehydrateShouldSucceed(new[] { $"Cannot dehydrate folder '{TestConstants.DotGit.Info.Root}': invalid folder path." }, confirm: true, noStatus: false, foldersToDehydrate: TestConstants.DotGit.Info.Root); } - [TestCase] + [TestCase] public void FolderDehydratePreviouslyDeletedFolders() { string folderToDehydrate = "TrailingSlashTests"; diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSLockTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSLockTests.cs index af3fe49ec6..7046231e5d 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSLockTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSLockTests.cs @@ -1,5 +1,5 @@ using GVFS.FunctionalTests.FileSystemRunners; -using GVFS.FunctionalTests.Properties; +using GVFS.FunctionalTests.Properties; using GVFS.FunctionalTests.Tools; using GVFS.Tests.Should; using NUnit.Framework; @@ -64,7 +64,6 @@ public void GitCheckoutFailsOutsideLock() } [TestCase] - [Category(Categories.RepositoryMountsSameFileSystem)] public void LockPreventsRenameFromOutsideRootOnTopOfIndex() { this.OverwritingIndexShouldFail(Path.Combine(this.Enlistment.EnlistmentRoot, "LockPreventsRenameFromOutsideRootOnTopOfIndex.txt")); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSUpgradeReminderTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSUpgradeReminderTests.cs index 909c402ac1..1801571128 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSUpgradeReminderTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GVFSUpgradeReminderTests.cs @@ -13,7 +13,6 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture [TestFixture] [NonParallelizable] [Category(Categories.ExtraCoverage)] - [Category(Categories.WindowsOnly)] public class UpgradeReminderTests : TestsWithEnlistmentPerFixture { private const string HighestAvailableVersionFileName = "HighestAvailableVersion"; diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs index 634e8e380b..50fc1e1ecc 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitFilesTests.cs @@ -332,9 +332,7 @@ public void OverwrittenFileAddedToModifiedPathsAndSkipWorktreeBitCleared() this.VerifyWorktreeBit(fileToOverwriteEntry, LsFilesStatus.Cached); } - // WindowsOnly because Mac does not support SupersedeFile [TestCase, Order(15)] - [Category(Categories.WindowsOnly)] public void SupersededFileAddedToModifiedPathsAndSkipWorktreeBitCleared() { string fileToSupersedeEntry = "GVFlt_FileOperationTest/WriteAndVerify.txt"; @@ -396,7 +394,6 @@ public void FileMovedFromInsideRepoToOutside() } [TestCase, Order(18)] - [Category(Categories.RepositoryMountsSameFileSystem)] public void HardlinkFromOutsideRepoToInside() { string fileName = "OutsideRepoToInside_FileForHardlink.txt"; @@ -416,7 +413,6 @@ public void HardlinkFromOutsideRepoToInside() } [TestCase, Order(19)] - [Category(Categories.RepositoryMountsSameFileSystem)] public void HardlinkFromInsideRepoToOutside() { string fileName = "Readme.md"; diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitMoveRenameTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitMoveRenameTests.cs index 6e2a21fb9d..b106876ec0 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitMoveRenameTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/GitMoveRenameTests.cs @@ -221,7 +221,6 @@ public void GitStatusAfterRenameFileOutOfRepo() } [TestCase, Order(11)] - [Category(Categories.RepositoryMountsSameFileSystem)] public void GitStatusAfterRenameFolderIntoRepo() { string folderName = "GitStatusAfterRenameFolderIntoRepo"; diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/HealthTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/HealthTests.cs index 605e2dcb17..d16cda74cc 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/HealthTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/HealthTests.cs @@ -11,7 +11,7 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture { - [TestFixture, Category(Categories.WindowsOnly)] + [TestFixture] public class HealthTests : TestsWithEnlistmentPerFixture { [TestCase, Order(0)] diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MountTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MountTests.cs index 72271b0b2f..40e9016ce4 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MountTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MountTests.cs @@ -30,16 +30,8 @@ public MountTests() { this.fileSystem = new SystemIORunner(); - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - this.fileDeletedBackgroundOperationCode = 16; - this.directoryDeletedBackgroundOperationCode = 17; - } - else - { - this.fileDeletedBackgroundOperationCode = 3; - this.directoryDeletedBackgroundOperationCode = 11; - } + this.fileDeletedBackgroundOperationCode = 3; + this.directoryDeletedBackgroundOperationCode = 11; } [TestCaseSource(typeof(MountSubfolders), MountSubfolders.MountFolders)] @@ -97,7 +89,6 @@ public void MountSetsCoreHooksPath() } [TestCase] - [Category(Categories.WindowsOnly)] // Only Windows uses GitHooksLoader.exe and merges hooks public void MountMergesLocalPrePostHooksConfig() { // Create some dummy pre/post command hooks @@ -379,7 +370,6 @@ public void MountFailsUpgradingFromInvalidUpgradePath(string mountSubfolder) // Ported from ProjFS's BugRegressionTest [TestCase] - [Category(Categories.WindowsOnly)] public void ProjFS_CMDHangNoneActiveInstance() { this.Enlistment.UnmountGVFS(); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MoveRenameFolderTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MoveRenameFolderTests.cs index 78316ef815..48656333cb 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MoveRenameFolderTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/MoveRenameFolderTests.cs @@ -40,9 +40,7 @@ public MoveRenameFolderTests(FileSystemRunner fileSystem) this.fileSystem = fileSystem; } - // WindowsOnly because renames of partial folders are blocked only on Windows [TestCase] - [Category(Categories.WindowsOnly)] public void RenameFolderShouldFail() { string testFileName = "RenameFolderShouldFail.cpp"; @@ -59,70 +57,6 @@ public void RenameFolderShouldFail() this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, testFileName)).ShouldBeAFile(this.fileSystem).WithContents(TestFileContents); } - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void ChangeUnhydratedFolderName() - { - string testFileName = "ChangeUnhydratedFolderName.cpp"; - string oldFolderName = Path.Combine("Test_EPF_MoveRenameFolderTests", "ChangeUnhydratedFolderName", "source"); - string newFolderName = Path.Combine("Test_EPF_MoveRenameFolderTests", "ChangeUnhydratedFolderName", "source_renamed"); - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldNotExistOnDisk(this.fileSystem); - - this.fileSystem.MoveDirectory(this.Enlistment.GetVirtualPathTo(oldFolderName), this.Enlistment.GetVirtualPathTo(newFolderName)); - - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldBeADirectory(this.fileSystem); - this.Enlistment.GetVirtualPathTo(oldFolderName).ShouldNotExistOnDisk(this.fileSystem); - - this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, testFileName)).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(newFolderName, testFileName)).ShouldBeAFile(this.fileSystem).WithContents(TestFileContents); - } - - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void MoveUnhydratedFolderToNewFolder() - { - string testFileName = "MoveUnhydratedFolderToVirtualNTFSFolder.cpp"; - string oldFolderName = Path.Combine("Test_EPF_MoveRenameFolderTests", "MoveUnhydratedFolderToVirtualNTFSFolder"); - - string newFolderName = "NewPerFixtureParent"; - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldNotExistOnDisk(this.fileSystem); - this.fileSystem.CreateDirectory(this.Enlistment.GetVirtualPathTo(newFolderName)); - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldBeADirectory(this.fileSystem); - - string movedFolderPath = Path.Combine(newFolderName, "EnlistmentPerFixture"); - this.fileSystem.MoveDirectory(this.Enlistment.GetVirtualPathTo(oldFolderName), this.Enlistment.GetVirtualPathTo(movedFolderPath)); - - this.Enlistment.GetVirtualPathTo(movedFolderPath).ShouldBeADirectory(this.fileSystem); - this.Enlistment.GetVirtualPathTo(oldFolderName).ShouldNotExistOnDisk(this.fileSystem); - - this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, testFileName)).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(movedFolderPath, testFileName)).ShouldBeAFile(this.fileSystem).WithContents(TestFileContents); - } - - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void MoveUnhydratedFolderToFullFolderInDotGitFolder() - { - string testFileName = "MoveUnhydratedFolderToFullFolderInDotGitFolder.cpp"; - string oldFolderName = Path.Combine("Test_EPF_MoveRenameFolderTests", "MoveUnhydratedFolderToFullFolderInDotGitFolder"); - - string newFolderName = Path.Combine(".git", "NewPerFixtureParent"); - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldNotExistOnDisk(this.fileSystem); - this.fileSystem.CreateDirectory(this.Enlistment.GetVirtualPathTo(newFolderName)); - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldBeADirectory(this.fileSystem); - - string movedFolderPath = Path.Combine(newFolderName, "Should"); - this.fileSystem.MoveDirectory(this.Enlistment.GetVirtualPathTo(oldFolderName), this.Enlistment.GetVirtualPathTo(movedFolderPath)); - - this.Enlistment.GetVirtualPathTo(movedFolderPath).ShouldBeADirectory(this.fileSystem); - this.Enlistment.GetVirtualPathTo(oldFolderName).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, testFileName)).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(movedFolderPath, testFileName)).ShouldBeAFile(this.fileSystem).WithContents(TestFileContents); - } - [TestCase] public void MoveFullFolderToFullFolderInDotGitFolder() { @@ -150,99 +84,5 @@ public void MoveFullFolderToFullFolderInDotGitFolder() oldFolderPath.ShouldNotExistOnDisk(this.fileSystem); Path.Combine(movedFolderPath, testFileName).ShouldBeAFile(this.fileSystem).WithContents(fileContents); } - - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void MoveAndRenameUnhydratedFolderToNewFolder() - { - string testFileName = "MoveAndRenameUnhydratedFolderToNewFolder.cpp"; - string oldFolderName = Path.Combine("Test_EPF_MoveRenameFolderTests", "MoveAndRenameUnhydratedFolderToNewFolder"); - - string newFolderName = "NewPerTestCaseParent"; - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldNotExistOnDisk(this.fileSystem); - this.fileSystem.CreateDirectory(this.Enlistment.GetVirtualPathTo(newFolderName)); - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldBeADirectory(this.fileSystem); - - string movedFolderPath = Path.Combine(newFolderName, "MoveAndRenameUnhydratedFolderToNewFolder_renamed"); - this.fileSystem.MoveDirectory(this.Enlistment.GetVirtualPathTo(oldFolderName), this.Enlistment.GetVirtualPathTo(movedFolderPath)); - - this.Enlistment.GetVirtualPathTo(movedFolderPath).ShouldBeADirectory(this.fileSystem); - this.Enlistment.GetVirtualPathTo(oldFolderName).ShouldNotExistOnDisk(this.fileSystem); - - this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, testFileName)).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(movedFolderPath, testFileName)).ShouldBeAFile(this.fileSystem).WithContents(TestFileContents); - } - - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void MoveFolderWithUnhydratedAndFullContents() - { - string testFileName = "MoveFolderWithUnhydratedAndFullContents.cpp"; - string oldFolderName = Path.Combine("Test_EPF_MoveRenameFolderTests", "MoveFolderWithUnhydratedAndFullContents"); - - string newFile = "TestFile.txt"; - string newFileContents = "Contents of TestFile.txt"; - this.fileSystem.WriteAllText(this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, newFile)), newFileContents); - - string newFolderName = "New_MoveFolderWithUnhydratedAndFullContents"; - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldNotExistOnDisk(this.fileSystem); - this.fileSystem.CreateDirectory(this.Enlistment.GetVirtualPathTo(newFolderName)); - this.Enlistment.GetVirtualPathTo(newFolderName).ShouldBeADirectory(this.fileSystem); - - string movedFolderPath = Path.Combine(newFolderName, "MoveFolderWithUnhydratedAndFullContents_renamed"); - this.fileSystem.MoveDirectory(this.Enlistment.GetVirtualPathTo(oldFolderName), this.Enlistment.GetVirtualPathTo(movedFolderPath)); - - this.Enlistment.GetVirtualPathTo(movedFolderPath).ShouldBeADirectory(this.fileSystem); - this.Enlistment.GetVirtualPathTo(oldFolderName).ShouldNotExistOnDisk(this.fileSystem); - - // Test file should have been moved - this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, testFileName)).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(movedFolderPath, testFileName)).ShouldBeAFile(this.fileSystem).WithContents(TestFileContents); - - // New file should have been moved - this.Enlistment.GetVirtualPathTo(Path.Combine(oldFolderName, newFile)).ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(Path.Combine(movedFolderPath, newFile)).ShouldBeAFile(this.fileSystem).WithContents(newFileContents); - } - - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void MoveFolderWithUnexpandedChildFolders() - { - string oldFolderPath = this.Enlistment.GetVirtualPathTo("Test_EPF_MoveRenameFileTests"); - string newFolderName = "Test_EPF_MoveRenameFileTests_Renamed"; - string newFolderPath = this.Enlistment.GetVirtualPathTo(newFolderName); - this.fileSystem.MoveDirectory(oldFolderPath, newFolderPath); - oldFolderPath.ShouldNotExistOnDisk(this.fileSystem); - - newFolderPath.ShouldBeADirectory(this.fileSystem); - this.Enlistment.GetVirtualPathTo(newFolderName, "ChangeNestedUnhydratedFileNameCase", "Program.cs") - .ShouldBeAFile(this.fileSystem) - .WithContents(MoveRenameFileTests.TestFileContents); - - this.Enlistment.GetVirtualPathTo(newFolderName, "ChangeUnhydratedFileName", "Program.cs") - .ShouldBeAFile(this.fileSystem) - .WithContents(MoveRenameFileTests.TestFileContents); - - this.Enlistment.GetVirtualPathTo(newFolderName, "MoveUnhydratedFileToDotGitFolder", "Program.cs") - .ShouldBeAFile(this.fileSystem) - .WithContents(MoveRenameFileTests.TestFileContents); - - // Test moving a folder with a very deep unhydrated child tree - oldFolderPath = this.Enlistment.GetVirtualPathTo("Test_EPF_WorkingDirectoryTests"); - - // But expand the folder we will be renaming (so that only the children have not been expanded) - oldFolderPath.ShouldBeADirectory(this.fileSystem).WithDirectories().ShouldContain(dir => dir.Name.Equals("1")); - - newFolderName = "Test_EPF_WorkingDirectoryTests_Renamed"; - newFolderPath = this.Enlistment.GetVirtualPathTo(newFolderName); - this.fileSystem.MoveDirectory(oldFolderPath, newFolderPath); - oldFolderPath.ShouldNotExistOnDisk(this.fileSystem); - this.Enlistment.GetVirtualPathTo(newFolderName, "1", "2", "3", "4", "ReadDeepProjectedFile.cpp") - .ShouldBeAFile(this.fileSystem) - .WithContents(WorkingDirectoryTests.TestFileContents); - } } } diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs index 1f85474bd2..a56cab3388 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbTests.cs @@ -115,9 +115,7 @@ public void NoopPrefetch() this.Enlistment.Prefetch("--files *").ShouldContain("Nothing new to prefetch."); } - // TODO(#1219): Handle that lock files are not deleted on Mac, they are simply unlocked [TestCase, Order(11)] - [Category(Categories.MacTODO.TestNeedsToLockFile)] public void PrefetchCleansUpStalePrefetchLock() { this.Enlistment.Prefetch("--commits"); @@ -162,6 +160,7 @@ public void PrefetchFilesFromFileListFile() } [TestCase, Order(13)] + [Category(Categories.NeedsReactionInCI)] public void PrefetchFilesFromFileListStdIn() { // on case-insensitive filesystems, test case-blind matching @@ -178,6 +177,7 @@ public void PrefetchFilesFromFileListStdIn() } [TestCase, Order(14)] + [Category(Categories.NeedsReactionInCI)] public void PrefetchFolderListFromStdin() { string input = string.Join(Environment.NewLine, PrefetchFolderList); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs index d94fe70376..68dbb3dd65 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/PrefetchVerbWithoutSharedCacheTests.cs @@ -9,11 +9,8 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture { - // TODO(#1219): Before these tests can be enabled PostFetchJobShouldComplete needs - // to work on Mac (where post-fetch.lock is not removed from disk) [TestFixture] [Category(Categories.ExtraCoverage)] - [Category(Categories.MacTODO.TestNeedsToLockFile)] public class PrefetchVerbWithoutSharedCacheTests : TestsWithEnlistmentPerFixture { private const string PrefetchPackPrefix = "prefetch"; diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SparseTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SparseTests.cs index 84c5de3b70..30a8056bd8 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SparseTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SparseTests.cs @@ -143,7 +143,6 @@ public void AddingSubfolderShouldKeepParentRecursive() } [TestCase, Order(6)] - [Category(Categories.WindowsOnly)] public void CreatingFolderShouldAddToSparseListAndStartProjecting() { this.gvfsProcess.AddSparseFolders(this.mainSparseFolder); @@ -166,33 +165,6 @@ public void CreatingFolderShouldAddToSparseListAndStartProjecting() projectedFile.ShouldBeAFile(this.fileSystem); } - [TestCase, Order(7)] - [Category(Categories.MacOnly)] - public void CreateFolderThenFileShouldAddToSparseListAndStartProjecting() - { - this.gvfsProcess.AddSparseFolders(this.mainSparseFolder); - this.ValidateFoldersInSparseList(this.mainSparseFolder); - - string newFolderPath = Path.Combine(this.Enlistment.RepoRoot, "GVFS", "GVFS.Common"); - newFolderPath.ShouldNotExistOnDisk(this.fileSystem); - Directory.CreateDirectory(newFolderPath); - string newFilePath = Path.Combine(newFolderPath, "test.txt"); - File.WriteAllText(newFilePath, "New file content"); - newFolderPath.ShouldBeADirectory(this.fileSystem); - newFilePath.ShouldBeAFile(this.fileSystem); - string[] fileSystemEntries = Directory.GetFileSystemEntries(newFolderPath); - fileSystemEntries.Length.ShouldEqual(33); - this.ValidateFoldersInSparseList(this.mainSparseFolder, Path.Combine("GVFS", "GVFS.Common")); - - string projectedFolder = Path.Combine(newFolderPath, "Git"); - projectedFolder.ShouldBeADirectory(this.fileSystem); - fileSystemEntries = Directory.GetFileSystemEntries(projectedFolder); - fileSystemEntries.Length.ShouldEqual(13); - - string projectedFile = Path.Combine(newFolderPath, "ReturnCode.cs"); - projectedFile.ShouldBeAFile(this.fileSystem); - } - [TestCase, Order(7)] public void ReadFileThenChangingSparseFoldersShouldRemoveFileAndFolder() { @@ -300,33 +272,6 @@ public void CreateNewFileAndCommitThenRemoveSparseFolderShouldKeepFileAndFolder( fileToCreate.ShouldBeAFile(this.fileSystem); } - [TestCase, Order(13)] - [Category(Categories.MacOnly)] - public void CreateFolderAndFileThatAreExcluded() - { - this.gvfsProcess.AddSparseFolders(this.mainSparseFolder); - this.ValidateFoldersInSparseList(this.mainSparseFolder); - - // Create a file that should already be in the projection but excluded - string newFolderPath = Path.Combine(this.Enlistment.RepoRoot, "GVFS", "GVFS.Mount"); - newFolderPath.ShouldNotExistOnDisk(this.fileSystem); - Directory.CreateDirectory(newFolderPath); - string newFilePath = Path.Combine(newFolderPath, "Program.cs"); - File.WriteAllText(newFilePath, "New file content"); - newFolderPath.ShouldBeADirectory(this.fileSystem); - newFilePath.ShouldBeAFile(this.fileSystem); - string[] fileSystemEntries = Directory.GetFileSystemEntries(newFolderPath); - fileSystemEntries.Length.ShouldEqual(7); - - string projectedFolder = Path.Combine(newFolderPath, "Properties"); - projectedFolder.ShouldBeADirectory(this.fileSystem); - fileSystemEntries = Directory.GetFileSystemEntries(projectedFolder); - fileSystemEntries.Length.ShouldEqual(1); - - string projectedFile = Path.Combine(newFolderPath, "MountVerb.cs"); - projectedFile.ShouldBeAFile(this.fileSystem); - } - [TestCase, Order(14)] public void ModifiedFileAndCommitThenChangingSparseFoldersWithPrune() { diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SymbolicLinkTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SymbolicLinkTests.cs index 5f7a83e04b..9e6140e21e 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SymbolicLinkTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/SymbolicLinkTests.cs @@ -1,14 +1,14 @@ using System.IO; using GVFS.FunctionalTests.FileSystemRunners; -using GVFS.FunctionalTests.Should; +using GVFS.FunctionalTests.Should; using GVFS.FunctionalTests.Tools; -using GVFS.Tests.Should; +using GVFS.Tests.Should; using NUnit.Framework; namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture { - // POSIXOnly until issue #297 (add SymLink support for Windows) is complete - [Category(Categories.POSIXOnly)] + // Ignored until issue #297 (add SymLink support for Windows) is complete + [Ignore("Symbolic link support not yet implemented (see issue #297)")] [TestFixture] public class SymbolicLinkTests : TestsWithEnlistmentPerFixture { diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs index f08e13ab48..683b02a2c4 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerFixture/WorkingDirectoryTests.cs @@ -398,7 +398,6 @@ public void FolderPlaceHolderHasVersionInfo() [TestCase, Order(13)] [Category(Categories.GitCommands)] - [Category(Categories.MacTODO.NeedsNewFolderCreateNotification)] public void FolderContentsProjectedAfterFolderCreateAndCheckout() { string folderName = "GVFlt_MultiThreadTest"; @@ -548,29 +547,15 @@ public void TruncatedObjectRedownloaded() objectPath.ShouldBeAFile(this.fileSystem); new FileInfo(objectPath).Length.ShouldEqual(objectLength - 16); - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - // Mac can't correct corrupt objects, but it should detect them and add to ModifiedPaths.dat - this.Enlistment.GetVirtualPathTo("Test_EPF_WorkingDirectoryTests", "TruncatedObjectRedownloaded.txt").ShouldBeAFile(this.fileSystem); - - GVFSHelpers.ModifiedPathsShouldContain(this.Enlistment, this.fileSystem, modifedFile); - GitHelpers.CheckGitCommandAgainstGVFSRepo( - this.Enlistment.RepoRoot, - "status", - $"modified: {modifedFile}"); - } - else - { - // Windows should correct a corrupt obect - // Read the original path and verify its contents are correct - this.Enlistment.GetVirtualPathTo("Test_EPF_WorkingDirectoryTests", "TruncatedObjectRedownloaded.txt").ShouldBeAFile(this.fileSystem).WithContents(testFileContents); + // Windows should correct a corrupt obect + // Read the original path and verify its contents are correct + this.Enlistment.GetVirtualPathTo("Test_EPF_WorkingDirectoryTests", "TruncatedObjectRedownloaded.txt").ShouldBeAFile(this.fileSystem).WithContents(testFileContents); - // Confirm there's a new item in the corrupt objects folder - corruptObjectFolderPath.ShouldBeADirectory(this.fileSystem).WithItems().Count().ShouldEqual(initialCorruptObjectCount + 1); + // Confirm there's a new item in the corrupt objects folder + corruptObjectFolderPath.ShouldBeADirectory(this.fileSystem).WithItems().Count().ShouldEqual(initialCorruptObjectCount + 1); - // File should not be in ModifiedPaths.dat - GVFSHelpers.ModifiedPathsShouldNotContain(this.Enlistment, this.fileSystem, "Test_EPF_WorkingDirectoryTests/TruncatedObjectRedownloaded.txt"); - } + // File should not be in ModifiedPaths.dat + GVFSHelpers.ModifiedPathsShouldNotContain(this.Enlistment, this.fileSystem, "Test_EPF_WorkingDirectoryTests/TruncatedObjectRedownloaded.txt"); } [TestCase, Order(18)] @@ -625,44 +610,12 @@ private void FolderEnumerationShouldHaveSingleEntry(string folderVirtualPath, st private void EnumerateAndReadShouldNotChangeEnumerationOrder(string folderRelativePath) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - NativeTests.EnumerateAndReadDoesNotChangeEnumerationOrder(folderRelativePath).ShouldEqual(true); - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - string[] entries = Directory.GetFileSystemEntries(folderRelativePath); - foreach (string entry in entries) - { - File.ReadAllText(entry); - } - - string[] postReadEntries = Directory.GetFileSystemEntries(folderRelativePath); - Enumerable.SequenceEqual(entries, postReadEntries) - .ShouldBeTrue($"Entries are not the same after reading. Orignial list:\n{string.Join(",", entries)}\n\nAfter read:\n{string.Join(",", postReadEntries)}"); - } - else - { - Assert.Fail("Unsupported platform"); - } + NativeTests.EnumerateAndReadDoesNotChangeEnumerationOrder(folderRelativePath).ShouldEqual(true); } private bool PlaceholderHasVersionInfo(string relativePath, int version, string sha) { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - return NativeTests.PlaceHolderHasVersionInfo(relativePath, version, sha); - } - else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - // TODO(#1360): Add a version of PlaceHolderHasVersionInfo that works on Mac - return true; - } - else - { - Assert.Fail("Unsupported platform"); - return false; - } + return NativeTests.PlaceHolderHasVersionInfo(relativePath, version, sha); } private class NativeTests diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/CaseOnlyFolderRenameTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/CaseOnlyFolderRenameTests.cs deleted file mode 100644 index 3c4a9fc0c5..0000000000 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/CaseOnlyFolderRenameTests.cs +++ /dev/null @@ -1,76 +0,0 @@ -using GVFS.FunctionalTests.FileSystemRunners; -using GVFS.FunctionalTests.Should; -using GVFS.FunctionalTests.Tools; -using GVFS.Tests.Should; -using NUnit.Framework; -using System.IO; - -namespace GVFS.FunctionalTests.Tests.EnlistmentPerTestCase -{ - [TestFixture] - public class CaseOnlyFolderRenameTests : TestsWithEnlistmentPerTestCase - { - private FileSystemRunner fileSystem; - - public CaseOnlyFolderRenameTests() - { - this.fileSystem = new BashRunner(); - } - - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void CaseRenameFoldersAndRemountAndRenameAgain() - { - // Projected folder without a physical folder - string parentFolderName = "GVFS"; - string oldGVFSSubFolderName = "GVFS"; - string oldGVFSSubFolderPath = Path.Combine(parentFolderName, oldGVFSSubFolderName); - string newGVFSSubFolderName = "gvfs"; - string newGVFSSubFolderPath = Path.Combine(parentFolderName, newGVFSSubFolderName); - - this.Enlistment.GetVirtualPathTo(oldGVFSSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(oldGVFSSubFolderName); - - this.fileSystem.MoveFile(this.Enlistment.GetVirtualPathTo(oldGVFSSubFolderPath), this.Enlistment.GetVirtualPathTo(newGVFSSubFolderPath)); - - this.Enlistment.GetVirtualPathTo(newGVFSSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(newGVFSSubFolderName); - - // Projected folder with a physical folder - string oldTestsSubFolderName = "GVFS.FunctionalTests"; - string oldTestsSubFolderPath = Path.Combine(parentFolderName, oldTestsSubFolderName); - string newTestsSubFolderName = "gvfs.functionaltests"; - string newTestsSubFolderPath = Path.Combine(parentFolderName, newTestsSubFolderName); - - string fileToAdd = "NewFile.txt"; - string fileToAddContent = "This is new file text."; - string fileToAddPath = this.Enlistment.GetVirtualPathTo(Path.Combine(oldTestsSubFolderPath, fileToAdd)); - this.fileSystem.WriteAllText(fileToAddPath, fileToAddContent); - - this.Enlistment.GetVirtualPathTo(oldTestsSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(oldTestsSubFolderName); - - this.fileSystem.MoveFile(this.Enlistment.GetVirtualPathTo(oldTestsSubFolderPath), this.Enlistment.GetVirtualPathTo(newTestsSubFolderPath)); - - this.Enlistment.GetVirtualPathTo(newTestsSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(newTestsSubFolderName); - - // Remount - this.Enlistment.UnmountGVFS(); - this.Enlistment.MountGVFS(); - - this.Enlistment.GetVirtualPathTo(newGVFSSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(newGVFSSubFolderName); - this.Enlistment.GetVirtualPathTo(newTestsSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(newTestsSubFolderName); - this.Enlistment.GetVirtualPathTo(Path.Combine(newTestsSubFolderPath, fileToAdd)).ShouldBeAFile(this.fileSystem).WithContents().ShouldEqual(fileToAddContent); - - // Rename each folder again - string finalGVFSSubFolderName = "gvFS"; - string finalGVFSSubFolderPath = Path.Combine(parentFolderName, finalGVFSSubFolderName); - this.fileSystem.MoveFile(this.Enlistment.GetVirtualPathTo(newGVFSSubFolderPath), this.Enlistment.GetVirtualPathTo(finalGVFSSubFolderPath)); - this.Enlistment.GetVirtualPathTo(finalGVFSSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(finalGVFSSubFolderName); - - string finalTestsSubFolderName = "gvfs.FunctionalTESTS"; - string finalTestsSubFolderPath = Path.Combine(parentFolderName, finalTestsSubFolderName); - this.fileSystem.MoveFile(this.Enlistment.GetVirtualPathTo(newTestsSubFolderPath), this.Enlistment.GetVirtualPathTo(finalTestsSubFolderPath)); - this.Enlistment.GetVirtualPathTo(finalTestsSubFolderPath).ShouldBeADirectory(this.fileSystem).WithCaseMatchingName(finalTestsSubFolderName); - this.Enlistment.GetVirtualPathTo(Path.Combine(finalTestsSubFolderPath, fileToAdd)).ShouldBeAFile(this.fileSystem).WithContents().ShouldEqual(fileToAddContent); - } - } -} diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/LooseObjectStepTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/LooseObjectStepTests.cs index 69254634f1..aa29b8de93 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/LooseObjectStepTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/LooseObjectStepTests.cs @@ -6,6 +6,7 @@ using System.IO; using System.Linq; using System.Text.RegularExpressions; +using System; namespace GVFS.FunctionalTests.Tests.EnlistmentPerTestCase { @@ -28,6 +29,7 @@ public LooseObjectStepTests() private string TempPackRoot => Path.Combine(this.PackRoot, TempPackFolder); [TestCase] + [Category(Categories.NeedsReactionInCI)] public void RemoveLooseObjectsInPackFiles() { this.ClearAllObjects(); @@ -47,6 +49,7 @@ public void RemoveLooseObjectsInPackFiles() } [TestCase] + [Category(Categories.NeedsReactionInCI)] public void PutLooseObjectsInPackFiles() { this.ClearAllObjects(); @@ -83,6 +86,7 @@ public void NoLooseObjectsDoesNothing() } [TestCase] + [Category(Categories.NeedsReactionInCI)] public void CorruptLooseObjectIsDeleted() { this.ClearAllObjects(); diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/MacDiskLayoutUpgradeTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/MacDiskLayoutUpgradeTests.cs deleted file mode 100644 index b8face6690..0000000000 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/MacDiskLayoutUpgradeTests.cs +++ /dev/null @@ -1,45 +0,0 @@ -using GVFS.FunctionalTests.Should; -using GVFS.FunctionalTests.Tools; -using GVFS.Tests.Should; -using NUnit.Framework; -using System; -using System.IO; - -namespace GVFS.FunctionalTests.Tests.EnlistmentPerTestCase -{ - [TestFixture] - [Category(Categories.ExtraCoverage)] - [Category(Categories.MacOnly)] - public class MacDiskLayoutUpgradeTests : DiskLayoutUpgradeTests - { - public const int CurrentDiskLayoutMajorVersion = 19; - public const int CurrentDiskLayoutMinorVersion = 0; - - public override int GetCurrentDiskLayoutMajorVersion() => CurrentDiskLayoutMajorVersion; - public override int GetCurrentDiskLayoutMinorVersion() => CurrentDiskLayoutMinorVersion; - - [TestCase] - public void MountUpgradesPlaceholderListDatabaseToSQLite() - { - this.Enlistment.UnmountGVFS(); - - this.fileSystem.DeleteFile(Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.VFSForGit)); - this.WriteOldPlaceholderListDatabase(); - - GVFSHelpers.SaveDiskLayoutVersion(this.Enlistment.DotGVFSRoot, "18", "0"); - - this.Enlistment.MountGVFS(); - this.Enlistment.UnmountGVFS(); - - // Validate the placeholders are in the SQLite placeholder database now - string placeholderDatabasePath = Path.Combine(this.Enlistment.DotGVFSRoot, TestConstants.Databases.VFSForGit); - placeholderDatabasePath.ShouldBeAFile(this.fileSystem); - string[] lines = GVFSHelpers.GetAllSQLitePlaceholdersAsString(placeholderDatabasePath).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); - lines.Length.ShouldEqual(10); - this.PlaceholderDatabaseShouldIncludeCommonLines(lines); - lines.ShouldContain(x => x == this.PartialFolderPlaceholderString("GVFS", "GVFS.Tests", "Properties")); - - this.ValidatePersistedVersionMatchesCurrentVersion(); - } - } -} diff --git a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs index c07e601060..3754cfaaab 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/EnlistmentPerTestCase/ModifiedPathsTests.cs @@ -61,7 +61,6 @@ public void DeletedTempFolderDeletesFilesFromModifiedFiles(FileSystemRunner file } [TestCaseSource(typeof(FileSystemRunner), nameof(FileSystemRunner.Runners))] - [Category(Categories.MacTODO.NeedsNewFolderCreateNotification)] public void ModifiedPathsFromChangesInsideRepoSavedAfterRemount(FileSystemRunner fileSystem) { string[] expectedModifiedFilesContentsAfterRemount = @@ -134,8 +133,6 @@ public void ModifiedPathsFromChangesInsideRepoSavedAfterRemount(FileSystemRunner } [TestCaseSource(typeof(FileSystemRunner), nameof(FileSystemRunner.Runners))] - [Category(Categories.RepositoryMountsSameFileSystem)] - [Category(Categories.MacTODO.NeedsNewFolderCreateNotification)] public void ModifiedPathsFromRenamingOutsideRepoSavedAfterRemount(FileSystemRunner fileSystem) { string[] expectedModifiedFilesContentsAfterRemount = @@ -221,7 +218,6 @@ public void ModifiedPathsCorrectAfterHardLinkingInsideRepo(FileSystemRunner file } [TestCaseSource(typeof(FileSystemRunner), nameof(FileSystemRunner.Runners))] - [Category(Categories.RepositoryMountsSameFileSystem)] public void ModifiedPathsCorrectAfterHardLinkingOutsideRepo(FileSystemRunner fileSystem) { string[] expectedModifiedFilesContentsAfterHardlinks = diff --git a/GVFS/GVFS.FunctionalTests/Tests/FastFetchTests.cs b/GVFS/GVFS.FunctionalTests/Tests/FastFetchTests.cs index faaa7edb38..2a09893276 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/FastFetchTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/FastFetchTests.cs @@ -9,7 +9,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Runtime.InteropServices; using System.Text.RegularExpressions; namespace GVFS.FunctionalTests.Tests @@ -492,21 +491,13 @@ private ProcessResult RunFastFetch(string args) { args = args + " --verbose"; - string fastfetch; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - fastfetch = Path.Combine(Settings.Default.CurrentDirectory, "netcoreapp2.1", "FastFetch.dll"); - } - else - { - fastfetch = Path.Combine(Settings.Default.CurrentDirectory, "FastFetch.dll"); - } + string fastfetch = Path.Combine(Settings.Default.CurrentDirectory, "FastFetch.exe"); File.Exists(fastfetch).ShouldBeTrue($"{fastfetch} did not exist."); Console.WriteLine($"Using {fastfetch}"); - ProcessStartInfo processInfo = new ProcessStartInfo("dotnet"); - processInfo.Arguments = $"{fastfetch} {args}"; + ProcessStartInfo processInfo = new ProcessStartInfo(fastfetch); + processInfo.Arguments = args; processInfo.WorkingDirectory = this.fastFetchRepoRoot; processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = true; diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs index f7862cf42b..e6de487b72 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CheckoutTests.cs @@ -644,9 +644,7 @@ public void CheckoutBranchWhileOutsideToolDoesNotAllowDeleteOfOpenRepoMetadata() } } - // WindowsOnly because the test depends on Windows specific file sharing behavior [TestCase] - [Category(Categories.WindowsOnly)] public void CheckoutBranchWhileOutsideToolHasExclusiveReadHandleOnDatabasesFolder() { this.ControlGitRepo.Fetch(GitRepoTests.ConflictSourceBranch); @@ -871,7 +869,6 @@ public void CheckoutEditCheckoutWithoutFolderThenCheckoutWithMultipleFiles() } [TestCase] - [Category(Categories.MacTODO.NeedsNewFolderCreateNotification)] public void CreateAFolderThenCheckoutBranchWithFolder() { this.ControlGitRepo.Fetch("FunctionalTests/20201014_Checkout8"); @@ -1004,6 +1001,6 @@ private static extern SafeFileHandle CreateFile( [In] IntPtr securityAttributes, [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, [MarshalAs(UnmanagedType.U4)] NativeFileAttributes flagsAndAttributes, - [In] IntPtr templateFile); + [In] IntPtr templateFile); } } diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CreatePlaceholderTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CreatePlaceholderTests.cs index 8116824efe..ccf231e246 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CreatePlaceholderTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/CreatePlaceholderTests.cs @@ -39,7 +39,6 @@ public void AllowsPlaceholderCreationWhileGitCommandIsRunning(string commandToRu [TestCase("reset --stdin")] [TestCase("send-pack --stdin URL")] [TestCase("update-index --stdin")] - [Category(Categories.WindowsOnly)] // Mac never blocks placeholder creation public void BlocksPlaceholderCreationWhileGitCommandIsRunning(string commandToRun) { this.CheckPlaceholderCreation(commandToRun, shouldAllow: false); diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs index e952373ee3..28f7523534 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/GitCommandsTests.cs @@ -416,7 +416,6 @@ public void CaseOnlyRenameFileAndChangeBranches() } [TestCase] - [Category(Categories.RepositoryMountsSameFileSystem)] public void MoveFileFromOutsideRepoToInsideRepoAndAdd() { string testFileContents = "0123456789"; @@ -450,7 +449,6 @@ public void MoveFileFromOutsideRepoToInsideRepoAndAdd() } [TestCase] - [Category(Categories.RepositoryMountsSameFileSystem)] public void MoveFolderFromOutsideRepoToInsideRepoAndAdd() { string testFileContents = "0123456789"; @@ -488,7 +486,6 @@ public void MoveFolderFromOutsideRepoToInsideRepoAndAdd() } [TestCase] - [Category(Categories.RepositoryMountsSameFileSystem)] public void MoveFileFromInsideRepoToOutsideRepoAndCommit() { string newBranchName = "tests/functional/MoveFileFromInsideRepoToOutsideRepoAndCommit"; @@ -554,26 +551,6 @@ public void RenameFileCommitChangesSwitchBranchSwitchBackTest() this.CommitChangesSwitchBranchSwitchBack(fileSystemAction: this.RenameFile); } - // MacOnly because renames of partial folders are blocked on Windows - [TestCase] - [Category(Categories.MacOnly)] - public void MoveFolderCommitChangesSwitchBranchSwitchBackTest() - { - this.CommitChangesSwitchBranchSwitchBack(fileSystemAction: this.MoveFolder); - } - - // Mac and Linux only because Windows does not support file mode - [TestCase] - [Category(Categories.POSIXOnly)] - public void UpdateFileModeOnly() - { - const string TestFileName = "test-file-mode"; - this.CreateFile("#!/bin/bash\n", TestFileName); - this.ChangeMode(TestFileName, Convert.ToUInt16("755", 8)); - this.ValidateGitCommand($"add {TestFileName}"); - this.ValidateGitCommand($"ls-files --stage {TestFileName}"); - } - [TestCase] public void AddFileCommitThenDeleteAndCommit() { diff --git a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/StatusTests.cs b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/StatusTests.cs index bc5c776c25..65edacc6df 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/GitCommands/StatusTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/GitCommands/StatusTests.cs @@ -1,6 +1,6 @@ using GVFS.FunctionalTests.FileSystemRunners; using GVFS.FunctionalTests.Properties; -using GVFS.FunctionalTests.Should; +using GVFS.FunctionalTests.Should; using GVFS.FunctionalTests.Tools; using GVFS.Tests.Should; using NUnit.Framework; @@ -75,12 +75,11 @@ public void AppendFileUsingBash() // We check the contents after status, to ensure this check didn't cause the hydration string appendedContent = string.Concat("Commit2LockToPreventUpdate \r\n", content); - virtualFile.ShouldBeAFile(this.FileSystem).WithContents(appendedContent); - controlFile.ShouldBeAFile(this.FileSystem).WithContents(appendedContent); + virtualFile.ShouldBeAFile(this.FileSystem).WithContents(appendedContent); + controlFile.ShouldBeAFile(this.FileSystem).WithContents(appendedContent); } [TestCase] - [Category(Categories.MacTODO.NeedsStatusCache)] public void ModifyingAndDeletingRepositoryExcludeFileInvalidatesCache() { string repositoryExcludeFile = Path.Combine(".git", "info", "exclude"); @@ -106,7 +105,6 @@ public void ModifyingAndDeletingRepositoryExcludeFileInvalidatesCache() } [TestCase] - [Category(Categories.MacTODO.NeedsStatusCache)] public void NewRepositoryExcludeFileInvalidatesCache() { string repositoryExcludeFileRelativePath = Path.Combine(".git", "info", "exclude"); @@ -127,7 +125,6 @@ public void NewRepositoryExcludeFileInvalidatesCache() } [TestCase] - [Category(Categories.MacTODO.NeedsStatusCache)] public void ModifyingHeadSymbolicRefInvalidatesCache() { this.ValidateGitCommand("status"); @@ -143,7 +140,6 @@ public void ModifyingHeadSymbolicRefInvalidatesCache() } [TestCase] - [Category(Categories.MacTODO.NeedsStatusCache)] public void ModifyingHeadRefInvalidatesCache() { this.ValidateGitCommand("status"); diff --git a/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/ConfigVerbTests.cs b/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/ConfigVerbTests.cs index 9881020af8..b7c09600f0 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/ConfigVerbTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/ConfigVerbTests.cs @@ -3,14 +3,11 @@ using NUnit.Framework; using System; using System.Collections.Generic; -using System.Diagnostics; -using System.IO; namespace GVFS.FunctionalTests.Tests.MultiEnlistmentTests { [TestFixture] [Category(Categories.ExtraCoverage)] - [Category(Categories.MacTODO.NeedsGVFSConfig)] public class ConfigVerbTests : TestsWithMultiEnlistment { private const string IntegerSettingKey = "functionalTest_Integer"; diff --git a/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/SharedCacheTests.cs b/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/SharedCacheTests.cs index 5111b415e7..7d343d8b24 100644 --- a/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/SharedCacheTests.cs +++ b/GVFS/GVFS.FunctionalTests/Tests/MultiEnlistmentTests/SharedCacheTests.cs @@ -80,7 +80,6 @@ public void RepairFixesCorruptBlobSizesDatabase() } [TestCase] - [Category(Categories.MacTODO.TestNeedsToLockFile)] public void CloneCleansUpStaleMetadataLock() { GVFSFunctionalTestEnlistment enlistment1 = this.CloneAndMountEnlistment(); diff --git a/GVFS/GVFS.FunctionalTests/Tools/ControlGitRepo.cs b/GVFS/GVFS.FunctionalTests/Tools/ControlGitRepo.cs index a4352252cd..d2f792cea2 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/ControlGitRepo.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/ControlGitRepo.cs @@ -55,6 +55,7 @@ public void Initialize() GitProcess.Invoke(this.RootPath, "config merge.renames false"); GitProcess.Invoke(this.RootPath, "config advice.statusUoption false"); GitProcess.Invoke(this.RootPath, "config core.abbrev 40"); + GitProcess.Invoke(this.RootPath, "config core.useBuiltinFSMonitor false"); GitProcess.Invoke(this.RootPath, "config pack.useSparse true"); GitProcess.Invoke(this.RootPath, "config reset.quiet true"); GitProcess.Invoke(this.RootPath, "config status.aheadbehind false"); diff --git a/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs b/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs index 391579a9a4..d079e36684 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/GVFSHelpers.cs @@ -206,44 +206,20 @@ public static string GetInternalParameter(string maintenanceJob = "null", string public static void RegisterForOfflineIO() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - uint result = PrjFSRegisterForOfflineIO(); - result.ShouldEqual(PrjFSResultSuccess, $"{nameof(RegisterForOfflineIO)} failed (result = {result})"); - } } public static void UnregisterForOfflineIO() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - uint result = PrjFSUnregisterForOfflineIO(); - result.ShouldEqual(PrjFSResultSuccess, $"{nameof(RegisterForOfflineIO)} failed (result = {result})"); - } } public static int GetCurrentDiskLayoutMajorVersion() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return MacCurrentDiskLayoutMajorVersion; - } - else - { - return WindowsCurrentDiskLayoutMajorVersion; - } + return WindowsCurrentDiskLayoutMajorVersion; } public static int GetCurrentDiskLayoutMinimumMajorVersion() { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return MacCurrentDiskLayoutMinimumMajorVersion; - } - else - { - return WindowsCurrentDiskLayoutMinimumMajorVersion; - } + return WindowsCurrentDiskLayoutMinimumMajorVersion; } private static string GetModifiedPathsContents(GVFSFunctionalTestEnlistment enlistment, FileSystemRunner fileSystem) diff --git a/GVFS/GVFS.FunctionalTests/Tools/GVFSServiceProcess.cs b/GVFS/GVFS.FunctionalTests/Tools/GVFSServiceProcess.cs index 5417a9337f..d27925e864 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/GVFSServiceProcess.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/GVFSServiceProcess.cs @@ -3,7 +3,7 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; using System.ServiceProcess; using System.Threading; @@ -17,20 +17,6 @@ public static string TestServiceName { get { - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - // Service name is used in the lookup of GVFS.Service communication pipes - // by clients for IPC. Custom pipe names can be specified as command line - // args to the Service during its startup. On the Mac, GVFS.Service started - // for testing is the same instance as the one that is installed by the - // Mac installer. Also it is not as easy as in Windows to pass command line - // args (that are specific to testing) to GVFS.Service (Service on Mac is a - // Launch agent and needs its args to be specified in its launchd.plist - // file). So on Mac - during tests GVFS.Service is started without any - // customized pipe name for testing. - return "GVFS.Service"; - } - return "Test.GVFS.Service"; } } @@ -127,25 +113,8 @@ private static ProcessResult RunScCommand(string command, string parameters) private static string GetPathToService() { - if (GVFSTestConfig.TestGVFSOnPath) - { - ProcessResult result = ProcessHelper.Run("where", Properties.Settings.Default.PathToGVFSService); - result.ExitCode.ShouldEqual(0, $"{nameof(GetPathToService)}: where returned {result.ExitCode} when looking for {Properties.Settings.Default.PathToGVFSService}"); - - string firstPath = - string.IsNullOrWhiteSpace(result.Output) - ? null - : result.Output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); - - firstPath.ShouldNotBeNull($"{nameof(GetPathToService)}: Failed to find {Properties.Settings.Default.PathToGVFSService}"); - return firstPath; - } - else - { - return Path.Combine( - Properties.Settings.Default.CurrentDirectory, - Properties.Settings.Default.PathToGVFSService); - } + File.Exists(Properties.Settings.Default.PathToGVFSService).ShouldBeTrue("Failed to locate GVFS.Service.exe"); + return Properties.Settings.Default.PathToGVFSService; } } } diff --git a/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs b/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs index 092d0011ae..8aacac84a7 100644 --- a/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs +++ b/GVFS/GVFS.FunctionalTests/Tools/GitHelpers.cs @@ -6,7 +6,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -19,7 +18,7 @@ public static class GitHelpers /// GVFS.FunctionalTests.LockHolder program. /// private const string LockHolderCommandName = @"GVFS.FunctionalTests.LockHolder"; - private const string LockHolderCommand = @"GVFS.FunctionalTests.LockHolder.dll"; + private const string LockHolderCommand = @"GVFS.FunctionalTests.LockHolder.exe"; private const string WindowsPathSeparator = "\\"; private const string GitPathSeparator = "/"; @@ -28,25 +27,9 @@ private static string LockHolderCommandPath { get { - // On OSX functional tests are run from inside Publish directory. Dependent - // assemblies including LockHolder test are available at the same level in - // the same directory. - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) - { - return Path.Combine( - Settings.Default.CurrentDirectory, - LockHolderCommand); - } - else - { - // On Windows, FT is run from the Output directory of GVFS.FunctionalTest project. - // LockHolder is a .netcore assembly and can be found inside netcoreapp2.1 - // subdirectory of GVFS.FunctionalTest Output directory. - return Path.Combine( - Settings.Default.CurrentDirectory, - "netcoreapp2.1", - LockHolderCommand); - } + // LockHolder is a .NET Framework application and can be found inside + // GVFS.FunctionalTest Output directory. + return Path.Combine(Settings.Default.CurrentDirectory, LockHolderCommand); } } @@ -149,16 +132,16 @@ public static ManualResetEventSlim AcquireGVFSLock( int resetTimeout = Timeout.Infinite, bool skipReleaseLock = false) { - string args = LockHolderCommandPath; + string args = null; if (skipReleaseLock) { - args += " --skip-release-lock"; + args = "--skip-release-lock"; } return RunCommandWithWaitAndStdIn( enlistment, resetTimeout, - "dotnet", + LockHolderCommandPath, args, GitHelpers.LockHolderCommandName, "done", diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.edb b/GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.edb similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.edb rename to GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.edb diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.jfm b/GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.jfm similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.jfm rename to GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/PersistentDictionary.jfm diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epc.chk b/GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/epc.chk similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epc.chk rename to GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/epc.chk diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epcres00001.jrs b/GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/epcres00001.jrs similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epcres00001.jrs rename to GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/epcres00001.jrs diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epcres00002.jrs b/GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/epcres00002.jrs similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/TestData/BackgroundGitUpdates/epcres00002.jrs rename to GVFS/GVFS.FunctionalTests/Windows/TestData/BackgroundGitUpdates/epcres00002.jrs diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/JunctionAndSubstTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/JunctionAndSubstTests.cs similarity index 97% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/JunctionAndSubstTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/JunctionAndSubstTests.cs index be3f05e201..617691a005 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/JunctionAndSubstTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/JunctionAndSubstTests.cs @@ -13,7 +13,6 @@ namespace GVFS.FunctionalTests.Windows.Tests { [TestFixture] [Category(Categories.ExtraCoverage)] - [Category(Categories.WindowsOnly)] public class JunctionAndSubstTests : TestsWithEnlistmentPerFixture { private const string SubstDrive = "Q:"; diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/ServiceTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/ServiceTests.cs similarity index 87% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/ServiceTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/ServiceTests.cs index c1353a571a..ddbca48c19 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/ServiceTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/ServiceTests.cs @@ -14,7 +14,6 @@ namespace GVFS.FunctionalTests.Windows.Tests [TestFixture] [NonParallelizable] [Category(Categories.ExtraCoverage)] - [Category(Categories.WindowsOnly)] public class ServiceTests : TestsWithEnlistmentPerFixture { private const string NativeLibPath = @"C:\Program Files\GVFS\ProjectedFSLib.dll"; @@ -31,11 +30,6 @@ public ServiceTests() [TestCase] public void MountAsksServiceToEnsurePrjFltServiceIsHealthy() { - if (!GVFSTestConfig.TestGVFSOnPath) - { - Assert.Ignore("Skipping test, test only enabled when --test-gvfs-on-path is set"); - } - this.Enlistment.UnmountGVFS(); StopPrjFlt(); @@ -53,11 +47,6 @@ public void MountAsksServiceToEnsurePrjFltServiceIsHealthy() [TestCase] public void ServiceStartsPrjFltService() { - if (!GVFSTestConfig.TestGVFSOnPath) - { - Assert.Ignore("Skipping test, test only enabled when --test-gvfs-on-path is set"); - } - this.Enlistment.UnmountGVFS(); StopPrjFlt(); GVFSServiceProcess.StopService(); diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/SharedCacheUpgradeTests.cs similarity index 97% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/SharedCacheUpgradeTests.cs index 3be0cb77fe..3025b443e3 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/SharedCacheUpgradeTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/SharedCacheUpgradeTests.cs @@ -14,7 +14,6 @@ namespace GVFS.FunctionalTests.Windows.Windows.Tests { [TestFixture] [Category(Categories.ExtraCoverage)] - [Category(Categories.WindowsOnly)] public class SharedCacheUpgradeTests : TestsWithMultiEnlistment { private string localCachePath; diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsDiskLayoutUpgradeTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsDiskLayoutUpgradeTests.cs similarity index 97% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsDiskLayoutUpgradeTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsDiskLayoutUpgradeTests.cs index ff355734b4..328652458d 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsDiskLayoutUpgradeTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsDiskLayoutUpgradeTests.cs @@ -13,7 +13,6 @@ namespace GVFS.FunctionalTests.Windows.Tests { [TestFixture] [Category(Categories.ExtraCoverage)] - [Category(Categories.WindowsOnly)] public class WindowsDiskLayoutUpgradeTests : DiskLayoutUpgradeTests { public const int CurrentDiskLayoutMajorVersion = 19; diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsFileSystemTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsFileSystemTests.cs similarity index 97% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsFileSystemTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsFileSystemTests.cs index 74d49a3c69..f6537afaa9 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsFileSystemTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsFileSystemTests.cs @@ -16,7 +16,6 @@ namespace GVFS.FunctionalTests.Windows.Windows.Tests { [TestFixture] - [Category(Categories.WindowsOnly)] public class WindowsFileSystemTests : TestsWithEnlistmentPerFixture { private enum CreationDisposition diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsFolderUsnUpdate.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsFolderUsnUpdate.cs similarity index 96% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsFolderUsnUpdate.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsFolderUsnUpdate.cs index 79f3d62b76..7ddb30aefb 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsFolderUsnUpdate.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsFolderUsnUpdate.cs @@ -10,7 +10,6 @@ namespace GVFS.FunctionalTests.Windows.Windows.Tests { [TestFixture] - [Category(Categories.WindowsOnly)] [Category(Categories.GitCommands)] [Ignore("fsutil requires WSL be enabled. Need to find a way to enable for builds or a different way to get the USN for the folder.")] public class WindowsFolderUsnUpdate : TestsWithEnlistmentPerFixture diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsTombstoneTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsTombstoneTests.cs similarity index 96% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsTombstoneTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsTombstoneTests.cs index a9c1f06360..f2c1b2d47d 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsTombstoneTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsTombstoneTests.cs @@ -10,7 +10,6 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture { [TestFixture] - [Category(Categories.WindowsOnly)] [Category(Categories.GitCommands)] public class WindowsTombstoneTests : TestsWithEnlistmentPerFixture { diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsUpdatePlaceholderTests.cs similarity index 98% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsUpdatePlaceholderTests.cs index a9e2f4cf86..acd88a8844 100644 --- a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tests/WindowsUpdatePlaceholderTests.cs +++ b/GVFS/GVFS.FunctionalTests/Windows/Tests/WindowsUpdatePlaceholderTests.cs @@ -13,7 +13,6 @@ namespace GVFS.FunctionalTests.Tests.EnlistmentPerFixture { // WindowsOnly because tests in this class depend on Windows specific file sharing behavior [TestFixture] - [Category(Categories.WindowsOnly)] [Category(Categories.GitCommands)] public class WindowsUpdatePlaceholderTests : TestsWithEnlistmentPerFixture { diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tools/ESENTDatabase.cs b/GVFS/GVFS.FunctionalTests/Windows/Tools/ESENTDatabase.cs similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tools/ESENTDatabase.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tools/ESENTDatabase.cs diff --git a/GVFS/GVFS.FunctionalTests.Windows/Windows/Tools/RegistryHelper.cs b/GVFS/GVFS.FunctionalTests/Windows/Tools/RegistryHelper.cs similarity index 100% rename from GVFS/GVFS.FunctionalTests.Windows/Windows/Tools/RegistryHelper.cs rename to GVFS/GVFS.FunctionalTests/Windows/Tools/RegistryHelper.cs diff --git a/GVFS/GVFS.GVFlt/GVFS.GVFlt.csproj b/GVFS/GVFS.GVFlt/GVFS.GVFlt.csproj index 094009ca9c..16074079a8 100644 --- a/GVFS/GVFS.GVFlt/GVFS.GVFlt.csproj +++ b/GVFS/GVFS.GVFlt/GVFS.GVFlt.csproj @@ -1,66 +1,11 @@ - - - - + + - {1118B427-7063-422F-83B9-5023C8EC5A7A} - Library - Properties - GVFS.GVFlt - GVFS.GVFlt - v4.6.1 - 512 - - + net461 - - true - DEBUG;TRACE - full - x64 - prompt - - - TRACE - true - pdbonly - x64 - prompt - - - - False - ..\..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - - - - - Designer - - + - - + - - + diff --git a/GVFS/GVFS.GVFlt/Properties/AssemblyInfo.cs b/GVFS/GVFS.GVFlt/Properties/AssemblyInfo.cs deleted file mode 100644 index ab6e7354cb..0000000000 --- a/GVFS/GVFS.GVFlt/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.GVFlt")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.GVFlt")] -[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("1118b427-7063-422f-83b9-5023c8ec5a7a")] diff --git a/GVFS/GVFS.GVFlt/packages.config b/GVFS/GVFS.GVFlt/packages.config deleted file mode 100644 index c7d616a3fa..0000000000 --- a/GVFS/GVFS.GVFlt/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Hooks/App.config b/GVFS/GVFS.Hooks/App.config deleted file mode 100644 index 6d44256319..0000000000 --- a/GVFS/GVFS.Hooks/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/GVFS/GVFS.Hooks/GVFS.Hooks.Windows.csproj b/GVFS/GVFS.Hooks/GVFS.Hooks.csproj similarity index 51% rename from GVFS/GVFS.Hooks/GVFS.Hooks.Windows.csproj rename to GVFS/GVFS.Hooks/GVFS.Hooks.csproj index f8252b2563..efe7842a7d 100644 --- a/GVFS/GVFS.Hooks/GVFS.Hooks.Windows.csproj +++ b/GVFS/GVFS.Hooks/GVFS.Hooks.csproj @@ -1,45 +1,10 @@ - - - - + + - {BDA91EE5-C684-4FC5-A90A-B7D677421917} Exe - Properties - GVFS.Hooks - GVFS.Hooks - v4.6.1 - 512 - true - - - - - true - DEBUG;TRACE - full - x64 - prompt - true - - - TRACE - true - pdbonly - x64 - prompt - true + net461 - - - - - - - - - - + + diff --git a/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Mac.cs b/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Mac.cs deleted file mode 100644 index 589ae46983..0000000000 --- a/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Mac.cs +++ /dev/null @@ -1,32 +0,0 @@ -using GVFS.Platform.Mac; - -namespace GVFS.Hooks.HooksPlatform -{ - public static partial class GVFSHooksPlatform - { - public static string GetUpgradeHighestAvailableVersionDirectory() - { - return MacPlatform.GetUpgradeHighestAvailableVersionDirectoryImplementation(); - } - - public static bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage) - { - return MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage); - } - - public static string GetNamedPipeName(string enlistmentRoot) - { - return MacPlatform.GetNamedPipeNameImplementation(enlistmentRoot); - } - - public static string GetGitGuiBlockedMessage() - { - return "git gui is not supported in VFS for Git repos on Mac"; - } - - public static string GetUpgradeReminderNotification() - { - return MacPlatform.GetUpgradeReminderNotificationImplementation(); - } - } -} diff --git a/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.POSIX.cs b/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.POSIX.cs deleted file mode 100644 index 99f7eedcc5..0000000000 --- a/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.POSIX.cs +++ /dev/null @@ -1,27 +0,0 @@ -using GVFS.Platform.POSIX; - -namespace GVFS.Hooks.HooksPlatform -{ - public static partial class GVFSHooksPlatform - { - public static bool IsElevated() - { - return POSIXPlatform.IsElevatedImplementation(); - } - - public static bool IsProcessActive(int processId) - { - return POSIXPlatform.IsProcessActiveImplementation(processId); - } - - public static bool IsConsoleOutputRedirectedToFile() - { - return POSIXPlatform.IsConsoleOutputRedirectedToFileImplementation(); - } - - public static bool TryGetNormalizedPath(string path, out string normalizedPath, out string errorMessage) - { - return POSIXFileSystem.TryGetNormalizedPathImplementation(path, out normalizedPath, out errorMessage); - } - } -} diff --git a/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Windows.cs b/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.cs similarity index 79% rename from GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Windows.cs rename to GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.cs index f3bd65a012..0c7cf7239f 100644 --- a/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Windows.cs +++ b/GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.cs @@ -1,4 +1,4 @@ -using GVFS.Platform.Windows; +using GVFS.Platform.Windows; namespace GVFS.Hooks.HooksPlatform { @@ -37,19 +37,9 @@ public static bool TryGetNormalizedPath(string path, out string normalizedPath, return WindowsFileSystem.TryGetNormalizedPathImplementation(path, out normalizedPath, out errorMessage); } - public static string GetUpgradeHighestAvailableVersionDirectory() - { - return WindowsPlatform.GetUpgradeHighestAvailableVersionDirectoryImplementation(); - } - public static string GetGitGuiBlockedMessage() { return "To access the 'git gui' in a GVFS repo, please invoke 'git-gui.exe' instead."; } - - public static string GetUpgradeReminderNotification() - { - return WindowsPlatform.GetUpgradeReminderNotificationImplementation(); - } } } diff --git a/GVFS/GVFS.Hooks/Program.cs b/GVFS/GVFS.Hooks/Program.cs index af84760803..4dc9aeb99e 100644 --- a/GVFS/GVFS.Hooks/Program.cs +++ b/GVFS/GVFS.Hooks/Program.cs @@ -1,4 +1,4 @@ -using GVFS.Common; +using GVFS.Common; using GVFS.Common.NamedPipes; using GVFS.Hooks.HooksPlatform; using System; @@ -65,8 +65,6 @@ public static void Main(string[] args) { RunLockRequest(args, unattended, ReleaseGVFSLock); } - - RunPostCommands(args, unattended); break; default: @@ -92,30 +90,6 @@ private static void RunPreCommands(string[] args) } } - private static void RunPostCommands(string[] args, bool unattended) - { - if (!unattended) - { - RemindUpgradeAvailable(); - } - } - - private static void RemindUpgradeAvailable() - { - // The idea is to generate a random number between 0 and 100. To make - // sure that the reminder is displayed only 10% of the times a git - // command is run, check that the random number is between 0 and 10, - // which will have a probability of 10/100 == 10%. - int reminderFrequency = 10; - int randomValue = random.Next(0, 100); - - if ((IsUpgradeMessageDeterministic() || randomValue <= reminderFrequency) && - ProductUpgraderInfo.IsLocalUpgradeAvailable(tracer: null, highestAvailableVersionDirectory: GVFSHooksPlatform.GetUpgradeHighestAvailableVersionDirectory())) - { - Console.WriteLine(Environment.NewLine + GVFSHooksPlatform.GetUpgradeReminderNotification()); - } - } - private static void ExitWithError(params string[] messages) { foreach (string message in messages) diff --git a/GVFS/GVFS.Hooks/Properties/AssemblyInfo.cs b/GVFS/GVFS.Hooks/Properties/AssemblyInfo.cs deleted file mode 100644 index 21669de01f..0000000000 --- a/GVFS/GVFS.Hooks/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.Hooks")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Hooks")] -[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("bda91ee5-c684-4fc5-a90a-b7d677421917")] diff --git a/GVFS/GVFS.Hooks/packages.config b/GVFS/GVFS.Hooks/packages.config deleted file mode 100644 index 119108d189..0000000000 --- a/GVFS/GVFS.Hooks/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Installer.Windows/GVFS.Installer.Windows.csproj b/GVFS/GVFS.Installer.Windows/GVFS.Installer.Windows.csproj deleted file mode 100644 index 0159c407e7..0000000000 --- a/GVFS/GVFS.Installer.Windows/GVFS.Installer.Windows.csproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893} - Library - Properties - GVFS.Installer.Windows - GVFS.Installer.Windows - v4.6.1 - 512 - - - - - true - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - - Microsoft400 - false - - - - - - - - Designer - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Installer.Windows/packages.config b/GVFS/GVFS.Installer.Windows/packages.config deleted file mode 100644 index 7635037a7b..0000000000 --- a/GVFS/GVFS.Installer.Windows/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Installers/GVFS.Installers.csproj b/GVFS/GVFS.Installers/GVFS.Installers.csproj new file mode 100644 index 0000000000..da65ffbe46 --- /dev/null +++ b/GVFS/GVFS.Installers/GVFS.Installers.csproj @@ -0,0 +1,58 @@ + + + + net461 + false + $(RepoOutPath)GVFS.Payload\bin\$(Configuration)\win-x64\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft400 + false + + + + + + + + + + + + + + + + + + + diff --git a/GVFS/GVFS.Installers/GVFS.Installers.template.nuspec b/GVFS/GVFS.Installers/GVFS.Installers.template.nuspec new file mode 100644 index 0000000000..8991bd81e0 --- /dev/null +++ b/GVFS/GVFS.Installers/GVFS.Installers.template.nuspec @@ -0,0 +1,15 @@ + + + + GVFS.Installers + $version$ + Microsoft + false + GVFS and G4W installers + + + + + + + diff --git a/GVFS/GVFS.Installer.Windows/Setup.iss b/GVFS/GVFS.Installers/Setup.iss similarity index 70% rename from GVFS/GVFS.Installer.Windows/Setup.iss rename to GVFS/GVFS.Installers/Setup.iss index 2b6525c3d2..f12f289fc8 100644 --- a/GVFS/GVFS.Installer.Windows/Setup.iss +++ b/GVFS/GVFS.Installers/Setup.iss @@ -3,23 +3,8 @@ ; General documentation on how to use InnoSetup scripts: http://www.jrsoftware.org/ishelp/index.php -#define PrjFltDir PackagesDir + "\" + ProjFSNativePackage + "\filter" -#define ProjFSNativeLibDir PackagesDir + "\" + ProjFSNativePackage + "\lib" -#define VCRuntimeDir PackagesDir + "\GVFS.VCRuntime.0.2.0-build\lib\x64" -#define GVFSDir BuildOutputDir + "\GVFS.Windows\bin\" + PlatformAndConfiguration -#define GVFSCommonDir BuildOutputDir + "\GVFS.Common\bin\" + PlatformAndConfiguration + "\netstandard2.0" -#define HooksDir BuildOutputDir + "\GVFS.Hooks.Windows\bin\" + PlatformAndConfiguration -#define HooksLoaderDir BuildOutputDir + "\GitHooksLoader\bin\" + PlatformAndConfiguration -#define ServiceDir BuildOutputDir + "\GVFS.Service.Windows\bin\" + PlatformAndConfiguration -#define ServiceUIDir BuildOutputDir + "\GVFS.Service.UI\bin\" + PlatformAndConfiguration -#define GVFSMountDir BuildOutputDir + "\GVFS.Mount.Windows\bin\" + PlatformAndConfiguration -#define ReadObjectDir BuildOutputDir + "\GVFS.ReadObjectHook.Windows\bin\" + PlatformAndConfiguration -#define VirtualFileSystemDir BuildOutputDir + "\GVFS.VirtualFileSystemHook.Windows\bin\" + PlatformAndConfiguration -#define PostIndexChangedDir BuildOutputDir + "\GVFS.PostIndexChangedHook.Windows\bin\" + PlatformAndConfiguration -#define GVFSUpgraderDir BuildOutputDir + "\GVFS.Upgrader\bin\" + PlatformAndConfiguration + "\net461" - #define MyAppName "GVFS" -#define MyAppInstallerVersion GetFileVersion(GVFSDir + "\GVFS.exe") +#define MyAppInstallerVersion GetFileVersion(LayoutDir + "\GVFS.exe") #define MyAppPublisher "Microsoft Corporation" #define MyAppPublisherURL "http://www.microsoft.com" #define MyAppURL "https://github.com/microsoft/VFSForGit" @@ -41,7 +26,7 @@ AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppPublisherURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} -AppCopyright=Copyright � Microsoft 2019 +AppCopyright=Copyright (c) Microsoft 2021 BackColor=clWhite BackSolid=yes DefaultDirName={pf}\{#MyAppName} @@ -53,14 +38,14 @@ SolidCompression=yes MinVersion=10.0.14374 DisableDirPage=yes DisableReadyPage=yes -SetupIconFile="{#GVFSDir}\GitVirtualFileSystem.ico" +SetupIconFile="{#LayoutDir}\GitVirtualFileSystem.ico" ArchitecturesInstallIn64BitMode=x64 ArchitecturesAllowed=x64 WizardImageStretch=no WindowResizable=no CloseApplications=yes ChangesEnvironment=yes -RestartIfNeededByRun=yes +RestartIfNeededByRun=yes [Languages] Name: "english"; MessagesFile: "compiler:Default.isl"; @@ -75,113 +60,8 @@ Name: "full"; Description: "Full installation"; Flags: iscustom; Type: files; Name: "{app}\ucrtbase.dll" [Files] -; PrjFlt Filter Files -DestDir: "{app}\Filter"; Flags: ignoreversion; Source:"{#PrjFltDir}\PrjFlt.sys" -DestDir : "{app}\Filter"; Flags: ignoreversion; Source: "{#PrjFltDir}\prjflt.inf" - -; PrjFlt Native Library Files, the GVFS.Service will copy these files into the {app} directory if needed -DestDir: "{app}\ProjFS"; Flags: ignoreversion; Source:"{#ProjFSNativeLibDir}\ProjectedFSLib.dll" - -; PrjFlt Managed Assembly Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\ProjectedFSLib.Managed.dll" - -; GitHooks Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#HooksDir}\GVFS.Hooks.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#HooksDir}\GVFS.Hooks.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#HooksDir}\GVFS.Hooks.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#HooksLoaderDir}\GitHooksLoader.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#HooksLoaderDir}\GitHooksLoader.exe" - -; GVFS.Common Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSCommonDir}\git2.dll" - -; GVFS.Mount Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSMountDir}\GVFS.Mount.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSMountDir}\GVFS.Mount.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSMountDir}\GVFS.Mount.exe.config" - -; GVFS.Upgrader Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSUpgraderDir}\GVFS.Upgrader.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSUpgraderDir}\GVFS.Upgrader.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSUpgraderDir}\GVFS.Upgrader.exe.config" - -; GVFS.ReadObjectHook files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ReadObjectDir}\GVFS.ReadObjectHook.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ReadObjectDir}\GVFS.ReadObjectHook.exe" - -; GVFS.VirtualFileSystemHook files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#VirtualFileSystemDir}\GVFS.VirtualFileSystemHook.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#VirtualFileSystemDir}\GVFS.VirtualFileSystemHook.exe" - -; GVFS.PostIndexChangedHook files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#PostIndexChangedDir}\GVFS.PostIndexChangedHook.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#PostIndexChangedDir}\GVFS.PostIndexChangedHook.exe" - -; Cpp Dependencies -DestDir: "{app}"; Flags: ignoreversion; Source:"{#VCRuntimeDir}\msvcp140.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#VCRuntimeDir}\msvcp140_1.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#VCRuntimeDir}\msvcp140_2.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#VCRuntimeDir}\vcruntime140.dll" - -; GVFS PDB's -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Esent.Collections.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Esent.Interop.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Esent.Isam.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.Common.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.GVFlt.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.Virtualization.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.Platform.Windows.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.pdb" - -; GVFS.Service.UI Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\GVFS.Service.UI.exe" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\GVFS.Service.UI.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\GVFS.Service.UI.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\GitVirtualFileSystem.ico" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceUIDir}\System.Runtime.dll" - -; GVFS Files -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\CommandLine.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Esent.Collections.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Esent.Interop.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Esent.Isam.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Microsoft.Data.Sqlite.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\SQLitePCLRaw.batteries_green.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\SQLitePCLRaw.batteries_v2.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\SQLitePCLRaw.core.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\SQLitePCLRaw.provider.e_sqlite3.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\x64\e_sqlite3.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.Common.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.GVFlt.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.Virtualization.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.Platform.Windows.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\Newtonsoft.Json.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\ICSharpCode.SharpZipLib.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GitVirtualFileSystem.ico" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\GVFS.exe" - -; NuGet support DLLs -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Commands.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Common.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Configuration.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Frameworks.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Packaging.Core.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Packaging.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Protocol.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\NuGet.Versioning.dll" - -; .NET Standard Files -; See https://github.com/dotnet/standard/issues/415 for a discussion on why this are copied -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\netstandard.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\System.Net.Http.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\System.ValueTuple.dll" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#GVFSDir}\System.IO.Compression.dll" - -; GVFS.Service Files and PDB's -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceDir}\GVFS.Service.pdb" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceDir}\GVFS.Service.exe.config" -DestDir: "{app}"; Flags: ignoreversion; Source:"{#ServiceDir}\GVFS.Service.exe"; AfterInstall: InstallGVFSService +DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Source:"{#LayoutDir}\*" +DestDir: "{app}"; Flags: ignoreversion; Source:"{#LayoutDir}\GVFS.Service.exe"; AfterInstall: InstallGVFSService [Dirs] Name: "{app}\ProgramData\{#ServiceName}"; Permissions: users-readexec @@ -221,7 +101,7 @@ begin exit; end; // look for the path with leading and trailing semicolon - // Pos() returns 0 if not found + // Pos() returns 0 if not found Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0; end; @@ -336,11 +216,11 @@ var InstallSuccessful: Boolean; begin InstallSuccessful := False; - + StatusText := WizardForm.StatusLabel.Caption; WizardForm.StatusLabel.Caption := 'Installing GVFS.Service.'; WizardForm.ProgressGauge.Style := npbstMarquee; - + try if Exec(ExpandConstant('{sys}\SC.EXE'), ExpandConstant('create GVFS.Service binPath="{app}\GVFS.Service.exe" start=auto'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0) then begin @@ -369,7 +249,11 @@ procedure StartGVFSServiceUI(); var ResultCode: integer; begin - if ExecAsOriginalUser(ExpandConstant('{app}\GVFS.Service.UI.exe'), '', '', SW_HIDE, ewNoWait, ResultCode) then + if GetEnv('GVFS_UNATTENDED') = '1' then + begin + Log('StartGVFSServiceUI: Skipping launching GVFS.Service.UI'); + end + else if ExecAsOriginalUser(ExpandConstant('{app}\GVFS.Service.UI.exe'), '', '', SW_HIDE, ewNoWait, ResultCode) then begin Log('StartGVFSServiceUI: Successfully launched GVFS.Service.UI'); end @@ -468,7 +352,7 @@ begin StatusText := WizardForm.StatusLabel.Caption; WizardForm.StatusLabel.Caption := 'Uninstalling PrjFlt Driver.'; WizardForm.ProgressGauge.Style := npbstMarquee; - + Log('UninstallNonInboxProjFS: Uninstalling ProjFS'); try UninstallService('prjflt', False); @@ -477,7 +361,7 @@ begin if DeleteFileIfItExists(ExpandConstant('{sys}\drivers\prjflt.sys')) then begin Result := True; - end; + end; end; finally WizardForm.StatusLabel.Caption := StatusText; @@ -493,7 +377,7 @@ begin if FileExists(ExpandConstant('{app}\Filter\PrjFlt.inf')) and FileExists(ExpandConstant('{sys}\drivers\prjflt.sys')) then begin UninstallSuccessful := False; - + if Exec('powershell.exe', '-NoProfile "$var=(Get-WindowsOptionalFeature -Online -FeatureName Client-ProjFS); if($var -eq $null){exit 2}else{if($var.State -eq ''Enabled''){exit 3}else{exit 4}}"', '', SW_HIDE, ewWaitUntilTerminated, ProjFSFeatureEnabledResultCode) then begin if ProjFSFeatureEnabledResultCode = 2 then @@ -525,7 +409,7 @@ begin end; end; end; - + if UninstallSuccessful = False then begin RaiseException('Fatal: An error occured while uninstalling ProjFS.'); @@ -588,7 +472,7 @@ begin ExecWithResult(ExpandConstant('{app}') + '\gvfs.exe', 'service --mount-all', '', SW_HIDE, ewWaitUntilTerminated, ResultCode, MountOutput); WizardForm.StatusLabel.Caption := StatusText; WizardForm.ProgressGauge.Style := npbstNormal; - + // 4 = ReturnCode.FilterError if (ResultCode = 4) then begin @@ -770,7 +654,7 @@ begin SetIfNotConfigured('upgrade.feedpackagename', FeedPackageName); end; -// Below are EVENT FUNCTIONS -> The main entry points of InnoSetup into the code region +// Below are EVENT FUNCTIONS -> The main entry points of InnoSetup into the code region // Documentation : http://www.jrsoftware.org/ishelp/index.php?topic=scriptevents function InitializeUninstall(): Boolean; diff --git a/GVFS/GVFS.Installers/info.bat b/GVFS/GVFS.Installers/info.bat new file mode 100644 index 0000000000..335fc269e7 --- /dev/null +++ b/GVFS/GVFS.Installers/info.bat @@ -0,0 +1,68 @@ +@ECHO OFF +SETLOCAL + +SET SYS_PRJFLT=C:\Windows\System32\drivers\prjflt.sys +SET SYS_PROJFSLIB=C:\Windows\System32\ProjectedFSLib.dll +SET VFS_PROJFSLIB=C:\Program Files\GVFS\ProjectedFSLib.dll +SET VFS_BUND_PRJFLT=C:\Program Files\GVFS\Filter\PrjFlt.sys +SET VFS_BUND_PROJFSLIB=C:\Program Files\GVFS\ProjFS\ProjectedFSLib.dll +SET VFS_EXEC=C:\Program Files\GVFS\GVFS.exe +SET GIT_EXEC=C:\Program Files\Git\cmd\git.exe + +ECHO Checking ProjFS Windows feature... +powershell -Command "Get-WindowsOptionalFeature -Online -FeatureName Client-ProjFS" + +ECHO Checking ProjFS and GVFS services... +ECHO GVFS.Service: +sc query GVFS.Service + +ECHO Test.GVFS.Service: +sc query Test.GVFS.Service + +ECHO prjflt: +sc query prjflt + +ECHO Checking ProjFS files... +IF EXIST "%SYS_PRJFLT%" ( + ECHO [ FOUND ] %SYS_PRJFLT% +) ELSE ( + ECHO [MISSING] %SYS_PRJFLT% +) + +IF EXIST "%SYS_PROJFSLIB%" ( + ECHO [ FOUND ] %SYS_PROJFSLIB% +) ELSE ( + ECHO [MISSING] %SYS_PROJFSLIB% +) + +IF EXIST "%VFS_PROJFSLIB%" ( + ECHO [ FOUND ] %VFS_PROJFSLIB% +) ELSE ( + ECHO [MISSING] %VFS_PROJFSLIB% +) + +IF EXIST "%VFS_BUND_PRJFLT%" ( + ECHO [ FOUND ] %VFS_BUND_PRJFLT% +) ELSE ( + ECHO [MISSING] %VFS_BUND_PRJFLT% +) + +IF EXIST "%VFS_BUND_PROJFSLIB%" ( + ECHO [ FOUND ] %VFS_BUND_PROJFSLIB% +) ELSE ( + ECHO [MISSING] %VFS_BUND_PROJFSLIB% +) + +ECHO. +ECHO Print product versions... +IF EXIST "%VFS_EXEC%" ( + "%VFS_EXEC%" version +) ELSE ( + ECHO GVFS not installed at %VFS_EXEC% +) + +IF EXIST "%GIT_EXEC%" ( + "%GIT_EXEC%" version +) ELSE ( + ECHO Git not installed at %GIT_EXEC% +) diff --git a/GVFS/GVFS.Installers/install.bat b/GVFS/GVFS.Installers/install.bat new file mode 100644 index 0000000000..fb92991537 --- /dev/null +++ b/GVFS/GVFS.Installers/install.bat @@ -0,0 +1,19 @@ +@ECHO OFF +SETLOCAL + +REM Lookup full paths to Git and VFS for Git installers +FOR /F "tokens=* USEBACKQ" %%F IN ( `where /R %~dp0 Git*.exe` ) DO SET GIT_INSTALLER=%%F +FOR /F "tokens=* USEBACKQ" %%F IN ( `where /R %~dp0 SetupGVFS*.exe` ) DO SET GVFS_INSTALLER=%%F + +REM Create new empty directory for logs +SET LOGDIR=%~dp0\logs +IF EXIST %LOGDIR% ( + rmdir /S /Q %LOGDIR% +) +mkdir %LOGDIR% + +ECHO Installing Git for Windows... +%GIT_INSTALLER% /LOG="%LOGDIR%\git.log" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /ALLOWDOWNGRADE=1 + +ECHO Installing VFS for Git... +%GVFS_INSTALLER% /LOG="%LOGDIR%\gvfs.log" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART diff --git a/GVFS/GVFS.MSBuild/CompileTemplatedFile.cs b/GVFS/GVFS.MSBuild/CompileTemplatedFile.cs new file mode 100644 index 0000000000..a9c3df72cb --- /dev/null +++ b/GVFS/GVFS.MSBuild/CompileTemplatedFile.cs @@ -0,0 +1,88 @@ +using System; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace GVFS.MSBuild +{ + public class CompileTemplatedFile : Task + { + [Required] + public ITaskItem Template { get; set; } + + [Required] + public string OutputFile { get; set; } + + [Output] + public ITaskItem CompiledTemplate { get; set; } + + public override bool Execute() + { + string templateFilePath = this.Template.ItemSpec; + IDictionary properties = ParseProperties(this.Template.GetMetadata("Properties")); + + string outputFileDirectory = Path.GetDirectoryName(this.OutputFile); + + if (!File.Exists(templateFilePath)) + { + this.Log.LogError("Failed to find template file '{0}'.", templateFilePath); + return false; + } + + // Copy the template to the destination to keep the same file mode bits/ACLs as the template + File.Copy(templateFilePath, this.OutputFile, true); + + this.Log.LogMessage(MessageImportance.Low, "Reading template contents"); + string template = File.ReadAllText(this.OutputFile); + + this.Log.LogMessage(MessageImportance.Normal, "Compiling template '{0}'", templateFilePath); + string compiled = Compile(template, properties); + + if (!Directory.Exists(outputFileDirectory)) + { + this.Log.LogMessage(MessageImportance.Low, "Creating output directory '{0}'", outputFileDirectory); + Directory.CreateDirectory(outputFileDirectory); + } + + this.Log.LogMessage(MessageImportance.Normal, "Writing compiled template to '{0}'", this.OutputFile); + File.WriteAllText(this.OutputFile, compiled); + + this.CompiledTemplate = new TaskItem(this.OutputFile, this.Template.CloneCustomMetadata()); + + return true; + } + + private IDictionary ParseProperties(string propertiesStr) + { + string[] properties = propertiesStr?.Split(';') ?? new string[0]; + var dict = new Dictionary(); + + foreach (string propertyStr in properties) + { + string[] kvp = propertyStr.Split(new[] {'='}, count: 2); + if (kvp.Length > 1) + { + string key = kvp[0].Trim(); + dict[key] = kvp[1].Trim(); + } + } + + return dict; + } + + private string Compile(string template, IDictionary properties) + { + var sb = new StringBuilder(template); + + foreach (var kvp in properties) + { + this.Log.LogMessage(MessageImportance.Low, "Replacing \"{0}\" -> \"{1}\"", kvp.Key, kvp.Value); + sb.Replace(kvp.Key, kvp.Value); + } + + return sb.ToString(); + } + } +} diff --git a/GVFS/GVFS.MSBuild/GVFS.MSBuild.csproj b/GVFS/GVFS.MSBuild/GVFS.MSBuild.csproj new file mode 100644 index 0000000000..1505e24e07 --- /dev/null +++ b/GVFS/GVFS.MSBuild/GVFS.MSBuild.csproj @@ -0,0 +1,13 @@ + + + + netstandard2.0 + false + + + + + + + + diff --git a/GVFS/GVFS.MSBuild/GVFS.targets b/GVFS/GVFS.MSBuild/GVFS.targets new file mode 100644 index 0000000000..53859d6e62 --- /dev/null +++ b/GVFS/GVFS.MSBuild/GVFS.targets @@ -0,0 +1,34 @@ + + + + + + + $(IntermediateOutputPath)app.manifest + + + + + + + + + + + + + + + + + + diff --git a/GVFS/GVFS.MSBuild/GVFS.tasks b/GVFS/GVFS.MSBuild/GVFS.tasks new file mode 100644 index 0000000000..b9e9b35aed --- /dev/null +++ b/GVFS/GVFS.MSBuild/GVFS.tasks @@ -0,0 +1,31 @@ + + + <_TaskAssembly>$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll + <_TaskFactory>CodeTaskFactory + + + <_TaskAssembly>$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll + <_TaskFactory>RoslynCodeTaskFactory + + + + + + + + + + + + + + + + + + + + + + + diff --git a/GVFS/GVFS.MSBuild/GenerateGVFSConstants.cs b/GVFS/GVFS.MSBuild/GenerateGVFSConstants.cs new file mode 100644 index 0000000000..bb831584d7 --- /dev/null +++ b/GVFS/GVFS.MSBuild/GenerateGVFSConstants.cs @@ -0,0 +1,102 @@ +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.IO; +using System.Text.RegularExpressions; + +namespace GVFS.MSBuild +{ + public class GenerateGVFSConstants : Task + { + [Required] + public string MinimumGitVersion { get; set; } + + [Required] + public string LibGit2FileName { get; set; } + + [Required] + public string OutputFile { get; set; } + + public override bool Execute() + { + this.Log.LogMessage(MessageImportance.Normal, + "Creating GVFS constants file with minimum Git version '{0}' at '{1}'...", + this.MinimumGitVersion, this.OutputFile); + + if (!TryParseVersion(this.MinimumGitVersion, out var version)) + { + this.Log.LogError("Failed to parse Git version '{0}'.", this.MinimumGitVersion); + return false; + } + + string outputDirectory = Path.GetDirectoryName(this.OutputFile); + if (!Directory.Exists(outputDirectory)) + { + Directory.CreateDirectory(outputDirectory); + } + + string template = +@"// +// This file is auto-generated by Scalar.Build.GenerateScalarConstants. +// Any changes made directly in this file will be lost. +// +using GVFS.Common.Git; + +namespace GVFS.Common +{{ + public static partial class GVFSConstants + {{ + public static readonly GitVersion SupportedGitVersion = new GitVersion({0}, {1}, {2}, ""{3}"", {4}, {5}); + public const string LibGit2LibraryName = ""{6}""; + }} +}}"; + + File.WriteAllText( + this.OutputFile, + string.Format( + template, + version.Major, + version.Minor, + version.Build, + version.Platform, + version.Revision, + version.MinorRevision, + this.LibGit2FileName)); + + return true; + } + + private static bool TryParseVersion(string versionString, out GitVersion version) + { + const string pattern = @"(\d+)\.(\d+)\.(\d+)\.([A-Z]+)\.(\d+)\.(\d+)"; + + Match match = Regex.Match(versionString, pattern, RegexOptions.IgnoreCase); + if (match.Success) + { + version = new GitVersion + { + Major = int.Parse(match.Groups[1].Value), + Minor = int.Parse(match.Groups[2].Value), + Build = int.Parse(match.Groups[3].Value), + Platform = match.Groups[4].Value, + Revision = int.Parse(match.Groups[5].Value), + MinorRevision = int.Parse(match.Groups[6].Value) + }; + + return true; + } + + version = default(GitVersion); + return false; + } + + private struct GitVersion + { + public int Major { get; set; } + public int Minor { get; set; } + public int Build { get; set; } + public string Platform { get; set; } + public int Revision { get; set; } + public int MinorRevision { get; set; } + } + } +} \ No newline at end of file diff --git a/GVFS/GVFS.MSBuild/GenerateGVFSVersionHeader.cs b/GVFS/GVFS.MSBuild/GenerateGVFSVersionHeader.cs new file mode 100644 index 0000000000..a6dcec9367 --- /dev/null +++ b/GVFS/GVFS.MSBuild/GenerateGVFSVersionHeader.cs @@ -0,0 +1,48 @@ +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using System.IO; + +namespace GVFS.MSBuild +{ + public class GenerateGVFSVersionHeader : Task + { + [Required] + public string Version { get; set; } + + [Required] + public string OutputFile { get; set; } + + public override bool Execute() + { + this.Log.LogMessage(MessageImportance.Normal, + "Creating GVFS version header file with version '{0}' at '{1}'...", + this.Version, this.OutputFile); + + string outputDirectory = Path.GetDirectoryName(this.OutputFile); + if (!Directory.Exists(outputDirectory)) + { + Directory.CreateDirectory(outputDirectory); + } + + string template = +@"/* + * This file is auto-generated by GVFS.MSBuild.GenerateGVFSVersionHeader. + * Any changes made directly in this file will be lost. + */ +#define GVFS_FILE_VERSION {1} +#define GVFS_FILE_VERSION_STRING ""{0}"" +#define GVFS_PRODUCT_VERSION {1} +#define GVFS_PRODUCT_VERSION_STRING ""{0}"" +"; + + File.WriteAllText( + this.OutputFile, + string.Format( + template, + this.Version, + this.Version?.Replace('.',','))); + + return true; + } + } +} \ No newline at end of file diff --git a/GVFS/GVFS.Build/GenerateApplicationManifests.cs b/GVFS/GVFS.MSBuild/GenerateWindowsAppManifest.cs similarity index 75% rename from GVFS/GVFS.Build/GenerateApplicationManifests.cs rename to GVFS/GVFS.MSBuild/GenerateWindowsAppManifest.cs index 296dd39833..fc16070024 100644 --- a/GVFS/GVFS.Build/GenerateApplicationManifests.cs +++ b/GVFS/GVFS.MSBuild/GenerateWindowsAppManifest.cs @@ -2,9 +2,9 @@ using Microsoft.Build.Utilities; using System.IO; -namespace GVFS.PreBuild +namespace GVFS.MSBuild { - public class GenerateApplicationManifests : Task + public class GenerateWindowsAppManifest : Task { [Required] public string Version { get; set; } @@ -13,13 +13,13 @@ public class GenerateApplicationManifests : Task public string ApplicationName { get; set; } [Required] - public string ManifestPath { get; set; } + public string OutputFile { get; set; } public override bool Execute() { - this.Log.LogMessage(MessageImportance.High, "Creating application manifest file for {0}", ApplicationName); + this.Log.LogMessage(MessageImportance.Normal, "Creating application manifest file for '{0}'...", this.ApplicationName); - string manifestDirectory = Path.GetDirectoryName(this.ManifestPath); + string manifestDirectory = Path.GetDirectoryName(this.OutputFile); if (!Directory.Exists(manifestDirectory)) { Directory.CreateDirectory(manifestDirectory); @@ -28,9 +28,9 @@ public override bool Execute() // Any application that calls GetVersionEx must have an application manifest in order to get an accurate response. // See https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx for details File.WriteAllText( - this.ManifestPath, + this.OutputFile, string.Format( -@" + @" @@ -47,5 +47,4 @@ public override bool Execute() return true; } } -} - +} \ No newline at end of file diff --git a/GVFS/GVFS.Mount/GVFS.Mount.Windows.csproj b/GVFS/GVFS.Mount/GVFS.Mount.Windows.csproj deleted file mode 100644 index 677a482acf..0000000000 --- a/GVFS/GVFS.Mount/GVFS.Mount.Windows.csproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} - Exe - Properties - GVFS.Mount - GVFS.Mount - v4.6.1 - 512 - true - - - - - x64 - true - full - false - DEBUG;TRACE - prompt - 4 - false - - - x64 - pdbonly - TRACE - true - prompt - 4 - - - - False - ..\..\..\packages\CommandLineParser.2.1.1-beta\lib\net45\CommandLine.dll - True - - - ..\..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - False - ..\..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - False - ..\..\..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll - True - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - PlatformLoader.Windows.cs - - - - - - - - - - - Designer - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - GVFS.Platform.Windows - - - {f468b05a-95e5-46bc-8c67-b80a78527b7d} - GVFS.Virtualization - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - xcopy /Y $(BuildOutputDir)\GVFS.ReadObjectHook.Windows\bin\$(Platform)\$(Configuration)\GVFS.ReadObjectHook.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GVFS.VirtualFileSystemHook.Windows\bin\$(Platform)\$(Configuration)\GVFS.VirtualFileSystemHook.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GVFS.PostIndexChangedHook.Windows\bin\$(Platform)\$(Configuration)\GVFS.PostIndexChangedHook.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GVFS.Hooks.Windows\bin\$(Platform)\$(Configuration)\GVFS.Hooks.* $(TargetDir) - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Mount/GVFS.Mount.csproj b/GVFS/GVFS.Mount/GVFS.Mount.csproj new file mode 100644 index 0000000000..b770e6f99c --- /dev/null +++ b/GVFS/GVFS.Mount/GVFS.Mount.csproj @@ -0,0 +1,22 @@ + + + + Exe + net461 + + + + + false + Content + PreserveNewest + Build;DebugSymbolsProjectOutputGroup + + + + + + + + + diff --git a/GVFS/GVFS.Mount/Properties/AssemblyInfo.cs b/GVFS/GVFS.Mount/Properties/AssemblyInfo.cs deleted file mode 100644 index cd83cf8c2b..0000000000 --- a/GVFS/GVFS.Mount/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.Mount")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Mount")] -[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("b8c1dfbd-cafd-4f7e-a1a3-e11907b5467b")] diff --git a/GVFS/GVFS.Mount/app.config b/GVFS/GVFS.Mount/app.config deleted file mode 100644 index 1da8c9b53a..0000000000 --- a/GVFS/GVFS.Mount/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/GVFS/GVFS.Mount/packages.config b/GVFS/GVFS.Mount/packages.config deleted file mode 100644 index 7b9c65be5c..0000000000 --- a/GVFS/GVFS.Mount/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.NativeHooks.Common/common.posix.cpp b/GVFS/GVFS.NativeHooks.Common/common.posix.cpp deleted file mode 100644 index 7e982aadd2..0000000000 --- a/GVFS/GVFS.NativeHooks.Common/common.posix.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include "stdafx.h" - -#include -#include -#include -#include -#include -#include - -#include "common.h" - -#define MAX_PATH 260 - -PATH_STRING GetFinalPathName(const PATH_STRING& path) -{ - // TODO(#1358): Implement - return path; -} - -PATH_STRING GetGVFSPipeName(const char *appName) -{ - // The pipe name is built using the path of the GVFS enlistment root. - // Start in the current directory and walk up the directory tree - // until we find a folder that contains the ".gvfs" folder - - // TODO 640838: Support paths longer than MAX_PATH - char enlistmentRoot[MAX_PATH]; - if (getcwd(enlistmentRoot, MAX_PATH) == nullptr) - { - die(ReturnCode::GetCurrentDirectoryFailure, "getcwd failed (%d)\n", errno); - } - - PATH_STRING finalRootPath(GetFinalPathName(enlistmentRoot)); - size_t enlistmentRootLength = finalRootPath.length(); - // allow an extra byte in case we need to add a trailing slash - if (enlistmentRootLength + 2 > sizeof(enlistmentRoot)) - { - die(ReturnCode::PipeConnectError, - "Could not copy finalRootPath: %s, insufficient buffer. enlistmentRootLength: %zu, sizeof(enlistmentRoot): %zu\n", - finalRootPath.c_str(), - enlistmentRootLength, - sizeof(enlistmentRoot)); - } - - memcpy(enlistmentRoot, finalRootPath.c_str(), enlistmentRootLength); - if (enlistmentRootLength == 0 || enlistmentRoot[enlistmentRootLength - 1] != '/') - { - enlistmentRoot[enlistmentRootLength++] = '/'; - } - enlistmentRoot[enlistmentRootLength] = '\0'; - - // Walk up enlistmentRoot looking for a folder named .gvfs - char* lastslash = enlistmentRoot + enlistmentRootLength - 1; - bool gvfsFound = false; - while (1) - { - *lastslash = '\0'; - DIR* directory = opendir(enlistmentRoot); - if (directory == nullptr) - { - die(ReturnCode::NotInGVFSEnlistment, "Failed to open directory: %s, error: %d\n", enlistmentRoot, errno); - } - - dirent* dirEntry = readdir(directory); - while (!gvfsFound && dirEntry != nullptr) - { - if (dirEntry->d_type == DT_DIR && strcmp(dirEntry->d_name, ".gvfs") == 0) - { - gvfsFound = true; - } - else - { - dirEntry = readdir(directory); - } - } - - closedir(directory); - - if (gvfsFound) - { - break; - } - - if (errno != 0) - { - die(ReturnCode::NotInGVFSEnlistment, "readdir failed in directory: %s, error: %i\n", enlistmentRoot, errno); - } - - lastslash--; - while ((enlistmentRoot != lastslash) && (*lastslash != '/')) - { - lastslash--; - } - - if (enlistmentRoot == lastslash) - { - die(ReturnCode::NotInGVFSEnlistment, "%s must be run from inside a GVFS enlistment\n", appName); - } - - *(lastslash + 1) = 0; - }; - - *(lastslash) = 0; - - return PATH_STRING(enlistmentRoot) + "/.gvfs/GVFS_NetCorePipe"; -} - -PIPE_HANDLE CreatePipeToGVFS(const PATH_STRING& pipeName) -{ - PIPE_HANDLE socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); - if (socket_fd < 0) - { - die(ReturnCode::PipeConnectError, "Failed to create a new socket, pipeName: %s, error: %d\n", pipeName.c_str(), errno); - } - - struct sockaddr_un socket_address; - memset(&socket_address, 0, sizeof(struct sockaddr_un)); - - socket_address.sun_family = AF_UNIX; - size_t pathLength = pipeName.length(); - if (pathLength + 1 > sizeof(socket_address.sun_path)) - { - die(ReturnCode::PipeConnectError, - "Could not copy pipeName: %s, insufficient buffer. pathLength: %zu, sizeof(socket_address.sun_path): %zu\n", - pipeName.c_str(), - pathLength, - sizeof(socket_address.sun_path)); - } - - memcpy(socket_address.sun_path, pipeName.c_str(), pathLength); - socket_address.sun_path[pathLength] = '\0'; - - if(connect(socket_fd, (struct sockaddr *) &socket_address, sizeof(struct sockaddr_un)) != 0) - { - die(ReturnCode::PipeConnectError, "Failed to connect socket, pipeName: %s, error: %d\n", pipeName.c_str(), errno); - } - - return socket_fd; -} - -void DisableCRLFTranslationOnStdPipes() -{ - // not required on Mac -} - -bool WriteToPipe(PIPE_HANDLE pipe, const char* message, size_t messageLength, /* out */ size_t* bytesWritten, /* out */ int* error) -{ - - size_t bytesRemaining = messageLength; - while (bytesRemaining > 0) - { - size_t offset = messageLength - bytesRemaining; - ssize_t bytesSent = write(pipe, message + offset, bytesRemaining); - - if (-1 == bytesSent) - { - if (EINTR != errno) - { - break; - } - } - else - { - bytesRemaining -= bytesSent; - } - } - - *bytesWritten = messageLength - bytesRemaining; - - bool success = *bytesWritten == messageLength; - *error = success ? 0 : errno; - return success; -} - -bool ReadFromPipe(PIPE_HANDLE pipe, char* buffer, size_t bufferLength, /* out */ size_t* bytesRead, /* out */ int* error) -{ - *error = 0; - *bytesRead = 0; - ssize_t readByteCount; - - do - { - readByteCount = recv(pipe, buffer, bufferLength, 0); - } while (readByteCount == -1 && errno == EINTR); - - if (readByteCount < 0) - { - *error = errno; - return false; - } - - *bytesRead = readByteCount; - return true; -} diff --git a/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj b/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj index f08d118aaf..87352d6112 100644 --- a/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj +++ b/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj @@ -1,5 +1,8 @@ + + GVFS.ProjFS.2019.411.1 + Debug @@ -14,21 +17,19 @@ {3771C555-B5C1-45E2-B8B7-2CEF1619CDC5} Win32Proj GVFSNativeTests - 10.0.10240.0 + 10.0.16299.0 - - DynamicLibrary true - v141 + v142 NotSet DynamicLibrary false - v141 + v142 true NotSet @@ -58,13 +59,13 @@ _DEBUG;_WINDOWS;_USRDLL;GVFSNATIVETESTS_EXPORTS;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\$(Projectname)\include;$(SolutionDir)\GVFS\$(Projectname)\interface;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;$(MSBuildProjectDirectory)\include;$(MSBuildProjectDirectory)\interface;%(AdditionalIncludeDirectories) Windows true ProjectedFSLib.lib;fltlib.lib;Shlwapi.lib;%(AdditionalDependencies) - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;$(PackagesDir)\$(ProjFSNativePackage)\lib + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;$(BuildPackagesPath)$(ProjFSNativePackage)\lib @@ -77,7 +78,7 @@ NDEBUG;_WINDOWS;_USRDLL;GVFSNATIVETESTS_EXPORTS;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\$(Projectname)\include;$(SolutionDir)\GVFS\$(Projectname)\interface;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;$(MSBuildProjectDirectory)\include;$(MSBuildProjectDirectory)\interface;%(AdditionalIncludeDirectories) Windows @@ -85,7 +86,7 @@ true true ProjectedFSLib.lib;fltlib.lib;Shlwapi.lib;%(AdditionalDependencies) - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;$(PackagesDir)\$(ProjFSNativePackage)\lib + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;$(BuildPackagesPath)$(ProjFSNativePackage)\lib @@ -151,7 +152,8 @@ Create + + + - - - + \ No newline at end of file diff --git a/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj.filters b/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj.filters index 78765fc3c5..4dfa38544d 100644 --- a/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj.filters +++ b/GVFS/GVFS.NativeTests/GVFS.NativeTests.vcxproj.filters @@ -160,4 +160,7 @@ source + + + \ No newline at end of file diff --git a/GVFS/GVFS.NativeTests/packages.config b/GVFS/GVFS.NativeTests/packages.config new file mode 100644 index 0000000000..0dac1a4251 --- /dev/null +++ b/GVFS/GVFS.NativeTests/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSForGitNotification.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSForGitNotification.h deleted file mode 100644 index f1978445f6..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSForGitNotification.h +++ /dev/null @@ -1,30 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -extern NSString * const KnownMessagePrefix; - -typedef NS_ENUM(NSInteger, Identifier) -{ - AutomountStart, - MountSuccess, - MountFailure, - UpgradeAvailable, - UnknownMessage -}; - -@interface VFSForGitNotification : NSObject - -@property (assign, readonly) Identifier identifier; -@property (copy, readonly) NSString *title; -@property (copy, readonly) NSString *actionTitle; -@property (copy, readonly) NSString *message; -@property (copy, readonly) NSString *gvfsCommand; -@property (assign, readonly) BOOL actionable; - -+ (BOOL)tryValidateMessage:(NSDictionary *)jsonMessage - buildNotification:(VFSForGitNotification *_Nullable *_Nonnull)notification - error:(NSError *__autoreleasing *)error; -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSForGitNotification.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSForGitNotification.m deleted file mode 100644 index bff539dda6..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSForGitNotification.m +++ /dev/null @@ -1,280 +0,0 @@ -#import "VFSForGitNotification.h" -#import "VFSNotificationErrors.h" - -NSString * const IdentifierKey = @"Id"; -NSString * const EnlistmentKey = @"Enlistment"; -NSString * const EnlistmentCountKey = @"EnlistmentCount"; -NSString * const NewUpgradeVersionKey = @"NewVersion"; -NSString * const TitleKey = @"Title"; -NSString * const ActionTitleKey = @"ActionTitle"; -NSString * const IsActionableKey = @"IsActionable"; -NSString * const MessageKey = @"Message"; -NSString * const GVFSCommandKey = @"GVFSCommand"; - -NSString * const AutomountTitle = @"GVFS AutoMount"; -NSString * const MountGVFSCommandFormat = @"gvfs mount %@"; -NSString * const MountActionTitle = @"Retry"; -NSString * const AutomountStartMessageFormat = @"Attempting to mount %lu GVFS repos(s)"; -NSString * const AutomountSuccessMessageFormat = @"The following GVFS repo is now mounted: \n%@"; -NSString * const AutomountFailureMessageFormat = @"The following GVFS repo failed to mount: \n%@"; - -NSString * const UpgradeAvailableTitleFormat = @"New version %@ is available"; -NSString * const UpgradeAvailableMessage = @"Upgrade will unmount and remount gvfs repos, ensure you are at a stopping point.\nWhen ready, click Upgrade button to run upgrade."; -NSString * const UpgradeActionTitle = @"Upgrade"; -NSString * const UpgradeGVFSCommandFormat = @"sudo gvfs upgrade --confirm"; - -@interface VFSForGitNotification() - -@property (readwrite) Identifier identifier; -@property (readwrite) NSString *title; -@property (readwrite) NSString *message; -@property (readwrite) NSString *actionTitle; -@property (readwrite) NSString *gvfsCommand; -@property (readwrite) BOOL actionable; - -NS_ASSUME_NONNULL_BEGIN - -- (instancetype _Nullable)initAsMountSuccessWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error; - -- (instancetype _Nullable)initAsMountFailureWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error; - -- (instancetype _Nullable)initAsMountWithMessage:(NSDictionary *)messageDict - title:(NSString *)title - messageFormat:(NSString *)messageFormat - actionFormat:(NSString * _Nullable)commandFormat - error:(NSError *__autoreleasing *)error; - -- (instancetype)initAsUpgradeAvailableWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error; -NS_ASSUME_NONNULL_END - -@end - -@implementation VFSForGitNotification - -+ (BOOL)tryValidateMessage:(NSDictionary *)jsonMessage - buildNotification:(VFSForGitNotification **)notification - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(notification); - NSParameterAssert(jsonMessage); - - id identifier = jsonMessage[IdentifierKey]; - if (![identifier isKindOfClass:[NSNumber class]]) - { - if (error != nil) - { - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitInvalidMessageIdFormatError - userInfo:@{ NSLocalizedDescriptionKey : @"Unexpected message id/format)" }]; - } - - return NO; - } - - Identifier idValue = [identifier integerValue]; - NSError *initError = nil; - switch (idValue) - { - case AutomountStart: - { - *notification = [[VFSForGitNotification alloc] - initAsAutomountStartWithMessage:jsonMessage - error:&initError]; - break; - } - - case MountSuccess: - { - *notification = [[VFSForGitNotification alloc] - initAsMountSuccessWithMessage:jsonMessage - error:&initError]; - break; - } - - case MountFailure: - { - *notification = [[VFSForGitNotification alloc] - initAsMountFailureWithMessage:jsonMessage - error:&initError]; - break; - } - - case UpgradeAvailable: - { - *notification = [[VFSForGitNotification alloc] - initAsUpgradeAvailableWithMessage:jsonMessage - error:&initError]; - break; - } - - default: - { - *notification = nil; - initError = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitUnsupportedMessageError - userInfo:@{ NSLocalizedDescriptionKey : @"Unrecognised message id" }]; - break; - } - } - - if (error != nil) - { - *error = initError; - } - - return *notification != nil; -} - -#pragma mark Private initializers - -- (instancetype)initAsAutomountStartWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error -{ - if (self = [super init]) - { - id repoCount = messageDict[EnlistmentCountKey]; - if ((repoCount != nil) && [repoCount isKindOfClass:[NSNumber class]]) - { - _title = [AutomountTitle copy]; - _message = [[NSString stringWithFormat:AutomountStartMessageFormat, [repoCount unsignedIntegerValue]] copy]; - } - else - { - if (error != nil) - { - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitMissingRepoCountError - userInfo:@{ NSLocalizedDescriptionKey : @"Missing repos count in AutomountStart message" }]; - } - - self = nil; - } - } - - return self; -} - -- (instancetype)initAsMountSuccessWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error -{ - return self = [self initAsMountWithMessage:messageDict - title:(NSString *)AutomountTitle - messageFormat:(NSString *)AutomountSuccessMessageFormat - actionFormat:nil - error:error]; -} - -- (instancetype)initAsMountFailureWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error -{ - return self = [self initAsMountWithMessage:messageDict - title:(NSString *)AutomountTitle - messageFormat:(NSString *)AutomountFailureMessageFormat - actionFormat:MountGVFSCommandFormat - error:error]; -} - -- (instancetype)initAsMountWithMessage:(NSDictionary *)messageDict - title:(NSString *)title - messageFormat:(NSString *)messageFormat - actionFormat:(NSString *)commandFormat - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(title); - NSParameterAssert(messageFormat); - - if (self = [super init]) - { - id enlistment = messageDict[EnlistmentKey]; - if ((enlistment != nil) && [enlistment isKindOfClass:[NSString class]]) - { - _title = [title copy]; - _message = [[NSString stringWithFormat: - (NSString *)messageFormat, - enlistment] copy]; - if (commandFormat != nil) - { - _gvfsCommand = [[NSString stringWithFormat:commandFormat, enlistment] copy]; - _actionable = YES; - _actionTitle = MountActionTitle; - } - - return self; - } - else - { - if (error != nil) - { - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitMissingEntitlementInfoError - userInfo:@{ NSLocalizedDescriptionKey : @"ERROR: missing enlistment info." }]; - } - - self = nil; - } - } - - return self; -} - -- (instancetype)initAsUpgradeAvailableWithMessage:(NSDictionary *)messageDict - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(messageDict); - - if (self = [super init]) - { - id newVersion = messageDict[NewUpgradeVersionKey]; - if ((newVersion != nil) && [newVersion isKindOfClass:[NSString class]]) - { - _title = [[NSString stringWithFormat:UpgradeAvailableTitleFormat, newVersion] copy]; - _message = [UpgradeAvailableMessage copy]; - _actionTitle = [UpgradeActionTitle copy]; - _actionable = YES; - _gvfsCommand = [UpgradeGVFSCommandFormat copy]; - } - else - { - if (error != nil) - { - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitMissingEntitlementInfoError - userInfo:@{ NSLocalizedDescriptionKey : @"ERROR: missing new upgrade version info." }]; - } - - self = nil; - } - } - - return self; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder -{ - [aCoder encodeObject:[NSNumber numberWithInt:[self identifier]] forKey:IdentifierKey]; - [aCoder encodeObject:[self title] forKey:TitleKey]; - [aCoder encodeObject:[self message] forKey:MessageKey]; - [aCoder encodeObject:[self actionTitle] forKey:ActionTitleKey]; - [aCoder encodeObject:[self gvfsCommand] forKey:GVFSCommandKey]; - [aCoder encodeObject:[NSNumber numberWithBool:[self actionable]] forKey:IsActionableKey]; -} - -- (instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if (self = [super init]) - { - _identifier = [[aDecoder decodeObjectForKey:IdentifierKey] integerValue]; - _title = [[aDecoder decodeObjectForKey:TitleKey] copy]; - _message = [[aDecoder decodeObjectForKey:MessageKey] copy]; - _actionTitle = [[aDecoder decodeObjectForKey:ActionTitleKey] copy]; - _gvfsCommand = [[aDecoder decodeObjectForKey:GVFSCommandKey] copy]; - _actionable = [[aDecoder decodeObjectForKey:IsActionableKey] boolValue]; - } - - return self; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageListener.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageListener.h deleted file mode 100644 index 4f161a1317..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageListener.h +++ /dev/null @@ -1,19 +0,0 @@ -#import - -typedef void (^NewMessageCallback) (NSDictionary *_Nonnull messageInfo); - -NS_ASSUME_NONNULL_BEGIN - -@interface VFSMessageListener : NSObject - -@property (copy) NSString *socketPath; -@property (copy) NewMessageCallback messageCallback; - -- (instancetype _Nullable)initWithSocket:(NSString *)socketPath - callback:(NewMessageCallback)callback; -- (BOOL)startListening; -- (void)stopListening; - -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageListener.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageListener.m deleted file mode 100644 index a4dce2259d..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageListener.m +++ /dev/null @@ -1,163 +0,0 @@ -#import -#import -#import -#import "VFSMessageListener.h" -#import "VFSMessageParser.h" - -NSString * const NotificationServerPipeName = @"vfsforgit.notification"; - -@interface VFSMessageListener () - -@property (strong) NSFileHandle *connectionHandle; -@property CFSocketRef socketRef; - -@end - -@implementation VFSMessageListener - -- (instancetype)initWithSocket:(NSString *)socketPath - callback:(nonnull NewMessageCallback)callback -{ - if (self = [super init]) - { - _socketPath = - [[socketPath stringByAppendingPathComponent:NotificationServerPipeName] - copy]; - _messageCallback = [callback copy]; - } - - return self; -} - -- (void) dealloc -{ - if (_socketRef != NULL) - { - CFSocketInvalidate(_socketRef); - CFRelease(_socketRef); - } -} - -- (BOOL)startListening -{ - CFSocketRef cfSocket; - if ((cfSocket = CFSocketCreate(kCFAllocatorDefault, - PF_LOCAL, - SOCK_STREAM, - 0, - kCFSocketNoCallBack, - NULL, - NULL)) == NULL) - { - return NO; - } - - CFAutorelease(cfSocket); - - int reuse = TRUE; - int socketDescriptor = CFSocketGetNative(cfSocket); - if (setsockopt(socketDescriptor, - SOL_SOCKET, - SO_REUSEADDR, - (void *) &reuse, - sizeof(reuse))) - { - return NO; - } - - if ([[NSFileManager defaultManager] fileExistsAtPath:self.socketPath] && - ![[NSFileManager defaultManager] removeItemAtPath:self.socketPath error:nil]) - { - return NO; - } - - struct sockaddr_un sockAddress = {}; - memset(&sockAddress, 0, sizeof(sockAddress)); - sockAddress.sun_family = AF_UNIX; - sockAddress.sun_len = sizeof(sockAddress); - [self.socketPath getCString:sockAddress.sun_path - maxLength:sizeof(sockAddress.sun_path) - encoding:NSUTF8StringEncoding]; - - CFDataRef addressData = CFDataCreate(kCFAllocatorDefault, - (const UInt8 *) &sockAddress, - sizeof(sockAddress)); - CFAutorelease(addressData); - if (CFSocketSetAddress(cfSocket, addressData) != kCFSocketSuccess) - { - return NO; - } - - self.socketRef = (CFSocketRef) CFRetain(cfSocket); - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(messageReadCompleteCallback:) - name:NSFileHandleReadToEndOfFileCompletionNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(newConnectionCallback:) - name:NSFileHandleConnectionAcceptedNotification - object:nil]; - - self.connectionHandle = [[NSFileHandle alloc] initWithFileDescriptor:socketDescriptor - closeOnDealloc:YES]; - [self.connectionHandle acceptConnectionInBackgroundAndNotify]; - - return YES; -} - -- (void)stopListening -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - CFSocketInvalidate(self.socketRef); - CFRelease(self.socketRef); - - self.socketRef = NULL; - self.connectionHandle = nil; -} - -- (void)newConnectionCallback:(NSNotification *)notification -{ - @autoreleasepool - { - NSFileHandle *readHandle = [[notification userInfo] - objectForKey:NSFileHandleNotificationFileHandleItem]; - if (readHandle != nil) - { - [readHandle readToEndOfFileInBackgroundAndNotify]; - } - - [self.connectionHandle acceptConnectionInBackgroundAndNotify]; - } -} - -- (void)messageReadCompleteCallback:(NSNotification *)notification -{ - @autoreleasepool - { - NSData *data = [[notification userInfo] objectForKey:NSFileHandleNotificationDataItem]; - if ((data != nil) && ([data length] > 0)) - { - NSError *error; - NSDictionary *message; - if([VFSMessageParser tryParseData:data message:&message error:&error]) - { - self.messageCallback(message); - } - else - { - NSLog(@"ERROR: Could not parse notification payload: %@.", [error description]); - } - } - else - { - NSNumber *unixError = [[notification userInfo] objectForKey:@"NSFileHandleError"]; - NSLog(@"ERROR: Could not read data from socket %s.", - unixError != nil ? strerror([unixError intValue]) : ""); - } - } -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageParser.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageParser.h deleted file mode 100644 index 7860d9ccc0..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageParser.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface VFSMessageParser : NSObject - -+ (BOOL)tryParseData:(NSData *)data - message:(NSDictionary *_Nullable __autoreleasing *_Nonnull)parsedMessage - error:(NSError *__autoreleasing *)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageParser.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageParser.m deleted file mode 100644 index f557085142..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/IPC/VFSMessageParser.m +++ /dev/null @@ -1,63 +0,0 @@ -#import "VFSMessageParser.h" -#import "VFSNotificationErrors.h" - -NSString * const NotificationPrefix = @"Notification|"; - -@implementation VFSMessageParser - -+ (BOOL)tryParseData:(NSData *)data - message:(NSDictionary *__autoreleasing *)parsedMessage - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(parsedMessage); - - NSString *messageStr; - if (!(messageStr = [[NSString alloc] initWithData:data - encoding:NSUTF8StringEncoding])) - { - if (error != nil) - { - NSString *info = [NSString stringWithFormat:@"%@: ERROR: error reading data.", - NSStringFromSelector(_cmd)]; - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitMessageReadError - userInfo:@{ NSLocalizedDescriptionKey : info }]; - } - *parsedMessage = nil; - return NO; - } - - if ([messageStr hasPrefix:NotificationPrefix]) - { - messageStr = [messageStr substringFromIndex:[NotificationPrefix length]]; - } - - messageStr = [messageStr stringByTrimmingCharactersInSet:[NSCharacterSet controlCharacterSet]]; - - NSError *parseError; - if (!(*parsedMessage = [NSJSONSerialization - JSONObjectWithData:[messageStr dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingAllowFragments - error:&parseError])) - { - if (error != nil) - { - if (parseError == nil) - { - NSString *info = [NSString stringWithFormat:@"%@: ERROR: Unknown parse error.", - NSStringFromSelector(_cmd)]; - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:VFSForGitMessageParseError - userInfo:@{ NSLocalizedDescriptionKey : info }]; - } - else - { - *error = parseError; - } - } - } - - return *parsedMessage != nil; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Info.plist b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Info.plist deleted file mode 100644 index fef4889365..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - LSApplicationCategoryType - - NSAppleEventsUsageDescription - `$(PRODUCT_NAME)` uses `Terminal` app to run `gvfs` commands. - LSUIElement - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - Copyright © 2019 Microsoft. All rights reserved. - NSMainNibFile - MainMenu - NSPrincipalClass - NSApplication - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164c91..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json deleted file mode 100644 index 3830a74e1b..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "VFSForGit_16.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "VFSForGit_32.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "VFSForGit_64.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_16.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_16.png deleted file mode 100644 index 77915f68a8..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_16.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_32.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_32.png deleted file mode 100644 index b0bc232fe7..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_32.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_64.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_64.png deleted file mode 100644 index 72a22b25b4..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/StatusItem.imageset/VFSForGit_64.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/Contents.json b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/Contents.json deleted file mode 100644 index c15d868722..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/Contents.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "images" : [ - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "VFSForGit_16.png", - "scale" : "1x" - }, - { - "size" : "16x16", - "idiom" : "mac", - "filename" : "VFSForGit_32-1.png", - "scale" : "2x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "VFSForGit_32.png", - "scale" : "1x" - }, - { - "size" : "32x32", - "idiom" : "mac", - "filename" : "VFSForGit_64.png", - "scale" : "2x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "VFSForGit_128.png", - "scale" : "1x" - }, - { - "size" : "128x128", - "idiom" : "mac", - "filename" : "VFSForGit_256-1.png", - "scale" : "2x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "VFSForGit_256.png", - "scale" : "1x" - }, - { - "size" : "256x256", - "idiom" : "mac", - "filename" : "VFSForGit_512-1.png", - "scale" : "2x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "VFSForGit_512.png", - "scale" : "1x" - }, - { - "size" : "512x512", - "idiom" : "mac", - "filename" : "VFSForGit_1024.png", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_1024.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_1024.png deleted file mode 100644 index 9a08221228..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_1024.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_128.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_128.png deleted file mode 100644 index d953ad9ae3..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_128.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_16.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_16.png deleted file mode 100644 index 77915f68a8..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_16.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_256-1.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_256-1.png deleted file mode 100644 index c57e4e533e..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_256-1.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_256.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_256.png deleted file mode 100644 index c57e4e533e..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_256.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_32-1.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_32-1.png deleted file mode 100644 index b0bc232fe7..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_32-1.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_32.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_32.png deleted file mode 100644 index b0bc232fe7..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_32.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_512-1.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_512-1.png deleted file mode 100644 index c42a319ef3..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_512-1.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_512.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_512.png deleted file mode 100644 index c42a319ef3..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_512.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_64.png b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_64.png deleted file mode 100644 index 72a22b25b4..0000000000 Binary files a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Assets.xcassets/VFS For Git.appiconset/VFSForGit_64.png and /dev/null differ diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib deleted file mode 100644 index 91dae4551f..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/Base.lproj/MainMenu.xib +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.h deleted file mode 100644 index 54470a1ed3..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.h +++ /dev/null @@ -1,11 +0,0 @@ -#import -#import "VFSProductInfoFetcher.h" - -@interface VFSAboutWindowController : NSWindowController - -@property (readonly, nullable) NSString *vfsforgitVersion; -@property (readonly, nullable) NSString *gitVersion; - -- (instancetype _Nullable)initWithProductInfoFetcher:(VFSProductInfoFetcher *_Nonnull)productInfoFetcher; - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.m deleted file mode 100644 index bd93a6b8ac..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.m +++ /dev/null @@ -1,55 +0,0 @@ -#import "VFSAboutWindowController.h" - -@interface VFSAboutWindowController () - -@property (strong) VFSProductInfoFetcher *productInfoFetcher; - -@end - -@implementation VFSAboutWindowController - -- (instancetype)initWithProductInfoFetcher:(VFSProductInfoFetcher *)productInfoFetcher -{ - if (productInfoFetcher == nil) - { - self = nil; - } - else if (self = [super initWithWindowNibName:@"VFSAboutWindowController"]) - { - _productInfoFetcher = productInfoFetcher; - } - - return self; -} - -- (NSString *)vfsforgitVersion -{ - NSString *version; - NSError *error; - if ([self.productInfoFetcher tryGetVFSForGitVersion:&version error:&error]) - { - return version; - } - else - { - NSLog(@"Error getting VFS For Git version: %@", [error description]); - return @"Not available"; - } -} - -- (NSString *)gitVersion -{ - NSString *version; - NSError *error; - if ([self.productInfoFetcher tryGetGitVersion:&version error:&error]) - { - return version; - } - else - { - NSLog(@"Error getting Git version: %@", [error description]); - return @"Not available"; - } -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.xib b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.xib deleted file mode 100644 index b03070d52c..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAboutWindowController.xib +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAppDelegate.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAppDelegate.h deleted file mode 100644 index 0033a9e983..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAppDelegate.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - -@interface VFSAppDelegate : NSObject - -@end - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAppDelegate.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAppDelegate.m deleted file mode 100644 index 7b1fe0077d..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSAppDelegate.m +++ /dev/null @@ -1,73 +0,0 @@ -#import "VFSAboutWindowController.h" -#import "VFSAppDelegate.h" -#import "VFSCommandRunner.h" -#import "VFSMessageListener.h" -#import "VFSNotificationDisplay.h" -#import "VFSForGitNotification.h" -#import "VFSProductInfoFetcher.h" -#import "VFSStatusBarItem.h" -#import "VFSNotificationDisplay.h" - -@interface VFSAppDelegate () - -@property (weak) IBOutlet NSWindow *Window; -@property (strong) VFSStatusBarItem *StatusDisplay; -@property (strong) VFSMessageListener *messageListener; -@property (strong) VFSNotificationDisplay *notificationDisplay; - -- (void)displayNotification:(NSDictionary *_Nonnull)messageInfo; - -@end - -@implementation VFSAppDelegate - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification -{ - self.messageListener = [[VFSMessageListener alloc] - initWithSocket:NSTemporaryDirectory() - callback:^(NSDictionary *messageInfo) - { - [self displayNotification:messageInfo]; - }]; - - [self.messageListener startListening]; - - VFSProductInfoFetcher *productInfoFetcher = - [[VFSProductInfoFetcher alloc] - initWithProcessRunner:[[VFSProcessRunner alloc] initWithProcessFactory:^NSTask * - { - return [[NSTask alloc] init]; - }]]; - - self.StatusDisplay = [[VFSStatusBarItem alloc] initWithAboutWindowController: - [[VFSAboutWindowController alloc] - initWithProductInfoFetcher:productInfoFetcher]]; - - [self.StatusDisplay load]; - - self.notificationDisplay = [[VFSNotificationDisplay alloc] - initWithCommandRunner:[[VFSCommandRunner alloc] init]]; -} - -- (void)applicationWillTerminate:(NSNotification *)aNotification -{ - [self.messageListener stopListening]; -} - -- (void)displayNotification:(NSDictionary *_Nonnull)messageInfo -{ - NSParameterAssert(messageInfo); - - VFSForGitNotification *notification; - NSError *error; - if (![VFSForGitNotification tryValidateMessage:messageInfo - buildNotification:¬ification - error:&error]) - { - NSLog(@"ERROR: Could not display notification. %@", [error description]); - return; - } - - [self.notificationDisplay display:notification]; -} -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSNotificationDisplay.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSNotificationDisplay.h deleted file mode 100644 index 8c3979cee8..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSNotificationDisplay.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import "VFSForGitNotification.h" - -@interface VFSNotificationDisplay : NSObject - -- (instancetype)initWithCommandRunner:(VFSCommandRunner *)commandRunner; -- (void)display:(VFSForGitNotification *) notification; - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSNotificationDisplay.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSNotificationDisplay.m deleted file mode 100644 index d157508cd2..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSNotificationDisplay.m +++ /dev/null @@ -1,70 +0,0 @@ -#import -#import "VFSCommandRunner.h" -#import "VFSNotificationDisplay.h" - -@interface VFSNotificationDisplay () - -@property (strong, nonnull) VFSCommandRunner *commandRunner; - -@end - -@implementation VFSNotificationDisplay - -- (instancetype)initWithCommandRunner:(VFSCommandRunner *)commandRunner -{ - if (self = [super init]) - { - _commandRunner = commandRunner; - [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self]; - } - - return self; -} - -- (void)display:(VFSForGitNotification *) notification -{ - NSUserNotification *userNotification = [[NSUserNotification alloc] init]; - userNotification.title = notification.title; - userNotification.informativeText = notification.message; - userNotification.userInfo = [NSDictionary dictionaryWithObject:[NSKeyedArchiver archivedDataWithRootObject:notification] - forKey:@"VFSForGitNotification"]; - if (notification.actionable == YES) - { - userNotification.hasActionButton = notification.actionable; - userNotification.actionButtonTitle = notification.actionTitle; - } - - [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:userNotification]; -} - -- (void)userNotificationCenter:(NSUserNotificationCenter *)center - didActivateNotification:(NSUserNotification *)notification -{ - [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:notification]; - - VFSForGitNotification *vfsNotification = [NSKeyedUnarchiver - unarchiveObjectWithData:[[notification userInfo] - objectForKey:@"VFSForGitNotification"]]; - if (vfsNotification != nil) - { - switch (notification.activationType) - { - case NSUserNotificationActivationTypeActionButtonClicked: - { - if (vfsNotification.gvfsCommand) - { - [self.commandRunner runCommand:vfsNotification.gvfsCommand]; - } - - break; - } - - default: - { - break; - } - } - } -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSStatusBarItem.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSStatusBarItem.h deleted file mode 100644 index 86160ed123..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSStatusBarItem.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -@interface VFSStatusBarItem : NSObject - -- (instancetype _Nullable)initWithAboutWindowController:(VFSAboutWindowController *_Nonnull)aboutWindowController; -- (void)load; -- (NSMenu *_Nullable)getStatusMenu; -- (IBAction)handleMenuClick:(id)sender; - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSStatusBarItem.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSStatusBarItem.m deleted file mode 100644 index 5b3f281e62..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/UI/VFSStatusBarItem.m +++ /dev/null @@ -1,97 +0,0 @@ -#import "VFSAboutWindowController.h" -#import "VFSStatusBarItem.h" -#import "VFSProductInfoFetcher.h" - -@interface VFSStatusBarItem () - -@property (strong, nonnull) NSStatusItem *statusItem; -@property (strong, nonnull) VFSAboutWindowController *aboutWindowController; - -@end - -@implementation VFSStatusBarItem - -- (instancetype)initWithAboutWindowController:(VFSAboutWindowController *)aboutWindowController -{ - if (aboutWindowController == nil) - { - self = nil; - } - else if (self = [super init]) - { - _aboutWindowController = aboutWindowController; - } - - return self; -} - -- (void)load -{ - self.statusItem = [[NSStatusBar systemStatusBar] - statusItemWithLength:NSVariableStatusItemLength]; - - [self.statusItem setHighlightMode:YES]; - - [self addStatusButton]; - [self addMenuItems]; -} - -- (IBAction)handleMenuClick:(id)sender -{ - switch (((NSButton *) sender).tag) - { - case 0: - { - [self displayAboutBox]; - break; - } - - default: - { - break; - } - } -} - -- (IBAction)displayAboutBox -{ - [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; - [self.aboutWindowController showWindow:self]; - [self.aboutWindowController.window makeKeyAndOrderFront:self]; -} - -- (NSMenu *)getStatusMenu -{ - return self.statusItem.menu; -} - -- (void)addStatusButton -{ - NSImage *image = [NSImage imageNamed:@"StatusItem"]; - - [image setTemplate:YES]; - - [self.statusItem.button setImage:image]; - [self.statusItem.button setTarget:nil]; - [self.statusItem.button setAction:nil]; -} - -- (void)addMenuItems -{ - NSUInteger index = 0; - NSMenu *menu = [[NSMenu alloc] init]; - NSMenuItem *aboutItem = [[NSMenuItem alloc] - initWithTitle:@"About VFS For Git" - action:@selector(handleMenuClick:) - keyEquivalent:@""]; - - [aboutItem setTag:0]; - [aboutItem setTarget:self]; - [menu insertItem:[NSMenuItem separatorItem] atIndex:index++]; - [menu insertItem:aboutItem atIndex:index++]; - [menu setAutoenablesItems:NO]; - - [self.statusItem setMenu:menu]; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSCommandRunner.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSCommandRunner.h deleted file mode 100644 index db7797276c..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSCommandRunner.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface VFSCommandRunner : NSObject - -- (void) runCommand:(NSString *) command; - -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSCommandRunner.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSCommandRunner.m deleted file mode 100644 index e44bf3e10b..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSCommandRunner.m +++ /dev/null @@ -1,25 +0,0 @@ -#import "VFSCommandRunner.h" - -NSString * const LaunchTerminalScriptFormat = @"\ -tell application \"Terminal\" \n\ -activate \n\ -do script (\"echo;echo Running gvfs command: %@;echo You might need to type Admin password;%@ \") \n\ -end tell"; - -@implementation VFSCommandRunner - -- (void) runCommand:(NSString *) command -{ - NSString *scriptSource = [NSString stringWithFormat:LaunchTerminalScriptFormat, command, command]; - NSAppleScript *scriptObject = [[NSAppleScript alloc] initWithSource:scriptSource]; - NSDictionary *errorDict; - NSAppleEventDescriptor *returnDescriptor = NULL; - - returnDescriptor = [scriptObject executeAndReturnError: &errorDict]; - if (returnDescriptor == nil) - { - NSLog(@"Error running %@. %@", command, [errorDict description]); - } -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSNotificationErrors.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSNotificationErrors.h deleted file mode 100644 index f9b10c96a3..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSNotificationErrors.h +++ /dev/null @@ -1,18 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -extern NSErrorDomain const VFSForGitNotificationErrorDomain; -typedef NS_ERROR_ENUM(VFSForGitNotificationErrorDomain, VFSForGitNotificationErrorCode) -{ - VFSForGitInitError = 200, - VFSForGitAllocError, - VFSForGitInvalidMessageIdFormatError, - VFSForGitUnsupportedMessageError, - VFSForGitMissingEntitlementInfoError, - VFSForGitMissingRepoCountError, - VFSForGitMessageParseError, - VFSForGitMessageReadError, -}; - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSNotificationErrors.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSNotificationErrors.m deleted file mode 100644 index 2f21d3c6e4..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSNotificationErrors.m +++ /dev/null @@ -1,3 +0,0 @@ -#import "VFSNotificationErrors.h" - -NSErrorDomain const VFSForGitNotificationErrorDomain = @"VFSForGitNotificationErrorDomain"; diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProcessRunner.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProcessRunner.h deleted file mode 100644 index be03a9be13..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProcessRunner.h +++ /dev/null @@ -1,17 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NSTask *_Nonnull (^ProcessFactory)(void); - -@interface VFSProcessRunner : NSObject - -- (instancetype _Nullable)initWithProcessFactory:(ProcessFactory)processFactory; -- (BOOL)tryRunExecutable:(NSURL *)path - args:(NSArray *_Nullable)args - output:(NSString *_Nullable __autoreleasing *_Nonnull)output - error:(NSError * __autoreleasing *)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProcessRunner.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProcessRunner.m deleted file mode 100644 index 6c017ddeb9..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProcessRunner.m +++ /dev/null @@ -1,82 +0,0 @@ -#import "VFSProcessRunner.h" -#import "VFSNotificationErrors.h" - -@interface VFSProcessRunner() - -@property (strong) ProcessFactory processFactory; - -@end - -@implementation VFSProcessRunner - -- (instancetype)initWithProcessFactory:(ProcessFactory)processFactory -{ - if (processFactory == nil) - { - self = nil; - } - else if (self = [super init]) - { - _processFactory = processFactory; - } - - return self; -} - -/** - Runs an executable specified by path and args. If the executable could be run - successfully - output will contain the executable's combined stderr/stdout - output and the method returns YES. In case of failure, it returns NO and error - will hold the executable's combined stderr/stdout output. - - @param path - specify full path to the executable. - @param args - specify any command line args to pass to the executable. - @param output - contains executable's output, if it was successfully run. - @param error - contains executable's output, if it exited with an error. - @return YES if the executable was successfully run, NO otherwise. - */ -- (BOOL)tryRunExecutable:(NSURL *)path - args:(NSArray *)args - output:(NSString *__autoreleasing *)output - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(path); - NSParameterAssert(output); - - NSTask *task = self.processFactory(); - NSPipe *taskOut = [NSPipe pipe]; - - task.executableURL = path; - task.arguments = args; - task.standardOutput = taskOut; - task.standardError = taskOut; - - int exitCode = -1; - - if ([task launchAndReturnError:error]) - { - [task waitUntilExit]; - - exitCode = [task terminationStatus]; - - *output = [[NSString alloc] initWithData:[taskOut.fileHandleForReading availableData] - encoding:NSUTF8StringEncoding]; - - if (0 != exitCode) - { - if (error != nil) - { - NSDictionary *userInfo = @{ NSLocalizedDescriptionKey : *output }; - *error = [NSError errorWithDomain:VFSForGitNotificationErrorDomain - code:exitCode - userInfo:userInfo]; - } - - *output = nil; - } - } - - return 0 == exitCode; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProductInfoFetcher.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProductInfoFetcher.h deleted file mode 100644 index 32a3a53e93..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProductInfoFetcher.h +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import "VFSProcessRunner.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface VFSProductInfoFetcher : NSObject - -- (instancetype _Nullable)initWithProcessRunner:(VFSProcessRunner *)processRunner; -- (BOOL)tryGetGitVersion:(NSString *_Nullable __autoreleasing *_Nonnull)version - error:(NSError **)error; -- (BOOL)tryGetVFSForGitVersion:(NSString *_Nullable __autoreleasing *_Nonnull)version - error:(NSError **)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProductInfoFetcher.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProductInfoFetcher.m deleted file mode 100644 index 8b9014830a..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/Utilities/VFSProductInfoFetcher.m +++ /dev/null @@ -1,61 +0,0 @@ -#import -#import "VFSProductInfoFetcher.h" - -NSString * const VFSForGitPath = @"/usr/local/bin/gvfs"; -NSString * const GitPath = @"/usr/local/bin/git"; - -@interface VFSProductInfoFetcher() - -@property (strong, nonnull) VFSProcessRunner *processRunner; - -@end - -@implementation VFSProductInfoFetcher - -- (instancetype)initWithProcessRunner:(VFSProcessRunner *)processRunner -{ - if (processRunner == nil) - { - self = nil; - } - else if (self = [super init]) - { - _processRunner = processRunner; - } - - return self; -} - -- (BOOL)tryGetVFSForGitVersion:(NSString *__autoreleasing *)version - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(version); - - if (![self.processRunner tryRunExecutable:[NSURL fileURLWithPath:VFSForGitPath] - args:@[ @"version" ] - output:version - error:error]) - { - return NO; - } - - return YES; -} - -- (BOOL)tryGetGitVersion:(NSString *__autoreleasing *)version - error:(NSError *__autoreleasing *)error -{ - NSParameterAssert(version); - - if (![self.processRunner tryRunExecutable:[NSURL fileURLWithPath:GitPath] - args:@[ @"version" ] - output:version - error:error]) - { - return NO; - } - - return YES; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/VFSForGit.entitlements b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/VFSForGit.entitlements deleted file mode 100644 index f2ef3ae026..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/VFSForGit.entitlements +++ /dev/null @@ -1,10 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/main.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/main.m deleted file mode 100644 index 3eb7a378e1..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/StatusMenuItem/main.m +++ /dev/null @@ -1,6 +0,0 @@ -#import - -int main(int argc, const char * argv[]) -{ - return NSApplicationMain(argc, argv); -} diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Info.plist b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Info.plist deleted file mode 100644 index 6c40a6cd0c..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockAboutWindowController.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockAboutWindowController.h deleted file mode 100644 index b70ef79b33..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockAboutWindowController.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import "VFSAboutWindowController.h" - -@interface VFSMockAboutWindowController : VFSAboutWindowController - -@property (readonly) BOOL aboutBoxDisplayed; - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockAboutWindowController.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockAboutWindowController.m deleted file mode 100644 index fd9ff69924..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockAboutWindowController.m +++ /dev/null @@ -1,23 +0,0 @@ -#import -#import "VFSMockAboutWindowController.h" - -@interface VFSMockAboutWindowController() - -@property (readwrite) BOOL aboutBoxDisplayed; - -@end - -@implementation VFSMockAboutWindowController - -- (instancetype) initWithProductInfo:(VFSProductInfoFetcher *) productInfo -{ - self = [super initWithProductInfoFetcher:productInfo]; - return self; -} - -- (IBAction)showWindow:(nullable id)sender -{ - self.aboutBoxDisplayed = YES; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockNotificationCenter.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockNotificationCenter.h deleted file mode 100644 index 357ffab45c..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockNotificationCenter.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface VFSMockNotificationCenter : NSUserNotificationCenter - -@property (assign) BOOL notificationDelivered; - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockNotificationCenter.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockNotificationCenter.m deleted file mode 100644 index 6d9a2dd01a..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockNotificationCenter.m +++ /dev/null @@ -1,31 +0,0 @@ -#import -#import "VFSMockNotificationCenter.h" - -@interface VFSMockNotificationCenter () - -@property (strong) NSUserNotification *expectedNotification; - -@end - -@implementation VFSMockNotificationCenter - -- (instancetype) initWithExpectedNotification:(NSUserNotification *) notification -{ - if (self = [super init]) - { - _expectedNotification = notification; - } - - return self; -} - -- (void)deliverNotification:(NSUserNotification *) notification -{ - if ([notification.title isEqualToString:self.expectedNotification.title] && - [notification.informativeText isEqualToString:self.expectedNotification.informativeText]) - { - self.notificationDelivered = YES; - } -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockProductInfoFetcher.h b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockProductInfoFetcher.h deleted file mode 100644 index 32c7654c79..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockProductInfoFetcher.h +++ /dev/null @@ -1,13 +0,0 @@ -#import -#import "VFSProductInfoFetcher.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface VFSMockProductInfoFetcher : VFSProductInfoFetcher - -- (instancetype _Nullable) initWithGitVersion:(NSString *) gitVersion - vfsforgitVersion:(NSString *) vfsforgitVersion; - -@end - -NS_ASSUME_NONNULL_END diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockProductInfoFetcher.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockProductInfoFetcher.m deleted file mode 100644 index 500d95f68e..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/Mocks/VFSMockProductInfoFetcher.m +++ /dev/null @@ -1,39 +0,0 @@ -#import -#import "VFSMockProductInfoFetcher.h" - -@interface VFSMockProductInfoFetcher() - -@property (copy) NSString *gitVersion; -@property (copy) NSString *vfsforgitVersion; - -@end - -@implementation VFSMockProductInfoFetcher - -- (instancetype) initWithGitVersion:(NSString *) gitVersion - vfsforgitVersion:(NSString *) vfsforgitVersion -{ - if (self = [super init]) - { - _gitVersion = [gitVersion copy]; - _vfsforgitVersion = [vfsforgitVersion copy]; - } - - return self; -} - -- (BOOL) tryGetVFSForGitVersion:(NSString *__autoreleasing *) version - error:(NSError *__autoreleasing *) error -{ - *version = self.vfsforgitVersion; - return YES; -} - -- (BOOL) tryGetGitVersion:(NSString *__autoreleasing *) version - error:(NSError *__autoreleasing *) error -{ - *version = self.gitVersion; - return YES; -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSAboutWindowControllerTests.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSAboutWindowControllerTests.m deleted file mode 100644 index 96fcdb41f2..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSAboutWindowControllerTests.m +++ /dev/null @@ -1,47 +0,0 @@ -#import -#import "VFSMockAboutWindowController.h" -#import "VFSMockProductInfoFetcher.h" - -NSString * const ExpectedGitVersionString = @"2.20.1.vfs.1.1.104.g2ab7360"; -NSString * const ExpectedVFSForGitVersionString = @"1.0.19116.1"; - -@interface VFSAboutWindowControllerTests : XCTestCase - -@property (strong) VFSAboutWindowController *windowController; - -@end - -@implementation VFSAboutWindowControllerTests - -- (void)setUp -{ - [super setUp]; - - VFSMockProductInfoFetcher *mockProductInfoFetcher = - [[VFSMockProductInfoFetcher alloc] initWithGitVersion:(NSString *) ExpectedGitVersionString - vfsforgitVersion:(NSString *) ExpectedVFSForGitVersionString]; - - self.windowController = [[VFSAboutWindowController alloc] - initWithProductInfoFetcher:mockProductInfoFetcher]; -} - -- (void)tearDown -{ - [super tearDown]; -} - -- (void)testAboutWindowContainsGVFSVersion -{ - XCTAssertEqual(self.windowController.vfsforgitVersion, - ExpectedVFSForGitVersionString, - @"Incorrect VFSForGit version displayed in About box"); -} - -- (void)testAboutWindowContainsGitVersion -{ - XCTAssertEqual(self.windowController.gitVersion, - ExpectedGitVersionString, - @"Incorrect Git version displayed in About box"); -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSForGitNotificationTests.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSForGitNotificationTests.m deleted file mode 100644 index 3935e17dd3..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSForGitNotificationTests.m +++ /dev/null @@ -1,93 +0,0 @@ -#import -#import "VFSForGitNotification.h" - -@interface VFSForGitNotificationTests : XCTestCase -@end - -@implementation VFSForGitNotificationTests - -- (void)testCreateNotificationWithMissingIdFails -{ - NSDictionary *message = @{ - @"Title" : @"foo", - @"Message" : @"bar", - @"Enlistment" : @"/foo/bar", - @"EnlistmentCount" : [NSNumber numberWithLong:0] - }; - - NSError *error; - VFSForGitNotification *notification; - - XCTAssertFalse([VFSForGitNotification tryValidateMessage:message - buildNotification:¬ification - error:&error]); - XCTAssertNotNil(error); -} - -- (void)testCreateNotificationWithInvalidIdFails -{ - NSDictionary *message = @{ - @"Id" : [NSNumber numberWithLong:32], - @"Title" : @"foo", - @"Message" : @"bar", - @"EnlistmentCount" : [NSNumber numberWithLong:0] - }; - - NSError *error; - VFSForGitNotification *notification; - XCTAssertFalse([VFSForGitNotification tryValidateMessage:message - buildNotification:¬ification - error:&error]); - XCTAssertNotNil(error); -} - -- (void)testCreateAutomountNotificationWithValidMessageSucceeds -{ - NSDictionary *message = @{ - @"Id" : [NSNumber numberWithLong:0], - @"EnlistmentCount" : [NSNumber numberWithLong:5] - }; - - NSError *error; - VFSForGitNotification *notification; - XCTAssertTrue([VFSForGitNotification tryValidateMessage:message - buildNotification:¬ification - error:&error]); - XCTAssertTrue([notification.title isEqualToString:@"GVFS AutoMount"]); - XCTAssertTrue([notification.message isEqualToString:@"Attempting to mount 5 GVFS repos(s)"]); - XCTAssertNil(error); -} - -- (void)testCreateMountNotificationWithValidMessageSucceeds -{ - NSString *enlistment = @"/Users/foo/bar/foo.bar"; - NSDictionary *message = @{ - @"Id" : [NSNumber numberWithLong:1], - @"Enlistment" : enlistment - }; - - NSError *error; - VFSForGitNotification *notification; - XCTAssertTrue([VFSForGitNotification tryValidateMessage:message - buildNotification:¬ification - error:&error]); - XCTAssertTrue([notification.title isEqualToString:@"GVFS AutoMount"]); - XCTAssertTrue([notification.message containsString:enlistment]); - XCTAssertNil(error); -} - -- (void)testCreateMountNotificationWithMissingEnlistmentFails -{ - NSDictionary *message = @{ - @"Id" : [NSNumber numberWithLong:1], - }; - - NSError *error; - VFSForGitNotification *notification; - XCTAssertFalse([VFSForGitNotification tryValidateMessage:message - buildNotification:¬ification - error:&error]); - XCTAssertNotNil(error); -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSMessageParserTests.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSMessageParserTests.m deleted file mode 100644 index 3f3b14f977..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSMessageParserTests.m +++ /dev/null @@ -1,115 +0,0 @@ -#import -#import "VFSMessageParser.h" - -@interface MessageParserTests : XCTestCase -@end - -@implementation MessageParserTests - -- (void)testParsingValidMessageSucceeds -{ - NSDictionary *expectedDict = [self validMessage]; - NSData *messageData = - [NSJSONSerialization dataWithJSONObject:expectedDict - options:NSJSONWritingPrettyPrinted - error:nil]; - - NSError *error; - NSDictionary *parsedMessage; - XCTAssertTrue([VFSMessageParser tryParseData:messageData - message:&parsedMessage - error:&error]); - XCTAssertNil(error); - - [self validateParsedMessage:parsedMessage expectedMessage:expectedDict]; -} - -- (void)testParsingMessageWithTrailingCtrlCharsSucceed -{ - NSDictionary *expectedDict = [self validMessage]; - NSData *messageData = - [NSJSONSerialization dataWithJSONObject:expectedDict - options:NSJSONWritingPrettyPrinted - error:nil]; - NSMutableData *dataWithCtrlChars = [NSMutableData dataWithData:messageData]; - NSString *stringWithCtrlChars = [NSString stringWithFormat:@"%c%c%c%c%c%c%c", - 0x07, - 0x08, - 0x1B, - 0x0C, - 0x0A, - 0x0D, - 0x09]; - [dataWithCtrlChars appendData:[stringWithCtrlChars - dataUsingEncoding:NSUTF8StringEncoding]]; - - NSError *error; - NSDictionary *parsedMessage; - XCTAssertTrue([VFSMessageParser tryParseData:dataWithCtrlChars - message:&parsedMessage - error:&error]); - XCTAssertNil(error); - - [self validateParsedMessage:parsedMessage expectedMessage:expectedDict]; -} - -- (void)testParsingMalformedMessageFails -{ - NSString *message = @"{ \"Id\", \"Message\", \"Foobar\"}"; - NSError *error; - NSDictionary *parsedMessage; - XCTAssertFalse([VFSMessageParser tryParseData:[message dataUsingEncoding:NSUTF8StringEncoding] - message:&parsedMessage - error:&error]); - XCTAssertNil(parsedMessage); - XCTAssertNotNil(error); -} - -- (void)testParsingEmptyMessageFails -{ - NSString *message = @""; - NSError *error; - NSDictionary *parsedMessage; - - XCTAssertFalse([VFSMessageParser tryParseData:[message dataUsingEncoding:NSUTF8StringEncoding] - message:&parsedMessage - error:&error]); - XCTAssertNil(parsedMessage); - XCTAssertNotNil(error); -} - -#pragma mark Utility Methods - -- (NSDictionary *)validMessage -{ - NSInteger messageId = 1; - NSString *title = @"GVFS Mount"; - NSString *message = @"Successfully mount repo"; - NSString *enlistment = @"/Users/foo/bar"; - NSInteger enlistmentCount = 0; - NSDictionary *validDict = @{ - @"Id" : [NSNumber numberWithLong:messageId], - @"Title" : title, - @"Message" : message, - @"Enlistment" : enlistment, - @"EnlistmentCount" : [NSNumber numberWithLong:enlistmentCount] - }; - return validDict; -} - -- (BOOL)validateParsedMessage:(NSDictionary *)messageDict - expectedMessage:(NSDictionary *)expectedDict -{ - XCTAssertNotNil(messageDict, @"Parse error: failure parsing message"); - - [messageDict enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, - id _Nonnull obj, - BOOL * _Nonnull stop) - { - XCTAssertEqualObjects(obj, - expectedDict[key], - @"Parse error: mismatch in values of %@", - key); - }]; -} -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSStatusBarItemTests.m b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSStatusBarItemTests.m deleted file mode 100644 index 302ecd4d33..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.UnitTests/VFSStatusBarItemTests.m +++ /dev/null @@ -1,56 +0,0 @@ -#import -#import "VFSMockAboutWindowController.h" -#import "VFSMockProductInfoFetcher.h" -#import "VFSStatusBarItem.h" - -NSString * const ExpectedAboutMenuTitle = @"About VFS For Git"; - -@interface VFSStatusBarItemTests : XCTestCase - -@property (strong) VFSStatusBarItem *statusbarItem; -@property (strong) VFSMockAboutWindowController *aboutWindowController; - -@end - -@implementation VFSStatusBarItemTests - -- (void)setUp -{ - [super setUp]; - - VFSMockProductInfoFetcher *mockProductInfoFetcher = [[VFSMockProductInfoFetcher alloc] - initWithGitVersion:@"" - vfsforgitVersion:@""]; - - self.aboutWindowController = [[VFSMockAboutWindowController alloc] - initWithProductInfoFetcher:mockProductInfoFetcher]; - self.statusbarItem = [[VFSStatusBarItem alloc] - initWithAboutWindowController:self.aboutWindowController]; - - [self.statusbarItem load]; -} - -- (void)tearDown -{ - [super tearDown]; -} - -- (void)testStatusItemContainsAboutMenu -{ - NSMenu *statusMenu = [self.statusbarItem getStatusMenu]; - XCTAssertNotNil(statusMenu, @"Status bar does not contain VFSForGit menu"); - - NSMenuItem *menuItem = [statusMenu itemWithTitle:ExpectedAboutMenuTitle]; - XCTAssertNotNil(menuItem, @"Missing \"%@\" item in VFSForGit menu", ExpectedAboutMenuTitle); -} - -- (void)testAboutMenuClickDisplaysAboutBox -{ - [self.statusbarItem handleMenuClick:nil]; - - XCTAssertTrue(self.aboutWindowController.aboutBoxDisplayed, - @"Clicking on \"%@\" menu does not show About box", - ExpectedAboutMenuTitle); -} - -@end diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.pbxproj b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.pbxproj deleted file mode 100644 index 2664a692e9..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.pbxproj +++ /dev/null @@ -1,595 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 433FE819227B593500488730 /* VFSAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 433FE818227B593500488730 /* VFSAppDelegate.m */; }; - 433FE81B227B594300488730 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 433FE81A227B594300488730 /* Assets.xcassets */; }; - 433FE81E227B594300488730 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 433FE81C227B594300488730 /* MainMenu.xib */; }; - 433FE821227B594300488730 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 433FE820227B594300488730 /* main.m */; }; - 433FE8562280C21000488730 /* VFSStatusBarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 433FE8542280C21000488730 /* VFSStatusBarItem.m */; }; - 433FE85A2280E10F00488730 /* VFSProductInfoFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 433FE8592280E10F00488730 /* VFSProductInfoFetcher.m */; }; - 433FE8632281D06100488730 /* VFSAboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 433FE8602281D06000488730 /* VFSAboutWindowController.m */; }; - 433FE8642281D06100488730 /* VFSAboutWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 433FE8612281D06100488730 /* VFSAboutWindowController.xib */; }; - 43583C362289BDAA003357D6 /* VFSStatusBarItemTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43583C352289BDAA003357D6 /* VFSStatusBarItemTests.m */; }; - 43583C382289BE94003357D6 /* VFSAboutWindowControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43583C372289BE94003357D6 /* VFSAboutWindowControllerTests.m */; }; - 435B1E0F228CC1E000E853F3 /* VFSProcessRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 435B1E0E228CC1E000E853F3 /* VFSProcessRunner.m */; }; - 43AF0DF822B01C9800E54D48 /* VFSForGitNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 43AF0DF422B01C9700E54D48 /* VFSForGitNotification.m */; }; - 43AF0DFA22B01C9800E54D48 /* VFSMessageParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 43AF0DF522B01C9700E54D48 /* VFSMessageParser.m */; }; - 43AF0DFC22B01C9800E54D48 /* VFSMessageListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 43AF0DF622B01C9800E54D48 /* VFSMessageListener.m */; }; - 43AF0E0222B01E3200E54D48 /* VFSNotificationDisplay.m in Sources */ = {isa = PBXBuildFile; fileRef = 43AF0E0122B01E3200E54D48 /* VFSNotificationDisplay.m */; }; - 43AF0E0322B023BE00E54D48 /* VFSMockAboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 435B1DFA228B4C8400E853F3 /* VFSMockAboutWindowController.m */; }; - 43AF0E0422B023BE00E54D48 /* VFSMockProductInfoFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 435B1DFE228B590100E853F3 /* VFSMockProductInfoFetcher.m */; }; - 43AF0E0522B023BE00E54D48 /* VFSMockNotificationCenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 435B1E01228B6C3900E853F3 /* VFSMockNotificationCenter.m */; }; - 43AF0E0822B023F200E54D48 /* VFSMessageParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43AF0E0622B023F200E54D48 /* VFSMessageParserTests.m */; }; - 43AF0E0922B023F200E54D48 /* VFSForGitNotificationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43AF0E0722B023F200E54D48 /* VFSForGitNotificationTests.m */; }; - 43C021F022B18BDD00F868F2 /* VFSNotificationErrors.m in Sources */ = {isa = PBXBuildFile; fileRef = 43C021EF22B18BDD00F868F2 /* VFSNotificationErrors.m */; }; - 43C0221A22BBFA7A00F868F2 /* VFSCommandRunner.m in Sources */ = {isa = PBXBuildFile; fileRef = 43C0221822BBFA7A00F868F2 /* VFSCommandRunner.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 43583C302285E3E1003357D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 433FE80C227B593500488730 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 433FE813227B593500488730; - remoteInfo = VFSForGit; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 433FE814227B593500488730 /* VFS For Git.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "VFS For Git.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 433FE817227B593500488730 /* VFSAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VFSAppDelegate.h; sourceTree = ""; }; - 433FE818227B593500488730 /* VFSAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSAppDelegate.m; sourceTree = ""; }; - 433FE81A227B594300488730 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 433FE81D227B594300488730 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 433FE81F227B594300488730 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 433FE820227B594300488730 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 433FE822227B594300488730 /* VFSForGit.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = VFSForGit.entitlements; sourceTree = ""; }; - 433FE8532280C21000488730 /* VFSStatusBarItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VFSStatusBarItem.h; sourceTree = ""; }; - 433FE8542280C21000488730 /* VFSStatusBarItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSStatusBarItem.m; sourceTree = ""; }; - 433FE8582280E10F00488730 /* VFSProductInfoFetcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VFSProductInfoFetcher.h; sourceTree = ""; }; - 433FE8592280E10F00488730 /* VFSProductInfoFetcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSProductInfoFetcher.m; sourceTree = ""; }; - 433FE8602281D06000488730 /* VFSAboutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSAboutWindowController.m; sourceTree = ""; }; - 433FE8612281D06100488730 /* VFSAboutWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VFSAboutWindowController.xib; sourceTree = ""; }; - 433FE8622281D06100488730 /* VFSAboutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSAboutWindowController.h; sourceTree = ""; }; - 43583C2B2285E3E1003357D6 /* VFSForGit.UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VFSForGit.UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 43583C2F2285E3E1003357D6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 43583C352289BDAA003357D6 /* VFSStatusBarItemTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSStatusBarItemTests.m; sourceTree = ""; }; - 43583C372289BE94003357D6 /* VFSAboutWindowControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSAboutWindowControllerTests.m; sourceTree = ""; }; - 435B1DFA228B4C8400E853F3 /* VFSMockAboutWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSMockAboutWindowController.m; sourceTree = ""; }; - 435B1DFC228B4CB500E853F3 /* VFSMockAboutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSMockAboutWindowController.h; sourceTree = ""; }; - 435B1DFD228B590100E853F3 /* VFSMockProductInfoFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSMockProductInfoFetcher.h; sourceTree = ""; }; - 435B1DFE228B590100E853F3 /* VFSMockProductInfoFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSMockProductInfoFetcher.m; sourceTree = ""; }; - 435B1E00228B6C3900E853F3 /* VFSMockNotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSMockNotificationCenter.h; sourceTree = ""; }; - 435B1E01228B6C3900E853F3 /* VFSMockNotificationCenter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSMockNotificationCenter.m; sourceTree = ""; }; - 435B1E0D228CC1E000E853F3 /* VFSProcessRunner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VFSProcessRunner.h; sourceTree = ""; }; - 435B1E0E228CC1E000E853F3 /* VFSProcessRunner.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSProcessRunner.m; sourceTree = ""; }; - 43AF0DF222B01C9700E54D48 /* VFSForGitNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSForGitNotification.h; sourceTree = ""; }; - 43AF0DF322B01C9700E54D48 /* VFSMessageListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSMessageListener.h; sourceTree = ""; }; - 43AF0DF422B01C9700E54D48 /* VFSForGitNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSForGitNotification.m; sourceTree = ""; }; - 43AF0DF522B01C9700E54D48 /* VFSMessageParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSMessageParser.m; sourceTree = ""; }; - 43AF0DF622B01C9800E54D48 /* VFSMessageListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSMessageListener.m; sourceTree = ""; }; - 43AF0DF722B01C9800E54D48 /* VFSMessageParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSMessageParser.h; sourceTree = ""; }; - 43AF0E0022B01E3200E54D48 /* VFSNotificationDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSNotificationDisplay.h; sourceTree = ""; }; - 43AF0E0122B01E3200E54D48 /* VFSNotificationDisplay.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSNotificationDisplay.m; sourceTree = ""; }; - 43AF0E0622B023F200E54D48 /* VFSMessageParserTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSMessageParserTests.m; sourceTree = ""; }; - 43AF0E0722B023F200E54D48 /* VFSForGitNotificationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSForGitNotificationTests.m; sourceTree = ""; }; - 43C021EE22B18BDD00F868F2 /* VFSNotificationErrors.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VFSNotificationErrors.h; sourceTree = ""; }; - 43C021EF22B18BDD00F868F2 /* VFSNotificationErrors.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VFSNotificationErrors.m; sourceTree = ""; }; - 43C0221822BBFA7A00F868F2 /* VFSCommandRunner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VFSCommandRunner.m; sourceTree = ""; }; - 43C0221922BBFA7A00F868F2 /* VFSCommandRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VFSCommandRunner.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 433FE811227B593500488730 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 43583C282285E3E1003357D6 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 430ED36D2281E6B200319408 /* UI */ = { - isa = PBXGroup; - children = ( - 43AF0E0022B01E3200E54D48 /* VFSNotificationDisplay.h */, - 43AF0E0122B01E3200E54D48 /* VFSNotificationDisplay.m */, - 433FE8532280C21000488730 /* VFSStatusBarItem.h */, - 433FE8542280C21000488730 /* VFSStatusBarItem.m */, - 433FE8622281D06100488730 /* VFSAboutWindowController.h */, - 433FE8602281D06000488730 /* VFSAboutWindowController.m */, - 433FE8612281D06100488730 /* VFSAboutWindowController.xib */, - 433FE817227B593500488730 /* VFSAppDelegate.h */, - 433FE818227B593500488730 /* VFSAppDelegate.m */, - 433FE81A227B594300488730 /* Assets.xcassets */, - 433FE81C227B594300488730 /* MainMenu.xib */, - ); - path = UI; - sourceTree = ""; - }; - 433FE80B227B593500488730 = { - isa = PBXGroup; - children = ( - 433FE816227B593500488730 /* StatusMenuItem */, - 43583C2C2285E3E1003357D6 /* VFSForGit.UnitTests */, - 433FE815227B593500488730 /* Products */, - ); - sourceTree = ""; - }; - 433FE815227B593500488730 /* Products */ = { - isa = PBXGroup; - children = ( - 433FE814227B593500488730 /* VFS For Git.app */, - 43583C2B2285E3E1003357D6 /* VFSForGit.UnitTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 433FE816227B593500488730 /* StatusMenuItem */ = { - isa = PBXGroup; - children = ( - 43AF0DFF22B01CD400E54D48 /* IPC */, - 435B1E04228C88E300E853F3 /* Utilities */, - 430ED36D2281E6B200319408 /* UI */, - 433FE81F227B594300488730 /* Info.plist */, - 433FE820227B594300488730 /* main.m */, - 433FE822227B594300488730 /* VFSForGit.entitlements */, - ); - path = StatusMenuItem; - sourceTree = ""; - }; - 43583C2C2285E3E1003357D6 /* VFSForGit.UnitTests */ = { - isa = PBXGroup; - children = ( - 43583C3B228A17D4003357D6 /* Mocks */, - 43583C2F2285E3E1003357D6 /* Info.plist */, - 43583C372289BE94003357D6 /* VFSAboutWindowControllerTests.m */, - 43AF0E0722B023F200E54D48 /* VFSForGitNotificationTests.m */, - 43AF0E0622B023F200E54D48 /* VFSMessageParserTests.m */, - 43583C352289BDAA003357D6 /* VFSStatusBarItemTests.m */, - ); - path = VFSForGit.UnitTests; - sourceTree = ""; - }; - 43583C3B228A17D4003357D6 /* Mocks */ = { - isa = PBXGroup; - children = ( - 435B1DFC228B4CB500E853F3 /* VFSMockAboutWindowController.h */, - 435B1DFA228B4C8400E853F3 /* VFSMockAboutWindowController.m */, - 435B1DFD228B590100E853F3 /* VFSMockProductInfoFetcher.h */, - 435B1DFE228B590100E853F3 /* VFSMockProductInfoFetcher.m */, - 435B1E00228B6C3900E853F3 /* VFSMockNotificationCenter.h */, - 435B1E01228B6C3900E853F3 /* VFSMockNotificationCenter.m */, - ); - path = Mocks; - sourceTree = ""; - }; - 435B1E04228C88E300E853F3 /* Utilities */ = { - isa = PBXGroup; - children = ( - 43C0221922BBFA7A00F868F2 /* VFSCommandRunner.h */, - 43C0221822BBFA7A00F868F2 /* VFSCommandRunner.m */, - 433FE8582280E10F00488730 /* VFSProductInfoFetcher.h */, - 433FE8592280E10F00488730 /* VFSProductInfoFetcher.m */, - 435B1E0D228CC1E000E853F3 /* VFSProcessRunner.h */, - 435B1E0E228CC1E000E853F3 /* VFSProcessRunner.m */, - 43C021EE22B18BDD00F868F2 /* VFSNotificationErrors.h */, - 43C021EF22B18BDD00F868F2 /* VFSNotificationErrors.m */, - ); - path = Utilities; - sourceTree = ""; - }; - 43AF0DFF22B01CD400E54D48 /* IPC */ = { - isa = PBXGroup; - children = ( - 43AF0DF222B01C9700E54D48 /* VFSForGitNotification.h */, - 43AF0DF422B01C9700E54D48 /* VFSForGitNotification.m */, - 43AF0DF322B01C9700E54D48 /* VFSMessageListener.h */, - 43AF0DF622B01C9800E54D48 /* VFSMessageListener.m */, - 43AF0DF722B01C9800E54D48 /* VFSMessageParser.h */, - 43AF0DF522B01C9700E54D48 /* VFSMessageParser.m */, - ); - path = IPC; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 433FE813227B593500488730 /* VFS For Git */ = { - isa = PBXNativeTarget; - buildConfigurationList = 433FE830227B594300488730 /* Build configuration list for PBXNativeTarget "VFS For Git" */; - buildPhases = ( - 433FE810227B593500488730 /* Sources */, - 433FE811227B593500488730 /* Frameworks */, - 433FE812227B593500488730 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "VFS For Git"; - productName = VFSForGit; - productReference = 433FE814227B593500488730 /* VFS For Git.app */; - productType = "com.apple.product-type.application"; - }; - 43583C2A2285E3E1003357D6 /* VFSForGit.UnitTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 43583C322285E3E1003357D6 /* Build configuration list for PBXNativeTarget "VFSForGit.UnitTests" */; - buildPhases = ( - 43583C272285E3E1003357D6 /* Sources */, - 43583C282285E3E1003357D6 /* Frameworks */, - 43583C292285E3E1003357D6 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 43583C312285E3E1003357D6 /* PBXTargetDependency */, - ); - name = VFSForGit.UnitTests; - productName = VFSForGit.UnitTests; - productReference = 43583C2B2285E3E1003357D6 /* VFSForGit.UnitTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 433FE80C227B593500488730 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0930; - ORGANIZATIONNAME = Microsoft; - TargetAttributes = { - 433FE813227B593500488730 = { - CreatedOnToolsVersion = 9.3; - }; - 43583C2A2285E3E1003357D6 = { - CreatedOnToolsVersion = 9.3; - TestTargetID = 433FE813227B593500488730; - }; - }; - }; - buildConfigurationList = 433FE80F227B593500488730 /* Build configuration list for PBXProject "VFSForGit" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 433FE80B227B593500488730; - productRefGroup = 433FE815227B593500488730 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 433FE813227B593500488730 /* VFS For Git */, - 43583C2A2285E3E1003357D6 /* VFSForGit.UnitTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 433FE812227B593500488730 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 433FE8642281D06100488730 /* VFSAboutWindowController.xib in Resources */, - 433FE81B227B594300488730 /* Assets.xcassets in Resources */, - 433FE81E227B594300488730 /* MainMenu.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 43583C292285E3E1003357D6 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 433FE810227B593500488730 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 433FE85A2280E10F00488730 /* VFSProductInfoFetcher.m in Sources */, - 435B1E0F228CC1E000E853F3 /* VFSProcessRunner.m in Sources */, - 433FE8632281D06100488730 /* VFSAboutWindowController.m in Sources */, - 43AF0DF822B01C9800E54D48 /* VFSForGitNotification.m in Sources */, - 433FE821227B594300488730 /* main.m in Sources */, - 43C0221A22BBFA7A00F868F2 /* VFSCommandRunner.m in Sources */, - 43C021F022B18BDD00F868F2 /* VFSNotificationErrors.m in Sources */, - 43AF0DFA22B01C9800E54D48 /* VFSMessageParser.m in Sources */, - 433FE819227B593500488730 /* VFSAppDelegate.m in Sources */, - 43AF0E0222B01E3200E54D48 /* VFSNotificationDisplay.m in Sources */, - 433FE8562280C21000488730 /* VFSStatusBarItem.m in Sources */, - 43AF0DFC22B01C9800E54D48 /* VFSMessageListener.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 43583C272285E3E1003357D6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 43AF0E0322B023BE00E54D48 /* VFSMockAboutWindowController.m in Sources */, - 43AF0E0422B023BE00E54D48 /* VFSMockProductInfoFetcher.m in Sources */, - 43AF0E0822B023F200E54D48 /* VFSMessageParserTests.m in Sources */, - 43AF0E0922B023F200E54D48 /* VFSForGitNotificationTests.m in Sources */, - 43AF0E0522B023BE00E54D48 /* VFSMockNotificationCenter.m in Sources */, - 43583C362289BDAA003357D6 /* VFSStatusBarItemTests.m in Sources */, - 43583C382289BE94003357D6 /* VFSAboutWindowControllerTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 43583C312285E3E1003357D6 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 433FE813227B593500488730 /* VFS For Git */; - targetProxy = 43583C302285E3E1003357D6 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 433FE81C227B594300488730 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 433FE81D227B594300488730 /* Base */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 433FE82E227B594300488730 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = VFSForGit; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 433FE82F227B594300488730 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = VFSForGit; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 433FE831227B594300488730 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "VFS For Git"; - CODE_SIGN_ENTITLEMENTS = ""; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = UBF8T346G9; - INFOPLIST_FILE = StatusMenuItem/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.13; - PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.VFSForGit; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 433FE832227B594300488730 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = "VFS For Git"; - CODE_SIGN_ENTITLEMENTS = ""; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_TESTABILITY = YES; - INFOPLIST_FILE = StatusMenuItem/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - ); - MACOSX_DEPLOYMENT_TARGET = 10.13; - PRODUCT_BUNDLE_IDENTIFIER = com.microsoft.VFSForGit; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; - 43583C332285E3E1003357D6 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = UBF8T346G9; - HEADER_SEARCH_PATHS = "$(SRCROOT)/VFSForGit.UnitTests/Mocks"; - INFOPLIST_FILE = VFSForGit.UnitTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/../Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.VFSForGit-UnitTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/VFS For Git.app/Contents/MacOS/VFS For Git"; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 43583C342285E3E1003357D6 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = UBF8T346G9; - HEADER_SEARCH_PATHS = "$(SRCROOT)/VFSForGit.UnitTests/Mocks"; - INFOPLIST_FILE = VFSForGit.UnitTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/../Frameworks", - "@loader_path/../Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = "com.microsoft.VFSForGit-UnitTests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/VFS For Git.app/Contents/MacOS/VFS For Git"; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 433FE80F227B593500488730 /* Build configuration list for PBXProject "VFSForGit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 433FE82E227B594300488730 /* Debug */, - 433FE82F227B594300488730 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 433FE830227B594300488730 /* Build configuration list for PBXNativeTarget "VFS For Git" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 433FE831227B594300488730 /* Debug */, - 433FE832227B594300488730 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 43583C322285E3E1003357D6 /* Build configuration list for PBXNativeTarget "VFSForGit.UnitTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 43583C332285E3E1003357D6 /* Debug */, - 43583C342285E3E1003357D6 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 433FE80C227B593500488730 /* Project object */; -} diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index a952dc9ef2..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/VFSForGit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GVFS/GVFS.Notifications/VFSForGit.Mac/org.vfsforgit.usernotification.plist b/GVFS/GVFS.Notifications/VFSForGit.Mac/org.vfsforgit.usernotification.plist deleted file mode 100644 index ed609ec568..0000000000 --- a/GVFS/GVFS.Notifications/VFSForGit.Mac/org.vfsforgit.usernotification.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - EnvironmentVariables - - - PATH - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - - Label - org.vfsforgit.usernotification - ProgramArguments - - /Library/Application Support/VFS For Git/VFS For Git.app/Contents/MacOS/VFS For Git - - WorkingDirectory - /usr/local/vfsforgit - ProcessType - Interactive - LimitLoadToSessionType - Aqua - Disabled - - OnDemand - - KeepAlive - - RunAtLoad - - - diff --git a/GVFS/GVFS.Payload/GVFS.Payload.csproj b/GVFS/GVFS.Payload/GVFS.Payload.csproj new file mode 100644 index 0000000000..a976360f65 --- /dev/null +++ b/GVFS/GVFS.Payload/GVFS.Payload.csproj @@ -0,0 +1,59 @@ + + + + net461 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Microsoft400 + false + + + + diff --git a/GVFS/GVFS.Payload/layout.bat b/GVFS/GVFS.Payload/layout.bat new file mode 100644 index 0000000000..85036a5018 --- /dev/null +++ b/GVFS/GVFS.Payload/layout.bat @@ -0,0 +1,86 @@ +@ECHO OFF +SETLOCAL + +IF "%~1" == "" ( + ECHO error: missing configuration + ECHO. + GOTO USAGE +) + +IF "%~2" == "" ( + ECHO error: missing version + ECHO. + GOTO USAGE +) + +IF "%~3" == "" ( + ECHO error: missing ProjFS path + ECHO. + GOTO USAGE +) + +IF "%~4" == "" ( + ECHO error: missing VCRuntime path + ECHO. + GOTO USAGE +) + +IF "%~5" == "" ( + ECHO error: missing output path + ECHO. + GOTO USAGE +) + +SET CONFIGURATION=%1 +SET GVFSVERSION=%2 +SET PROJFS=%3 +SET VCRUNTIME=%4 +SET OUTPUT=%5 + +SET ROOT=%~dp0..\.. +SET BUILD_OUT=%ROOT%\..\out +SET MANAGED_OUT_FRAGMENT=bin\%CONFIGURATION%\net461\win-x64 +SET NATIVE_OUT_FRAGMENT=bin\x64\%CONFIGURATION% + +ECHO Copying files... +xcopy /Y %PROJFS%\filter\PrjFlt.sys %OUTPUT%\Filter\ +xcopy /Y %PROJFS%\filter\prjflt.inf %OUTPUT%\Filter\ +xcopy /Y %PROJFS%\lib\ProjectedFSLib.dll %OUTPUT%\ProjFS\ +xcopy /Y %VCRUNTIME%\lib\x64\msvcp140.dll %OUTPUT% +xcopy /Y %VCRUNTIME%\lib\x64\msvcp140_1.dll %OUTPUT% +xcopy /Y %VCRUNTIME%\lib\x64\msvcp140_2.dll %OUTPUT% +xcopy /Y %VCRUNTIME%\lib\x64\vcruntime140.dll %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS\%MANAGED_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.Hooks\%MANAGED_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.Mount\%MANAGED_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.Service\%MANAGED_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.Service.UI\%MANAGED_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GitHooksLoader\%NATIVE_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.PostIndexChangedHook\%NATIVE_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.ReadObjectHook\%NATIVE_OUT_FRAGMENT%\* %OUTPUT% +xcopy /Y /S %BUILD_OUT%\GVFS.VirtualFileSystemHook\%NATIVE_OUT_FRAGMENT%\* %OUTPUT% + +ECHO Cleaning up... +REM Remove unused LibGit2 files +RMDIR /S /Q %OUTPUT%\lib +REM Remove files for x86 (not supported) +RMDIR /S /Q %OUTPUT%\x86 + +GOTO EOF + +:USAGE +ECHO usage: %~n0%~x0 ^ ^ ^ ^ ^ +ECHO. +ECHO configuration Build configuration (Debug, Release). +ECHO version GVFS version string. +ECHO projfs Path to GVFS.ProjFS NuGet package contents. +ECHO vcruntime Path to GVFS.VCRuntime NuGet package contents. +ECHO output Output directory. +ECHO. +EXIT 1 + +:ERROR +ECHO Failed with error %ERRORLEVEL% +EXIT /B %ERRORLEVEL% + +:EOF diff --git a/GVFS/GVFS.PerfProfiling/App.config b/GVFS/GVFS.PerfProfiling/App.config deleted file mode 100644 index 6d44256319..0000000000 --- a/GVFS/GVFS.PerfProfiling/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/GVFS/GVFS.PerfProfiling/GVFS.PerfProfiling.csproj b/GVFS/GVFS.PerfProfiling/GVFS.PerfProfiling.csproj index fac88be03a..de092f981c 100644 --- a/GVFS/GVFS.PerfProfiling/GVFS.PerfProfiling.csproj +++ b/GVFS/GVFS.PerfProfiling/GVFS.PerfProfiling.csproj @@ -1,105 +1,14 @@ - - - - + + - {C5D3CA26-562F-4CA4-A378-B93E97A730E3} Exe - Properties - GVFS.PerfProfiling - GVFS.PerfProfiling - v4.6.1 - 512 - true - - + net461 - - true - DEBUG;TRACE - full - x64 - prompt - - - TRACE - true - pdbonly - x64 - prompt - - - - ..\..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - - - PlatformLoader.Windows.cs - - - - - - + - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {1118b427-7063-422f-83b9-5023c8ec5a7a} - GVFS.GVFlt - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - GVFS.Platform.Windows - - - {f468b05a-95e5-46bc-8c67-b80a78527b7d} - GVFS.Virtualization - + + + - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file + + diff --git a/GVFS/GVFS.PerfProfiling/Properties/AssemblyInfo.cs b/GVFS/GVFS.PerfProfiling/Properties/AssemblyInfo.cs deleted file mode 100644 index 540c65d5d1..0000000000 --- a/GVFS/GVFS.PerfProfiling/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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.PerfProfiling")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.PerfProfiling")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[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("c5d3ca26-562f-4ca4-a378-b93e97a730e3")] diff --git a/GVFS/GVFS.PerfProfiling/packages.config b/GVFS/GVFS.PerfProfiling/packages.config deleted file mode 100644 index ebcf07f92f..0000000000 --- a/GVFS/GVFS.PerfProfiling/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Platform.POSIX/GVFS.Platform.POSIX.csproj b/GVFS/GVFS.Platform.POSIX/GVFS.Platform.POSIX.csproj deleted file mode 100644 index 9c267f5381..0000000000 --- a/GVFS/GVFS.Platform.POSIX/GVFS.Platform.POSIX.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - netcoreapp2.1;netstandard2.0 - x64 - true - true - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - $(GVFSVersion) - - - - - - - - - - all - - - diff --git a/GVFS/GVFS.Platform.POSIX/POSIXFileSystem.Shared.cs b/GVFS/GVFS.Platform.POSIX/POSIXFileSystem.Shared.cs deleted file mode 100644 index 212eeefeb4..0000000000 --- a/GVFS/GVFS.Platform.POSIX/POSIXFileSystem.Shared.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace GVFS.Platform.POSIX -{ - public partial class POSIXFileSystem - { - public static bool TryGetNormalizedPathImplementation(string path, out string normalizedPath, out string errorMessage) - { - // TODO(#1358): Properly determine normalized paths (e.g. across links) - errorMessage = null; - normalizedPath = path; - return true; - } - } -} diff --git a/GVFS/GVFS.Platform.POSIX/POSIXFileSystem.cs b/GVFS/GVFS.Platform.POSIX/POSIXFileSystem.cs deleted file mode 100644 index c1ff51c2ac..0000000000 --- a/GVFS/GVFS.Platform.POSIX/POSIXFileSystem.cs +++ /dev/null @@ -1,108 +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.POSIX -{ - public abstract partial class POSIXFileSystem : IPlatformFileSystem - { - // https://github.com/dotnet/corefx/blob/103639b6ff5aa6ab6097f70732530e411817f09b/src/Common/src/CoreLib/Interop/Unix/System.Native/Interop.OpenFlags.cs#L12 - [Flags] - public enum OpenFlags - { - // Access modes (mutually exclusive) - O_RDONLY = 0x0000, - O_WRONLY = 0x0001, - O_RDWR = 0x0002, - - // Flags (combinable) - O_CLOEXEC = 0x0010, - O_CREAT = 0x0020, - O_EXCL = 0x0040, - O_TRUNC = 0x0080, - O_SYNC = 0x0100, - } - - public bool SupportsFileMode { get; } = true; - - public void FlushFileBuffers(string path) - { - // TODO(#1057): Use native API to flush file - } - - public void MoveAndOverwriteFile(string sourceFileName, string destinationFilename) - { - if (Rename(sourceFileName, destinationFilename) != 0) - { - NativeMethods.ThrowLastWin32Exception($"Failed to rename {sourceFileName} to {destinationFilename}"); - } - } - - public abstract void ChangeMode(string path, ushort mode); - - public bool TryGetNormalizedPath(string path, out string normalizedPath, out string errorMessage) - { - return POSIXFileSystem.TryGetNormalizedPathImplementation(path, out normalizedPath, out errorMessage); - } - - public void SetDirectoryLastWriteTime(string path, DateTime lastWriteTime, out bool directoryExists) - { - directoryExists = Directory.Exists(path); - if (directoryExists) - { - Directory.SetLastWriteTime(path, lastWriteTime); - } - } - - public abstract bool HydrateFile(string fileName, byte[] buffer); - - public abstract bool IsExecutable(string fileName); - - public abstract bool IsSocket(string fileName); - - public bool TryCreateDirectoryAccessibleByAuthUsers(string directoryPath, out string error, ITracer tracer = null) - { - try - { - Directory.CreateDirectory(directoryPath); - error = null; - return true; - } - catch (Exception e) when (e is IOException || e is UnauthorizedAccessException) - { - if (tracer != null) - { - EventMetadata metadataData = new EventMetadata(); - metadataData.Add("Exception", e.ToString()); - metadataData.Add(nameof(directoryPath), directoryPath); - tracer.RelatedError(metadataData, $"{nameof(this.TryCreateDirectoryAccessibleByAuthUsers)}: Failed to create directory"); - } - - error = e.Message; - return false; - } - } - - public bool TryCreateDirectoryWithAdminAndUserModifyPermissions(string directoryPath, out string error) - { - throw new NotImplementedException(); - } - - public bool TryCreateOrUpdateDirectoryToAdminModifyPermissions(ITracer tracer, string directoryPath, out string error) - { - throw new NotImplementedException(); - } - - public virtual bool IsFileSystemSupported(string path, out string error) - { - error = null; - return true; - } - - [DllImport("libc", EntryPoint = "rename", SetLastError = true)] - private static extern int Rename(string oldPath, string newPath); - } -} diff --git a/GVFS/GVFS.Platform.POSIX/POSIXGitInstallation.cs b/GVFS/GVFS.Platform.POSIX/POSIXGitInstallation.cs deleted file mode 100644 index 5c63532dde..0000000000 --- a/GVFS/GVFS.Platform.POSIX/POSIXGitInstallation.cs +++ /dev/null @@ -1,32 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using System.IO; - -namespace GVFS.Platform.POSIX -{ - public class POSIXGitInstallation : IGitInstallation - { - private const string GitProcessName = "git"; - - public bool GitExists(string gitBinPath) - { - if (!string.IsNullOrWhiteSpace(gitBinPath)) - { - return File.Exists(gitBinPath); - } - - return this.GetInstalledGitBinPath() != null; - } - - public string GetInstalledGitBinPath() - { - ProcessResult result = ProcessHelper.Run("which", args: "git", redirectOutput: true); - if (result.ExitCode != 0) - { - return null; - } - - return result.Output.Trim(); - } - } -} diff --git a/GVFS/GVFS.Platform.POSIX/POSIXPlatform.Shared.cs b/GVFS/GVFS.Platform.POSIX/POSIXPlatform.Shared.cs deleted file mode 100644 index 0a9d642e7f..0000000000 --- a/GVFS/GVFS.Platform.POSIX/POSIXPlatform.Shared.cs +++ /dev/null @@ -1,66 +0,0 @@ -using GVFS.Common; -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; - -namespace GVFS.Platform.POSIX -{ - public abstract partial class POSIXPlatform - { - public static bool IsElevatedImplementation() - { - int euid = GetEuid(); - return euid == 0; - } - - public static bool IsProcessActiveImplementation(int processId) - { - try - { - Process process = Process.GetProcessById(processId); - } - catch (ArgumentException) - { - return false; - } - - return true; - } - - public static string GetNamedPipeNameImplementation(string enlistmentRoot, string dotGVFSRoot) - { - // Pipes are stored as files on POSIX, use a rooted pipe name to keep full control of the location of the file - return Path.Combine(enlistmentRoot, dotGVFSRoot, "GVFS_NetCorePipe"); - } - - public static bool IsConsoleOutputRedirectedToFileImplementation() - { - // TODO(#1355): Implement proper check - return false; - } - - public static bool TryGetGVFSEnlistmentRootImplementation(string directory, string dotGVFSRoot, out string enlistmentRoot, out string errorMessage) - { - enlistmentRoot = null; - - string finalDirectory; - if (!POSIXFileSystem.TryGetNormalizedPathImplementation(directory, out finalDirectory, out errorMessage)) - { - return false; - } - - enlistmentRoot = Paths.GetRoot(finalDirectory, dotGVFSRoot); - if (enlistmentRoot == null) - { - errorMessage = $"Failed to find the root directory for {dotGVFSRoot} in {finalDirectory}"; - return false; - } - - return true; - } - - [DllImport("libc", EntryPoint = "geteuid", SetLastError = true)] - private static extern int GetEuid(); - } -} diff --git a/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs b/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs deleted file mode 100644 index 19bec8c9af..0000000000 --- a/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs +++ /dev/null @@ -1,302 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.IO; -using System.IO.Pipes; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security; - -namespace GVFS.Platform.POSIX -{ - public abstract partial class POSIXPlatform : GVFSPlatform - { - private const int StdInFileNo = 0; // STDIN_FILENO -> standard input file descriptor - private const int StdOutFileNo = 1; // STDOUT_FILENO -> standard output file descriptor - private const int StdErrFileNo = 2; // STDERR_FILENO -> standard error file descriptor - - protected POSIXPlatform() : this( - underConstruction: new UnderConstructionFlags( - supportsGVFSUpgrade: false, - supportsGVFSConfig: false, - supportsNuGetEncryption: false, - supportsNuGetVerification: false)) - { - } - - protected POSIXPlatform(UnderConstructionFlags underConstruction) - : base(underConstruction) - { - } - - public override IGitInstallation GitInstallation { get; } = new POSIXGitInstallation(); - - public override void ConfigureVisualStudio(string gitBinPath, ITracer tracer) - { - } - - public override bool TryGetGVFSHooksVersion(out string hooksVersion, out string error) - { - // TODO(#1044): Get the hooks version rather than the GVFS version (and share that code with the Windows platform) - hooksVersion = ProcessHelper.GetCurrentProcessVersion(); - error = null; - return true; - } - - public override bool TryInstallGitCommandHooks(GVFSContext context, string executingDirectory, string hookName, string commandHookPath, out string errorMessage) - { - errorMessage = null; - - string gvfsHooksPath = Path.Combine(executingDirectory, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); - - File.WriteAllText( - commandHookPath, - $"#!/bin/sh\n{gvfsHooksPath} {hookName} \"$@\""); - GVFSPlatform.Instance.FileSystem.ChangeMode(commandHookPath, Convert.ToUInt16("755", 8)); - - return true; - } - - public override bool TryVerifyAuthenticodeSignature(string path, out string subject, out string issuer, out string error) - { - throw new NotImplementedException(); - } - - public override bool IsProcessActive(int processId) - { - return POSIXPlatform.IsProcessActiveImplementation(processId); - } - - public override void IsServiceInstalledAndRunning(string name, out bool installed, out bool running) - { - throw new NotImplementedException(); - } - - public override void StartBackgroundVFS4GProcess(ITracer tracer, string programName, string[] args) - { - string programArguments = string.Empty; - try - { - programArguments = string.Join(" ", args.Select(arg => arg.Contains(' ') ? "\"" + arg + "\"" : arg)); - ProcessStartInfo processInfo = new ProcessStartInfo(programName, programArguments); - - // Redirecting stdin/out/err ensures that all standard input/output file descriptors are properly closed - // by dup2 before execve is called for the child process - // (see https://github.com/dotnet/corefx/blob/b10e8d67b260e26f2e47750cf96669e6f48e774d/src/Native/Unix/System.Native/pal_process.c#L381) - // - // Testing has shown that without redirecting stdin/err/out code like this: - // - // string result = process.StandardOutput.ReadToEnd(); - // process.WaitForExit(); - // - // That waits on a `gvfs` verb to exit can hang in the WaitForExit() call because the chuild process has inheritied - // standard input/output handle(s), and redirecting those streams before spawing the process appears to be the only - // way to ensure they're properly closed. - // - // Note that this approach requires that the child process know that it needs to redirect its standard input/output to /dev/null and - // so this method can only be used with VFS4G processes that are aware they're being launched in the background - processInfo.RedirectStandardError = true; - processInfo.RedirectStandardInput = true; - processInfo.RedirectStandardOutput = true; - - Process executingProcess = new Process(); - executingProcess.StartInfo = processInfo; - executingProcess.Start(); - } - catch (Exception ex) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add(nameof(programName), programName); - metadata.Add(nameof(programArguments), programArguments); - metadata.Add("Exception", ex.ToString()); - tracer.RelatedError(metadata, "Failed to start background process."); - throw; - } - } - - public override void PrepareProcessToRunInBackground() - { - int devNullIn = Open("/dev/null", (int)POSIXFileSystem.OpenFlags.O_RDONLY); - if (devNullIn == -1) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to open /dev/null for reading"); - } - - int devNullOut = Open("/dev/null", (int)POSIXFileSystem.OpenFlags.O_WRONLY); - if (devNullOut == -1) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Unable to open /dev/null for writing"); - } - - // Redirect stdout/stdin/stderr to "/dev/null" - if (Dup2(devNullIn, StdInFileNo) == -1 || - Dup2(devNullOut, StdOutFileNo) == -1 || - Dup2(devNullOut, StdErrFileNo) == -1) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Error redirecting stdout/stdin/stderr to /dev/null"); - } - - Close(devNullIn); - Close(devNullOut); - - // Become session leader of a new session - if (SetSid() == -1) - { - throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to become session leader"); - } - } - - public override NamedPipeServerStream CreatePipeByName(string pipeName) - { - NamedPipeServerStream pipe = new NamedPipeServerStream( - pipeName, - PipeDirection.InOut, - NamedPipeServerStream.MaxAllowedServerInstances, - PipeTransmissionMode.Byte, - PipeOptions.WriteThrough | PipeOptions.Asynchronous, - 0, // default inBufferSize - 0); // default outBufferSize) - - return pipe; - } - - public override string GetCurrentUser() - { - return Getuid().ToString(); - } - - public override string GetUserIdFromLoginSessionId(int sessionId, ITracer tracer) - { - // There are no separate User and Session Ids on POSIX platforms. - return sessionId.ToString(); - } - - public override Dictionary GetPhysicalDiskInfo(string path, bool sizeStatsOnly) - { - // TODO(#1356): Collect disk information - Dictionary result = new Dictionary(); - result.Add("GetPhysicalDiskInfo", "Not yet implemented on POSIX"); - return result; - } - - public override string GetGVFSServiceNamedPipeName(string serviceName) - { - // Pipes are stored as files on POSIX, use a rooted pipe name - // in the same location as the service to keep full control of the location of the file - return this.GetSecureDataRootForGVFSComponent(serviceName) + ".pipe"; - } - - public override bool IsConsoleOutputRedirectedToFile() - { - return POSIXPlatform.IsConsoleOutputRedirectedToFileImplementation(); - } - - public override bool IsElevated() - { - return POSIXPlatform.IsElevatedImplementation(); - } - - public override bool TryGetDefaultLocalCacheRoot(string enlistmentRoot, out string localCacheRoot, out string localCacheRootError) - { - string homeDirectory; - - try - { - homeDirectory = Environment.GetEnvironmentVariable("HOME"); - } - catch (SecurityException e) - { - localCacheRoot = null; - localCacheRootError = $"Failed to read $HOME, insufficient permission: {e.Message}"; - return false; - } - - if (string.IsNullOrEmpty(homeDirectory)) - { - localCacheRoot = null; - localCacheRootError = "$HOME empty or not found"; - return false; - } - - try - { - localCacheRoot = Path.Combine(homeDirectory, GVFSConstants.DefaultGVFSCacheFolderName); - localCacheRootError = null; - return true; - } - catch (ArgumentException e) - { - localCacheRoot = null; - localCacheRootError = $"Failed to build local cache path using $HOME('{homeDirectory}'): {e.Message}"; - return false; - } - } - - public override bool IsGitStatusCacheSupported() - { - // Git status cache is only supported on Windows - return false; - } - - public override bool TryKillProcessTree(int processId, out int exitCode, out string error) - { - ProcessResult result = ProcessHelper.Run("pkill", $"-P {processId}"); - error = result.Errors; - exitCode = result.ExitCode; - return result.ExitCode == 0; - } - - public override bool TryCopyPanicLogs(string copyToDir, out string error) - { - error = null; - return true; - } - - [DllImport("libc", EntryPoint = "getuid", SetLastError = true)] - private static extern uint Getuid(); - - [DllImport("libc", EntryPoint = "setsid", SetLastError = true)] - private static extern int SetSid(); - - [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 filedes); - - [DllImport("libc", EntryPoint = "dup2", SetLastError = true)] - private static extern int Dup2(int oldfd, int newfd); - - public abstract class POSIXPlatformConstants : GVFSPlatformConstants - { - public override string ExecutableExtension - { - get { return string.Empty; } - } - - public override string GVFSExecutableName - { - get { return "gvfs"; } - } - - public override string ProgramLocaterCommand - { - get { return "which"; } - } - - public override HashSet UpgradeBlockingProcesses - { - get { return new HashSet(GVFSPlatform.Instance.Constants.PathComparer) { "GVFS.Mount", "git", "wish" }; } - } - - public override bool SupportsUpgradeWhileRunning => true; - - // Documented here (in the addressing section): https://www.unix.com/man-page/linux/7/unix/ - public override int MaxPipePathLength => 108; - } - } -} diff --git a/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj b/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj index 5373548cce..0528354ffc 100644 --- a/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj +++ b/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj @@ -1,134 +1,25 @@ - - - - - + + - {4CE404E7-D3FC-471C-993C-64615861EA63} - Library - Properties - GVFS.Platform.Windows - GVFS.Platform.Windows - v4.6.1 - 512 - - + net461 - - true - DEBUG;TRACE - full - x64 - prompt - - - TRACE - true - pdbonly - x64 - prompt - - - - False - ..\..\..\packages\Microsoft.Database.Collections.Generic.1.9.4\lib\net40\Esent.Collections.dll - True - - - False - ..\..\..\packages\ManagedEsent.1.9.4\lib\net40\Esent.Interop.dll - True - - - False - ..\..\..\packages\Microsoft.Database.Isam.1.9.4\lib\net40\Esent.Isam.dll - True - - - ..\..\..\packages\Microsoft.Windows.ProjFS.1.1.19156.1\lib\net461\ProjectedFSLib.Managed.dll - - - - - - ..\..\..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - + - - Designer - + + + - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {1118b427-7063-422f-83b9-5023c8ec5a7a} - GVFS.GVFlt - - - {f468b05a-95e5-46bc-8c67-b80a78527b7d} - GVFS.Virtualization - + + + + + + - - + + - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + diff --git a/GVFS/GVFS.PlatformLoader/PlatformLoader.Windows.cs b/GVFS/GVFS.Platform.Windows/PlatformLoader.Windows.cs similarity index 100% rename from GVFS/GVFS.PlatformLoader/PlatformLoader.Windows.cs rename to GVFS/GVFS.Platform.Windows/PlatformLoader.Windows.cs diff --git a/GVFS/GVFS.Platform.Windows/ProjFSFilter.cs b/GVFS/GVFS.Platform.Windows/ProjFSFilter.cs index 452b8687d3..7306eaefdf 100644 --- a/GVFS/GVFS.Platform.Windows/ProjFSFilter.cs +++ b/GVFS/GVFS.Platform.Windows/ProjFSFilter.cs @@ -5,7 +5,7 @@ using Microsoft.Windows.ProjFS; using System; using System.ComponentModel; -using System.Diagnostics; +using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -282,39 +282,39 @@ public static bool IsNativeLibInstalled(ITracer tracer, PhysicalFileSystem fileS return existsInSystem32 || existsInAppDirectory; } - public static bool TryCopyNativeLibIfDriverVersionsMatch(ITracer tracer, PhysicalFileSystem fileSystem, out string copyNativeDllError) - { + public static bool TryCopyNativeLibIfDriverVersionsMatch(ITracer tracer, PhysicalFileSystem fileSystem, out string copyNativeDllError) + { string system32NativeLibraryPath = Path.Combine(Environment.SystemDirectory, ProjFSNativeLibFileName); - if (fileSystem.FileExists(system32NativeLibraryPath)) + if (fileSystem.FileExists(system32NativeLibraryPath)) { copyNativeDllError = $"{ProjFSNativeLibFileName} already exists at {system32NativeLibraryPath}"; - return false; + return false; } string gvfsProcessLocation = ProcessHelper.GetCurrentProcessLocation(); string nonInboxNativeLibInstallPath; string packagedNativeLibPath; GetNativeLibPaths(gvfsProcessLocation, out packagedNativeLibPath, out nonInboxNativeLibInstallPath); - if (fileSystem.FileExists(nonInboxNativeLibInstallPath)) - { + if (fileSystem.FileExists(nonInboxNativeLibInstallPath)) + { copyNativeDllError = $"{ProjFSNativeLibFileName} already exists at {nonInboxNativeLibInstallPath}"; - return false; + return false; } - if (!fileSystem.FileExists(packagedNativeLibPath)) + if (!fileSystem.FileExists(packagedNativeLibPath)) { copyNativeDllError = $"{packagedNativeLibPath} not found, no {ProjFSNativeLibFileName} available to copy"; - return false; + return false; } string packagedPrjfltDriverPath = Path.Combine(gvfsProcessLocation, "Filter", DriverFileName); - if (!fileSystem.FileExists(packagedPrjfltDriverPath)) + if (!fileSystem.FileExists(packagedPrjfltDriverPath)) { copyNativeDllError = $"{packagedPrjfltDriverPath} not found, unable to validate that packaged driver matches installed driver"; - return false; + return false; } - string system32PrjfltDriverPath = Path.Combine(Environment.ExpandEnvironmentVariables(System32DriversRoot), DriverFileName); + string system32PrjfltDriverPath = Path.Combine(Environment.ExpandEnvironmentVariables(System32DriversRoot), DriverFileName); if (!fileSystem.FileExists(system32PrjfltDriverPath)) { copyNativeDllError = $"{system32PrjfltDriverPath} not found, unable to validate that packaged driver matches installed driver"; @@ -323,42 +323,42 @@ public static bool TryCopyNativeLibIfDriverVersionsMatch(ITracer tracer, Physica FileVersionInfo packagedDriverVersion; FileVersionInfo system32DriverVersion; - try - { - packagedDriverVersion = fileSystem.GetVersionInfo(packagedPrjfltDriverPath); - system32DriverVersion = fileSystem.GetVersionInfo(system32PrjfltDriverPath); - if (!fileSystem.FileVersionsMatch(packagedDriverVersion, system32DriverVersion)) + try + { + packagedDriverVersion = fileSystem.GetVersionInfo(packagedPrjfltDriverPath); + system32DriverVersion = fileSystem.GetVersionInfo(system32PrjfltDriverPath); + if (!fileSystem.FileVersionsMatch(packagedDriverVersion, system32DriverVersion)) { copyNativeDllError = $"Packaged sys FileVersion '{packagedDriverVersion.FileVersion}' does not match System32 sys FileVersion '{system32DriverVersion.FileVersion}'"; - return false; + return false; } if (!fileSystem.ProductVersionsMatch(packagedDriverVersion, system32DriverVersion)) { copyNativeDllError = $"Packaged sys ProductVersion '{packagedDriverVersion.ProductVersion}' does not match System32 sys ProductVersion '{system32DriverVersion.ProductVersion}'"; return false; - } - } - catch (FileNotFoundException e) - { - EventMetadata metadata = CreateEventMetadata(e); + } + } + catch (FileNotFoundException e) + { + EventMetadata metadata = CreateEventMetadata(e); tracer.RelatedWarning( metadata, - $"{nameof(TryCopyNativeLibIfDriverVersionsMatch)}: Exception caught while comparing sys versions"); - copyNativeDllError = $"Exception caught while comparing sys versions: {e.Message}"; - return false; - } - - EventMetadata driverVersionMetadata = CreateEventMetadata(); - driverVersionMetadata.Add($"{nameof(packagedDriverVersion)}.FileVersion", packagedDriverVersion.FileVersion.ToString()); + $"{nameof(TryCopyNativeLibIfDriverVersionsMatch)}: Exception caught while comparing sys versions"); + copyNativeDllError = $"Exception caught while comparing sys versions: {e.Message}"; + return false; + } + + EventMetadata driverVersionMetadata = CreateEventMetadata(); + driverVersionMetadata.Add($"{nameof(packagedDriverVersion)}.FileVersion", packagedDriverVersion.FileVersion.ToString()); driverVersionMetadata.Add($"{nameof(system32DriverVersion)}.FileVersion", system32DriverVersion.FileVersion.ToString()); - driverVersionMetadata.Add($"{nameof(packagedDriverVersion)}.ProductVersion", packagedDriverVersion.ProductVersion.ToString()); - driverVersionMetadata.Add($"{nameof(system32DriverVersion)}.ProductVersion", system32DriverVersion.ProductVersion.ToString()); - tracer.RelatedInfo(driverVersionMetadata, $"{nameof(TryCopyNativeLibIfDriverVersionsMatch)}: Copying native library"); - + driverVersionMetadata.Add($"{nameof(packagedDriverVersion)}.ProductVersion", packagedDriverVersion.ProductVersion.ToString()); + driverVersionMetadata.Add($"{nameof(system32DriverVersion)}.ProductVersion", system32DriverVersion.ProductVersion.ToString()); + tracer.RelatedInfo(driverVersionMetadata, $"{nameof(TryCopyNativeLibIfDriverVersionsMatch)}: Copying native library"); + if (!TryCopyNativeLibToNonInboxInstallLocation(tracer, fileSystem, gvfsProcessLocation)) { - copyNativeDllError = "Failed to copy native library"; + copyNativeDllError = "Failed to copy native library"; return false; } diff --git a/GVFS/GVFS.Platform.Windows/Properties/AssemblyInfo.cs b/GVFS/GVFS.Platform.Windows/Properties/AssemblyInfo.cs deleted file mode 100644 index 64dcb8f5f1..0000000000 --- a/GVFS/GVFS.Platform.Windows/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.Windows")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Platform.Windows")] -[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.Platform.Windows/WindowsFileSystem.cs b/GVFS/GVFS.Platform.Windows/WindowsFileSystem.cs index 9ea87ad963..98990c4f5f 100644 --- a/GVFS/GVFS.Platform.Windows/WindowsFileSystem.cs +++ b/GVFS/GVFS.Platform.Windows/WindowsFileSystem.cs @@ -104,8 +104,8 @@ public void ChangeMode(string path, ushort mode) public bool TryGetNormalizedPath(string path, out string normalizedPath, out string errorMessage) { return WindowsFileSystem.TryGetNormalizedPathImplementation(path, out normalizedPath, out errorMessage); - } - + } + public bool HydrateFile(string fileName, byte[] buffer) { return NativeFileReader.TryReadFirstByteOfFile(fileName, buffer); @@ -275,7 +275,7 @@ public bool IsFileSystemSupported(string path, out string error) private class NativeFileReader { private const uint GenericRead = 0x80000000; - private const uint OpenExisting = 3; + private const uint OpenExisting = 3; public static bool TryReadFirstByteOfFile(string fileName, byte[] buffer) { diff --git a/GVFS/GVFS.Platform.Windows/WindowsPlatform.Shared.cs b/GVFS/GVFS.Platform.Windows/WindowsPlatform.Shared.cs index 2bbef5a2b0..67414dbfc7 100644 --- a/GVFS/GVFS.Platform.Windows/WindowsPlatform.Shared.cs +++ b/GVFS/GVFS.Platform.Windows/WindowsPlatform.Shared.cs @@ -128,21 +128,6 @@ public static bool TryGetGVFSEnlistmentRootImplementation(string directory, out return true; } - public static string GetUpgradeProtectedDataDirectoryImplementation() - { - return Path.Combine(GetSecureDataRootForGVFSImplementation(), ProductUpgraderInfo.UpgradeDirectoryName); - } - - public static string GetUpgradeHighestAvailableVersionDirectoryImplementation() - { - return GetUpgradeProtectedDataDirectoryImplementation(); - } - - public static string GetUpgradeReminderNotificationImplementation() - { - return $"A new version of VFS for Git is available. Run {UpgradeConfirmMessage} from an elevated command prompt to upgrade."; - } - [DllImport("kernel32.dll")] private static extern IntPtr GetStdHandle(StdHandle std); diff --git a/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs b/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs index b31d3f6fe0..1f22f32482 100644 --- a/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs +++ b/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs @@ -45,7 +45,7 @@ public override string GVFSConfigPath return Path.Combine(gvfsDirectory, LocalGVFSConfig.FileName); } - } + } /// /// On Windows VFSForGit does not need to use system wide logs to track @@ -162,9 +162,9 @@ public override void StartBackgroundVFS4GProcess(ITracer tracer, string programN } } - public override void PrepareProcessToRunInBackground() - { - // No additional work required + public override void PrepareProcessToRunInBackground() + { + // No additional work required } public override NamedPipeServerStream CreatePipeByName(string pipeName) @@ -333,28 +333,11 @@ public override string GetUserIdFromLoginSessionId(int sessionId, ITracer tracer } } - public override string GetUpgradeLogDirectoryParentDirectory() - { - return Path.Combine( - this.GetCommonAppDataRootForGVFS(), - ProductUpgraderInfo.UpgradeDirectoryName); - } - public override string GetSystemInstallerLogPath() { return null; } - - public override string GetUpgradeHighestAvailableVersionDirectory() - { - return this.GetUpgradeProtectedDataDirectory(); - } - - public override string GetUpgradeProtectedDataDirectory() - { - return GetUpgradeProtectedDataDirectoryImplementation(); - } - + public override Dictionary GetPhysicalDiskInfo(string path, bool sizeStatsOnly) => WindowsPhysicalDiskInfo.GetPhysicalDiskInfo(path, sizeStatsOnly); public override bool IsConsoleOutputRedirectedToFile() @@ -374,45 +357,38 @@ public override FileBasedLock CreateFileBasedLock( { return new WindowsFileBasedLock(fileSystem, tracer, lockPath); } - - public override ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformInteractions( - PhysicalFileSystem fileSystem, - ITracer tracer) - { - return new WindowsProductUpgraderPlatformStrategy(fileSystem, tracer); - } public override bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage) { return WindowsPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage); } - public override bool TryGetDefaultLocalCacheRoot(string enlistmentRoot, out string localCacheRoot, out string localCacheRootError) + public override bool TryGetDefaultLocalCacheRoot(string enlistmentRoot, out string localCacheRoot, out string localCacheRootError) { string pathRoot; - try + try { - pathRoot = Path.GetPathRoot(enlistmentRoot); + pathRoot = Path.GetPathRoot(enlistmentRoot); } catch (ArgumentException e) { localCacheRoot = null; localCacheRootError = $"Failed to determine the root of '{enlistmentRoot}'): {e.Message}"; - return false; - } - + return false; + } + if (string.IsNullOrEmpty(pathRoot)) { localCacheRoot = null; localCacheRootError = $"Failed to determine the root of '{enlistmentRoot}', path does not contain root directory information"; return false; - } - + } + try { - localCacheRoot = Path.Combine(pathRoot, GVFSConstants.DefaultGVFSCacheFolderName); - localCacheRootError = null; + localCacheRoot = Path.Combine(pathRoot, GVFSConstants.DefaultGVFSCacheFolderName); + localCacheRootError = null; return true; } catch (ArgumentException e) @@ -420,7 +396,7 @@ public override bool TryGetDefaultLocalCacheRoot(string enlistmentRoot, out stri localCacheRoot = null; localCacheRootError = $"Failed to build local cache path using root directory '{pathRoot}'): {e.Message}"; return false; - } + } } public override bool TryKillProcessTree(int processId, out int exitCode, out string error) @@ -431,7 +407,7 @@ public override bool TryKillProcessTree(int processId, out int exitCode, out str return result.ExitCode == 0; } - public override bool TryCopyPanicLogs(string copyToDir, out string error) + public override bool TryCopyPanicLogs(string copyToDir, out string error) { error = null; return true; @@ -457,12 +433,12 @@ public override string InstallerExtension { get { return ".exe"; } } - - public override bool SupportsUpgradeWhileRunning => false; - - public override string WorkingDirectoryBackingRootPath - { - get { return GVFSConstants.WorkingDirectoryRootName; } + + public override bool SupportsUpgradeWhileRunning => false; + + public override string WorkingDirectoryBackingRootPath + { + get { return GVFSConstants.WorkingDirectoryRootName; } } public override string DotGVFSRoot @@ -478,23 +454,23 @@ public override string GVFSBinDirectoryPath Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), this.GVFSBinDirectoryName); } - } - - public override string GVFSBinDirectoryName - { - get { return "GVFS"; } - } - - public override string GVFSExecutableName - { - get { return "GVFS" + this.ExecutableExtension; } + } + + public override string GVFSBinDirectoryName + { + get { return "GVFS"; } + } + + public override string GVFSExecutableName + { + get { return "GVFS" + this.ExecutableExtension; } } public override string ProgramLocaterCommand { get { return "where"; } - } - + } + public override HashSet UpgradeBlockingProcesses { get { return new HashSet(GVFSPlatform.Instance.Constants.PathComparer) { "GVFS", "GVFS.Mount", "git", "ssh-agent", "wish", "bash" }; } diff --git a/GVFS/GVFS.Platform.Windows/WindowsProductUpgraderPlatformStrategy.cs b/GVFS/GVFS.Platform.Windows/WindowsProductUpgraderPlatformStrategy.cs deleted file mode 100644 index ccb6f07031..0000000000 --- a/GVFS/GVFS.Platform.Windows/WindowsProductUpgraderPlatformStrategy.cs +++ /dev/null @@ -1,75 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System; -using System.IO; - -namespace GVFS.Platform.Windows -{ - public class WindowsProductUpgraderPlatformStrategy : ProductUpgraderPlatformStrategy - { - public WindowsProductUpgraderPlatformStrategy(PhysicalFileSystem fileSystem, ITracer tracer) - : base(fileSystem, tracer) - { - } - - public override bool TryPrepareLogDirectory(out string error) - { - // Under normal circumstances - // ProductUpgraderInfo.GetLogDirectoryPath will have - // already been created by GVFS.Service. If for some - // reason it does not (e.g. the service failed to start), - // we need to create - // ProductUpgraderInfo.GetLogDirectoryPath() explicity to - // ensure that it has the correct ACLs (so that both admin - // and non-admin users can create log files). If the logs - // directory does not already exist, this call could fail - // when running as a non-elevated user. - string createDirectoryError; - if (!this.FileSystem.TryCreateDirectoryWithAdminAndUserModifyPermissions(ProductUpgraderInfo.GetLogDirectoryPath(), out createDirectoryError)) - { - error = $"ERROR: Unable to create directory `{ProductUpgraderInfo.GetLogDirectoryPath()}`"; - error += $"\n{createDirectoryError}"; - error += $"\n\nTry running {GVFSConstants.UpgradeVerbMessages.GVFSUpgrade} from an elevated command prompt."; - return false; - } - - 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; - } - - if (!this.FileSystem.TryCreateOrUpdateDirectoryToAdminModifyPermissions( - this.Tracer, - upgradeApplicationDirectory, - out error)) - { - return false; - } - - error = null; - return true; - } - - public override bool TryPrepareDownloadDirectory(out string error) - { - return this.FileSystem.TryCreateOrUpdateDirectoryToAdminModifyPermissions( - this.Tracer, - ProductUpgraderInfo.GetAssetDownloadsPath(), - out error); - } - } -} diff --git a/GVFS/GVFS.Platform.Windows/packages.config b/GVFS/GVFS.Platform.Windows/packages.config deleted file mode 100644 index cbf3000052..0000000000 --- a/GVFS/GVFS.Platform.Windows/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.PlatformLoader/PlatformLoader.Mac.cs b/GVFS/GVFS.PlatformLoader/PlatformLoader.Mac.cs deleted file mode 100644 index fb2a642ec7..0000000000 --- a/GVFS/GVFS.PlatformLoader/PlatformLoader.Mac.cs +++ /dev/null @@ -1,21 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Platform.Mac; -using GVFS.Virtualization.FileSystem; - -namespace GVFS.PlatformLoader -{ - public static class GVFSPlatformLoader - { - public static FileSystemVirtualizer CreateFileSystemVirtualizer(GVFSContext context, GVFSGitObjects gitObjects) - { - return new MacFileSystemVirtualizer(context, gitObjects); - } - - public static void Initialize() - { - GVFSPlatform.Register(new MacPlatform()); - return; - } - } -} \ No newline at end of file diff --git a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.pbxproj b/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.pbxproj deleted file mode 100644 index 4a3b3b90aa..0000000000 --- a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.pbxproj +++ /dev/null @@ -1,280 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 267A836C20EE9F27005E6B60 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267A836B20EE9F27005E6B60 /* main.cpp */; }; - 26E839D920FD4026004E53CE /* common.posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E839D620FD29D6004E53CE /* common.posix.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 267A836620EE9F27005E6B60 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 267A836820EE9F27005E6B60 /* GVFS.PostIndexChangedHook */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = GVFS.PostIndexChangedHook; sourceTree = BUILT_PRODUCTS_DIR; }; - 267A836B20EE9F27005E6B60 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = SOURCE_ROOT; }; - 2686926B20EFF2610080F95D /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../GVFS.NativeHooks.Common/common.h; sourceTree = SOURCE_ROOT; }; - 26E839D620FD29D6004E53CE /* common.posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.posix.cpp; path = ../GVFS.NativeHooks.Common/common.posix.cpp; sourceTree = SOURCE_ROOT; }; - 26E839DB20FD5918004E53CE /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 267A836520EE9F27005E6B60 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2673FD8620EBD84A00B64B7F = { - isa = PBXGroup; - children = ( - 26E839DB20FD5918004E53CE /* stdafx.h */, - 26E839D620FD29D6004E53CE /* common.posix.cpp */, - 2686926B20EFF2610080F95D /* common.h */, - 267A836B20EE9F27005E6B60 /* main.cpp */, - 267A836920EE9F27005E6B60 /* Products */, - ); - sourceTree = ""; - }; - 267A836920EE9F27005E6B60 /* Products */ = { - isa = PBXGroup; - children = ( - 267A836820EE9F27005E6B60 /* GVFS.PostIndexChangedHook */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 267A836720EE9F27005E6B60 /* GVFS.PostIndexChangedHook */ = { - isa = PBXNativeTarget; - buildConfigurationList = 267A836F20EE9F27005E6B60 /* Build configuration list for PBXNativeTarget "GVFS.PostIndexChangedHook" */; - buildPhases = ( - 267A836420EE9F27005E6B60 /* Sources */, - 267A836520EE9F27005E6B60 /* Frameworks */, - 267A836620EE9F27005E6B60 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = GVFS.PostIndexChangedHook; - productName = GVFS.PostIndexChangedHook; - productReference = 267A836820EE9F27005E6B60 /* GVFS.PostIndexChangedHook */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 2673FD8720EBD84A00B64B7F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - TargetAttributes = { - 267A836720EE9F27005E6B60 = { - CreatedOnToolsVersion = 9.4.1; - }; - }; - }; - buildConfigurationList = 2673FD8A20EBD84A00B64B7F /* Build configuration list for PBXProject "GVFS.PostIndexChangedHook.Mac" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 2673FD8620EBD84A00B64B7F; - productRefGroup = 267A836920EE9F27005E6B60 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 267A836720EE9F27005E6B60 /* GVFS.PostIndexChangedHook */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 267A836420EE9F27005E6B60 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 267A836C20EE9F27005E6B60 /* main.cpp in Sources */, - 26E839D920FD4026004E53CE /* common.posix.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2673FD8B20EBD84A00B64B7F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Debug; - }; - 2673FD8C20EBD84A00B64B7F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Release; - }; - 267A836D20EE9F27005E6B60 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 267A836E20EE9F27005E6B60 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2673FD8A20EBD84A00B64B7F /* Build configuration list for PBXProject "GVFS.PostIndexChangedHook.Mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2673FD8B20EBD84A00B64B7F /* Debug */, - 2673FD8C20EBD84A00B64B7F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 267A836F20EE9F27005E6B60 /* Build configuration list for PBXNativeTarget "GVFS.PostIndexChangedHook" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 267A836D20EE9F27005E6B60 /* Debug */, - 267A836E20EE9F27005E6B60 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 2673FD8720EBD84A00B64B7F /* Project object */; -} diff --git a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 4054d401b8..0000000000 --- a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Windows.vcxproj b/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.vcxproj similarity index 81% rename from GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Windows.vcxproj rename to GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.vcxproj index 7200135816..0537dfaf1e 100644 --- a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Windows.vcxproj +++ b/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.vcxproj @@ -14,22 +14,21 @@ {24D161E9-D1F0-4299-BBD3-5D940BEDD535} Win32Proj GVFSPostIndexChangedHook - 10.0.10240.0 - GVFS.PostIndexChangedHook.Windows + 10.0.16299.0 + GVFS.PostIndexChangedHook GVFS.PostIndexChangedHook - Application true - v141 + v142 MultiByte Application false - v141 + v142 true MultiByte @@ -59,22 +58,22 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;..\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) /Zc:__cplusplus MultiThreadedDebug Console true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) @@ -87,7 +86,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;..\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) /Zc:__cplusplus MultiThreaded @@ -96,15 +95,15 @@ true true true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) diff --git a/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Windows.vcxproj.filters b/GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.vcxproj.filters similarity index 100% rename from GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.Windows.vcxproj.filters rename to GVFS/GVFS.PostIndexChangedHook/GVFS.PostIndexChangedHook.vcxproj.filters diff --git a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.pbxproj b/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.pbxproj deleted file mode 100644 index 5e9c95a823..0000000000 --- a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.pbxproj +++ /dev/null @@ -1,286 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 2673FD9620EBDAA900B64B7F /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2673FD9520EBDAA900B64B7F /* main.cpp */; }; - 2673FD9C20EBDEA500B64B7F /* packet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2673FD9B20EBDEA500B64B7F /* packet.cpp */; }; - 26E839D820FD387D004E53CE /* common.posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E839D720FD29EC004E53CE /* common.posix.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 2673FD9020EBDAA900B64B7F /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 2673FD9220EBDAA900B64B7F /* GVFS.ReadObjectHook */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = GVFS.ReadObjectHook; sourceTree = BUILT_PRODUCTS_DIR; }; - 2673FD9520EBDAA900B64B7F /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = SOURCE_ROOT; }; - 2673FD9A20EBDEA500B64B7F /* packet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = packet.h; sourceTree = SOURCE_ROOT; }; - 2673FD9B20EBDEA500B64B7F /* packet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = packet.cpp; sourceTree = SOURCE_ROOT; }; - 2673FD9D20EBDEAA00B64B7F /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../GVFS.NativeHooks.Common/common.h; sourceTree = SOURCE_ROOT; }; - 26E839D720FD29EC004E53CE /* common.posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.posix.cpp; path = ../GVFS.NativeHooks.Common/common.posix.cpp; sourceTree = SOURCE_ROOT; }; - 26E839DA20FD58B8004E53CE /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 2673FD8F20EBDAA900B64B7F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2673FD7F20EBD81D00B64B7F = { - isa = PBXGroup; - children = ( - 26E839DA20FD58B8004E53CE /* stdafx.h */, - 26E839D720FD29EC004E53CE /* common.posix.cpp */, - 2673FD9D20EBDEAA00B64B7F /* common.h */, - 2673FD9B20EBDEA500B64B7F /* packet.cpp */, - 2673FD9A20EBDEA500B64B7F /* packet.h */, - 2673FD9520EBDAA900B64B7F /* main.cpp */, - 2673FD9320EBDAA900B64B7F /* Products */, - ); - sourceTree = ""; - }; - 2673FD9320EBDAA900B64B7F /* Products */ = { - isa = PBXGroup; - children = ( - 2673FD9220EBDAA900B64B7F /* GVFS.ReadObjectHook */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 2673FD9120EBDAA900B64B7F /* GVFS.ReadObjectHook */ = { - isa = PBXNativeTarget; - buildConfigurationList = 2673FD9720EBDAA900B64B7F /* Build configuration list for PBXNativeTarget "GVFS.ReadObjectHook" */; - buildPhases = ( - 2673FD8E20EBDAA900B64B7F /* Sources */, - 2673FD8F20EBDAA900B64B7F /* Frameworks */, - 2673FD9020EBDAA900B64B7F /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = GVFS.ReadObjectHook; - productName = GVFS.ReadObjectHook; - productReference = 2673FD9220EBDAA900B64B7F /* GVFS.ReadObjectHook */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 2673FD8020EBD81D00B64B7F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - TargetAttributes = { - 2673FD9120EBDAA900B64B7F = { - CreatedOnToolsVersion = 9.4.1; - }; - }; - }; - buildConfigurationList = 2673FD8320EBD81D00B64B7F /* Build configuration list for PBXProject "GVFS.ReadObjectHook.Mac" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 2673FD7F20EBD81D00B64B7F; - productRefGroup = 2673FD9320EBDAA900B64B7F /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 2673FD9120EBDAA900B64B7F /* GVFS.ReadObjectHook */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 2673FD8E20EBDAA900B64B7F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 26E839D820FD387D004E53CE /* common.posix.cpp in Sources */, - 2673FD9620EBDAA900B64B7F /* main.cpp in Sources */, - 2673FD9C20EBDEA500B64B7F /* packet.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2673FD8420EBD81D00B64B7F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Debug; - }; - 2673FD8520EBD81D00B64B7F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Release; - }; - 2673FD9820EBDAA900B64B7F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 2673FD9920EBDAA900B64B7F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2673FD8320EBD81D00B64B7F /* Build configuration list for PBXProject "GVFS.ReadObjectHook.Mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2673FD8420EBD81D00B64B7F /* Debug */, - 2673FD8520EBD81D00B64B7F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2673FD9720EBDAA900B64B7F /* Build configuration list for PBXNativeTarget "GVFS.ReadObjectHook" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2673FD9820EBDAA900B64B7F /* Debug */, - 2673FD9920EBDAA900B64B7F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 2673FD8020EBD81D00B64B7F /* Project object */; -} diff --git a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index fd68549aed..0000000000 --- a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Windows.vcxproj b/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.vcxproj similarity index 81% rename from GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Windows.vcxproj rename to GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.vcxproj index 03d2702621..613e9d9a7c 100644 --- a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Windows.vcxproj +++ b/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.vcxproj @@ -14,22 +14,21 @@ {5A6656D5-81C7-472C-9DC8-32D071CB2258} Win32Proj readobject - 10.0.10240.0 - GVFS.ReadObjectHook.Windows + 10.0.16299.0 + GVFS.ReadObjectHook GVFS.ReadObjectHook - Application true - v141 + v142 MultiByte Application false - v141 + v142 true MultiByte @@ -59,22 +58,22 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;..\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) /Zc:__cplusplus MultiThreadedDebug Console true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) @@ -87,7 +86,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;..\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) /Zc:__cplusplus MultiThreaded @@ -96,15 +95,15 @@ true true true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) diff --git a/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Windows.vcxproj.filters b/GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.vcxproj.filters similarity index 100% rename from GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.Windows.vcxproj.filters rename to GVFS/GVFS.ReadObjectHook/GVFS.ReadObjectHook.vcxproj.filters diff --git a/GVFS/GVFS.Service.UI/GVFS.Service.UI.csproj b/GVFS/GVFS.Service.UI/GVFS.Service.UI.csproj index 0693223d52..90589d9330 100644 --- a/GVFS/GVFS.Service.UI/GVFS.Service.UI.csproj +++ b/GVFS/GVFS.Service.UI/GVFS.Service.UI.csproj @@ -1,94 +1,22 @@ - - - - + + - {93B403FD-DAFB-46C5-9636-B122792A548A} Exe - Properties - GVFS.Service.UI - GVFS.Service.UI - v4.6.1 - 512 - true - - + net461 - - x64 - true - full - false - DEBUG;TRACE - prompt - 4 - false - - - x64 - pdbonly - true - TRACE - prompt - 4 - - - - - - - - - - - - - C:\Program Files (x86)\Windows Kits\10\App Certification Kit\winmds\windows81\Windows.winmd - - + - - PlatformLoader.Windows.cs - - - - - - - - - - - - - + + - - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - GVFS.Platform.Windows - - - {f468b05a-95e5-46bc-8c67-b80a78527b7d} - GVFS.Virtualization - + + PreserveNewest - - - - - + diff --git a/GVFS/GVFS.Service.UI/GVFSServiceUI.cs b/GVFS/GVFS.Service.UI/GVFSServiceUI.cs index 58178919eb..c81e80b7d2 100644 --- a/GVFS/GVFS.Service.UI/GVFSServiceUI.cs +++ b/GVFS/GVFS.Service.UI/GVFSServiceUI.cs @@ -2,12 +2,7 @@ using GVFS.Common.NamedPipes; using GVFS.Common.Tracing; using System; -using System.Collections.Generic; -using System.Linq; -using System.ServiceProcess; -using System.Text; using System.Threading; -using System.Threading.Tasks; namespace GVFS.Service.UI { diff --git a/GVFS/GVFS.Service.UI/app.config b/GVFS/GVFS.Service.UI/app.config deleted file mode 100644 index 1da8c9b53a..0000000000 --- a/GVFS/GVFS.Service.UI/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/GVFS/GVFS.Service.UI/packages.config b/GVFS/GVFS.Service.UI/packages.config deleted file mode 100644 index 119108d189..0000000000 --- a/GVFS/GVFS.Service.UI/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Service/GVFS.Service.Windows.csproj b/GVFS/GVFS.Service/GVFS.Service.Windows.csproj deleted file mode 100644 index 90a034794e..0000000000 --- a/GVFS/GVFS.Service/GVFS.Service.Windows.csproj +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} - Exe - Properties - GVFS.Service - GVFS.Service - v4.6.1 - 512 - true - - - - - x64 - true - full - false - DEBUG;TRACE - prompt - 4 - - - x64 - pdbonly - true - TRACE - prompt - 4 - - - - - - $(BuildOutputDir)\GVFS.Service.exe.manifest - - - - False - ..\..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - False - ..\..\..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll - True - - - - - - - - - - - - - - - - - Component - - - - - - - - - - - - - - - - - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - GVFS.Platform.Windows - - - {93b403fd-dafb-46c5-9636-b122792a548a} - GVFS.Service.UI - - - - - - GVFS.Service.exe.manifest - - - - - - - - - - - - - diff --git a/GVFS/GVFS.Service/GVFS.Service.csproj b/GVFS/GVFS.Service/GVFS.Service.csproj new file mode 100644 index 0000000000..99fa85b3ee --- /dev/null +++ b/GVFS/GVFS.Service/GVFS.Service.csproj @@ -0,0 +1,23 @@ + + + + Exe + net461 + true + + + + + + + + + + + + + + + + + diff --git a/GVFS/GVFS.Service/GVFSMountProcess.Mac.cs b/GVFS/GVFS.Service/GVFSMountProcess.Mac.cs deleted file mode 100644 index 4b9dfd231a..0000000000 --- a/GVFS/GVFS.Service/GVFSMountProcess.Mac.cs +++ /dev/null @@ -1,87 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Tracing; -using System.Diagnostics; -using System.IO; - -namespace GVFS.Service -{ - public class GVFSMountProcess : IRepoMounter - { - private const string ExecutablePath = "/bin/launchctl"; - - private MountLauncher processLauncher; - private ITracer tracer; - - public GVFSMountProcess(ITracer tracer, MountLauncher processLauncher = null) - { - this.tracer = tracer; - this.processLauncher = processLauncher ?? new MountLauncher(tracer); - } - - public bool MountRepository(string repoRoot, int sessionId) - { - string arguments = string.Format( - "asuser {0} {1} mount {2}", - sessionId, - Path.Combine(GVFSPlatform.Instance.Constants.GVFSBinDirectoryPath, GVFSPlatform.Instance.Constants.GVFSExecutableName), - repoRoot); - - if (!this.processLauncher.LaunchProcess(ExecutablePath, arguments, repoRoot)) - { - this.tracer.RelatedError($"{nameof(this.MountRepository)}: Unable to start the GVFS process."); - return false; - } - - string errorMessage; - if (!this.processLauncher.WaitUntilMounted(this.tracer, repoRoot, false, out errorMessage)) - { - this.tracer.RelatedError(errorMessage); - return false; - } - - return true; - } - - public class MountLauncher - { - private ITracer tracer; - - public MountLauncher(ITracer tracer) - { - this.tracer = tracer; - } - - public virtual bool LaunchProcess(string executablePath, string arguments, string workingDirectory) - { - ProcessStartInfo processInfo = new ProcessStartInfo(executablePath); - processInfo.Arguments = arguments; - processInfo.WindowStyle = ProcessWindowStyle.Hidden; - processInfo.WorkingDirectory = workingDirectory; - processInfo.UseShellExecute = false; - processInfo.RedirectStandardOutput = true; - - ProcessResult result = ProcessHelper.Run(processInfo); - if (result.ExitCode != 0) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(GVFSMountProcess)); - metadata.Add(nameof(executablePath), executablePath); - metadata.Add(nameof(arguments), arguments); - metadata.Add(nameof(workingDirectory), workingDirectory); - metadata.Add(nameof(result.ExitCode), result.ExitCode); - metadata.Add(nameof(result.Errors), result.Errors); - - this.tracer.RelatedError(metadata, $"{nameof(this.LaunchProcess)} ERROR: Could not launch {executablePath}"); - return false; - } - - return true; - } - - public virtual bool WaitUntilMounted(ITracer tracer, string enlistmentRoot, bool unattended, out string errorMessage) - { - return GVFSEnlistment.WaitUntilMounted(tracer, enlistmentRoot, unattended: false, errorMessage: out errorMessage); - } - } - } -} diff --git a/GVFS/GVFS.Service/GVFSMountProcess.Windows.cs b/GVFS/GVFS.Service/GVFSMountProcess.cs similarity index 100% rename from GVFS/GVFS.Service/GVFSMountProcess.Windows.cs rename to GVFS/GVFS.Service/GVFSMountProcess.cs diff --git a/GVFS/GVFS.Service/GVFSService.Mac.cs b/GVFS/GVFS.Service/GVFSService.Mac.cs deleted file mode 100644 index 5a706d4afc..0000000000 --- a/GVFS/GVFS.Service/GVFSService.Mac.cs +++ /dev/null @@ -1,109 +0,0 @@ -using GVFS.Common; -using GVFS.Common.NamedPipes; -using GVFS.Common.Tracing; -using GVFS.Service.Handlers; -using System; -using System.Threading; - -namespace GVFS.Service -{ - public class GVFSService - { - public const string ServiceNameArgPrefix = "--servicename="; - - private const string EtwArea = nameof(GVFSService); - - private ITracer tracer; - private Thread serviceThread; - private ManualResetEvent serviceStopped; - private string serviceName; - private IRepoRegistry repoRegistry; - private RequestHandler requestHandler; - - public GVFSService( - ITracer tracer, - string serviceName, - IRepoRegistry repoRegistry) - { - this.tracer = tracer; - this.repoRegistry = repoRegistry; - this.serviceName = serviceName; - - this.serviceStopped = new ManualResetEvent(false); - this.serviceThread = new Thread(this.ServiceThreadMain); - this.requestHandler = new RequestHandler(this.tracer, EtwArea, this.repoRegistry); - } - - public void Run() - { - try - { - this.AutoMountReposForUser(); - - if (!string.IsNullOrEmpty(this.serviceName)) - { - string pipeName = GVFSPlatform.Instance.GetGVFSServiceNamedPipeName(this.serviceName); - this.tracer.RelatedInfo("Starting pipe server with name: " + pipeName); - - using (NamedPipeServer pipeServer = NamedPipeServer.StartNewServer( - pipeName, - this.tracer, - this.requestHandler.HandleRequest)) - { - this.serviceThread.Start(); - this.serviceThread.Join(); - } - } - else - { - this.tracer.RelatedError("No name specified for Service Pipe."); - } - } - catch (Exception e) - { - this.LogExceptionAndExit(e, nameof(this.Run)); - } - } - - private void ServiceThreadMain() - { - try - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Version", ProcessHelper.GetCurrentProcessVersion()); - this.tracer.RelatedEvent(EventLevel.Informational, $"{nameof(GVFSService)}_{nameof(this.ServiceThreadMain)}", metadata); - - this.serviceStopped.WaitOne(); - this.serviceStopped.Dispose(); - } - catch (Exception e) - { - this.LogExceptionAndExit(e, nameof(this.ServiceThreadMain)); - } - } - - private void AutoMountReposForUser() - { - string currentUser = GVFSPlatform.Instance.GetCurrentUser(); - if (int.TryParse(currentUser, out int sessionId)) - { - // On Mac, there is no separate session Id. currentUser is used as sessionId - this.repoRegistry.AutoMountRepos(currentUser, sessionId); - this.repoRegistry.TraceStatus(); - } - else - { - this.tracer.RelatedError($"{nameof(this.AutoMountReposForUser)} Error: could not parse current user({currentUser}) info from RepoRegistry."); - } - } - - private void LogExceptionAndExit(Exception e, string method) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", EtwArea); - metadata.Add("Exception", e.ToString()); - this.tracer.RelatedError(metadata, "Unhandled exception in " + method); - Environment.Exit((int)ReturnCode.GenericError); - } - } -} diff --git a/GVFS/GVFS.Service/GVFSService.Windows.cs b/GVFS/GVFS.Service/GVFSService.Windows.cs index 701e25caad..92d4fd4fc3 100644 --- a/GVFS/GVFS.Service/GVFSService.Windows.cs +++ b/GVFS/GVFS.Service/GVFSService.Windows.cs @@ -26,7 +26,6 @@ public class GVFSService : ServiceBase private string serviceName; private string serviceDataLocation; private RepoRegistry repoRegistry; - private ProductUpgradeTimer productUpgradeTimer; private WindowsRequestHandler requestHandler; private INotificationHandler notificationHandler; @@ -36,7 +35,6 @@ public GVFSService(JsonTracer tracer) this.serviceName = GVFSConstants.Service.ServiceName; this.CanHandleSessionChangeEvent = true; this.notificationHandler = new NotificationHandler(tracer); - this.productUpgradeTimer = new ProductUpgradeTimer(tracer, this.notificationHandler); } public void Run() @@ -74,12 +72,6 @@ public void Run() EnableAndAttachProjFSHandler.TryEnablePrjFlt(activity, out error); } - // Start product upgrade timer only after attempting to enable prjflt. - // On Windows server (where PrjFlt is not inboxed) this helps avoid - // a race between TryEnablePrjFlt() and installer pre-check which is - // performed by UpgradeTimer in parallel. - this.productUpgradeTimer.Start(); - this.serviceStopped.WaitOne(); } } @@ -98,11 +90,6 @@ public void StopRunning() try { - if (this.productUpgradeTimer != null) - { - this.productUpgradeTimer.Stop(); - } - if (this.tracer != null) { this.tracer.RelatedInfo("Stopping"); @@ -318,16 +305,14 @@ private void CreateAndConfigureProgramDataDirectories() DirectorySecurity serviceDataRootSecurity = this.GetServiceDirectorySecurity(serviceDataRootPath); - // Create GVFS.Service and GVFS.Upgrade related directories (if they don't already exist) + // Create GVFS.Service related directories (if they don't already exist) Directory.CreateDirectory(serviceDataRootPath, serviceDataRootSecurity); Directory.CreateDirectory(this.serviceDataLocation, serviceDataRootSecurity); - Directory.CreateDirectory(ProductUpgraderInfo.GetUpgradeProtectedDataDirectory(), serviceDataRootSecurity); // Ensure the ACLs are set correctly on any files or directories that were already created (e.g. after upgrading VFS4G) Directory.SetAccessControl(serviceDataRootPath, serviceDataRootSecurity); - // Special rules for the upgrader logs, as non-elevated users need to be be able to write - this.CreateAndConfigureLogDirectory(ProductUpgraderInfo.GetLogDirectoryPath()); + // Special rules for the Service.UI logs, as non-elevated users need to be be able to write this.CreateAndConfigureLogDirectory(GVFSPlatform.Instance.GetLogsDirectoryForGVFSComponent(GVFSConstants.Service.UIName)); } diff --git a/GVFS/GVFS.Service/Handlers/NotificationHandler.Mac.cs b/GVFS/GVFS.Service/Handlers/NotificationHandler.Mac.cs deleted file mode 100644 index f38be1a57e..0000000000 --- a/GVFS/GVFS.Service/Handlers/NotificationHandler.Mac.cs +++ /dev/null @@ -1,45 +0,0 @@ -using GVFS.Common.NamedPipes; -using GVFS.Common.Tracing; -using System; -using System.IO; - -namespace GVFS.Service.Handlers -{ - public class NotificationHandler : INotificationHandler - { - private const string NotificationServerPipeName = "vfsforgit.notification"; - private ITracer tracer; - - public NotificationHandler(ITracer tracer) - { - this.tracer = tracer; - } - - public void SendNotification(NamedPipeMessages.Notification.Request request) - { - string pipeName = Path.Combine(Path.GetTempPath(), NotificationServerPipeName); - using (NamedPipeClient client = new NamedPipeClient(pipeName)) - { - if (client.Connect()) - { - try - { - client.SendRequest(request.ToMessage()); - } - catch (Exception ex) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Area", nameof(NotificationHandler)); - metadata.Add("Exception", ex.ToString()); - metadata.Add(TracingConstants.MessageKey.ErrorMessage, "MacOS notification display error"); - this.tracer.RelatedError(metadata, $"MacOS notification: {request.Title} - {request.Message}."); - } - } - else - { - this.tracer.RelatedError($"ERROR: Communication failure with native notification display tool. Notification info: {request.Title} - {request.Message}."); - } - } - } - } -} diff --git a/GVFS/GVFS.Service/Handlers/NotificationHandler.Windows.cs b/GVFS/GVFS.Service/Handlers/NotificationHandler.cs similarity index 100% rename from GVFS/GVFS.Service/Handlers/NotificationHandler.Windows.cs rename to GVFS/GVFS.Service/Handlers/NotificationHandler.cs diff --git a/GVFS/GVFS.Service/Mac/org.vfsforgit.service.plist b/GVFS/GVFS.Service/Mac/org.vfsforgit.service.plist deleted file mode 100644 index fee588529e..0000000000 --- a/GVFS/GVFS.Service/Mac/org.vfsforgit.service.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - EnvironmentVariables - - - PATH - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - - Label - org.vfsforgit.service - ProgramArguments - - /usr/local/vfsforgit/GVFS.Service - - WorkingDirectory - /usr/local/vfsforgit - ProcessType - Interactive - LimitLoadToSessionType - Aqua - Disabled - - OnDemand - - KeepAlive - - RunAtLoad - - - diff --git a/GVFS/GVFS.Service/ProductUpgradeTimer.cs b/GVFS/GVFS.Service/ProductUpgradeTimer.cs deleted file mode 100644 index ee37448851..0000000000 --- a/GVFS/GVFS.Service/ProductUpgradeTimer.cs +++ /dev/null @@ -1,261 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.NamedPipes; -using GVFS.Common.NuGetUpgrade; -using GVFS.Common.Tracing; -using GVFS.Service.Handlers; -using GVFS.Upgrader; -using System; -using System.IO; -using System.Threading; - -namespace GVFS.Service -{ - public class ProductUpgradeTimer : IDisposable - { - private static readonly TimeSpan TimeInterval = TimeSpan.FromDays(1); - private JsonTracer tracer; - private PhysicalFileSystem fileSystem; - private Timer timer; - private INotificationHandler notificationHandler; - - public ProductUpgradeTimer(JsonTracer tracer, INotificationHandler notificationHandler) - { - this.tracer = tracer; - this.notificationHandler = notificationHandler; - this.fileSystem = new PhysicalFileSystem(); - } - - public void Start() - { - if (!GVFSEnlistment.IsUnattended(this.tracer)) - { - // Adding 60 seconds wait time here. This gives VFSForGit installer/upgrader - // sufficient enough time to launch GVFS.Service.UI that is needed to display - // Upgrade available toaster. - TimeSpan startTime = TimeSpan.FromSeconds(60); - - this.tracer.RelatedInfo("Starting auto upgrade checks."); - this.timer = new Timer( - this.TimerCallback, - state: null, - dueTime: startTime, - period: TimeInterval); - } - else - { - this.tracer.RelatedInfo("No upgrade checks scheduled, GVFS is running in unattended mode."); - } - } - - public void Stop() - { - this.tracer.RelatedInfo("Stopping auto upgrade checks"); - this.Dispose(); - } - - public void Dispose() - { - if (this.timer != null) - { - this.timer.Dispose(); - this.timer = null; - } - } - - private static EventMetadata CreateEventMetadata(Exception e) - { - EventMetadata metadata = new EventMetadata(); - if (e != null) - { - metadata.Add("Exception", e.ToString()); - } - - return metadata; - } - - private void TimerCallback(object unusedState) - { - string errorMessage = null; - - using (ITracer activity = this.tracer.StartActivity("Checking for product upgrades.", EventLevel.Informational)) - { - try - { - ProductUpgraderInfo info = new ProductUpgraderInfo( - this.tracer, - this.fileSystem); - - ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystem, - new LocalGVFSConfig(), - credentialStore: null, - dryRun: false, - noVerify: false, - newUpgrader: out ProductUpgrader productUpgrader, - error: out errorMessage); - - if (productUpgrader == null) - { - string message = string.Format( - "{0}.{1}: failed to create upgrader: {2}", - nameof(ProductUpgradeTimer), - nameof(this.TimerCallback), - errorMessage); - - activity.RelatedWarning( - metadata: new EventMetadata(), - message: message, - keywords: Keywords.Telemetry); - - info.RecordHighestAvailableVersion(highestAvailableVersion: null); - return; - } - - if (!productUpgrader.SupportsAnonymousVersionQuery) - { - // If this is a NuGetUpgrader that does not support anonymous version query, - // fall back to using the GitHubUpgrader, to preserve existing behavior. - // Once we have completely transitioned to using the anonymous endpoint, - // we can remove this code. - if (productUpgrader is NuGetUpgrader) - { - productUpgrader = GitHubUpgrader.Create( - this.tracer, - this.fileSystem, - new LocalGVFSConfig(), - dryRun: false, - noVerify: false, - error: out errorMessage); - - if (productUpgrader == null) - { - string gitHubUpgraderFailedMessage = string.Format( - "{0}.{1}: GitHubUpgrader.Create failed to create upgrader: {2}", - nameof(ProductUpgradeTimer), - nameof(this.TimerCallback), - errorMessage); - - activity.RelatedWarning( - metadata: new EventMetadata(), - message: gitHubUpgraderFailedMessage, - keywords: Keywords.Telemetry); - - info.RecordHighestAvailableVersion(highestAvailableVersion: null); - return; - } - } - else - { - errorMessage = string.Format( - "{0}.{1}: Configured Product Upgrader does not support anonymous version queries.", - nameof(ProductUpgradeTimer), - nameof(this.TimerCallback), - errorMessage); - - activity.RelatedWarning( - metadata: new EventMetadata(), - message: errorMessage, - keywords: Keywords.Telemetry); - - info.RecordHighestAvailableVersion(highestAvailableVersion: null); - return; - } - } - - InstallerPreRunChecker prerunChecker = new InstallerPreRunChecker(this.tracer, string.Empty); - if (!prerunChecker.TryRunPreUpgradeChecks(out errorMessage)) - { - string message = string.Format( - "{0}.{1}: PreUpgradeChecks failed with: {2}", - nameof(ProductUpgradeTimer), - nameof(this.TimerCallback), - errorMessage); - - activity.RelatedWarning( - metadata: new EventMetadata(), - message: message, - keywords: Keywords.Telemetry); - - info.RecordHighestAvailableVersion(highestAvailableVersion: null); - return; - } - - if (!productUpgrader.UpgradeAllowed(out errorMessage)) - { - errorMessage = errorMessage ?? - $"{nameof(ProductUpgradeTimer)}.{nameof(this.TimerCallback)}: Upgrade is not allowed, but no reason provided."; - activity.RelatedWarning( - metadata: new EventMetadata(), - message: errorMessage, - keywords: Keywords.Telemetry); - - info.RecordHighestAvailableVersion(highestAvailableVersion: null); - return; - } - - if (!this.TryQueryForNewerVersion( - activity, - productUpgrader, - out Version newerVersion, - out errorMessage)) - { - string message = string.Format( - "{0}.{1}: TryQueryForNewerVersion failed with: {2}", - nameof(ProductUpgradeTimer), - nameof(this.TimerCallback), - errorMessage); - - activity.RelatedWarning( - metadata: new EventMetadata(), - message: message, - keywords: Keywords.Telemetry); - - info.RecordHighestAvailableVersion(highestAvailableVersion: null); - return; - } - - info.RecordHighestAvailableVersion(highestAvailableVersion: newerVersion); - - if (newerVersion != null) - { - this.DisplayUpgradeAvailableToast(newerVersion.ToString()); - } - } - catch (Exception ex) - { - this.tracer.RelatedWarning( - CreateEventMetadata(ex), - "Exception encountered recording highest available version"); - } - } - } - - private bool TryQueryForNewerVersion(ITracer tracer, ProductUpgrader productUpgrader, out Version newVersion, out string errorMessage) - { - errorMessage = null; - tracer.RelatedInfo($"Querying server for latest version..."); - - if (!productUpgrader.TryQueryNewestVersion(out newVersion, out string detailedError)) - { - errorMessage = "Could not fetch new version info. " + detailedError; - return false; - } - - string logMessage = newVersion == null ? "No newer versions available." : $"Newer version available: {newVersion}."; - tracer.RelatedInfo(logMessage); - - return true; - } - - private void DisplayUpgradeAvailableToast(string version) - { - NamedPipeMessages.Notification.Request request = new NamedPipeMessages.Notification.Request(); - request.Id = NamedPipeMessages.Notification.Request.Identifier.UpgradeAvailable; - request.NewVersion = version; - - this.notificationHandler.SendNotification(request); - } - } -} diff --git a/GVFS/GVFS.Service/Program.Mac.cs b/GVFS/GVFS.Service/Program.Mac.cs deleted file mode 100644 index d3b4b3a974..0000000000 --- a/GVFS/GVFS.Service/Program.Mac.cs +++ /dev/null @@ -1,67 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using GVFS.PlatformLoader; -using GVFS.Service.Handlers; -using System; -using System.IO; -using System.Linq; - -namespace GVFS.Service -{ - public static class Program - { - public static void Main(string[] args) - { - GVFSPlatformLoader.Initialize(); - - AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; - - using (JsonTracer tracer = new JsonTracer(GVFSConstants.Service.ServiceName, GVFSConstants.Service.ServiceName)) - { - CreateService(tracer, args).Run(); - } - } - - private static GVFSService CreateService(JsonTracer tracer, string[] args) - { - string serviceName = args.FirstOrDefault(arg => arg.StartsWith(GVFSService.ServiceNameArgPrefix, StringComparison.OrdinalIgnoreCase)); - if (serviceName != null) - { - serviceName = serviceName.Substring(GVFSService.ServiceNameArgPrefix.Length); - } - else - { - serviceName = GVFSConstants.Service.ServiceName; - } - - GVFSPlatform gvfsPlatform = GVFSPlatform.Instance; - - string logFilePath = GVFSPlatform.Instance.GetLogsDirectoryForGVFSComponent(serviceName); - Directory.CreateDirectory(logFilePath); - - tracer.AddLogFileEventListener( - GVFSEnlistment.GetNewGVFSLogFileName(logFilePath, GVFSConstants.LogFileTypes.Service), - EventLevel.Informational, - Keywords.Any); - - string serviceDataLocation = gvfsPlatform.GetSecureDataRootForGVFSComponent(serviceName); - RepoRegistry repoRegistry = new RepoRegistry( - tracer, - new PhysicalFileSystem(), - serviceDataLocation, - new GVFSMountProcess(tracer), - new NotificationHandler(tracer)); - - return new GVFSService(tracer, serviceName, repoRegistry); - } - - private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) - { - using (JsonTracer tracer = new JsonTracer(GVFSConstants.Service.ServiceName, GVFSConstants.Service.ServiceName)) - { - tracer.RelatedError($"Unhandled exception in GVFS.Service: {e.ExceptionObject.ToString()}"); - } - } - } -} diff --git a/GVFS/GVFS.Service/Program.Windows.cs b/GVFS/GVFS.Service/Program.cs similarity index 100% rename from GVFS/GVFS.Service/Program.Windows.cs rename to GVFS/GVFS.Service/Program.cs diff --git a/GVFS/GVFS.Service/Properties/AssemblyInfo.cs b/GVFS/GVFS.Service/Properties/AssemblyInfo.cs deleted file mode 100644 index c31bc35a19..0000000000 --- a/GVFS/GVFS.Service/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.Service")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Service")] -[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("b8c1dfba-cafd-4f7e-a1a3-e11907b5467b")] diff --git a/GVFS/GVFS.Service/app.config b/GVFS/GVFS.Service/app.config deleted file mode 100644 index 1da8c9b53a..0000000000 --- a/GVFS/GVFS.Service/app.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/GVFS/GVFS.Service/packages.config b/GVFS/GVFS.Service/packages.config deleted file mode 100644 index 5bd2182d5c..0000000000 --- a/GVFS/GVFS.Service/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.SignFiles/GVFS.SignFiles.csproj b/GVFS/GVFS.SignFiles/GVFS.SignFiles.csproj deleted file mode 100644 index e64f658d69..0000000000 --- a/GVFS/GVFS.SignFiles/GVFS.SignFiles.csproj +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - {2F63B22B-EE26-4266-BF17-28A9146483A1} - Library - Properties - GVFS.SignFiles - GVFS.SignFiles - $(BuildOutputDir) - - v4.6.1 - 512 - - - - - - true - DEBUG;TRACE - full - x64 - prompt - MinimumRecommendedRules.ruleset - - - TRACE - true - pdbonly - x64 - prompt - MinimumRecommendedRules.ruleset - - - - Microsoft400 - false - - - - - Designer - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - diff --git a/GVFS/GVFS.SignFiles/packages.config b/GVFS/GVFS.SignFiles/packages.config deleted file mode 100644 index 7e1df5b5d9..0000000000 --- a/GVFS/GVFS.SignFiles/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Tests/GVFS.Tests.csproj b/GVFS/GVFS.Tests/GVFS.Tests.csproj index acf5c82801..c02954c262 100644 --- a/GVFS/GVFS.Tests/GVFS.Tests.csproj +++ b/GVFS/GVFS.Tests/GVFS.Tests.csproj @@ -1,24 +1,12 @@ - - netcoreapp2.1;netstandard2.0 - x64 - true - true - win-x64;osx-x64 - - - $(GVFSVersion) - - - $(GVFSVersion) + net461 - - all - + - \ No newline at end of file + + diff --git a/GVFS/GVFS.UnitTests.Windows/App.config b/GVFS/GVFS.UnitTests.Windows/App.config deleted file mode 100644 index 0acacc87be..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/App.config +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj b/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj deleted file mode 100644 index 2150248d73..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/GVFS.UnitTests.Windows.csproj +++ /dev/null @@ -1,543 +0,0 @@ - - - - - - - - - - {8E0D0989-21F6-4DD8-946C-39F992523CC6} - Exe - Properties - GVFS.UnitTests.Windows - GVFS.UnitTests.Windows - v4.6.1 - 512 - true - - - - - true - DEBUG;TRACE - full - x64 - prompt - true - true - - - TRACE - true - pdbonly - x64 - prompt - true - true - - - - ..\..\..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll - - - ..\..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - ..\..\..\packages\Moq.4.10.1\lib\net45\Moq.dll - - - ..\..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - False - ..\..\..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll - True - - - ..\..\..\packages\NuGet.Common.4.9.2\lib\net46\NuGet.Common.dll - - - ..\..\..\packages\NuGet.Configuration.4.9.2\lib\net46\NuGet.Configuration.dll - - - ..\..\..\packages\NuGet.Frameworks.4.9.2\lib\net46\NuGet.Frameworks.dll - - - ..\..\..\packages\NuGet.Packaging.4.9.2\lib\net46\NuGet.Packaging.dll - - - ..\..\..\packages\NuGet.Packaging.Core.4.9.2\lib\net46\NuGet.Packaging.Core.dll - - - ..\..\..\packages\NuGet.Protocol.4.9.2\lib\net46\NuGet.Protocol.dll - - - ..\..\..\packages\NuGet.Versioning.4.9.2\lib\net46\NuGet.Versioning.dll - - - ..\..\..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll - - - ..\..\..\packages\NUnitLite.3.12.0\lib\net45\nunitlite.dll - - - ..\..\..\packages\Microsoft.Windows.ProjFS.1.1.19156.1\lib\net461\ProjectedFSLib.Managed.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - ..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - - - - - - - - ..\..\..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {1118b427-7063-422f-83b9-5023c8ec5a7a} - GVFS.GVFlt - - - {15fae44c-0d21-4312-9fd3-28f05a5ab7a6} - GVFS.Platform.POSIX - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - GVFS.Platform.Windows - - - {93b403fd-dafb-46c5-9636-b122792a548a} - GVFS.Service.UI - - - {b8c1dfba-cafd-4f7e-a1a3-e11907b5467b} - GVFS.Service.Windows - - - {72701bc3-5da9-4c7a-bf10-9e98c9fc8eac} - GVFS.Tests - - - {aecec217-2499-403d-b0bb-2962b9be5970} - GVFS.Upgrader - - - {F468B05A-95E5-46BC-8C67-B80A78527B7D} - GVFS.Virtualization - - - {32220664-594C-4425-B9A0-88E0BE2F3D2A} - GVFS.Windows - - - - - - - - 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) - Always - - - Readme.md - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.UnitTests.Windows/Properties/AssemblyInfo.cs b/GVFS/GVFS.UnitTests.Windows/Properties/AssemblyInfo.cs deleted file mode 100644 index e8d089a151..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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.UnitTests.Windows")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.UnitTests.Windows")] -[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("8e0d0989-21f6-4dd8-946c-39f992523cc6")] diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockProcessLauncher.cs b/GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockProcessLauncher.cs deleted file mode 100644 index 52630e3ed5..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockProcessLauncher.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; - -namespace GVFS.UnitTests.Windows.Upgrader -{ - public class MockProcessLauncher : GVFS.CommandLine.UpgradeVerb.ProcessLauncher - { - private int exitCode; - private bool hasExited; - private bool startResult; - - public MockProcessLauncher( - int exitCode, - bool hasExited, - bool startResult) - { - this.exitCode = exitCode; - this.hasExited = hasExited; - this.startResult = startResult; - } - - public bool IsLaunched { get; private set; } - - public string LaunchPath { get; private set; } - - public override bool HasExited - { - get { return this.hasExited; } - } - - public override int ExitCode - { - get { return this.exitCode; } - } - - public override bool TryStart(string path, string args, bool useShellExecute, out Exception exception) - { - this.LaunchPath = path; - this.IsLaunched = true; - - exception = null; - return this.startResult; - } - } -} diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Upgrader/UpgradeVerbTests.cs b/GVFS/GVFS.UnitTests.Windows/Windows/Upgrader/UpgradeVerbTests.cs deleted file mode 100644 index 48cde9233c..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/Windows/Upgrader/UpgradeVerbTests.cs +++ /dev/null @@ -1,256 +0,0 @@ -using GVFS.CommandLine; -using GVFS.Common; -using GVFS.Tests.Should; -using GVFS.UnitTests.Category; -using GVFS.UnitTests.Mock.Upgrader; -using GVFS.UnitTests.Upgrader; -using NUnit.Framework; -using System.Collections.Generic; - -namespace GVFS.UnitTests.Windows.Upgrader -{ - [TestFixture] - public class UpgradeVerbTests : UpgradeTests - { - private MockProcessLauncher processLauncher; - private UpgradeVerb upgradeVerb; - - [SetUp] - public override void Setup() - { - base.Setup(); - - this.processLauncher = new MockProcessLauncher(exitCode: 0, hasExited: true, startResult: true); - this.upgradeVerb = new UpgradeVerb( - this.Upgrader, - this.Tracer, - this.FileSystem, - this.PrerunChecker, - this.processLauncher, - this.Output); - this.upgradeVerb.Confirmed = false; - this.PrerunChecker.SetCommandToRerun("`gvfs upgrade`"); - } - - [TestCase] - public void UpgradeAvailabilityReporting() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.SetUpgradeRing("Slow"); - this.Upgrader.PretendNewReleaseAvailableAtRemote( - upgradeVersion: NewerThanLocalVersion, - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - "New GVFS version " + NewerThanLocalVersion + " available in ring Slow", - "MockUpgradeInstallAdvice" - }, - expectedErrors: null); - } - - [TestCase] - public void DowngradePrevention() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.SetUpgradeRing("Slow"); - this.Upgrader.PretendNewReleaseAvailableAtRemote( - upgradeVersion: OlderThanLocalVersion, - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - "Checking for GVFS upgrades...Succeeded", - "Great news, you're all caught up on upgrades in the Slow ring!" - }, - expectedErrors: null); - } - - [TestCase] - public void LaunchInstaller() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.SetUpgradeRing("Slow"); - this.upgradeVerb.Confirmed = true; - this.PrerunChecker.SetCommandToRerun("`gvfs upgrade --confirm`"); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - "New GVFS version " + NewerThanLocalVersion + " available in ring Slow", - "Launching upgrade tool..." - }, - expectedErrors:null); - - this.processLauncher.IsLaunched.ShouldBeTrue(); - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public override void NoneLocalRing() - { - base.NoneLocalRing(); - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public override void InvalidUpgradeRing() - { - base.InvalidUpgradeRing(); - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public void CopyTools() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.SetUpgradeRing("Slow"); - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.CopyTools); - this.upgradeVerb.Confirmed = true; - this.PrerunChecker.SetCommandToRerun("`gvfs upgrade --confirm`"); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "Could not launch upgrade tool. Unable to copy upgrader tools" - }, - expectedErrors: new List - { - "Could not launch upgrade tool. Unable to copy upgrader tools" - }); - } - - [TestCase] - public void ProjFSPreCheck() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.upgradeVerb.Confirmed = true; - this.PrerunChecker.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.ProjFSEnabled); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "ERROR: `gvfs upgrade` is only supported after the \"Windows Projected File System\" optional feature has been enabled by a manual installation of VFS for Git, and only on versions of Windows that support this feature.", - "Check your team's documentation for how to upgrade." - }, - expectedErrors: null, - expectedWarnings: new List - { - "`gvfs upgrade` is only supported after the \"Windows Projected File System\" optional feature has been enabled by a manual installation of VFS for Git, and only on versions of Windows that support this feature." - }); - } - - [TestCase] - public void IsGVFSServiceRunningPreCheck() - { - this.PrerunChecker.SetCommandToRerun("`gvfs upgrade --confirm`"); - this.ConfigureRunAndVerify( - configure: () => - { - this.upgradeVerb.Confirmed = true; - this.PrerunChecker.SetReturnTrueOnCheck(MockInstallerPrerunChecker.FailOnCheckType.IsServiceInstalledAndNotRunning); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "GVFS Service is not running.", - "To install, run MockStartServiceCommand and run MockUpgradeConfirmCommand." - }, - expectedErrors: null, - expectedWarnings: new List - { - "GVFS Service is not running." - }); - } - - [TestCase] - public void ElevatedRunPreCheck() - { - this.PrerunChecker.SetCommandToRerun("`gvfs upgrade --confirm`"); - this.ConfigureRunAndVerify( - configure: () => - { - this.upgradeVerb.Confirmed = true; - this.PrerunChecker.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.IsElevated); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "The installer needs to be run with elevated permissions.", - "MockRunUpdateMessage" - }, - expectedErrors: null, - expectedWarnings: new List - { - "The installer needs to be run with elevated permissions." - }); - } - - [TestCase] - public void UnAttendedModePreCheck() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.upgradeVerb.Confirmed = true; - this.PrerunChecker.SetReturnTrueOnCheck(MockInstallerPrerunChecker.FailOnCheckType.UnattendedMode); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "`gvfs upgrade` is not supported in unattended mode" - }, - expectedErrors: null, - expectedWarnings: new List - { - "`gvfs upgrade` is not supported in unattended mode" - }); - } - - [TestCase] - public void DryRunLaunchesUpgradeTool() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.upgradeVerb.DryRun = true; - this.SetUpgradeRing("Slow"); - this.Upgrader.PretendNewReleaseAvailableAtRemote( - upgradeVersion: NewerThanLocalVersion, - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - "Installer launched in a new window." - }, - expectedErrors: null); - } - - protected override ReturnCode RunUpgrade() - { - try - { - this.upgradeVerb.Execute(); - } - catch (GVFSVerb.VerbAbortedException) - { - // ignore. exceptions are expected while simulating some failures. - } - - return this.upgradeVerb.ReturnCode; - } - } -} \ No newline at end of file diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Upgrader/WindowsNuGetUpgraderTests.cs b/GVFS/GVFS.UnitTests.Windows/Windows/Upgrader/WindowsNuGetUpgraderTests.cs deleted file mode 100644 index 59920dadbc..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/Windows/Upgrader/WindowsNuGetUpgraderTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -using GVFS.Common; -using GVFS.Platform.Windows; -using GVFS.Tests.Should; -using GVFS.UnitTests.Common.NuGetUpgrade; -using Moq; -using NuGet.Packaging.Core; -using NuGet.Protocol.Core.Types; -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace GVFS.UnitTests.Windows.Common.Upgrader -{ - [TestFixture] - public class WindowsNuGetUpgraderTests : NuGetUpgraderTests - { - public override ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformStrategy() - { - return new WindowsProductUpgraderPlatformStrategy(this.mockFileSystem, this.tracer); - } - - [TestCase] - public void TrySetupUpgradeApplicationDirectoryFailsIfCreateToolsDirectoryFails() - { - this.mockFileSystem.TryCreateOrUpdateDirectoryToAdminModifyPermissionsShouldSucceed = false; - this.upgrader.TrySetupUpgradeApplicationDirectory(out string _, out string _).ShouldBeFalse(); - this.mockFileSystem.TryCreateOrUpdateDirectoryToAdminModifyPermissionsShouldSucceed = true; - } - - [TestCase] - public void CanDownloadNewestVersionFailsIfDownloadDirectoryCreationFails() - { - Version actualNewestVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - string testDownloadPath = Path.Combine(this.downloadDirectoryPath, "testNuget.zip"); - IPackageSearchMetadata newestAvailableVersion = availablePackages.Last(); - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(NuGetFeedName)).ReturnsAsync(availablePackages); - this.mockNuGetFeed.Setup(foo => foo.DownloadPackageAsync(It.Is(packageIdentity => packageIdentity == newestAvailableVersion.Identity))).ReturnsAsync(testDownloadPath); - - bool success = this.upgrader.TryQueryNewestVersion(out actualNewestVersion, out message); - - // Assert that no new version was returned - success.ShouldBeTrue($"Expecting TryQueryNewestVersion to have completed sucessfully. Error: {message}"); - actualNewestVersion.ShouldEqual(newestAvailableVersion.Identity.Version.Version, "Actual new version does not match expected new version."); - - this.mockFileSystem.TryCreateOrUpdateDirectoryToAdminModifyPermissionsShouldSucceed = false; - bool downloadSuccessful = this.upgrader.TryDownloadNewestVersion(out message); - this.mockFileSystem.TryCreateOrUpdateDirectoryToAdminModifyPermissionsShouldSucceed = true; - downloadSuccessful.ShouldBeFalse(); - } - } -} diff --git a/GVFS/GVFS.UnitTests.Windows/packages.config b/GVFS/GVFS.UnitTests.Windows/packages.config deleted file mode 100644 index c66117ee1f..0000000000 --- a/GVFS/GVFS.UnitTests.Windows/packages.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.UnitTests/Common/InstallManifestTests.cs b/GVFS/GVFS.UnitTests/Common/InstallManifestTests.cs deleted file mode 100644 index 0c3eec512d..0000000000 --- a/GVFS/GVFS.UnitTests/Common/InstallManifestTests.cs +++ /dev/null @@ -1,140 +0,0 @@ -using GVFS.Common.NuGetUpgrade; -using GVFS.Tests.Should; -using Newtonsoft.Json; -using NUnit.Framework; -using System.Collections.Generic; -using System.IO; - -namespace GVFS.UnitTests.Common -{ - [TestFixture] - public class JsonInstallManifestTests - { - private static int manifestEntryCount = 0; - - [TestCase] - public void CanReadExpectedJsonString() - { - string installManifestJsonString = -@" -{ - ""Version"" : ""1"", - ""PlatformInstallManifests"" : { - ""Windows"": { - ""InstallActions"": [ - { - ""Name"" : ""Git"", - ""Version"" : ""2.19.0.1.34"", - ""InstallerRelativePath"" : ""Installers\\Windows\\G4W\\Git-2.19.0.gvfs.1.34.gc7fb556-64-bit.exe"", - ""Args"" : ""/VERYSILENT /CLOSEAPPLICATIONS"" - }, - { - ""Name"" : ""PostGitInstall script"", - ""InstallerRelativePath"" : ""Installers\\Windows\\GSD\\postinstall.ps1"" - }, - ] - } - } -} -"; - InstallManifest installManifest = InstallManifest.FromJsonString(installManifestJsonString); - - installManifest.ShouldNotBeNull(); - InstallManifestPlatform platformInstallManifest = installManifest.PlatformInstallManifests[InstallManifest.WindowsPlatformKey]; - platformInstallManifest.ShouldNotBeNull(); - platformInstallManifest.InstallActions.Count.ShouldEqual(2); - - this.VerifyInstallActionInfo( - platformInstallManifest.InstallActions[0], - "Git", - "2.19.0.1.34", - "/VERYSILENT /CLOSEAPPLICATIONS", - "Installers\\Windows\\G4W\\Git-2.19.0.gvfs.1.34.gc7fb556-64-bit.exe"); - - this.VerifyInstallActionInfo( - platformInstallManifest.InstallActions[1], - "PostGitInstall script", - null, - null, - "Installers\\Windows\\GSD\\postinstall.ps1"); - } - - [TestCase] - public void CanDeserializeAndSerializeInstallManifest() - { - List entries = new List() - { - this.CreateInstallActionInfo(), - this.CreateInstallActionInfo() - }; - - InstallManifest installManifest = new InstallManifest(); - installManifest.AddPlatformInstallManifest(InstallManifest.WindowsPlatformKey, entries); - - JsonSerializer serializer = new JsonSerializer(); - - using (MemoryStream ms = new MemoryStream()) - using (StreamWriter streamWriter = new StreamWriter(ms)) - using (JsonWriter jsWriter = new JsonTextWriter(streamWriter)) - { - string output = JsonConvert.SerializeObject(installManifest); - serializer.Serialize(jsWriter, installManifest); - jsWriter.Flush(); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader streamReader = new StreamReader(ms); - InstallManifest deserializedInstallManifest = InstallManifest.FromJson(streamReader); - - this.VerifyInstallManifestsAreEqual(installManifest, deserializedInstallManifest); - } - } - - private InstallActionInfo CreateInstallActionInfo() - { - int entrySuffix = manifestEntryCount++; - return new InstallActionInfo( - name: $"Installer{entrySuffix}", - version: $"1.{entrySuffix}.1.2", - args: $"/nodowngrade{entrySuffix}", - installerRelativePath: $"installers/installer1{entrySuffix}", - command: string.Empty); - } - - private void VerifyInstallManifestsAreEqual(InstallManifest expected, InstallManifest actual) - { - actual.PlatformInstallManifests.Count.ShouldEqual(expected.PlatformInstallManifests.Count, $"The number of platforms ({actual.PlatformInstallManifests.Count}) do not match the expected number of platforms ({expected.PlatformInstallManifests.Count})."); - - foreach (KeyValuePair kvp in expected.PlatformInstallManifests) - { - this.VerifyPlatformManifestsAreEqual(kvp.Value, actual.PlatformInstallManifests[kvp.Key]); - } - } - - private void VerifyInstallActionInfo( - InstallActionInfo actualEntry, - string expectedName, - string expectedVersion, - string expectedArgs, - string expectedInstallerRelativePath) - { - actualEntry.Name.ShouldEqual(expectedName, "InstallActionInfo name does not match expected value"); - actualEntry.Version.ShouldEqual(expectedVersion, "InstallActionInfo version does not match expected value"); - actualEntry.Args.ShouldEqual(expectedArgs, "InstallActionInfo Args does not match expected value"); - actualEntry.InstallerRelativePath.ShouldEqual(expectedInstallerRelativePath, "InstallActionInfo InstallerRelativePath does not match expected value"); - } - - private void VerifyPlatformManifestsAreEqual(InstallManifestPlatform expected, InstallManifestPlatform actual) - { - actual.InstallActions.Count.ShouldEqual(expected.InstallActions.Count, $"The number of platforms ({actual.InstallActions.Count}) do not match the expected number of platforms ({expected.InstallActions.Count})."); - - for (int i = 0; i < actual.InstallActions.Count; i++) - { - actual.InstallActions[i].Version.ShouldEqual(expected.InstallActions[i].Version); - actual.InstallActions[i].Args.ShouldEqual(expected.InstallActions[i].Args); - actual.InstallActions[i].Name.ShouldEqual(expected.InstallActions[i].Name); - actual.InstallActions[i].InstallerRelativePath.ShouldEqual(expected.InstallActions[i].InstallerRelativePath); - } - } - } -} diff --git a/GVFS/GVFS.UnitTests/Common/NuGetUpgrade/NuGetUpgraderTests.cs b/GVFS/GVFS.UnitTests/Common/NuGetUpgrade/NuGetUpgraderTests.cs deleted file mode 100644 index 44a8795e88..0000000000 --- a/GVFS/GVFS.UnitTests/Common/NuGetUpgrade/NuGetUpgraderTests.cs +++ /dev/null @@ -1,455 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Common.NuGetUpgrade; -using GVFS.Common.Tracing; -using GVFS.Tests.Should; -using GVFS.UnitTests.Category; -using GVFS.UnitTests.Mock.Common; -using GVFS.UnitTests.Mock.FileSystem; -using Moq; -using NuGet.Packaging.Core; -using NuGet.Protocol.Core.Types; -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace GVFS.UnitTests.Common.NuGetUpgrade -{ - [TestFixture] - public class NuGetUpgraderTests - { - protected const string OlderVersion = "1.0.1185.0"; - protected const string CurrentVersion = "1.5.1185.0"; - protected const string NewerVersion = "1.6.1185.0"; - protected const string NewerVersion2 = "1.7.1185.0"; - - protected const string NuGetFeedUrl = "https://pkgs.dev.azure.com/contoso/packages"; - protected const string NuGetFeedName = "feedNameValue"; - - protected static Exception httpRequestAuthException = new System.Net.Http.HttpRequestException("Response status code does not indicate success: 401 (Unauthorized)."); - protected static Exception fatalProtocolAuthException = new FatalProtocolException("Unable to load the service index for source.", httpRequestAuthException); - - protected static Exception[] networkAuthFailures = - { - httpRequestAuthException, - fatalProtocolAuthException - }; - - protected NuGetUpgrader upgrader; - protected MockTracer tracer; - - protected NuGetUpgrader.NuGetUpgraderConfig upgraderConfig; - - protected Mock mockNuGetFeed; - protected MockFileSystem mockFileSystem; - protected Mock mockCredentialManager; - protected ProductUpgraderPlatformStrategy productUpgraderPlatformStrategy; - - protected string downloadDirectoryPath = Path.Combine( - $"mock:{Path.DirectorySeparatorChar}", - ProductUpgraderInfo.UpgradeDirectoryName, - ProductUpgraderInfo.DownloadDirectory); - - protected delegate void DownloadPackageAsyncCallback(PackageIdentity packageIdentity); - - public virtual ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformStrategy() - { - return new MockProductUpgraderPlatformStrategy(this.mockFileSystem, this.tracer); - } - - [SetUp] - public void SetUp() - { - this.upgraderConfig = new NuGetUpgrader.NuGetUpgraderConfig(this.tracer, null, NuGetFeedUrl, NuGetFeedName); - - this.tracer = new MockTracer(); - - this.mockNuGetFeed = new Mock( - NuGetFeedUrl, - NuGetFeedName, - this.downloadDirectoryPath, - null, - GVFSPlatform.Instance.UnderConstruction.SupportsNuGetEncryption, - this.tracer); - this.mockNuGetFeed.Setup(feed => feed.SetCredentials(It.IsAny())); - - this.mockFileSystem = new MockFileSystem( - new MockDirectory( - Path.GetDirectoryName(this.downloadDirectoryPath), - new[] { new MockDirectory(this.downloadDirectoryPath, null, null) }, - null)); - - this.mockCredentialManager = new Mock(); - string credentialManagerString = "value"; - string emptyString = string.Empty; - this.mockCredentialManager.Setup(foo => foo.TryGetCredential(It.IsAny(), It.IsAny(), out credentialManagerString, out credentialManagerString, out credentialManagerString)).Returns(true); - - this.productUpgraderPlatformStrategy = this.CreateProductUpgraderPlatformStrategy(); - - this.upgrader = new NuGetUpgrader( - CurrentVersion, - this.tracer, - false, - false, - this.mockFileSystem, - this.upgraderConfig, - this.mockNuGetFeed.Object, - this.mockCredentialManager.Object, - this.productUpgraderPlatformStrategy); - } - - [TearDown] - public void TearDown() - { - this.mockNuGetFeed.Object.Dispose(); - this.tracer.Dispose(); - } - - [TestCase] - public void TryQueryNewestVersion_NewVersionAvailable() - { - Version newVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(It.IsAny())).ReturnsAsync(availablePackages); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - // Assert that we found the newer version - success.ShouldBeTrue(); - newVersion.ShouldNotBeNull(); - newVersion.ShouldEqual(new Version(NewerVersion)); - message.ShouldNotBeNull(); - } - - [TestCase] - public void TryQueryNewestVersion_MultipleNewVersionsAvailable() - { - Version newVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion2)), - }; - - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(It.IsAny())).ReturnsAsync(availablePackages); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - // Assert that we found the newest version - success.ShouldBeTrue(); - newVersion.ShouldNotBeNull(); - newVersion.ShouldEqual(new Version(NewerVersion2)); - message.ShouldNotBeNull(); - } - - [TestCase] - public void TryQueryNewestVersion_NoNewerVersionsAvailable() - { - Version newVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(OlderVersion)), - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - }; - - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(It.IsAny())).ReturnsAsync(availablePackages); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - // Assert that no new version was returned - success.ShouldBeTrue(); - newVersion.ShouldBeNull(); - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public void TryQueryNewestVersion_Exception() - { - Version newVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(OlderVersion)), - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - }; - - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(It.IsAny())).Throws(new Exception("Network Error")); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - // Assert that no new version was returned - success.ShouldBeFalse(); - newVersion.ShouldBeNull(); - message.ShouldNotBeNull(); - message.Any().ShouldBeTrue(); - } - - [TestCase] - public void CanDownloadNewestVersion() - { - Version actualNewestVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - string testDownloadPath = Path.Combine(this.downloadDirectoryPath, "testNuget.zip"); - IPackageSearchMetadata newestAvailableVersion = availablePackages.Last(); - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(NuGetFeedName)).ReturnsAsync(availablePackages); - this.mockNuGetFeed.Setup(foo => foo.DownloadPackageAsync(It.Is(packageIdentity => packageIdentity == newestAvailableVersion.Identity))).ReturnsAsync(testDownloadPath); - this.mockNuGetFeed.Setup(foo => foo.VerifyPackage(It.IsAny())).Returns(true); - - bool success = this.upgrader.TryQueryNewestVersion(out actualNewestVersion, out message); - - // Assert that no new version was returned - success.ShouldBeTrue($"Expecting TryQueryNewestVersion to have completed sucessfully. Error: {message}"); - actualNewestVersion.ShouldEqual(newestAvailableVersion.Identity.Version.Version, "Actual new version does not match expected new version."); - - bool downloadSuccessful = this.upgrader.TryDownloadNewestVersion(out message); - downloadSuccessful.ShouldBeTrue(); - this.upgrader.DownloadedPackagePath.ShouldEqual(testDownloadPath); - this.mockNuGetFeed.Verify(nuGetFeed => nuGetFeed.VerifyPackage(It.IsAny()), Times.Once()); - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public void DownloadNewestVersion_HandleException() - { - Version newVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(It.IsAny())).ReturnsAsync(availablePackages); - this.mockNuGetFeed.Setup(foo => foo.DownloadPackageAsync(It.IsAny())).Throws(new Exception("Network Error")); - this.mockNuGetFeed.Setup(foo => foo.VerifyPackage(It.IsAny())).Returns(true); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - success.ShouldBeTrue($"Expecting TryQueryNewestVersion to have completed sucessfully. Error: {message}"); - newVersion.ShouldNotBeNull(); - - bool downloadSuccessful = this.upgrader.TryDownloadNewestVersion(out message); - downloadSuccessful.ShouldBeFalse(); - } - - [TestCase] - public void AttemptingToDownloadBeforeQueryingFails() - { - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - IPackageSearchMetadata newestAvailableVersion = availablePackages.Last(); - - string downloadPath = "c:\\test_download_path"; - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(NuGetFeedName)).ReturnsAsync(availablePackages); - this.mockNuGetFeed.Setup(foo => foo.DownloadPackageAsync(It.Is(packageIdentity => packageIdentity == newestAvailableVersion.Identity))).ReturnsAsync(downloadPath); - - bool downloadSuccessful = this.upgrader.TryDownloadNewestVersion(out message); - downloadSuccessful.ShouldBeFalse(); - } - - [TestCase] - public void TestUpgradeAllowed() - { - // Properly Configured NuGet config - NuGetUpgrader.NuGetUpgraderConfig nuGetUpgraderConfig = - new NuGetUpgrader.NuGetUpgraderConfig(this.tracer, null, NuGetFeedUrl, NuGetFeedName); - - NuGetUpgrader nuGetUpgrader = new NuGetUpgrader( - CurrentVersion, - this.tracer, - false, - false, - this.mockFileSystem, - nuGetUpgraderConfig, - this.mockNuGetFeed.Object, - this.mockCredentialManager.Object, - this.productUpgraderPlatformStrategy); - - nuGetUpgrader.UpgradeAllowed(out _).ShouldBeTrue("NuGetUpgrader config is complete: upgrade should be allowed."); - - // Empty FeedURL - nuGetUpgraderConfig = - new NuGetUpgrader.NuGetUpgraderConfig(this.tracer, null, string.Empty, NuGetFeedName); - - nuGetUpgrader = new NuGetUpgrader( - CurrentVersion, - this.tracer, - false, - false, - this.mockFileSystem, - nuGetUpgraderConfig, - this.mockNuGetFeed.Object, - this.mockCredentialManager.Object, - this.productUpgraderPlatformStrategy); - - nuGetUpgrader.UpgradeAllowed(out string _).ShouldBeFalse("Upgrade without FeedURL configured should not be allowed."); - - // Empty packageFeedName - nuGetUpgraderConfig = - new NuGetUpgrader.NuGetUpgraderConfig(this.tracer, null, NuGetFeedUrl, string.Empty); - - // Empty packageFeedName - nuGetUpgrader = new NuGetUpgrader( - CurrentVersion, - this.tracer, - false, - false, - this.mockFileSystem, - nuGetUpgraderConfig, - this.mockNuGetFeed.Object, - this.mockCredentialManager.Object, - this.productUpgraderPlatformStrategy); - - nuGetUpgrader.UpgradeAllowed(out string _).ShouldBeFalse("Upgrade without FeedName configured should not be allowed."); - } - - [TestCaseSource("networkAuthFailures")] - public void QueryNewestVersionReacquiresCredentialsOnAuthFailure(Exception exception) - { - Version actualNewestVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - string testDownloadPath = Path.Combine(this.downloadDirectoryPath, "testNuget.zip"); - IPackageSearchMetadata newestAvailableVersion = availablePackages.Last(); - this.mockNuGetFeed.SetupSequence(foo => foo.QueryFeedAsync(It.IsAny())) - .Throws(exception) - .ReturnsAsync(availablePackages); - - // Setup the credential manager - string emptyString = string.Empty; - this.mockCredentialManager.Setup(foo => foo.TryDeleteCredential(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), out emptyString)).Returns(true); - - bool success = this.upgrader.TryQueryNewestVersion(out actualNewestVersion, out message); - - // Verify expectations - success.ShouldBeTrue($"Expecting TryQueryNewestVersion to have completed sucessfully. Error: {message}"); - actualNewestVersion.ShouldEqual(newestAvailableVersion.Identity.Version.Version, "Actual new version does not match expected new version."); - - this.mockNuGetFeed.Verify(nuGetFeed => nuGetFeed.QueryFeedAsync(It.IsAny()), Times.Exactly(2)); - - string outString = string.Empty; - this.mockCredentialManager.Verify(credentialManager => credentialManager.TryGetCredential(It.IsAny(), It.IsAny(), out outString, out outString, out outString), Times.Exactly(2)); - this.mockCredentialManager.Verify(credentialManager => credentialManager.TryDeleteCredential(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), out outString), Times.Exactly(1)); - } - - [TestCase] - public void WellKnownArgumentTokensReplaced() - { - string logDirectory = "mock:\\test_log_directory"; - string noTokenSourceString = "/arg no_token log_directory installation_id"; - NuGetUpgrader.ReplaceArgTokens(noTokenSourceString, "unique_id", logDirectory, "installerBase").ShouldEqual(noTokenSourceString, "String with no tokens should not be modifed"); - - string sourceStringWithTokens = "/arg /log {log_directory}_{installation_id}_{installer_base_path}"; - string expectedProcessedString = "/arg /log " + logDirectory + "_unique_id_installerBase"; - NuGetUpgrader.ReplaceArgTokens(sourceStringWithTokens, "unique_id", logDirectory, "installerBase").ShouldEqual(expectedProcessedString, "expected tokens have not been replaced"); - } - - [TestCase] - public void DownloadFailsOnNuGetPackageVerificationFailure() - { - Version actualNewestVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - IPackageSearchMetadata newestAvailableVersion = availablePackages.Last(); - - string testDownloadPath = Path.Combine(this.downloadDirectoryPath, "testNuget.zip"); - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(NuGetFeedName)).ReturnsAsync(availablePackages); - this.mockNuGetFeed.Setup(foo => foo.DownloadPackageAsync(It.Is(packageIdentity => packageIdentity == newestAvailableVersion.Identity))) - .Callback(new DownloadPackageAsyncCallback( - (packageIdentity) => this.mockFileSystem.WriteAllText(testDownloadPath, "Package contents that will fail validation"))) - .ReturnsAsync(testDownloadPath); - this.mockNuGetFeed.Setup(foo => foo.VerifyPackage(It.IsAny())).Returns(false); - - bool success = this.upgrader.TryQueryNewestVersion(out actualNewestVersion, out message); - success.ShouldBeTrue($"Expecting TryQueryNewestVersion to have completed sucessfully. Error: {message}"); - actualNewestVersion.ShouldEqual(newestAvailableVersion.Identity.Version.Version, "Actual new version does not match expected new version."); - - bool downloadSuccessful = this.upgrader.TryDownloadNewestVersion(out message); - this.mockNuGetFeed.Verify(nuGetFeed => nuGetFeed.VerifyPackage(this.upgrader.DownloadedPackagePath), Times.Once()); - downloadSuccessful.ShouldBeFalse("Failure to verify NuGet package should cause download to fail."); - this.mockFileSystem.FileExists(testDownloadPath).ShouldBeFalse("VerifyPackage should delete invalid packages"); - } - - [TestCase] - public void DoNotVerifyNuGetPackageWhenNoVerifyIsSpecified() - { - NuGetUpgrader.NuGetUpgraderConfig nuGetUpgraderConfig = - new NuGetUpgrader.NuGetUpgraderConfig(this.tracer, null, NuGetFeedUrl, NuGetFeedName); - - NuGetUpgrader nuGetUpgrader = new NuGetUpgrader( - CurrentVersion, - this.tracer, - false, - true, - this.mockFileSystem, - nuGetUpgraderConfig, - this.mockNuGetFeed.Object, - this.mockCredentialManager.Object, - this.productUpgraderPlatformStrategy); - - Version actualNewestVersion; - string message; - List availablePackages = new List() - { - this.GeneratePackageSeachMetadata(new Version(CurrentVersion)), - this.GeneratePackageSeachMetadata(new Version(NewerVersion)), - }; - - IPackageSearchMetadata newestAvailableVersion = availablePackages.Last(); - - string testDownloadPath = Path.Combine(this.downloadDirectoryPath, "testNuget.zip"); - this.mockNuGetFeed.Setup(foo => foo.QueryFeedAsync(NuGetFeedName)).ReturnsAsync(availablePackages); - this.mockNuGetFeed.Setup(foo => foo.DownloadPackageAsync(It.Is(packageIdentity => packageIdentity == newestAvailableVersion.Identity))).ReturnsAsync(testDownloadPath); - this.mockNuGetFeed.Setup(foo => foo.VerifyPackage(It.IsAny())).Returns(false); - - bool success = nuGetUpgrader.TryQueryNewestVersion(out actualNewestVersion, out message); - success.ShouldBeTrue($"Expecting TryQueryNewestVersion to have completed sucessfully. Error: {message}"); - actualNewestVersion.ShouldEqual(newestAvailableVersion.Identity.Version.Version, "Actual new version does not match expected new version."); - - bool downloadSuccessful = nuGetUpgrader.TryDownloadNewestVersion(out message); - this.mockNuGetFeed.Verify(nuGetFeed => nuGetFeed.VerifyPackage(It.IsAny()), Times.Never()); - downloadSuccessful.ShouldBeTrue("Should be able to download package with verification issues when noVerify is specified"); - } - - protected IPackageSearchMetadata GeneratePackageSeachMetadata(Version version) - { - Mock mockPackageSearchMetaData = new Mock(); - NuGet.Versioning.NuGetVersion nuGetVersion = new NuGet.Versioning.NuGetVersion(version); - mockPackageSearchMetaData.Setup(foo => foo.Identity).Returns(new NuGet.Packaging.Core.PackageIdentity("generatedPackedId", nuGetVersion)); - - return mockPackageSearchMetaData.Object; - } - } -} diff --git a/GVFS/GVFS.UnitTests/Common/NuGetUpgrade/OrgNuGetUpgraderTests.cs b/GVFS/GVFS.UnitTests/Common/NuGetUpgrade/OrgNuGetUpgraderTests.cs deleted file mode 100644 index 8257840ba9..0000000000 --- a/GVFS/GVFS.UnitTests/Common/NuGetUpgrade/OrgNuGetUpgraderTests.cs +++ /dev/null @@ -1,192 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Common.NuGetUpgrade; -using GVFS.Common.Tracing; -using GVFS.Tests.Should; -using GVFS.UnitTests.Category; -using GVFS.UnitTests.Mock.Common; -using GVFS.UnitTests.Mock.FileSystem; -using Moq; -using Moq.Protected; -using NuGet.Packaging.Core; -using NuGet.Protocol.Core.Types; -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - -namespace GVFS.UnitTests.Common.NuGetUpgrade -{ - [TestFixture] - public class OrgNuGetUpgraderTests - { - private const string CurrentVersion = "1.5.1185.0"; - private const string NewerVersion = "1.6.1185.0"; - - private const string DefaultUpgradeFeedPackageName = "package"; - private const string DefaultUpgradeFeedUrl = "https://pkgs.dev.azure.com/contoso/"; - private const string DefaultOrgInfoServerUrl = "https://www.contoso.com"; - private const string DefaultRing = "slow"; - - private OrgNuGetUpgrader upgrader; - - private MockTracer tracer; - - private OrgNuGetUpgrader.OrgNuGetUpgraderConfig upgraderConfig; - - private Mock mockNuGetFeed; - private MockFileSystem mockFileSystem; - private Mock mockCredentialManager; - private Mock httpMessageHandlerMock; - - private string downloadDirectoryPath = Path.Combine( - $"mock:{Path.DirectorySeparatorChar}", - ProductUpgraderInfo.UpgradeDirectoryName, - ProductUpgraderInfo.DownloadDirectory); - - private interface IHttpMessageHandlerProtectedMembers - { - Task SendAsync(HttpRequestMessage message, CancellationToken token); - } - - public static IEnumerable NetworkFailureCases() - { - yield return new HttpRequestException("Response status code does not indicate success: 401: (Unauthorized)"); - yield return new TaskCanceledException("Task canceled"); - } - - [SetUp] - public void SetUp() - { - MockLocalGVFSConfig mockGvfsConfig = new MockLocalGVFSConfigBuilder( - DefaultRing, - DefaultUpgradeFeedUrl, - DefaultUpgradeFeedPackageName, - DefaultOrgInfoServerUrl) - .WithUpgradeRing() - .WithUpgradeFeedPackageName() - .WithUpgradeFeedUrl() - .WithOrgInfoServerUrl() - .Build(); - - this.upgraderConfig = new OrgNuGetUpgrader.OrgNuGetUpgraderConfig(this.tracer, mockGvfsConfig); - this.upgraderConfig.TryLoad(out _); - - this.tracer = new MockTracer(); - - this.mockNuGetFeed = new Mock( - DefaultUpgradeFeedUrl, - DefaultUpgradeFeedPackageName, - this.downloadDirectoryPath, - null, - GVFSPlatform.Instance.UnderConstruction.SupportsNuGetEncryption, - this.tracer); - - this.mockFileSystem = new MockFileSystem( - new MockDirectory( - Path.GetDirectoryName(this.downloadDirectoryPath), - new[] { new MockDirectory(this.downloadDirectoryPath, null, null) }, - null)); - - this.mockCredentialManager = new Mock(); - string credentialManagerString = "value"; - string emptyString = string.Empty; - this.mockCredentialManager.Setup(foo => foo.TryGetCredential(It.IsAny(), It.IsAny(), out credentialManagerString, out credentialManagerString, out credentialManagerString)).Returns(true); - - this.httpMessageHandlerMock = new Mock(); - - this.httpMessageHandlerMock.Protected().As() - .Setup(m => m.SendAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(this.ConstructResponseContent(NewerVersion)) - }); - - HttpClient httpClient = new HttpClient(this.httpMessageHandlerMock.Object); - - this.upgrader = new OrgNuGetUpgrader( - CurrentVersion, - this.tracer, - this.mockFileSystem, - httpClient, - false, - false, - this.upgraderConfig, - "windows", - this.mockNuGetFeed.Object, - this.mockCredentialManager.Object); - } - - [TestCase] - public void SupportsAnonymousQuery() - { - this.upgrader.SupportsAnonymousVersionQuery.ShouldBeTrue(); - } - - [TestCase] - public void TryQueryNewestVersion() - { - Version newVersion; - string message; - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - success.ShouldBeTrue(); - newVersion.ShouldNotBeNull(); - newVersion.ShouldEqual(new Version(NewerVersion)); - message.ShouldNotBeNull(); - message.ShouldEqual($"New version {OrgNuGetUpgraderTests.NewerVersion} is available."); - } - - [TestCaseSource("NetworkFailureCases")] - public void HandlesNetworkErrors(Exception ex) - { - Version newVersion; - string message; - - this.httpMessageHandlerMock.Protected().As() - .Setup(m => m.SendAsync(It.IsAny(), It.IsAny())) - .ThrowsAsync(ex); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - success.ShouldBeFalse(); - newVersion.ShouldBeNull(); - message.ShouldNotBeNull(); - message.ShouldContain("Network error"); - } - - [TestCase] - public void HandlesEmptyVersion() - { - Version newVersion; - string message; - - this.httpMessageHandlerMock.Protected().As() - .Setup(m => m.SendAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(new HttpResponseMessage() - { - StatusCode = HttpStatusCode.OK, - Content = new StringContent(this.ConstructResponseContent(string.Empty)) - }); - - bool success = this.upgrader.TryQueryNewestVersion(out newVersion, out message); - - success.ShouldBeTrue(); - newVersion.ShouldBeNull(); - message.ShouldNotBeNull(); - message.ShouldContain("No versions available"); - } - - private string ConstructResponseContent(string version) - { - return $"{{\"version\" : \"{version}\"}} "; - } - } -} diff --git a/GVFS/GVFS.UnitTests/Common/ProductUpgraderInfoTests.cs b/GVFS/GVFS.UnitTests/Common/ProductUpgraderInfoTests.cs deleted file mode 100644 index 9a64ca22a0..0000000000 --- a/GVFS/GVFS.UnitTests/Common/ProductUpgraderInfoTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using GVFS.Tests.Should; -using GVFS.UnitTests.Mock.Common; -using Moq; -using NUnit.Framework; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace GVFS.UnitTests.Common -{ - [TestFixture] - public class ProductUpgraderInfoTests - { - private Mock mockFileSystem; - private ProductUpgraderInfo productUpgraderInfo; - - private string upgradeDirectory; - - private string expectedNewVersionExistsFileName = "HighestAvailableVersion"; - private string expectedNewVersionExistsFilePath; - private MockTracer tracer; - - [SetUp] - public void SetUp() - { - this.upgradeDirectory = ProductUpgraderInfo.GetHighestAvailableVersionDirectory(); - this.expectedNewVersionExistsFilePath = Path.Combine(this.upgradeDirectory, this.expectedNewVersionExistsFileName); - this.mockFileSystem = new Mock(); - - this.mockFileSystem.Setup(fileSystem => fileSystem.WriteAllText(this.expectedNewVersionExistsFilePath, It.IsAny())); - - this.tracer = new MockTracer(); - - this.productUpgraderInfo = new ProductUpgraderInfo( - this.tracer, - this.mockFileSystem.Object); - } - - [TearDown] - public void TearDown() - { - this.mockFileSystem = null; - this.productUpgraderInfo = null; - this.tracer = null; - } - - [TestCase] - public void RecordHighestVersion() - { - this.productUpgraderInfo.RecordHighestAvailableVersion(new Version("1.0.0.0")); - this.mockFileSystem.Verify(fileSystem => fileSystem.WriteAllText(this.expectedNewVersionExistsFilePath, It.IsAny()), Times.Once()); - } - - [TestCase] - public void RecordingEmptyVersionDeletesExistingHighestVersionFile() - { - this.mockFileSystem.Setup(fileSystem => fileSystem.FileExists(this.expectedNewVersionExistsFilePath)).Returns(true); - - this.productUpgraderInfo.RecordHighestAvailableVersion(null); - - this.mockFileSystem.Verify(fileSystem => fileSystem.FileExists(this.expectedNewVersionExistsFilePath), Times.Once()); - this.mockFileSystem.Verify(fileSystem => fileSystem.DeleteFile(this.expectedNewVersionExistsFilePath), Times.Once()); - } - - [TestCase] - public void RecordingEmptyVersionDoesNotDeleteNonExistingHighestVersionFile() - { - this.mockFileSystem.Setup(fileSystem => fileSystem.FileExists(this.expectedNewVersionExistsFilePath)).Returns(false); - - this.productUpgraderInfo.RecordHighestAvailableVersion(null); - - this.mockFileSystem.Verify(fileSystem => fileSystem.FileExists(this.expectedNewVersionExistsFilePath), Times.Once()); - this.mockFileSystem.Verify(fileSystem => fileSystem.DeleteFile(this.expectedNewVersionExistsFilePath), Times.Never()); - } - } -} diff --git a/GVFS/GVFS.UnitTests/Common/TryCreateProductUpgraderTests.cs b/GVFS/GVFS.UnitTests/Common/TryCreateProductUpgraderTests.cs deleted file mode 100644 index 50ae7778e5..0000000000 --- a/GVFS/GVFS.UnitTests/Common/TryCreateProductUpgraderTests.cs +++ /dev/null @@ -1,260 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.NuGetUpgrade; -using GVFS.Tests.Should; -using GVFS.UnitTests.Mock.Common; -using Moq; -using NUnit.Framework; - -namespace GVFS.UnitTests.Common -{ - public class TryCreateProductUpgradeTests - { - private static string defaultUpgradeFeedPackageName = "package"; - private static string defaultUpgradeFeedUrl = "https://pkgs.dev.azure.com/contoso/"; - private static string defaultOrgInfoServerUrl = "https://www.contoso.com"; - private static string defaultRing = "slow"; - - private MockTracer tracer; - private Mock fileSystemMock; - private Mock credentialStoreMock; - - [SetUp] - public void Setup() - { - this.tracer = new MockTracer(); - - // It is important that creating a new Upgrader does not - // require credentials. We must be able to create an - // upgrader to query / check upgrade preconditions without - // requiring authorization. We create these mocks with - // strict behavior to validate methods on them are called - // unnecessarily. - this.credentialStoreMock = new Mock(MockBehavior.Strict); - this.fileSystemMock = new Mock(MockBehavior.Strict); - } - - [TearDown] - public void TearDown() - { - this.credentialStoreMock.VerifyAll(); - this.fileSystemMock.VerifyAll(); - } - - [TestCase] - public void CreatesNuGetUpgraderWhenConfigured() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockNuGetConfigBuilder() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeTrue(); - productUpgrader.ShouldNotBeNull(); - productUpgrader.ShouldBeOfType(); - error.ShouldBeNull(); - } - - [TestCase] - public void CreatesNuGetUpgraderWhenConfiguredWithNoRing() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockNuGetConfigBuilder() - .WithNoUpgradeRing() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeTrue(); - productUpgrader.ShouldNotBeNull(); - productUpgrader.ShouldBeOfType(); - error.ShouldBeNull(); - } - - [TestCase] - public void CreatesGitHubUpgraderWhenConfigured() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultGitHubConfigBuilder() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeTrue(); - productUpgrader.ShouldNotBeNull(); - productUpgrader.ShouldBeOfType(); - error.ShouldBeNull(); - } - - [TestCase] - public void CreatesOrgNuGetUpgrader() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockOrgNuGetConfigBuilder() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeTrue(); - productUpgrader.ShouldNotBeNull(); - productUpgrader.ShouldBeOfType(); - error.ShouldBeNull(); - } - - [TestCase] - public void NoUpgraderWhenNuGetFeedMissing() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockNuGetConfigBuilder() - .WithNoUpgradeFeedUrl() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeFalse(); - productUpgrader.ShouldBeNull(); - error.ShouldNotBeNull(); - } - - [TestCase] - public void NoOrgUpgraderWhenNuGetPackNameMissing() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockOrgNuGetConfigBuilder() - .WithNoUpgradeFeedPackageName() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeFalse(); - productUpgrader.ShouldBeNull(); - error.ShouldNotBeNull(); - } - - [TestCase] - public void NoOrgUpgraderWhenNuGetFeedMissing() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockOrgNuGetConfigBuilder() - .WithNoUpgradeFeedUrl() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeFalse(); - productUpgrader.ShouldBeNull(); - error.ShouldNotBeNull(); - } - - [TestCase] - public void NoUpgraderWhenNuGetPackNameMissing() - { - MockLocalGVFSConfig gvfsConfig = this.ConstructDefaultMockNuGetConfigBuilder() - .WithNoUpgradeFeedPackageName() - .Build(); - - bool success = ProductUpgrader.TryCreateUpgrader( - this.tracer, - this.fileSystemMock.Object, - gvfsConfig, - this.credentialStoreMock.Object, - false, - false, - out ProductUpgrader productUpgrader, - out string error); - - success.ShouldBeFalse(); - productUpgrader.ShouldBeNull(); - error.ShouldNotBeNull(); - } - - private MockLocalGVFSConfigBuilder ConstructDefaultMockNuGetConfigBuilder() - { - MockLocalGVFSConfigBuilder configBuilder = this.ConstructMockLocalGVFSConfigBuilder() - .WithUpgradeRing() - .WithUpgradeFeedPackageName() - .WithUpgradeFeedUrl(); - - return configBuilder; - } - - private MockLocalGVFSConfigBuilder ConstructDefaultMockOrgNuGetConfigBuilder() - { - MockLocalGVFSConfigBuilder configBuilder = this.ConstructMockLocalGVFSConfigBuilder() - .WithUpgradeRing() - .WithUpgradeFeedPackageName() - .WithUpgradeFeedUrl() - .WithOrgInfoServerUrl(); - - return configBuilder; - } - - private MockLocalGVFSConfigBuilder ConstructDefaultGitHubConfigBuilder() - { - MockLocalGVFSConfigBuilder configBuilder = this.ConstructMockLocalGVFSConfigBuilder() - .WithUpgradeRing(); - - return configBuilder; - } - - private MockLocalGVFSConfigBuilder ConstructMockLocalGVFSConfigBuilder() - { - return new MockLocalGVFSConfigBuilder( - defaultRing, - defaultUpgradeFeedUrl, - defaultUpgradeFeedPackageName, - defaultOrgInfoServerUrl); - } - } -} diff --git a/GVFS/GVFS.UnitTests/Data/backward.txt b/GVFS/GVFS.UnitTests/Data/backward.txt index 5c333e0260..e193347228 100644 --- a/GVFS/GVFS.UnitTests/Data/backward.txt +++ b/GVFS/GVFS.UnitTests/Data/backward.txt @@ -19,6 +19,8 @@ :000000 100644 0000000000000000000000000000000000000000 8724404da33605d27cfa5490d412f0dfea16a277 A folderToDelete/fileToEdit2.txt :040000 040000 403c21d5d12f6e6a6659460b5cec7e4b66b6c0f2 9a894ca28a2a8d813f2bae305cd94faf366ad5e0 M folderToEdit :100644 100644 45f57f3292952208ad72232bc2a64038a3d0987f 59b502537b91543cb8aa7e6a26ee235197fa154b M folderToEdit/fileToEdit2.txt +:000000 100644 bbbb404da33605d27cfa5490d412f0dfea16eeee 0000000000000000000000000000000000000000 D folderToEdit/fileToDelete.txt +:000000 100644 cccc404da33605d27cfa5490d412f0dfea16ffff 0000000000000000000000000000000000000000 D folderToEdit/fileToDelete.txt.bak :000000 040000 0000000000000000000000000000000000000000 e30358a677e3a55aa838d0bbe0207f61ce40f401 A folderToRename :000000 100644 0000000000000000000000000000000000000000 35151eac3bb089589836bfece4dfbb84fae502de A folderToRename/existence.txt :040000 000000 e30358a677e3a55aa838d0bbe0207f61ce40f401 0000000000000000000000000000000000000000 D folderWasRenamed diff --git a/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj b/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj index 8013af848b..fe7648aacd 100644 --- a/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj +++ b/GVFS/GVFS.UnitTests/GVFS.UnitTests.csproj @@ -1,26 +1,37 @@  - - - Exe - netcoreapp2.1 - x64 - false - true - win-x64;osx-x64 - + net461 + Exe true - GVFS.UnitTests - GVFS.UnitTests - - - $(GVFSVersion) - - - $(GVFSVersion) + + + + + + + + + + + + + + + + + + + + ProjectedFSLib.dll + PreserveNewest + + + Always @@ -36,26 +47,4 @@ - - - - - - - - - - - all - - - - - - - - - - - diff --git a/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs b/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs index 1f379802a3..1d89320087 100644 --- a/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs +++ b/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs @@ -120,27 +120,12 @@ public override string GetLogsDirectoryForGVFSComponent(string componentName) public override Dictionary GetPhysicalDiskInfo(string path, bool sizeStatsOnly) { return new Dictionary(); - } - - public override string GetUpgradeProtectedDataDirectory() - { - return this.GetSecureDataRootForGVFSComponent(ProductUpgraderInfo.UpgradeDirectoryName); - } - - public override string GetUpgradeLogDirectoryParentDirectory() - { - return this.GetUpgradeProtectedDataDirectory(); } public override string GetSystemInstallerLogPath() { return "MockPath"; } - - public override string GetUpgradeHighestAvailableVersionDirectory() - { - return this.GetUpgradeProtectedDataDirectory(); - } public override bool IsConsoleOutputRedirectedToFile() { @@ -191,13 +176,6 @@ public override FileBasedLock CreateFileBasedLock(PhysicalFileSystem fileSystem, { return new MockFileBasedLock(fileSystem, tracer, lockPath); } - - public override ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformInteractions( - PhysicalFileSystem fileSystem, - ITracer tracer) - { - return new MockProductUpgraderPlatformStrategy(fileSystem, tracer); - } public override bool TryKillProcessTree(int processId, out int exitCode, out string error) { diff --git a/GVFS/GVFS.UnitTests/Mock/Common/MockProductUpgraderPlatformStrategy.cs b/GVFS/GVFS.UnitTests/Mock/Common/MockProductUpgraderPlatformStrategy.cs deleted file mode 100644 index c622a2b48f..0000000000 --- a/GVFS/GVFS.UnitTests/Mock/Common/MockProductUpgraderPlatformStrategy.cs +++ /dev/null @@ -1,32 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; - -namespace GVFS.UnitTests.Mock.Common -{ - public class MockProductUpgraderPlatformStrategy : ProductUpgraderPlatformStrategy - { - public MockProductUpgraderPlatformStrategy(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) - { - error = null; - return true; - } - - public override bool TryPrepareDownloadDirectory(out string error) - { - error = null; - return true; - } - } -} diff --git a/GVFS/GVFS.UnitTests/Mock/MockGitHubUpgrader.cs b/GVFS/GVFS.UnitTests/Mock/MockGitHubUpgrader.cs deleted file mode 100644 index 56d6520e0f..0000000000 --- a/GVFS/GVFS.UnitTests/Mock/MockGitHubUpgrader.cs +++ /dev/null @@ -1,261 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System; -using System.Collections.Generic; -using System.IO; - -namespace GVFS.UnitTests.Mock.Upgrader -{ - public class MockGitHubUpgrader : GitHubUpgrader - { - private string expectedGVFSAssetName; - private string expectedGitAssetName; - private ActionType failActionTypes; - - public MockGitHubUpgrader( - string currentVersion, - ITracer tracer, - PhysicalFileSystem fileSystem, - GitHubUpgraderConfig config) : base(currentVersion, tracer, fileSystem, config) - { - this.DownloadedFiles = new List(); - this.InstallerArgs = new Dictionary>(); - } - - [Flags] - public enum ActionType - { - Invalid = 0, - FetchReleaseInfo = 0x1, - CopyTools = 0x2, - GitDownload = 0x4, - GVFSDownload = 0x8, - GitInstall = 0x10, - GVFSInstall = 0x20, - GVFSCleanup = 0x40, - GitCleanup = 0x80, - GitAuthenticodeCheck = 0x100, - GVFSAuthenticodeCheck = 0x200, - CreateDownloadDirectory = 0x400, - } - - public List DownloadedFiles { get; private set; } - public Dictionary> InstallerArgs { get; private set; } - public bool InstallerExeLaunched { get; set; } - private Release FakeUpgradeRelease { get; set; } - - public void SetDryRun(bool dryRun) - { - this.dryRun = dryRun; - } - - public void SetFailOnAction(ActionType failureType) - { - this.failActionTypes |= failureType; - } - - public void SetSucceedOnAction(ActionType failureType) - { - this.failActionTypes &= ~failureType; - } - - public void ResetFailedAction() - { - this.failActionTypes = ActionType.Invalid; - } - - public void PretendNewReleaseAvailableAtRemote(string upgradeVersion, GitHubUpgraderConfig.RingType remoteRing) - { - string assetDownloadURLPrefix = "https://github.com/Microsoft/VFSForGit/releases/download/v" + upgradeVersion; - Release release = new Release(); - - release.Name = "GVFS " + upgradeVersion; - release.Tag = "v" + upgradeVersion; - release.PreRelease = remoteRing == GitHubUpgraderConfig.RingType.Fast; - release.Assets = new List(); - - Random random = new Random(); - Asset gvfsAsset = new Asset(); - gvfsAsset.Name = "VFSForGit." + upgradeVersion + GVFSPlatform.Instance.Constants.InstallerExtension; - - // This is not cross-checked anywhere, random value is good. - gvfsAsset.Size = random.Next(int.MaxValue / 10, int.MaxValue / 2); - gvfsAsset.DownloadURL = new Uri(assetDownloadURLPrefix + "/VFSForGit." + upgradeVersion + GVFSPlatform.Instance.Constants.InstallerExtension); - release.Assets.Add(gvfsAsset); - - Asset gitAsset = new Asset(); - gitAsset.Name = "Git-2.17.1.gvfs.2.1.4.g4385455-64-bit" + GVFSPlatform.Instance.Constants.InstallerExtension; - gitAsset.Size = random.Next(int.MaxValue / 10, int.MaxValue / 2); - gitAsset.DownloadURL = new Uri(assetDownloadURLPrefix + "/Git-2.17.1.gvfs.2.1.4.g4385455-64-bit" + GVFSPlatform.Instance.Constants.InstallerExtension); - release.Assets.Add(gitAsset); - - this.expectedGVFSAssetName = gvfsAsset.Name; - this.expectedGitAssetName = gitAsset.Name; - this.FakeUpgradeRelease = release; - } - - public override bool TrySetupUpgradeApplicationDirectory(out string upgradeApplicationPath, out string error) - { - if (this.failActionTypes.HasFlag(ActionType.CopyTools)) - { - upgradeApplicationPath = null; - error = "Unable to copy upgrader tools"; - return false; - } - - upgradeApplicationPath = @"mock:\ProgramData\GVFS\GVFS.Upgrade\Tools\GVFS.Upgrader.exe"; - error = null; - return true; - } - - protected override bool TryCreateAndConfigureDownloadDirectory(ITracer tracer, out string error) - { - if (this.failActionTypes.HasFlag(ActionType.CreateDownloadDirectory)) - { - error = "Error creating download directory"; - return false; - } - - error = null; - return true; - } - - protected override bool TryDownloadAsset(Asset asset, out string errorMessage) - { - bool validAsset = true; - if (this.expectedGVFSAssetName.Equals(asset.Name, GVFSPlatform.Instance.Constants.PathComparison)) - { - if (this.failActionTypes.HasFlag(ActionType.GVFSDownload)) - { - errorMessage = "Error downloading GVFS from GitHub"; - return false; - } - } - else if (this.expectedGitAssetName.Equals(asset.Name, GVFSPlatform.Instance.Constants.PathComparison)) - { - if (this.failActionTypes.HasFlag(ActionType.GitDownload)) - { - errorMessage = "Error downloading Git from GitHub"; - return false; - } - } - else - { - validAsset = false; - } - - if (validAsset) - { - string fakeDownloadDirectory = @"mock:\ProgramData\GVFS\GVFS.Upgrade\Downloads"; - asset.LocalPath = Path.Combine(fakeDownloadDirectory, asset.Name); - this.DownloadedFiles.Add(asset.LocalPath); - - errorMessage = null; - return true; - } - - errorMessage = "Cannot download unknown asset."; - return false; - } - - protected override bool TryDeleteDownloadedAsset(Asset asset, out Exception exception) - { - if (this.expectedGVFSAssetName.Equals(asset.Name, GVFSPlatform.Instance.Constants.PathComparison)) - { - if (this.failActionTypes.HasFlag(ActionType.GVFSCleanup)) - { - exception = new Exception("Error deleting downloaded GVFS installer."); - return false; - } - - exception = null; - return true; - } - else if (this.expectedGitAssetName.Equals(asset.Name, GVFSPlatform.Instance.Constants.PathComparison)) - { - if (this.failActionTypes.HasFlag(ActionType.GitCleanup)) - { - exception = new Exception("Error deleting downloaded Git installer."); - return false; - } - - exception = null; - return true; - } - else - { - exception = new Exception("Unknown asset."); - return false; - } - } - - protected override bool TryFetchReleases(out List releases, out string errorMessage) - { - if (this.failActionTypes.HasFlag(ActionType.FetchReleaseInfo)) - { - releases = null; - errorMessage = "Error fetching upgrade release info."; - return false; - } - - releases = new List { this.FakeUpgradeRelease }; - errorMessage = null; - - return true; - } - - protected override void RunInstaller(string path, string args, string certCN, string issuerCN, out int exitCode, out string error) - { - string fileName = Path.GetFileName(path); - Dictionary installationInfo = new Dictionary(); - installationInfo.Add("Installer", fileName); - installationInfo.Add("Args", args); - - exitCode = 0; - error = null; - - if (fileName.Equals(this.expectedGitAssetName, GVFSPlatform.Instance.Constants.PathComparison)) - { - this.InstallerArgs.Add("Git", installationInfo); - this.InstallerExeLaunched = true; - if (this.failActionTypes.HasFlag(ActionType.GitInstall)) - { - exitCode = -1; - error = "Git installation failed"; - } - - if (this.failActionTypes.HasFlag(ActionType.GitAuthenticodeCheck)) - { - exitCode = -1; - error = "The contents of file C:\\ProgramData\\GVFS\\GVFS.Upgrade\\Tools\\Git-2.17.1.gvfs.2.1.4.g4385455-64-bit might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing."; - } - - return; - } - - if (fileName.Equals(this.expectedGVFSAssetName, GVFSPlatform.Instance.Constants.PathComparison)) - { - this.InstallerArgs.Add("GVFS", installationInfo); - this.InstallerExeLaunched = true; - if (this.failActionTypes.HasFlag(ActionType.GVFSInstall)) - { - exitCode = -1; - error = "GVFS installation failed"; - } - - if (this.failActionTypes.HasFlag(ActionType.GVFSAuthenticodeCheck)) - { - exitCode = -1; - error = "The contents of file C:\\ProgramData\\GVFS\\GVFS.Upgrade\\Tools\\SetupGVFS.1.0.18297.1.exe might have been changed by an unauthorized user or process, because the hash of the file does not match the hash stored in the digital signature. The script cannot run on the specified system. For more information, run Get-Help about_Signing."; - } - - return; - } - - exitCode = -1; - error = "Cannot launch unknown installer"; - return; - } - } -} diff --git a/GVFS/GVFS.UnitTests/Mock/MockInstallerPreRunChecker.cs b/GVFS/GVFS.UnitTests/Mock/MockInstallerPreRunChecker.cs deleted file mode 100644 index 348038f01f..0000000000 --- a/GVFS/GVFS.UnitTests/Mock/MockInstallerPreRunChecker.cs +++ /dev/null @@ -1,114 +0,0 @@ -using GVFS.Common.Tracing; -using GVFS.Upgrader; -using System; -using System.Collections.Generic; - -namespace GVFS.UnitTests.Mock.Upgrader -{ - public class MockInstallerPrerunChecker : InstallerPreRunChecker - { - public const string GitUpgradeCheckError = "Unable to upgrade Git"; - - private FailOnCheckType failOnCheck; - - public MockInstallerPrerunChecker(ITracer tracer) : base(tracer, string.Empty) - { - } - - [Flags] - public enum FailOnCheckType - { - Invalid = 0, - ProjFSEnabled = 0x1, - IsElevated = 0x2, - BlockingProcessesRunning = 0x4, - UnattendedMode = 0x8, - UnMountRepos = 0x10, - RemountRepos = 0x20, - IsServiceInstalledAndNotRunning = 0x40, - } - - public void SetReturnFalseOnCheck(FailOnCheckType prerunCheck) - { - this.failOnCheck |= prerunCheck; - } - - public void SetReturnTrueOnCheck(FailOnCheckType prerunCheck) - { - this.failOnCheck &= ~prerunCheck; - } - - public void Reset() - { - this.failOnCheck = FailOnCheckType.Invalid; - - this.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.UnattendedMode); - this.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.BlockingProcessesRunning); - this.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.IsServiceInstalledAndNotRunning); - } - - public void SetCommandToRerun(string command) - { - this.CommandToRerun = command; - } - - protected override bool IsServiceInstalledAndNotRunning() - { - return this.FakedResultOfCheck(FailOnCheckType.IsServiceInstalledAndNotRunning); - } - - protected override bool IsElevated() - { - return this.FakedResultOfCheck(FailOnCheckType.IsElevated); - } - - protected override bool IsGVFSUpgradeSupported() - { - return this.FakedResultOfCheck(FailOnCheckType.ProjFSEnabled); - } - - protected override bool IsUnattended() - { - return this.FakedResultOfCheck(FailOnCheckType.UnattendedMode); - } - - protected override bool IsBlockingProcessRunning(out HashSet processes) - { - processes = new HashSet(); - - bool isRunning = this.FakedResultOfCheck(FailOnCheckType.BlockingProcessesRunning); - if (isRunning) - { - processes.Add("GVFS.Mount"); - processes.Add("git"); - } - - return isRunning; - } - - protected override bool TryRunGVFSWithArgs(string args, out string error) - { - if (string.CompareOrdinal(args, "service --unmount-all") == 0) - { - bool result = this.FakedResultOfCheck(FailOnCheckType.UnMountRepos); - error = result == false ? "Unmount of some of the repositories failed." : null; - return result; - } - - if (string.CompareOrdinal(args, "service --mount-all") == 0) - { - bool result = this.FakedResultOfCheck(FailOnCheckType.RemountRepos); - error = result == false ? "Auto remount failed." : null; - return result; - } - - error = "Unknown GVFS command"; - return false; - } - - private bool FakedResultOfCheck(FailOnCheckType checkType) - { - return !this.failOnCheck.HasFlag(checkType); - } - } -} diff --git a/GVFS/GVFS.UnitTests/Prefetch/BatchObjectDownloadStageTests.cs b/GVFS/GVFS.UnitTests/Prefetch/BatchObjectDownloadStageTests.cs index 960d2e9456..8efec71cbe 100644 --- a/GVFS/GVFS.UnitTests/Prefetch/BatchObjectDownloadStageTests.cs +++ b/GVFS/GVFS.UnitTests/Prefetch/BatchObjectDownloadStageTests.cs @@ -6,6 +6,7 @@ using NUnit.Framework; using System; using System.Collections.Concurrent; +using System.Threading; namespace GVFS.UnitTests.Prefetch { @@ -73,5 +74,47 @@ public void OnlyRequestsObjectsNotDownloaded() obj1Count.ShouldEqual(1); obj2Count.ShouldEqual(2); } + + [TestCase] + public void DoesNotExitEarlyIfInputTakesLongerThanChunkSizeToGetFirstBlob() + { + BlockingCollection input = new BlockingCollection(); + string objSha = new string('1', 40); + + int objCount = 0; + + Func objectResolver = (oid) => + { + if (oid.Equals(objSha)) + { + objCount++; + return "Object1Contents"; + } + + return null; + }; + + BlockingCollection output = new BlockingCollection(); + MockTracer tracer = new MockTracer(); + MockGVFSEnlistment enlistment = new MockGVFSEnlistment(); + MockBatchHttpGitObjects httpObjects = new MockBatchHttpGitObjects(tracer, enlistment, objectResolver); + + BatchObjectDownloadStage dut = new BatchObjectDownloadStage( + MaxParallel, + 1, + input, + output, + tracer, + enlistment, + httpObjects, + new MockPhysicalGitObjects(tracer, null, enlistment, httpObjects)); + + dut.Start(); + Thread.Sleep(TimeSpan.FromMilliseconds(110)); + input.Add(objSha); + input.CompleteAdding(); + dut.WaitForCompletion(); + objCount.ShouldEqual(1); + } } } \ No newline at end of file diff --git a/GVFS/GVFS.UnitTests/Prefetch/DiffHelperTests.cs b/GVFS/GVFS.UnitTests/Prefetch/DiffHelperTests.cs index 15b1f2cd9c..09647738a9 100644 --- a/GVFS/GVFS.UnitTests/Prefetch/DiffHelperTests.cs +++ b/GVFS/GVFS.UnitTests/Prefetch/DiffHelperTests.cs @@ -90,10 +90,10 @@ public void CanParseBackwardsDiff() diffBackwards.RequiredBlobs.Count.ShouldEqual(10); // File added, folder > file, moved folder, added folder - diffBackwards.FileDeleteOperations.Count.ShouldEqual(4); + diffBackwards.FileDeleteOperations.Count.ShouldEqual(6); // Also includes, the children of: Folder added, folder renamed, file => folder - diffBackwards.TotalFileDeletes.ShouldEqual(7); + diffBackwards.TotalFileDeletes.ShouldEqual(9); // Folder created, folder edited, folder deleted, folder renamed (add + delete), // folder => file, file => folder, recursive delete (include subfolder) diff --git a/GVFS/GVFS.UnitTests/Upgrader/ProductUpgraderTests.cs b/GVFS/GVFS.UnitTests/Upgrader/ProductUpgraderTests.cs deleted file mode 100644 index 3b9989eea6..0000000000 --- a/GVFS/GVFS.UnitTests/Upgrader/ProductUpgraderTests.cs +++ /dev/null @@ -1,130 +0,0 @@ -using GVFS.Common; -using GVFS.Tests.Should; -using NUnit.Framework; -using System; - -namespace GVFS.UnitTests.Upgrader -{ - [TestFixture] - public class ProductUpgraderTests : UpgradeTests - { - [SetUp] - public override void Setup() - { - base.Setup(); - } - - [TestCase] - public void UpgradeAvailableOnFastWhileOnLocalNoneRing() - { - this.SimulateUpgradeAvailable( - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Fast, - remoteVersion: UpgradeTests.NewerThanLocalVersion, - localRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.None, - expectedReturn: true, - expectedUpgradeVersion: null); - } - - [TestCase] - public void UpgradeAvailableOnSlowWhileOnLocalNoneRing() - { - this.SimulateUpgradeAvailable( - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow, - remoteVersion: UpgradeTests.NewerThanLocalVersion, - localRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.None, - expectedReturn: true, - expectedUpgradeVersion: null); - } - - [TestCase] - public void UpgradeAvailableOnFastWhileOnLocalSlowRing() - { - this.SimulateUpgradeAvailable( - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Fast, - remoteVersion: UpgradeTests.NewerThanLocalVersion, - localRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow, - expectedReturn: true, - expectedUpgradeVersion: null); - } - - [TestCase] - public void UpgradeAvailableOnSlowWhileOnLocalSlowRing() - { - this.SimulateUpgradeAvailable( - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow, - remoteVersion: UpgradeTests.NewerThanLocalVersion, - localRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow, - expectedReturn: true, - expectedUpgradeVersion: UpgradeTests.NewerThanLocalVersion); - } - - [TestCase] - public void UpgradeAvailableOnFastWhileOnLocalFastRing() - { - this.SimulateUpgradeAvailable( - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Fast, - remoteVersion: UpgradeTests.NewerThanLocalVersion, - localRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Fast, - expectedReturn: true, - expectedUpgradeVersion: UpgradeTests.NewerThanLocalVersion); - } - - [TestCase] - public void UpgradeAvailableOnSlowWhileOnLocalFastRing() - { - this.SimulateUpgradeAvailable( - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow, - remoteVersion: UpgradeTests.NewerThanLocalVersion, - localRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Fast, - expectedReturn: true, - expectedUpgradeVersion:UpgradeTests.NewerThanLocalVersion); - } - - public override void NoneLocalRing() - { - throw new NotSupportedException(); - } - - public override void InvalidUpgradeRing() - { - throw new NotSupportedException(); - } - - public override void FetchReleaseInfo() - { - throw new NotSupportedException(); - } - - protected override ReturnCode RunUpgrade() - { - throw new NotSupportedException(); - } - - private void SimulateUpgradeAvailable( - GitHubUpgrader.GitHubUpgraderConfig.RingType remoteRing, - string remoteVersion, - GitHubUpgrader.GitHubUpgraderConfig.RingType localRing, - bool expectedReturn, - string expectedUpgradeVersion) - { - this.SetUpgradeRing(localRing.ToString()); - this.Upgrader.PretendNewReleaseAvailableAtRemote( - remoteVersion, - remoteRing); - - Version newVersion; - string message; - this.Upgrader.TryQueryNewestVersion(out newVersion, out message).ShouldEqual(expectedReturn); - - if (string.IsNullOrEmpty(expectedUpgradeVersion)) - { - newVersion.ShouldBeNull(); - } - else - { - newVersion.ShouldNotBeNull(); - newVersion.ShouldEqual(new Version(expectedUpgradeVersion)); - } - } - } -} \ No newline at end of file diff --git a/GVFS/GVFS.UnitTests/Upgrader/UpgradeOrchestratorTests.cs b/GVFS/GVFS.UnitTests/Upgrader/UpgradeOrchestratorTests.cs deleted file mode 100644 index 7491bf78da..0000000000 --- a/GVFS/GVFS.UnitTests/Upgrader/UpgradeOrchestratorTests.cs +++ /dev/null @@ -1,250 +0,0 @@ -using GVFS.Common; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using GVFS.Tests.Should; -using GVFS.UnitTests.Mock.Common; -using GVFS.UnitTests.Mock.FileSystem; -using GVFS.UnitTests.Mock.Upgrader; -using GVFS.Upgrader; -using Moq; -using NUnit.Framework; -using System; -using System.Collections.Generic; - -namespace GVFS.UnitTests.Upgrader -{ - [TestFixture] - public class UpgradeOrchestratorTests - { - private const string GVFSVersion = "1.1.18115.1"; - - private delegate void TryGetNewerVersionCallback(out System.Version version, out string message); - private delegate void UpgradeAllowedCallback(out string message); - private delegate void TryRunPreUpgradeChecksCallback(out string delegateMessage); - private delegate void TryDownloadNewestVersionCallback(out string message); - private delegate void TryCreateAndConfigureDownloadDirectoryCallback(ITracer tracer, out string message); - private delegate void TryRunInstallerCallback(InstallActionWrapper installActionWrapper, out string error); - - private MockTracer Tracer { get; set; } - private MockFileSystem FileSystem { get; set; } - private MockTextWriter Output { get; set; } - private MockInstallerPrerunChecker PreRunChecker { get; set; } - private Mock MoqLocalConfig { get; set; } - private Mock MoqUpgrader { get; set; } - - private UpgradeOrchestrator orchestrator { get; set; } - - [SetUp] - public void Setup() - { - this.Tracer = new MockTracer(); - this.FileSystem = new MockFileSystem(new MockDirectory(@"mock:\GVFS.Upgrades\Download", null, null)); - this.Output = new MockTextWriter(); - this.PreRunChecker = new MockInstallerPrerunChecker(this.Tracer); - this.PreRunChecker.Reset(); - this.MoqUpgrader = this.DefaultUpgrader(); - this.orchestrator = new WindowsUpgradeOrchestrator( - this.MoqUpgrader.Object, - this.Tracer, - this.FileSystem, - this.PreRunChecker, - input: null, - output: this.Output); - - this.SetUpgradeAvailable(new Version(GVFSVersion), error: null); - } - - [TestCase] - public void ExecuteSucceedsWhenUpgradeAvailable() - { - this.orchestrator.Execute(); - - this.VerifyOrchestratorInvokes( - upgradeAllowed: true, - queryNewestVersion: true, - downloadNewestVersion: true, - installNewestVersion: true, - cleanup: true); - - this.orchestrator.ExitCode.ShouldEqual(ReturnCode.Success); - } - - [TestCase] - public void ExecuteSucceedsWhenOnLatestVersion() - { - this.SetUpgradeAvailable(newVersion: null, error: null); - - this.orchestrator.Execute(); - - this.VerifyOrchestratorInvokes( - upgradeAllowed: true, - queryNewestVersion: true, - downloadNewestVersion: false, - installNewestVersion: false, - cleanup: true); - - this.orchestrator.ExitCode.ShouldEqual(ReturnCode.Success); - } - - [TestCase] - public void ExecuteFailsWhenGetNewVersionFails() - { - string errorMessage = "Authentication error."; - - this.SetUpgradeAvailable(newVersion: null, error: errorMessage); - - this.orchestrator.Execute(); - - this.VerifyOrchestratorInvokes( - upgradeAllowed: true, - queryNewestVersion: true, - downloadNewestVersion: false, - installNewestVersion: false, - cleanup: true); - - this.VerifyOutput("ERROR: Authentication error."); - - this.orchestrator.ExitCode.ShouldEqual(ReturnCode.GenericError); - } - - [TestCase] - public void ExecuteFailsWhenPrecheckFails() - { - this.PreRunChecker.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.IsElevated); - - this.orchestrator.Execute(); - - this.VerifyOrchestratorInvokes( - upgradeAllowed: true, - queryNewestVersion: false, - downloadNewestVersion: false, - installNewestVersion: false, - cleanup: true); - - this.orchestrator.ExitCode.ShouldEqual(ReturnCode.GenericError); - } - - [TestCase] - public void ExecuteFailsWhenDownloadFails() - { - this.MoqUpgrader.Setup(upgrader => upgrader.TryDownloadNewestVersion(out It.Ref.IsAny)) - .Callback(new TryDownloadNewestVersionCallback( - (out string delegateMessage) => - { - delegateMessage = "Download error."; - })) - .Returns(false); - - this.orchestrator.Execute(); - - this.VerifyOrchestratorInvokes( - upgradeAllowed: true, - queryNewestVersion: true, - downloadNewestVersion: true, - installNewestVersion: false, - cleanup: true); - - this.VerifyOutput("ERROR: Download error."); - - this.orchestrator.ExitCode.ShouldEqual(ReturnCode.GenericError); - } - - [TestCase] - public void ExecuteFailsWhenRunInstallerFails() - { - this.MoqUpgrader.Setup(upgrader => upgrader.TryRunInstaller(It.IsAny(), out It.Ref.IsAny)) - .Callback(new TryRunInstallerCallback((InstallActionWrapper installActionWrapper, out string delegateMessage) => - { - delegateMessage = "Installer error."; - })) - .Returns(false); - - this.orchestrator.Execute(); - - this.VerifyOrchestratorInvokes( - upgradeAllowed: true, - queryNewestVersion: true, - downloadNewestVersion: true, - installNewestVersion: true, - cleanup: true); - - this.VerifyOutput("ERROR: Installer error."); - - this.orchestrator.ExitCode.ShouldEqual(ReturnCode.GenericError); - } - - public Mock DefaultUpgrader() - { - Mock mockUpgrader = new Mock(); - - mockUpgrader.Setup(upgrader => upgrader.UpgradeAllowed(out It.Ref.IsAny)) - .Callback(new UpgradeAllowedCallback((out string delegateMessage) => - { - delegateMessage = string.Empty; - })) - .Returns(true); - - string message = string.Empty; - mockUpgrader.Setup(upgrader => upgrader.TryDownloadNewestVersion(out It.Ref.IsAny)).Returns(true); - mockUpgrader.Setup(upgrader => upgrader.TryRunInstaller(It.IsAny(), out message)).Returns(true); - mockUpgrader.Setup(upgrader => upgrader.TryCleanup(out It.Ref.IsAny)).Returns(true); - - return mockUpgrader; - } - - public void SetUpgradeAvailable(Version newVersion, string error) - { - bool upgradeResult = string.IsNullOrEmpty(error); - - this.MoqUpgrader.Setup(upgrader => upgrader.TryQueryNewestVersion(out It.Ref.IsAny, out It.Ref.IsAny)) - .Callback(new TryGetNewerVersionCallback((out System.Version delegateVersion, out string delegateMessage) => - { - delegateVersion = newVersion; - delegateMessage = error; - })) - .Returns(upgradeResult); - } - - public void VerifyOrchestratorInvokes( - bool upgradeAllowed, - bool queryNewestVersion, - bool downloadNewestVersion, - bool installNewestVersion, - bool cleanup) - { - this.MoqUpgrader.Verify( - upgrader => upgrader.UpgradeAllowed( - out It.Ref.IsAny), - upgradeAllowed ? Times.Once() : Times.Never()); - - this.MoqUpgrader.Verify( - upgrader => upgrader.TryQueryNewestVersion( - out It.Ref.IsAny, - out It.Ref.IsAny), - queryNewestVersion ? Times.Once() : Times.Never()); - - this.MoqUpgrader.Verify( - upgrader => upgrader.TryDownloadNewestVersion( - out It.Ref.IsAny), - downloadNewestVersion ? Times.Once() : Times.Never()); - - this.MoqUpgrader.Verify( - upgrader => upgrader.TryRunInstaller( - It.IsAny(), - out It.Ref.IsAny), - installNewestVersion ? Times.Once() : Times.Never()); - - this.MoqUpgrader.Verify( - upgrader => upgrader.TryCleanup( - out It.Ref.IsAny), - cleanup ? Times.Once() : Times.Never()); - } - - public void VerifyOutput(string expectedMessage) - { - this.Output.AllLines.ShouldContain( - new List() { expectedMessage }, - (line, expectedLine) => { return line.Contains(expectedLine); }); - } - } -} diff --git a/GVFS/GVFS.UnitTests/Upgrader/UpgradeOrchestratorWithGitHubUpgraderTests.cs b/GVFS/GVFS.UnitTests/Upgrader/UpgradeOrchestratorWithGitHubUpgraderTests.cs deleted file mode 100644 index fc455b8026..0000000000 --- a/GVFS/GVFS.UnitTests/Upgrader/UpgradeOrchestratorWithGitHubUpgraderTests.cs +++ /dev/null @@ -1,324 +0,0 @@ -using GVFS.Common; -using GVFS.Tests.Should; -using GVFS.UnitTests.Mock.Upgrader; -using GVFS.Upgrader; -using NUnit.Framework; -using System.Collections.Generic; - -namespace GVFS.UnitTests.Upgrader -{ - [TestFixture] - public class UpgradeOrchestratorWithGitHubUpgraderTests : UpgradeTests - { - private UpgradeOrchestrator orchestrator; - - [SetUp] - public override void Setup() - { - base.Setup(); - - this.orchestrator = new WindowsUpgradeOrchestrator( - this.Upgrader, - this.Tracer, - this.FileSystem, - this.PrerunChecker, - input: null, - output: this.Output); - this.PrerunChecker.SetCommandToRerun("`gvfs upgrade --confirm`"); - } - - [TestCase] - public void UpgradeNoError() - { - this.RunUpgrade().ShouldEqual(ReturnCode.Success); - this.Tracer.RelatedErrorEvents.ShouldBeEmpty(); - } - - [TestCase] - public void AutoUnmountError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.PrerunChecker.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.UnMountRepos); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "Unmount of some of the repositories failed." - }, - expectedErrors: new List - { - "Unmount of some of the repositories failed." - }); - } - - [TestCase] - public void AbortOnBlockingProcess() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.PrerunChecker.SetReturnTrueOnCheck(MockInstallerPrerunChecker.FailOnCheckType.BlockingProcessesRunning); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "ERROR: Blocking processes are running.", - $"Run `gvfs upgrade --confirm` again after quitting these processes - GVFS.Mount, git" - }, - expectedErrors: null, - expectedWarnings: new List - { - $"Run `gvfs upgrade --confirm` again after quitting these processes - GVFS.Mount, git" - }); - } - - [TestCase] - public void DownloadDirectoryCreationError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.CreateDownloadDirectory); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "Error creating download directory" - }, - expectedErrors: new List - { - "Error creating download directory" - }); - } - - [TestCase] - public void GVFSDownloadError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GVFSDownload); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "Error downloading GVFS from GitHub" - }, - expectedErrors: new List - { - "Error downloading GVFS from GitHub" - }); - } - - [TestCase] - public void GitDownloadError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GitDownload); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "Error downloading Git from GitHub" - }, - expectedErrors: new List - { - "Error downloading Git from GitHub" - }); - } - - [TestCase] - public void GitInstallationArgs() - { - this.RunUpgrade().ShouldEqual(ReturnCode.Success); - - Dictionary gitInstallerInfo; - this.Upgrader.InstallerArgs.ShouldBeNonEmpty(); - this.Upgrader.InstallerArgs.TryGetValue("Git", out gitInstallerInfo).ShouldBeTrue(); - - string args; - gitInstallerInfo.TryGetValue("Args", out args).ShouldBeTrue(); - args.ShouldContain(new string[] { "/VERYSILENT", "/CLOSEAPPLICATIONS", "/SUPPRESSMSGBOXES", "/NORESTART", "/Log" }); - } - - [TestCase] - public void GitInstallError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GitInstall); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "Git installation failed" - }, - expectedErrors: new List - { - "Git installation failed" - }); - } - - [TestCase] - public void GitInstallerAuthenticodeError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GitAuthenticodeCheck); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "hash of the file does not match the hash stored in the digital signature" - }, - expectedErrors: new List - { - "hash of the file does not match the hash stored in the digital signature" - }); - } - - [TestCase] - public void GVFSInstallationArgs() - { - this.RunUpgrade().ShouldEqual(ReturnCode.Success); - - Dictionary gitInstallerInfo; - this.Upgrader.InstallerArgs.ShouldBeNonEmpty(); - this.Upgrader.InstallerArgs.TryGetValue("GVFS", out gitInstallerInfo).ShouldBeTrue(); - - string args; - gitInstallerInfo.TryGetValue("Args", out args).ShouldBeTrue(); - args.ShouldContain(new string[] { "/VERYSILENT", "/CLOSEAPPLICATIONS", "/SUPPRESSMSGBOXES", "/NORESTART", "/Log", "/REMOUNTREPOS=false" }); - } - - [TestCase] - public void GVFSInstallError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GVFSInstall); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "GVFS installation failed" - }, - expectedErrors: new List - { - "GVFS installation failed" - }); - } - - [TestCase] - public void GVFSInstallerAuthenticodeError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GVFSAuthenticodeCheck); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - "hash of the file does not match the hash stored in the digital signature" - }, - expectedErrors: new List - { - "hash of the file does not match the hash stored in the digital signature" - }); - } - - [TestCase] - public void GVFSCleanupError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GVFSCleanup); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - }, - expectedErrors: new List - { - "Error deleting downloaded GVFS installer." - }); - } - - [TestCase] - public void GitCleanupError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.GitCleanup); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - }, - expectedErrors: new List - { - "Error deleting downloaded Git installer." - }); - } - - [TestCase] - public void RemountReposError() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.PrerunChecker.SetReturnFalseOnCheck(MockInstallerPrerunChecker.FailOnCheckType.RemountRepos); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - "Auto remount failed." - }, - expectedErrors: new List - { - "Auto remount failed." - }); - } - - [TestCase] - public void DryRunDoesNotRunInstallerExes() - { - this.ConfigureRunAndVerify( - configure: () => - { - this.Upgrader.SetDryRun(true); - this.Upgrader.InstallerExeLaunched = false; - this.SetUpgradeRing("Slow"); - this.Upgrader.PretendNewReleaseAvailableAtRemote( - upgradeVersion: NewerThanLocalVersion, - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - "Installing Git", - "Installing GVFS", - "Upgrade completed successfully." - }, - expectedErrors: null); - - this.Upgrader.InstallerExeLaunched.ShouldBeFalse(); - } - - protected override ReturnCode RunUpgrade() - { - this.orchestrator.Execute(); - return this.orchestrator.ExitCode; - } - } -} diff --git a/GVFS/GVFS.UnitTests/Upgrader/UpgradeTests.cs b/GVFS/GVFS.UnitTests/Upgrader/UpgradeTests.cs deleted file mode 100644 index 7ea331d2a0..0000000000 --- a/GVFS/GVFS.UnitTests/Upgrader/UpgradeTests.cs +++ /dev/null @@ -1,191 +0,0 @@ -using GVFS.Common; -using GVFS.Tests.Should; -using GVFS.UnitTests.Category; -using GVFS.UnitTests.Mock.Common; -using GVFS.UnitTests.Mock.FileSystem; -using GVFS.UnitTests.Mock.Upgrader; -using NUnit.Framework; -using System; -using System.Collections.Generic; - -namespace GVFS.UnitTests.Upgrader -{ - public abstract class UpgradeTests - { - protected const string OlderThanLocalVersion = "1.0.17000.1"; - protected const string LocalGVFSVersion = "1.0.18115.1"; - protected const string NewerThanLocalVersion = "1.1.18115.1"; - - protected MockTracer Tracer { get; private set; } - protected MockFileSystem FileSystem { get; private set; } - protected MockTextWriter Output { get; private set; } - protected MockInstallerPrerunChecker PrerunChecker { get; private set; } - protected MockGitHubUpgrader Upgrader { get; private set; } - protected MockLocalGVFSConfig LocalConfig { get; private set; } - - public virtual void Setup() - { - this.Tracer = new MockTracer(); - this.FileSystem = new MockFileSystem(new MockDirectory(@"mock:\GVFS.Upgrades\Download", null, null)); - this.Output = new MockTextWriter(); - this.PrerunChecker = new MockInstallerPrerunChecker(this.Tracer); - this.LocalConfig = new MockLocalGVFSConfig(); - - this.Upgrader = new MockGitHubUpgrader( - LocalGVFSVersion, - this.Tracer, - this.FileSystem, - new GitHubUpgrader.GitHubUpgraderConfig(this.Tracer, this.LocalConfig)); - - this.PrerunChecker.Reset(); - this.Upgrader.PretendNewReleaseAvailableAtRemote( - upgradeVersion: NewerThanLocalVersion, - remoteRing: GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow); - this.SetUpgradeRing("Slow"); - } - - [TestCase] - public virtual void NoneLocalRing() - { - string message = "Upgrade ring set to \"None\". No upgrade check was performed."; - this.ConfigureRunAndVerify( - configure: () => - { - this.SetUpgradeRing("None"); - }, - expectedReturn: ReturnCode.Success, - expectedOutput: new List - { - message - }, - expectedErrors: new List - { - }); - } - - [TestCase] - public virtual void InvalidUpgradeRing() - { - this.SetUpgradeRing("Invalid"); - - string expectedError = "Invalid upgrade ring `Invalid` specified in gvfs config."; - string errorString; - GitHubUpgrader.Create( - this.Tracer, - this.FileSystem, - dryRun: false, - noVerify: false, - localConfig: this.LocalConfig, - error: out errorString).ShouldBeNull(); - - errorString.ShouldContain(expectedError); - } - - [TestCase] - [Category(CategoryConstants.ExceptionExpected)] - public virtual void FetchReleaseInfo() - { - string errorString = "Error fetching upgrade release info."; - this.ConfigureRunAndVerify( - configure: () => - { - this.SetUpgradeRing("Fast"); - this.Upgrader.SetFailOnAction(MockGitHubUpgrader.ActionType.FetchReleaseInfo); - }, - expectedReturn: ReturnCode.GenericError, - expectedOutput: new List - { - errorString - }, - expectedErrors: new List - { - errorString - }); - } - - protected abstract ReturnCode RunUpgrade(); - - protected void ConfigureRunAndVerify( - Action configure, - ReturnCode expectedReturn, - List expectedOutput, - List expectedErrors, - List expectedWarnings = null) - { - configure(); - - this.RunUpgrade().ShouldEqual(expectedReturn); - - if (expectedOutput != null) - { - this.Output.AllLines.ShouldContain( - expectedOutput, - (line, expectedLine) => { return line.Contains(expectedLine); }); - } - - if (expectedErrors != null) - { - this.Tracer.RelatedErrorEvents.ShouldContain( - expectedErrors, - (error, expectedError) => { return error.Contains(expectedError); }); - } - - if (expectedWarnings != null) - { - this.Tracer.RelatedWarningEvents.ShouldContain( - expectedWarnings, - (warning, expectedWarning) => { return warning.Contains(expectedWarning); }); - } - } - - protected void SetUpgradeRing(string ringName) - { - GitHubUpgrader.GitHubUpgraderConfig.RingType ring; - if (!Enum.TryParse(ringName, ignoreCase: true, result: out ring)) - { - ring = GitHubUpgrader.GitHubUpgraderConfig.RingType.Invalid; - } - - string error; - if (ring == GitHubUpgrader.GitHubUpgraderConfig.RingType.Slow || - ring == GitHubUpgrader.GitHubUpgraderConfig.RingType.Fast) - { - this.LocalConfig.TrySetConfig("upgrade.ring", ringName, out error); - this.VerifyConfig(ring, isUpgradeAllowed: true, isConfigError: false); - return; - } - - if (ring == GitHubUpgrader.GitHubUpgraderConfig.RingType.None) - { - this.LocalConfig.TrySetConfig("upgrade.ring", ringName, out error); - this.VerifyConfig(ring, isUpgradeAllowed: false, isConfigError: false); - return; - } - - if (ring == GitHubUpgrader.GitHubUpgraderConfig.RingType.Invalid) - { - this.LocalConfig.TrySetConfig("upgrade.ring", ringName, out error); - this.VerifyConfig(ring, isUpgradeAllowed: false, isConfigError: true); - return; - } - } - - protected void VerifyConfig( - GVFS.Common.GitHubUpgrader.GitHubUpgraderConfig.RingType ring, - bool isUpgradeAllowed, - bool isConfigError) - { - string error; - this.Upgrader.Config.TryLoad(out error).ShouldBeTrue(); - - Assert.AreEqual(ring, this.Upgrader.Config.UpgradeRing); - error.ShouldBeNull(); - - bool upgradeAllowed = this.Upgrader.UpgradeAllowed(out _); - bool configError = this.Upgrader.Config.ConfigError(); - - upgradeAllowed.ShouldEqual(isUpgradeAllowed); - configError.ShouldEqual(isConfigError); - } - } -} diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/CommandLine/SparseVerbTests.cs b/GVFS/GVFS.UnitTests/Windows/CommandLine/SparseVerbTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/CommandLine/SparseVerbTests.cs rename to GVFS/GVFS.UnitTests/Windows/CommandLine/SparseVerbTests.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockVirtualizationInstance.cs b/GVFS/GVFS.UnitTests/Windows/Mock/MockVirtualizationInstance.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockVirtualizationInstance.cs rename to GVFS/GVFS.UnitTests/Windows/Mock/MockVirtualizationInstance.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockWriteBuffer.cs b/GVFS/GVFS.UnitTests/Windows/Mock/MockWriteBuffer.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Mock/MockWriteBuffer.cs rename to GVFS/GVFS.UnitTests/Windows/Mock/MockWriteBuffer.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Mock/WindowsFileSystemVirtualizerTester.cs b/GVFS/GVFS.UnitTests/Windows/Mock/WindowsFileSystemVirtualizerTester.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Mock/WindowsFileSystemVirtualizerTester.cs rename to GVFS/GVFS.UnitTests/Windows/Mock/WindowsFileSystemVirtualizerTester.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Platform/ProjFSFilterTests.cs b/GVFS/GVFS.UnitTests/Windows/Platform/ProjFSFilterTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Platform/ProjFSFilterTests.cs rename to GVFS/GVFS.UnitTests/Windows/Platform/ProjFSFilterTests.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/ServiceUI/GVFSToastRequestHandlerTests.cs b/GVFS/GVFS.UnitTests/Windows/ServiceUI/GVFSToastRequestHandlerTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/ServiceUI/GVFSToastRequestHandlerTests.cs rename to GVFS/GVFS.UnitTests/Windows/ServiceUI/GVFSToastRequestHandlerTests.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Virtualization/ActiveEnumerationTests.cs b/GVFS/GVFS.UnitTests/Windows/Virtualization/ActiveEnumerationTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Virtualization/ActiveEnumerationTests.cs rename to GVFS/GVFS.UnitTests/Windows/Virtualization/ActiveEnumerationTests.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Virtualization/PatternMatcherTests.cs b/GVFS/GVFS.UnitTests/Windows/Virtualization/PatternMatcherTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Virtualization/PatternMatcherTests.cs rename to GVFS/GVFS.UnitTests/Windows/Virtualization/PatternMatcherTests.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/Virtualization/WindowsFileSystemVirtualizerTests.cs b/GVFS/GVFS.UnitTests/Windows/Virtualization/WindowsFileSystemVirtualizerTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/Virtualization/WindowsFileSystemVirtualizerTests.cs rename to GVFS/GVFS.UnitTests/Windows/Virtualization/WindowsFileSystemVirtualizerTests.cs diff --git a/GVFS/GVFS.UnitTests.Windows/Windows/WindowsFileBasedLockTests.cs b/GVFS/GVFS.UnitTests/Windows/WindowsFileBasedLockTests.cs similarity index 100% rename from GVFS/GVFS.UnitTests.Windows/Windows/WindowsFileBasedLockTests.cs rename to GVFS/GVFS.UnitTests/Windows/WindowsFileBasedLockTests.cs diff --git a/GVFS/GVFS.Upgrader/App.config b/GVFS/GVFS.Upgrader/App.config deleted file mode 100644 index f5c0a8bea5..0000000000 --- a/GVFS/GVFS.Upgrader/App.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.Upgrader/GVFS.Upgrader.csproj b/GVFS/GVFS.Upgrader/GVFS.Upgrader.csproj deleted file mode 100644 index 3b9629484a..0000000000 --- a/GVFS/GVFS.Upgrader/GVFS.Upgrader.csproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Exe - GVFS.Upgrader - - x64 - x64 - GVFS.Upgrader - false - - true - - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - - - - net461;netcoreapp2.1 - $(DefineConstants);WINDOWS_BUILD - - - - - PlatformLoader.Windows.cs - - - - - - netcoreapp2.1 - osx-x64 - $(DefineConstants);MACOS_BUILD - - - - - PlatformLoader.Mac.cs - - - - - - - - - - - - - - - - - - all - - - - diff --git a/GVFS/GVFS.Upgrader/MacUpgradeOrchestrator.cs b/GVFS/GVFS.Upgrader/MacUpgradeOrchestrator.cs deleted file mode 100644 index 3d8a44a041..0000000000 --- a/GVFS/GVFS.Upgrader/MacUpgradeOrchestrator.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace GVFS.Upgrader -{ - public class MacUpgradeOrchestrator : UpgradeOrchestrator - { - public MacUpgradeOrchestrator(UpgradeOptions options) - : base(options) - { - } - - protected override bool TryMountRepositories(out string consoleError) - { - // Mac upgrader does not mount repositories - consoleError = null; - return true; - } - } -} diff --git a/GVFS/GVFS.Upgrader/Program.cs b/GVFS/GVFS.Upgrader/Program.cs deleted file mode 100644 index a77f4df5db..0000000000 --- a/GVFS/GVFS.Upgrader/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ -using CommandLine; -using GVFS.PlatformLoader; - -namespace GVFS.Upgrader -{ - public class Program - { - public static void Main(string[] args) - { - GVFSPlatformLoader.Initialize(); - - Parser.Default.ParseArguments(args) - .WithParsed(options => UpgradeOrchestratorFactory.Create(options).Execute()); - } - } -} diff --git a/GVFS/GVFS.Upgrader/Properties/AssemblyInfo.cs b/GVFS/GVFS.Upgrader/Properties/AssemblyInfo.cs deleted file mode 100644 index 60bb28ce6b..0000000000 --- a/GVFS/GVFS.Upgrader/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.Upgrader")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Upgrader")] -[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("aecec217-2499-403d-b0bb-2962b9be5970")] diff --git a/GVFS/GVFS.Upgrader/UpgradeOptions.cs b/GVFS/GVFS.Upgrader/UpgradeOptions.cs deleted file mode 100644 index eb648899fb..0000000000 --- a/GVFS/GVFS.Upgrader/UpgradeOptions.cs +++ /dev/null @@ -1,22 +0,0 @@ -using CommandLine; - -namespace GVFS.Upgrader -{ - [Verb("UpgradeOrchestrator", HelpText = "Upgrade VFS for Git.")] - public class UpgradeOptions - { - [Option( - "dry-run", - Default = false, - Required = false, - HelpText = "Display progress and errors, but don't install GVFS")] - public bool DryRun { get; set; } - - [Option( - "no-verify", - Default = false, - Required = false, - HelpText = "Don't verify authenticode signature of installers")] - public bool NoVerify { get; set; } - } -} diff --git a/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs b/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs deleted file mode 100644 index 1f44830781..0000000000 --- a/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs +++ /dev/null @@ -1,389 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using System; -using System.IO; -using System.Text; - -namespace GVFS.Upgrader -{ - public abstract class UpgradeOrchestrator - { - protected InstallerPreRunChecker preRunChecker; - protected bool mount; - protected ITracer tracer; - - private const EventLevel DefaultEventLevel = EventLevel.Informational; - - private ProductUpgrader upgrader; - private string logDirectory = ProductUpgraderInfo.GetLogDirectoryPath(); - private string installationId; - private PhysicalFileSystem fileSystem; - private TextWriter output; - private TextReader input; - - public UpgradeOrchestrator( - ProductUpgrader upgrader, - ITracer tracer, - PhysicalFileSystem fileSystem, - InstallerPreRunChecker preRunChecker, - TextReader input, - TextWriter output) - { - this.upgrader = upgrader; - this.tracer = tracer; - this.fileSystem = fileSystem; - this.preRunChecker = preRunChecker; - this.output = output; - this.input = input; - this.mount = false; - this.ExitCode = ReturnCode.Success; - this.installationId = DateTime.Now.ToString("yyyyMMdd_HHmmss"); - } - - public UpgradeOrchestrator(UpgradeOptions options) - : this() - { - this.DryRun = options.DryRun; - this.NoVerify = options.NoVerify; - } - - public UpgradeOrchestrator() - { - // CommandLine's Parser will create multiple instances of UpgradeOrchestrator, and we don't want - // multiple log files to get created. Defer tracer (and preRunChecker) creation until Execute() - this.tracer = null; - this.preRunChecker = null; - - this.fileSystem = new PhysicalFileSystem(); - this.output = Console.Out; - this.input = Console.In; - this.mount = false; - this.ExitCode = ReturnCode.Success; - this.installationId = DateTime.Now.ToString("yyyyMMdd_HHmmss"); - } - - public ReturnCode ExitCode { get; private set; } - - public bool DryRun { get; } - - public bool NoVerify { get; } - - public void Execute() - { - string error = null; - string mountError = null; - Version newVersion = null; - - if (this.tracer == null) - { - this.tracer = this.CreateTracer(); - } - - if (this.preRunChecker == null) - { - this.preRunChecker = new InstallerPreRunChecker(this.tracer, GVFSPlatform.Instance.Constants.UpgradeConfirmCommandMessage); - } - - try - { - if (this.TryInitialize(out error)) - { - try - { - if (!this.TryRunUpgrade(out newVersion, out error)) - { - this.ExitCode = ReturnCode.GenericError; - } - } - finally - { - if (!this.TryMountRepositories(out mountError)) - { - mountError = Environment.NewLine + "WARNING: " + mountError; - this.output.WriteLine(mountError); - } - - this.DeletedDownloadedAssets(); - } - } - else - { - this.ExitCode = ReturnCode.GenericError; - } - - if (this.ExitCode == ReturnCode.GenericError) - { - StringBuilder sb = new StringBuilder(); - sb.AppendLine(); - sb.Append("ERROR: " + error); - - sb.AppendLine(); - sb.AppendLine(); - - sb.AppendLine($"Upgrade logs can be found at: {this.logDirectory} with file names that end with the installation ID: {this.installationId}."); - - this.output.WriteLine(sb.ToString()); - } - else - { - if (newVersion != null) - { - this.output.WriteLine($"{Environment.NewLine}Upgrade completed successfully{(string.IsNullOrEmpty(mountError) ? "." : ", but one or more repositories will need to be mounted manually.")}"); - } - } - } - finally - { - this.upgrader?.Dispose(); - } - - if (this.input == Console.In) - { - this.output.WriteLine("Press Enter to exit."); - this.input.ReadLine(); - } - - Environment.ExitCode = (int)this.ExitCode; - } - - protected bool LaunchInsideSpinner(Func method, string message) - { - return ConsoleHelper.ShowStatusWhileRunning( - method, - message, - this.output, - this.output == Console.Out && !GVFSPlatform.Instance.IsConsoleOutputRedirectedToFile(), - null); - } - - protected abstract bool TryMountRepositories(out string consoleError); - - private JsonTracer CreateTracer() - { - string logFilePath = GVFSEnlistment.GetNewGVFSLogFileName( - this.logDirectory, - GVFSConstants.LogFileTypes.UpgradeProcess, - logId: null, - fileSystem: this.fileSystem); - - JsonTracer jsonTracer = new JsonTracer(GVFSConstants.GVFSEtwProviderName, "UpgradeProcess"); - - jsonTracer.AddLogFileEventListener( - logFilePath, - DefaultEventLevel, - Keywords.Any); - - return jsonTracer; - } - - private bool TryInitialize(out string errorMessage) - { - if (this.upgrader == null) - { - string gitBinPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(); - if (string.IsNullOrEmpty(gitBinPath)) - { - errorMessage = $"nameof(this.TryInitialize): Unable to locate git installation. Ensure git is installed and try again."; - return false; - } - - ICredentialStore credentialStore = new GitProcess(gitBinPath, workingDirectoryRoot: null); - - ProductUpgrader upgrader; - if (!ProductUpgrader.TryCreateUpgrader(this.tracer, this.fileSystem, new LocalGVFSConfig(), credentialStore, this.DryRun, this.NoVerify, out upgrader, out errorMessage)) - { - return false; - } - - // Configure the upgrader to have installer logs written to the same directory - // as the upgrader. - upgrader.UpgradeInstanceId = this.installationId; - this.upgrader = upgrader; - } - - errorMessage = null; - return true; - } - - private bool TryRunUpgrade(out Version newVersion, out string consoleError) - { - Version newGVFSVersion = null; - string error = null; - - if (!this.upgrader.UpgradeAllowed(out error)) - { - ProductUpgraderInfo productUpgraderInfo = new ProductUpgraderInfo( - this.tracer, - this.fileSystem); - productUpgraderInfo.DeleteAllInstallerDownloads(); - this.output.WriteLine(error); - consoleError = null; - newVersion = null; - return true; - } - - if (!this.LaunchInsideSpinner( - () => - { - if (!this.preRunChecker.TryRunPreUpgradeChecks(out error)) - { - return false; - } - - if (!this.TryCheckIfUpgradeAvailable(out newGVFSVersion, out error)) - { - return false; - } - - this.LogInstalledVersionInfo(); - - if (newGVFSVersion != null && !this.TryDownloadUpgrade(newGVFSVersion, out error)) - { - return false; - } - - return true; - }, - "Downloading")) - { - newVersion = null; - consoleError = error; - return false; - } - - if (newGVFSVersion == null) - { - newVersion = null; - consoleError = null; - return true; - } - - if (!this.LaunchInsideSpinner( - () => - { - if (!this.preRunChecker.TryUnmountAllGVFSRepos(out error)) - { - return false; - } - - this.mount = true; - - return true; - }, - "Unmounting repositories")) - { - newVersion = null; - consoleError = error; - return false; - } - - if (!this.LaunchInsideSpinner( - () => - { - if (!this.preRunChecker.IsInstallationBlockedByRunningProcess(out error)) - { - return false; - } - - return true; - }, - "Checking for blocking processes.")) - { - newVersion = null; - consoleError = error; - return false; - } - - if (!this.upgrader.TryRunInstaller(this.LaunchInsideSpinner, out consoleError)) - { - newVersion = null; - return false; - } - - newVersion = newGVFSVersion; - consoleError = null; - return true; - } - - private void DeletedDownloadedAssets() - { - string downloadsCleanupError; - if (!this.upgrader.TryCleanup(out downloadsCleanupError)) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Upgrade Step", nameof(this.DeletedDownloadedAssets)); - metadata.Add("Download cleanup error", downloadsCleanupError); - this.tracer.RelatedError(metadata, $"{nameof(this.DeletedDownloadedAssets)} failed."); - } - } - - private bool TryCheckIfUpgradeAvailable(out Version newestVersion, out string consoleError) - { - newestVersion = null; - consoleError = null; - - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryCheckIfUpgradeAvailable), EventLevel.Informational)) - { - string message; - if (!this.upgrader.TryQueryNewestVersion(out newestVersion, out message)) - { - consoleError = message; - EventMetadata metadata = new EventMetadata(); - metadata.Add("Upgrade Step", nameof(this.TryCheckIfUpgradeAvailable)); - this.tracer.RelatedError(metadata, $"{nameof(this.upgrader.TryQueryNewestVersion)} failed. {consoleError}"); - return false; - } - - if (newestVersion == null) - { - this.output.WriteLine(message); - this.tracer.RelatedInfo($"No new upgrade releases available. {message}"); - return true; - } - - activity.RelatedInfo("New release found - latest available version: {0}", newestVersion); - } - - return true; - } - - private bool TryDownloadUpgrade(Version version, out string consoleError) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Upgrade Step", nameof(this.TryDownloadUpgrade)); - metadata.Add("Version", version.ToString()); - - using (ITracer activity = this.tracer.StartActivity($"{nameof(this.TryDownloadUpgrade)}", EventLevel.Informational, metadata)) - { - if (!this.upgrader.TryDownloadNewestVersion(out consoleError)) - { - this.tracer.RelatedError(metadata, $"{nameof(this.upgrader.TryDownloadNewestVersion)} failed. {consoleError}"); - return false; - } - - activity.RelatedInfo("Successfully downloaded version: " + version.ToString()); - } - - return true; - } - - private void LogInstalledVersionInfo() - { - EventMetadata metadata = new EventMetadata(); - string installedGVFSVersion = ProcessHelper.GetCurrentProcessVersion(); - metadata.Add(nameof(installedGVFSVersion), installedGVFSVersion); - - GitVersion installedGitVersion = null; - string error = null; - string gitPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(); - if (!string.IsNullOrEmpty(gitPath) && GitProcess.TryGetVersion(gitPath, out installedGitVersion, out error)) - { - metadata.Add(nameof(installedGitVersion), installedGitVersion.ToString()); - } - - this.tracer.RelatedEvent(EventLevel.Informational, "Installed Version", metadata); - } - } -} diff --git a/GVFS/GVFS.Upgrader/UpgradeOrchestratorFactory.cs b/GVFS/GVFS.Upgrader/UpgradeOrchestratorFactory.cs deleted file mode 100644 index c2ce00dbcf..0000000000 --- a/GVFS/GVFS.Upgrader/UpgradeOrchestratorFactory.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace GVFS.Upgrader -{ - public static class UpgradeOrchestratorFactory - { - public static UpgradeOrchestrator Create(UpgradeOptions options) - { -#if MACOS_BUILD - return new MacUpgradeOrchestrator(options); -#elif WINDOWS_BUILD - return new WindowsUpgradeOrchestrator(options); -#else - throw new NotImplementedException(); -#endif - } - } -} diff --git a/GVFS/GVFS.Upgrader/WindowsUpgradeOrchestrator.cs b/GVFS/GVFS.Upgrader/WindowsUpgradeOrchestrator.cs deleted file mode 100644 index 206819d4e0..0000000000 --- a/GVFS/GVFS.Upgrader/WindowsUpgradeOrchestrator.cs +++ /dev/null @@ -1,55 +0,0 @@ -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Tracing; -using System.IO; - -namespace GVFS.Upgrader -{ - public class WindowsUpgradeOrchestrator : UpgradeOrchestrator - { - public WindowsUpgradeOrchestrator( - ProductUpgrader upgrader, - ITracer tracer, - PhysicalFileSystem fileSystem, - InstallerPreRunChecker preRunChecker, - TextReader input, - TextWriter output) - : base(upgrader, tracer, fileSystem, preRunChecker, input, output) - { - } - - public WindowsUpgradeOrchestrator(UpgradeOptions options) - : base(options) - { - } - - protected override bool TryMountRepositories(out string consoleError) - { - string errorMessage = string.Empty; - if (this.mount && !this.LaunchInsideSpinner( - () => - { - string mountError; - if (!this.preRunChecker.TryMountAllGVFSRepos(out mountError)) - { - EventMetadata metadata = new EventMetadata(); - metadata.Add("Upgrade Step", nameof(this.TryMountRepositories)); - metadata.Add("Mount Error", mountError); - this.tracer.RelatedError(metadata, $"{nameof(this.preRunChecker.TryMountAllGVFSRepos)} failed."); - errorMessage += mountError; - return false; - } - - return true; - }, - "Mounting repositories")) - { - consoleError = errorMessage; - return false; - } - - consoleError = null; - return true; - } - } -} diff --git a/GVFS/GVFS.Upgrader/packages.config b/GVFS/GVFS.Upgrader/packages.config deleted file mode 100644 index 92000da1c0..0000000000 --- a/GVFS/GVFS.Upgrader/packages.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.pbxproj b/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.pbxproj deleted file mode 100644 index 09425066c7..0000000000 --- a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.pbxproj +++ /dev/null @@ -1,280 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 267A836C20EE9F27005E6B60 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 267A836B20EE9F27005E6B60 /* main.cpp */; }; - 26E839D920FD4026004E53CE /* common.posix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E839D620FD29D6004E53CE /* common.posix.cpp */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 267A836620EE9F27005E6B60 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 267A836820EE9F27005E6B60 /* GVFS.VirtualFileSystemHook */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = GVFS.VirtualFileSystemHook; sourceTree = BUILT_PRODUCTS_DIR; }; - 267A836B20EE9F27005E6B60 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = SOURCE_ROOT; }; - 2686926B20EFF2610080F95D /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = ../GVFS.NativeHooks.Common/common.h; sourceTree = SOURCE_ROOT; }; - 26E839D620FD29D6004E53CE /* common.posix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.posix.cpp; path = ../GVFS.NativeHooks.Common/common.posix.cpp; sourceTree = SOURCE_ROOT; }; - 26E839DB20FD5918004E53CE /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stdafx.h; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 267A836520EE9F27005E6B60 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2673FD8620EBD84A00B64B7F = { - isa = PBXGroup; - children = ( - 26E839DB20FD5918004E53CE /* stdafx.h */, - 26E839D620FD29D6004E53CE /* common.posix.cpp */, - 2686926B20EFF2610080F95D /* common.h */, - 267A836B20EE9F27005E6B60 /* main.cpp */, - 267A836920EE9F27005E6B60 /* Products */, - ); - sourceTree = ""; - }; - 267A836920EE9F27005E6B60 /* Products */ = { - isa = PBXGroup; - children = ( - 267A836820EE9F27005E6B60 /* GVFS.VirtualFileSystemHook */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 267A836720EE9F27005E6B60 /* GVFS.VirtualFileSystemHook */ = { - isa = PBXNativeTarget; - buildConfigurationList = 267A836F20EE9F27005E6B60 /* Build configuration list for PBXNativeTarget "GVFS.VirtualFileSystemHook" */; - buildPhases = ( - 267A836420EE9F27005E6B60 /* Sources */, - 267A836520EE9F27005E6B60 /* Frameworks */, - 267A836620EE9F27005E6B60 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = GVFS.VirtualFileSystemHook; - productName = GVFS.VirtualFileSystemHook; - productReference = 267A836820EE9F27005E6B60 /* GVFS.VirtualFileSystemHook */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 2673FD8720EBD84A00B64B7F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0940; - TargetAttributes = { - 267A836720EE9F27005E6B60 = { - CreatedOnToolsVersion = 9.4.1; - }; - }; - }; - buildConfigurationList = 2673FD8A20EBD84A00B64B7F /* Build configuration list for PBXProject "GVFS.VirtualFileSystemHook.Mac" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 2673FD8620EBD84A00B64B7F; - productRefGroup = 267A836920EE9F27005E6B60 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 267A836720EE9F27005E6B60 /* GVFS.VirtualFileSystemHook */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 267A836420EE9F27005E6B60 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 267A836C20EE9F27005E6B60 /* main.cpp in Sources */, - 26E839D920FD4026004E53CE /* common.posix.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 2673FD8B20EBD84A00B64B7F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Debug; - }; - 2673FD8C20EBD84A00B64B7F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Release; - }; - 267A836D20EE9F27005E6B60 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 267A836E20EE9F27005E6B60 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "Mac Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = UBF8T346G9; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2673FD8A20EBD84A00B64B7F /* Build configuration list for PBXProject "GVFS.VirtualFileSystemHook.Mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2673FD8B20EBD84A00B64B7F /* Debug */, - 2673FD8C20EBD84A00B64B7F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 267A836F20EE9F27005E6B60 /* Build configuration list for PBXNativeTarget "GVFS.VirtualFileSystemHook" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 267A836D20EE9F27005E6B60 /* Debug */, - 267A836E20EE9F27005E6B60 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 2673FD8720EBD84A00B64B7F /* Project object */; -} diff --git a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 811d6a7e6a..0000000000 --- a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Mac.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Windows.vcxproj b/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.vcxproj similarity index 81% rename from GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Windows.vcxproj rename to GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.vcxproj index eda75135c0..8fb0cdb176 100644 --- a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Windows.vcxproj +++ b/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.vcxproj @@ -14,22 +14,21 @@ {2D23AB54-541F-4ABC-8DCA-08C199E97ABB} Win32Proj GVFSVirtualFileSystemHook - 10.0.10240.0 - GVFS.VirtualFileSystemHook.Windows + 10.0.16299.0 + GVFS.VirtualFileSystemHook GVFS.VirtualFileSystemHook - Application true - v141 + v142 MultiByte Application false - v141 + v142 true MultiByte @@ -59,22 +58,22 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;..\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) /Zc:__cplusplus MultiThreadedDebug Console true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) @@ -87,7 +86,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;$(SolutionDir)\GVFS\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;..\GVFS.NativeHooks.Common;%(AdditionalIncludeDirectories) /Zc:__cplusplus MultiThreaded @@ -96,15 +95,15 @@ true true true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) diff --git a/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Windows.vcxproj.filters b/GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.vcxproj.filters similarity index 100% rename from GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.Windows.vcxproj.filters rename to GVFS/GVFS.VirtualFileSystemHook/GVFS.VirtualFileSystemHook.vcxproj.filters diff --git a/GVFS/GVFS.Virtualization/GVFS.Virtualization.csproj b/GVFS/GVFS.Virtualization/GVFS.Virtualization.csproj index 7636c6eedf..0097850b8f 100644 --- a/GVFS/GVFS.Virtualization/GVFS.Virtualization.csproj +++ b/GVFS/GVFS.Virtualization/GVFS.Virtualization.csproj @@ -1,28 +1,17 @@ - + - netcoreapp2.1;netstandard2.0 - x64 + net461 true - true - - - $(GVFSVersion) - - - $(GVFSVersion) - - - - all - + - + + - \ No newline at end of file + diff --git a/GVFS/GVFS.Virtualization/AssemblyInfo.cs b/GVFS/GVFS.Virtualization/InternalsVisibleTo.cs similarity index 60% rename from GVFS/GVFS.Virtualization/AssemblyInfo.cs rename to GVFS/GVFS.Virtualization/InternalsVisibleTo.cs index a19d69f781..0ba48d81be 100644 --- a/GVFS/GVFS.Virtualization/AssemblyInfo.cs +++ b/GVFS/GVFS.Virtualization/InternalsVisibleTo.cs @@ -1,4 +1,3 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("GVFS.UnitTests")] -[assembly: InternalsVisibleTo("GVFS.UnitTests.Windows")] diff --git a/GVFS/GVFS.Virtualization/Properties/AssemblyInfo.cs b/GVFS/GVFS.Virtualization/Properties/AssemblyInfo.cs deleted file mode 100644 index eb36b90551..0000000000 --- a/GVFS/GVFS.Virtualization/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.Virtualization")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS.Virtualization")] -[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("f468b05a-95e5-46bc-8c67-b80a78527b7d")] diff --git a/GVFS/GVFS/App.config b/GVFS/GVFS/App.config deleted file mode 100644 index 3e680fdd37..0000000000 --- a/GVFS/GVFS/App.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/GVFS/GVFS/CommandLine/DiagnoseVerb.cs b/GVFS/GVFS/CommandLine/DiagnoseVerb.cs index 0074a88c9d..1d3a716394 100644 --- a/GVFS/GVFS/CommandLine/DiagnoseVerb.cs +++ b/GVFS/GVFS/CommandLine/DiagnoseVerb.cs @@ -140,30 +140,6 @@ protected override void Execute(GVFSEnlistment enlistment) GVFSConstants.Service.UIName, copySubFolders: true); - if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSUpgrade) - { - // upgrader - this.CopyAllFiles( - ProductUpgraderInfo.GetParentLogDirectoryPath(), - archiveFolderPath, - DeprecatedUpgradeLogsDirectory, - copySubFolders: true, - targetFolderName: Path.Combine(ProductUpgraderInfo.UpgradeDirectoryName, DeprecatedUpgradeLogsDirectory)); - - this.CopyAllFiles( - ProductUpgraderInfo.GetParentLogDirectoryPath(), - archiveFolderPath, - ProductUpgraderInfo.LogDirectory, - copySubFolders: true, - targetFolderName: Path.Combine(ProductUpgraderInfo.UpgradeDirectoryName, ProductUpgraderInfo.LogDirectory)); - - this.LogDirectoryEnumeration( - ProductUpgraderInfo.GetUpgradeProtectedDataDirectory(), - Path.Combine(archiveFolderPath, ProductUpgraderInfo.UpgradeDirectoryName), - ProductUpgraderInfo.DownloadDirectory, - "downloaded-assets.txt"); - } - if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSConfig) { this.CopyFile(GVFSPlatform.Instance.GetSecureDataRootForGVFS(), archiveFolderPath, LocalGVFSConfig.FileName); diff --git a/GVFS/GVFS/CommandLine/GVFSVerb.cs b/GVFS/GVFS/CommandLine/GVFSVerb.cs index 4e140a726a..8449b5bab1 100644 --- a/GVFS/GVFS/CommandLine/GVFSVerb.cs +++ b/GVFS/GVFS/CommandLine/GVFSVerb.cs @@ -309,6 +309,9 @@ public static bool TrySetRequiredGitConfigSettings(Enlistment enlistment) // Generation number v2 isn't ready for full use. Wait for v3. { "commitGraph.generationVersion", "1" }, + + // Disable the builtin FS Monitor in case it was enabled globally. + { "core.useBuiltinFSMonitor", "false" }, }; if (!TrySetConfig(enlistment, requiredSettings, isRequired: true)) @@ -877,33 +880,42 @@ private void CheckGitVersion(ITracer tracer, GVFSEnlistment enlistment, out stri GitVersion gitVersion = null; if (string.IsNullOrEmpty(enlistment.GitBinPath) || !GitProcess.TryGetVersion(enlistment.GitBinPath, out gitVersion, out string _)) { - this.ReportErrorAndExit(tracer, "Error: Unable to retrieve the git version"); + this.ReportErrorAndExit(tracer, "Error: Unable to retrieve the Git version"); } version = gitVersion.ToString(); if (gitVersion.Platform != GVFSConstants.SupportedGitVersion.Platform) { - this.ReportErrorAndExit(tracer, "Error: Invalid version of git {0}. Must use gvfs version.", version); + this.ReportErrorAndExit(tracer, "Error: Invalid version of Git {0}. Must use vfs version.", version); } if (gitVersion.IsLessThan(GVFSConstants.SupportedGitVersion)) { this.ReportErrorAndExit( tracer, - "Error: Installed git version {0} is less than the supported version of {1}.", + "Error: Installed Git version {0} is less than the minimum supported version of {1}.", gitVersion, GVFSConstants.SupportedGitVersion); } + /* We require that the revision (Z) of the Git version string (2.X.Y.vfs.Z.W) + * is an exact match. We will use this to signal that a microsoft/git version introduces + * a breaking change that requires a VFS for Git upgrade. + * Using the revision part allows us to modify the other version items arbitrarily, + * including taking version numbers 2.X.Y from upstream and updating .W if we have any + * hotfixes to microsoft/git. + */ else if (gitVersion.Revision != GVFSConstants.SupportedGitVersion.Revision) { this.ReportErrorAndExit( tracer, - "Error: Installed git version {0} has revision number {1} instead of {2}." + - " This Git version is too new, so either downgrade Git or upgrade VFS for Git", + "Error: Installed Git version {0} has revision number {1} instead of {2}." + + " This Git version is too new, so either downgrade Git or upgrade VFS for Git." + + " The minimum supported version of Git is {3}.", gitVersion, gitVersion.Revision, - GVFSConstants.SupportedGitVersion.Revision); + GVFSConstants.SupportedGitVersion.Revision, + GVFSConstants.SupportedGitVersion); } } diff --git a/GVFS/GVFS/CommandLine/LogVerb.cs b/GVFS/GVFS/CommandLine/LogVerb.cs index b604403494..416a91c6f8 100644 --- a/GVFS/GVFS/CommandLine/LogVerb.cs +++ b/GVFS/GVFS/CommandLine/LogVerb.cs @@ -64,8 +64,6 @@ public override void Execute() string serviceLogsRoot = GVFSPlatform.Instance.GetLogsDirectoryForGVFSComponent(GVFSConstants.Service.ServiceName); this.DisplayMostRecent(serviceLogsRoot, GVFSConstants.LogFileTypes.Service); - - this.DisplayMostRecent(ProductUpgraderInfo.GetLogDirectoryPath(), GVFSConstants.LogFileTypes.UpgradePrefix); } else { diff --git a/GVFS/GVFS/CommandLine/UpgradeVerb.cs b/GVFS/GVFS/CommandLine/UpgradeVerb.cs index 54f1c809f6..49d2bd9f95 100644 --- a/GVFS/GVFS/CommandLine/UpgradeVerb.cs +++ b/GVFS/GVFS/CommandLine/UpgradeVerb.cs @@ -1,12 +1,5 @@ using CommandLine; -using GVFS.Common; -using GVFS.Common.FileSystem; -using GVFS.Common.Git; -using GVFS.Common.Tracing; -using GVFS.Upgrader; using System; -using System.Diagnostics; -using System.IO; namespace GVFS.CommandLine { @@ -14,39 +7,9 @@ namespace GVFS.CommandLine public class UpgradeVerb : GVFSVerb.ForNoEnlistment { private const string UpgradeVerbName = "upgrade"; - private const string DryRunOption = "--dry-run"; - private const string NoVerifyOption = "--no-verify"; - private const string ConfirmOption = "--confirm"; - - private ITracer tracer; - private PhysicalFileSystem fileSystem; - private ProductUpgrader upgrader; - private InstallerPreRunChecker prerunChecker; - private ProcessLauncher processLauncher; - - private ProductUpgraderPlatformStrategy productUpgraderPlatformStrategy; - - public UpgradeVerb( - ProductUpgrader upgrader, - ITracer tracer, - PhysicalFileSystem fileSystem, - InstallerPreRunChecker prerunChecker, - ProcessLauncher processWrapper, - TextWriter output) - { - this.upgrader = upgrader; - this.tracer = tracer; - this.fileSystem = fileSystem; - this.prerunChecker = prerunChecker; - this.processLauncher = processWrapper; - this.Output = output; - this.productUpgraderPlatformStrategy = GVFSPlatform.Instance.CreateProductUpgraderPlatformInteractions(fileSystem, tracer); - } public UpgradeVerb() { - this.fileSystem = new PhysicalFileSystem(); - this.processLauncher = new ProcessLauncher(); this.Output = Console.Out; } @@ -78,369 +41,7 @@ protected override string VerbName public override void Execute() { - string error; - if (!this.TryInitializeUpgrader(out error) || !this.TryRunProductUpgrade()) - { - this.ReportErrorAndExit(this.tracer, ReturnCode.GenericError, error); - } - } - - private bool TryInitializeUpgrader(out string error) - { - if (this.DryRun && this.Confirmed) - { - error = $"{DryRunOption} and {ConfirmOption} arguments are not compatible."; - return false; - } - - if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSUpgrade) - { - error = null; - if (this.upgrader == null) - { - this.productUpgraderPlatformStrategy = GVFSPlatform.Instance.CreateProductUpgraderPlatformInteractions(this.fileSystem, tracer: null); - if (!this.productUpgraderPlatformStrategy.TryPrepareLogDirectory(out error)) - { - return false; - } - - JsonTracer jsonTracer = new JsonTracer(GVFSConstants.GVFSEtwProviderName, "UpgradeVerb"); - string logFilePath = GVFSEnlistment.GetNewGVFSLogFileName( - ProductUpgraderInfo.GetLogDirectoryPath(), - GVFSConstants.LogFileTypes.UpgradeVerb); - jsonTracer.AddLogFileEventListener(logFilePath, EventLevel.Informational, Keywords.Any); - - this.tracer = jsonTracer; - this.prerunChecker = new InstallerPreRunChecker(this.tracer, this.Confirmed ? GVFSPlatform.Instance.Constants.UpgradeConfirmCommandMessage : GVFSConstants.UpgradeVerbMessages.GVFSUpgrade); - - string gitBinPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(); - if (string.IsNullOrEmpty(gitBinPath)) - { - error = $"nameof(this.TryInitializeUpgrader): Unable to locate git installation. Ensure git is installed and try again."; - return false; - } - - ICredentialStore credentialStore = new GitProcess(gitBinPath, workingDirectoryRoot: null); - - ProductUpgrader upgrader; - if (ProductUpgrader.TryCreateUpgrader(this.tracer, this.fileSystem, new LocalGVFSConfig(), credentialStore, this.DryRun, this.NoVerify, out upgrader, out error)) - { - this.upgrader = upgrader; - } - else - { - error = $"ERROR: {error}"; - } - } - - return this.upgrader != null; - } - else - { - error = $"ERROR: {GVFSConstants.UpgradeVerbMessages.GVFSUpgrade} is not supported on this operating system."; - return false; - } - } - - private bool TryRunProductUpgrade() - { - string errorOutputFormat = Environment.NewLine + "ERROR: {0}"; - string message = null; - string cannotInstallReason = null; - Version newestVersion = null; - - bool isInstallable = this.TryCheckUpgradeInstallable(out cannotInstallReason); - if (this.ShouldRunUpgraderTool() && !isInstallable) - { - this.ReportInfoToConsole($"Cannot upgrade GVFS on this machine."); - this.Output.WriteLine(errorOutputFormat, cannotInstallReason); - return false; - } - - if (!this.upgrader.UpgradeAllowed(out message)) - { - ProductUpgraderInfo productUpgraderInfo = new ProductUpgraderInfo( - this.tracer, - this.fileSystem); - productUpgraderInfo.DeleteAllInstallerDownloads(); - productUpgraderInfo.RecordHighestAvailableVersion(highestAvailableVersion: null); - this.ReportInfoToConsole(message); - return true; - } - - if (!this.TryRunUpgradeChecks(out newestVersion, out message)) - { - this.Output.WriteLine(errorOutputFormat, message); - this.tracer.RelatedError($"{nameof(this.TryRunProductUpgrade)}: Upgrade checks failed. {message}"); - return false; - } - - if (newestVersion == null) - { - // Make sure there a no asset installers remaining in the Downloads directory. This can happen if user - // upgraded by manually downloading and running asset installers. - ProductUpgraderInfo productUpgraderInfo = new ProductUpgraderInfo( - this.tracer, - this.fileSystem); - productUpgraderInfo.DeleteAllInstallerDownloads(); - this.ReportInfoToConsole(message); - return true; - } - - if (this.ShouldRunUpgraderTool()) - { - this.ReportInfoToConsole(message); - - if (!isInstallable) - { - this.tracer.RelatedError($"{nameof(this.TryRunProductUpgrade)}: {message}"); - this.Output.WriteLine(errorOutputFormat, message); - return false; - } - - // If we are on a platform that does not support nuget verification, and user has not - // specified the --no-verify flag, then print a helpful message here. - if (!GVFSPlatform.Instance.UnderConstruction.SupportsNuGetVerification && !this.NoVerify) - { - string packageVerificationNotSupportedMessage = @" -NuGet package verification is not supported on this platform. In order to run upgrade, you must run upgrade without NuGet package verification. -To run upgrade without NuGet verification include the --no-verify option. -"; - this.ReportInfoToConsole(packageVerificationNotSupportedMessage); - return false; - } - - if (!this.TryRunInstaller(out message)) - { - this.tracer.RelatedError($"{nameof(this.TryRunProductUpgrade)}: Could not launch upgrade tool. {message}"); - this.Output.WriteLine(errorOutputFormat, "Could not launch upgrade tool. " + message); - return false; - } - } - else - { - string advisoryMessage = string.Join( - Environment.NewLine, - GVFSConstants.UpgradeVerbMessages.UnmountRepoWarning, - GVFSPlatform.Instance.Constants.UpgradeInstallAdviceMessage); - this.ReportInfoToConsole(message + Environment.NewLine + Environment.NewLine + advisoryMessage + Environment.NewLine); - } - - return true; - } - - private bool TryRunUpgradeChecks( - out Version latestVersion, - out string error) - { - bool upgradeCheckSuccess = false; - string errorMessage = null; - Version version = null; - - this.ShowStatusWhileRunning( - () => - { - upgradeCheckSuccess = this.TryCheckUpgradeAvailable(out version, out errorMessage); - return upgradeCheckSuccess; - }, - "Checking for GVFS upgrades", - suppressGvfsLogMessage: true); - - latestVersion = version; - error = errorMessage; - - return upgradeCheckSuccess; - } - - private bool TryRunInstaller(out string consoleError) - { - string upgraderPath = null; - string errorMessage = null; - bool supportsInlineUpgrade = GVFSPlatform.Instance.Constants.SupportsUpgradeWhileRunning; - - this.ReportInfoToConsole("Launching upgrade tool..."); - - if (!this.TryCopyUpgradeTool(out upgraderPath, out consoleError)) - { - return false; - } - - if (!this.TryLaunchUpgradeTool( - upgraderPath, - runUpgradeInline: supportsInlineUpgrade, - consoleError: out errorMessage)) - { - return false; - } - - if (supportsInlineUpgrade) - { - this.processLauncher.WaitForExit(); - this.ReportInfoToConsole($"{Environment.NewLine}Upgrade completed."); - } - else - { - this.ReportInfoToConsole($"{Environment.NewLine}Installer launched in a new window. Do not run any git or gvfs commands until the installer has completed."); - } - - consoleError = null; - return true; - } - - private bool TryCopyUpgradeTool(out string upgraderExePath, out string consoleError) - { - upgraderExePath = null; - - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryCopyUpgradeTool), EventLevel.Informational)) - { - if (!this.upgrader.TrySetupUpgradeApplicationDirectory(out upgraderExePath, out consoleError)) - { - return false; - } - - activity.RelatedInfo($"Successfully Copied upgrade tool to {upgraderExePath}"); - } - - return true; - } - - private bool TryLaunchUpgradeTool(string path, bool runUpgradeInline, out string consoleError) - { - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryLaunchUpgradeTool), EventLevel.Informational)) - { - Exception exception; - string args = string.Empty + (this.DryRun ? $" {DryRunOption}" : string.Empty) + (this.NoVerify ? $" {NoVerifyOption}" : string.Empty); - - // If the upgrade application is being run "inline" with the current process, then do not run the installer via the - // shell - we want the upgrade process to inherit the current terminal's stdin / stdout / sterr - if (!this.processLauncher.TryStart(path, args, !runUpgradeInline, out exception)) - { - if (exception != null) - { - consoleError = exception.Message; - this.tracer.RelatedError($"Error launching upgrade tool. {exception.ToString()}"); - } - else - { - consoleError = "Error launching upgrade tool"; - } - - return false; - } - - activity.RelatedInfo("Successfully launched upgrade tool."); - } - - consoleError = null; - return true; - } - - private bool TryCheckUpgradeAvailable( - out Version latestVersion, - out string error) - { - latestVersion = null; - error = null; - - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryCheckUpgradeAvailable), EventLevel.Informational)) - { - bool checkSucceeded = false; - Version version = null; - - checkSucceeded = this.upgrader.TryQueryNewestVersion(out version, out error); - if (!checkSucceeded) - { - return false; - } - - string currentVersion = ProcessHelper.GetCurrentProcessVersion(); - latestVersion = version; - - string message = latestVersion == null ? - $"Successfully checked for VFSForGit upgrades. Local version ({currentVersion}) is up-to-date." : - $"Successfully checked for VFSForGit upgrades. A new version is available: {latestVersion}, local version is: {currentVersion}."; - - activity.RelatedInfo(message); - } - - return true; - } - - private bool TryCheckUpgradeInstallable(out string consoleError) - { - consoleError = null; - - using (ITracer activity = this.tracer.StartActivity(nameof(this.TryCheckUpgradeInstallable), EventLevel.Informational)) - { - if (!this.prerunChecker.TryRunPreUpgradeChecks( - out consoleError)) - { - return false; - } - - activity.RelatedInfo("Upgrade is installable."); - } - - return true; - } - - private bool ShouldRunUpgraderTool() - { - return this.Confirmed || this.DryRun; - } - - private void ReportInfoToConsole(string message, params object[] args) - { - this.Output.WriteLine(message, args); - } - - public class ProcessLauncher - { - public ProcessLauncher() - { - this.Process = new Process(); - } - - public Process Process { get; private set; } - - public virtual bool HasExited - { - get { return this.Process.HasExited; } - } - - public virtual int ExitCode - { - get { return this.Process.ExitCode; } - } - - public virtual void WaitForExit() - { - this.Process.WaitForExit(); - } - - public virtual bool TryStart(string path, string args, bool useShellExecute, out Exception exception) - { - this.Process.StartInfo = new ProcessStartInfo(path) - { - UseShellExecute = useShellExecute, - WorkingDirectory = Environment.SystemDirectory, - WindowStyle = ProcessWindowStyle.Normal, - Arguments = args - }; - - exception = null; - - try - { - return this.Process.Start(); - } - catch (Exception ex) - { - exception = ex; - } - - return false; - } + Console.Error.WriteLine("'gvfs upgrade' is no longer supported. Visit https://github.com/microsoft/vfsforgit for the latest install/upgrade instructions."); } } } diff --git a/GVFS/GVFS/GVFS.Windows.csproj b/GVFS/GVFS/GVFS.Windows.csproj deleted file mode 100644 index 2e0af3feb1..0000000000 --- a/GVFS/GVFS/GVFS.Windows.csproj +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - {32220664-594C-4425-B9A0-88E0BE2F3D2A} - Exe - Properties - GVFS - GVFS - v4.6.1 - 512 - true - - - - - true - DEBUG;TRACE - full - x64 - prompt - true - - - TRACE - true - pdbonly - x64 - prompt - true - - - - False - ..\..\..\packages\CommandLineParser.2.1.1-beta\lib\net45\CommandLine.dll - True - - - ..\..\..\packages\Microsoft.Data.Sqlite.Core.2.2.4\lib\netstandard2.0\Microsoft.Data.Sqlite.dll - - - False - ..\..\..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - True - - - False - ..\..\..\packages\SharpZipLib.1.2.0\lib\net45\ICSharpCode.SharpZipLib.dll - True - - - ..\..\..\packages\NuGet.Commands.4.9.2\lib\net46\NuGet.Commands.dll - - - ..\..\..\packages\NuGet.Common.4.9.2\lib\net46\NuGet.Common.dll - - - ..\..\..\packages\NuGet.Configuration.4.9.2\lib\net46\NuGet.Configuration.dll - - - ..\..\..\packages\NuGet.Credentials.4.9.2\lib\net46\NuGet.Credentials.dll - - - ..\..\..\packages\NuGet.DependencyResolver.Core.4.9.2\lib\net46\NuGet.DependencyResolver.Core.dll - - - ..\..\..\packages\NuGet.Frameworks.4.9.2\lib\net46\NuGet.Frameworks.dll - - - ..\..\..\packages\NuGet.LibraryModel.4.9.2\lib\net46\NuGet.LibraryModel.dll - - - ..\..\..\packages\NuGet.Packaging.4.9.2\lib\net46\NuGet.Packaging.dll - - - ..\..\..\packages\NuGet.Packaging.Core.4.9.2\lib\net46\NuGet.Packaging.Core.dll - - - ..\..\..\packages\NuGet.ProjectModel.4.9.2\lib\net46\NuGet.ProjectModel.dll - - - ..\..\..\packages\NuGet.Protocol.4.9.2\lib\net46\NuGet.Protocol.dll - - - ..\..\..\packages\NuGet.Versioning.4.9.2\lib\net46\NuGet.Versioning.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll - - - ..\..\..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll - - - ..\..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll - - - ..\..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PlatformLoader.Windows.cs - - - - - - - Designer - - - PreserveNewest - - - - - {374bf1e5-0b2d-4d4a-bd5e-4212299def09} - GVFS.Common - - - {4ce404e7-d3fc-471c-993c-64615861ea63} - GVFS.Platform.Windows - - - {f468b05a-95e5-46bc-8c67-b80a78527b7d} - GVFS.Virtualization - - - - - - - - - xcopy /Y $(BuildOutputDir)\GVFS.ReadObjectHook.Windows\bin\$(Platform)\$(Configuration)\GVFS.ReadObjectHook.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GVFS.VirtualFileSystemHook.Windows\bin\$(Platform)\$(Configuration)\GVFS.VirtualFileSystemHook.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GVFS.PostIndexChangedHook.Windows\bin\$(Platform)\$(Configuration)\GVFS.PostIndexChangedHook.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GVFS.Hooks.Windows\bin\$(Platform)\$(Configuration)\GVFS.Hooks.* $(TargetDir) -xcopy /Y $(BuildOutputDir)\GitHooksLoader\bin\$(Platform)\$(Configuration)\GitHooksLoader.* $(TargetDir) - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - \ No newline at end of file diff --git a/GVFS/GVFS/GVFS.csproj b/GVFS/GVFS/GVFS.csproj new file mode 100644 index 0000000000..8c143ebbc7 --- /dev/null +++ b/GVFS/GVFS/GVFS.csproj @@ -0,0 +1,28 @@ + + + + Exe + net461 + + + + + false + Content + PreserveNewest + Build;DebugSymbolsProjectOutputGroup + + + + + + + + + + + PreserveNewest + + + + diff --git a/GVFS/GVFS/InternalsVisibleTo.cs b/GVFS/GVFS/InternalsVisibleTo.cs new file mode 100644 index 0000000000..0ba48d81be --- /dev/null +++ b/GVFS/GVFS/InternalsVisibleTo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("GVFS.UnitTests")] diff --git a/GVFS/GVFS/Properties/AssemblyInfo.cs b/GVFS/GVFS/Properties/AssemblyInfo.cs deleted file mode 100644 index 82d77cac1a..0000000000 --- a/GVFS/GVFS/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GVFS")] -[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("32220664-594c-4425-b9a0-88e0be2f3d2a")] - -[assembly: InternalsVisibleTo("GVFS.UnitTests")] -[assembly: InternalsVisibleTo("GVFS.UnitTests.Windows")] \ No newline at end of file diff --git a/GVFS/GVFS/packages.config b/GVFS/GVFS/packages.config deleted file mode 100644 index 39e6630529..0000000000 --- a/GVFS/GVFS/packages.config +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GitHooksLoader/GitHooksLoader.cpp b/GVFS/GitHooksLoader/GitHooksLoader.cpp similarity index 100% rename from GitHooksLoader/GitHooksLoader.cpp rename to GVFS/GitHooksLoader/GitHooksLoader.cpp diff --git a/GitHooksLoader/GitHooksLoader.vcxproj b/GVFS/GitHooksLoader/GitHooksLoader.vcxproj similarity index 83% rename from GitHooksLoader/GitHooksLoader.vcxproj rename to GVFS/GitHooksLoader/GitHooksLoader.vcxproj index dd251f6843..78a51bf7f8 100644 --- a/GitHooksLoader/GitHooksLoader.vcxproj +++ b/GVFS/GitHooksLoader/GitHooksLoader.vcxproj @@ -14,20 +14,19 @@ {798DE293-6EDA-4DC4-9395-BE7A71C563E3} Win32Proj GitHooksLoader - 10.0.10240.0 + 10.0.16299.0 - Application true - v141 + v142 Unicode Application false - v141 + v142 true Unicode @@ -57,19 +56,19 @@ _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;%(AdditionalIncludeDirectories) MultiThreadedDebug Console true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) @@ -82,7 +81,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;%(AdditionalIncludeDirectories) + C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt;%(AdditionalIncludeDirectories) MultiThreaded @@ -90,13 +89,13 @@ true true true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) + C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x64;%(AdditionalLibraryDirectories) - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log + $(IntDir)\$(MSBuildProjectName).log - $(BuildOutputDir) + $(GeneratedIncludePath) diff --git a/GitHooksLoader/GitHooksLoader.vcxproj.filters b/GVFS/GitHooksLoader/GitHooksLoader.vcxproj.filters similarity index 100% rename from GitHooksLoader/GitHooksLoader.vcxproj.filters rename to GVFS/GitHooksLoader/GitHooksLoader.vcxproj.filters diff --git a/GitHooksLoader/Version.rc b/GVFS/GitHooksLoader/Version.rc similarity index 100% rename from GitHooksLoader/Version.rc rename to GVFS/GitHooksLoader/Version.rc diff --git a/GitHooksLoader/resource.h b/GVFS/GitHooksLoader/resource.h similarity index 100% rename from GitHooksLoader/resource.h rename to GVFS/GitHooksLoader/resource.h diff --git a/GitHooksLoader/stdafx.cpp b/GVFS/GitHooksLoader/stdafx.cpp similarity index 100% rename from GitHooksLoader/stdafx.cpp rename to GVFS/GitHooksLoader/stdafx.cpp diff --git a/GitHooksLoader/stdafx.h b/GVFS/GitHooksLoader/stdafx.h similarity index 100% rename from GitHooksLoader/stdafx.h rename to GVFS/GitHooksLoader/stdafx.h diff --git a/GitHooksLoader/targetver.h b/GVFS/GitHooksLoader/targetver.h similarity index 100% rename from GitHooksLoader/targetver.h rename to GVFS/GitHooksLoader/targetver.h diff --git a/GVFS/LibGit2Sharp.NativeBinaries.props b/GVFS/LibGit2Sharp.NativeBinaries.props deleted file mode 100644 index caa67d3538..0000000000 --- a/GVFS/LibGit2Sharp.NativeBinaries.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - - git2.dll - PreserveNewest - - - git2.so - PreserveNewest - - - git2.dylib - PreserveNewest - - - diff --git a/GVFS/ProjectedFSLib.NativeBinaries.props b/GVFS/ProjectedFSLib.NativeBinaries.props deleted file mode 100644 index 0d585bd3de..0000000000 --- a/GVFS/ProjectedFSLib.NativeBinaries.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - - ProjectedFSLib.dll - PreserveNewest - - - diff --git a/Scripts/BuildGVFSForWindows.bat b/Scripts/BuildGVFSForWindows.bat deleted file mode 100644 index 3a1e54a0f9..0000000000 --- a/Scripts/BuildGVFSForWindows.bat +++ /dev/null @@ -1,49 +0,0 @@ -@ECHO OFF -SETLOCAL -setlocal enabledelayedexpansion -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1") -IF "%2"=="" (SET "GVFSVersion=0.2.173.2") ELSE (SET "GVFSVersion=%2") - -SET SolutionConfiguration=%Configuration%.Windows - -FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO ( - SET nuget=%%F - ECHO Found nuget.exe at '%%F' -) - -IF NOT EXIST %nuget% ( - ECHO ERROR: Could not find nuget.exe on the PATH - exit /b 10 -) - -:: Acquire vswhere to find dev15 installations reliably. -SET vswherever=2.6.7 -%nuget% install vswhere -Version %vswherever% || exit /b 1 -SET vswhere=%VFS_PACKAGESDIR%\vswhere.%vswherever%\tools\vswhere.exe - -:: Assumes default installation location for Windows 10 SDKs -IF NOT EXIST "c:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0" ( - echo ERROR: Could not find Windows 10 SDK Version 10240 - exit /b 1 -) - -:: Use vswhere to find the latest VS installation with the msbuild component. -:: See https://github.com/Microsoft/vswhere/wiki/Find-MSBuild -for /f "usebackq tokens=*" %%i in (`%vswhere% -all -prerelease -latest -products * -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.Net.Core.Component.SDK.2.1 -find MSBuild\**\Bin\amd64\MSBuild.exe`) do ( - set msbuild="%%i" -) - -IF NOT DEFINED msbuild ( - echo ERROR: Could not locate a Visual Studio installation with required components. - echo Refer to Readme.md for a list of the required Visual Studio components. - exit /b 10 -) - -dotnet restore %VFS_SRCDIR% - -%msbuild% %VFS_SRCDIR%\GVFS.sln /p:GVFSVersion=%GVFSVersion% /p:Configuration=%SolutionConfiguration% /p:Platform=x64 || exit /b 1 - -dotnet publish %VFS_SRCDIR%\GVFS\FastFetch\FastFetch.csproj /p:Configuration=%Configuration% /p:Platform=x64 /p:SolutionDir=%VFS_SRCDIR%\ --runtime win-x64 --framework netcoreapp2.1 --self-contained --output %VFS_PUBLISHDIR%\FastFetch || exit /b 1 -ENDLOCAL diff --git a/Scripts/CI/CreateBuildDrop.bat b/Scripts/CI/CreateBuildDrop.bat deleted file mode 100644 index 168599ed7f..0000000000 --- a/Scripts/CI/CreateBuildDrop.bat +++ /dev/null @@ -1,33 +0,0 @@ -@ECHO OFF -CALL %~dp0\..\InitializeEnvironment.bat || EXIT /b 10 - -IF "%1"=="" GOTO USAGE -IF "%2"=="" GOTO USAGE - -SETLOCAL enableextensions -SET Configuration=%1 -SET VFS_STAGEDIR=%2 - -REM Prepare the staging directories for functional tests. -IF EXIST %VFS_STAGEDIR% ( - rmdir /s /q %VFS_STAGEDIR% -) -mkdir %VFS_STAGEDIR%\src\Scripts -mkdir %VFS_STAGEDIR%\BuildOutput\GVFS.Build -mkdir %VFS_STAGEDIR%\BuildOutput\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1 -mkdir %VFS_STAGEDIR%\BuildOutput\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\ - -REM Make a minimal 'test' enlistment to pass along our pipeline. -copy %VFS_SRCDIR%\init.cmd %VFS_STAGEDIR%\src\ -copy %VFS_SCRIPTSDIR%\*.* %VFS_STAGEDIR%\src\Scripts\ -copy %VFS_OUTPUTDIR%\GVFS.Build\*.* %VFS_STAGEDIR%\BuildOutput\GVFS.Build -dotnet publish %VFS_SRCDIR%\GVFS\GVFS.FunctionalTests\GVFS.FunctionalTests.csproj -p:StyleCopEnabled=False --self-contained --framework netcoreapp2.1 -r win-x64 -c Release -o %VFS_STAGEDIR%\BuildOutput\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\ -robocopy %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\ %VFS_STAGEDIR%\BuildOutput\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\ /E /XC /XN /XO -copy %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\*.* %VFS_STAGEDIR%\BuildOutput\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\ -GOTO END - -:USAGE -echo "ERROR: Usage: CreateBuildDrop.bat [configuration] [build drop root directory]" -exit 1 - -:END \ No newline at end of file diff --git a/Scripts/CapturePerfView.bat b/Scripts/CapturePerfView.bat deleted file mode 100644 index 1c0af046f5..0000000000 --- a/Scripts/CapturePerfView.bat +++ /dev/null @@ -1,114 +0,0 @@ -@if not defined _echo echo off -setlocal - -set filename=%~n0 -goto :parseargs - -:showhelp -echo. -echo Captures a system wide PerfView while running a command then compresses it into a zip. -echo. -echo USAGE: %filename% command -echo. -echo EXAMPLES: -echo %filename% git status -echo %filename% git fetch -goto :end - -:parseargs -if "%1" == "" goto :showhelp -if /i "%1" == "/?" goto :showhelp -if /i "%1" == "-?" goto :showhelp -if /i "%1" == "/h" goto :showhelp -if /i "%1" == "-h" goto :showhelp -if /i "%1" == "/help" goto :showhelp -if /i "%1" == "-help" goto :showhelp - -:: Find the given command on the path, then look for a .PDB file next to it -:VerifyPDB -set P2=.;%PATH% -for %%e in (%PATHEXT%) do @for %%i in (%~n1%%e) do @if NOT "%%~$P2:i"=="" if NOT exist "%%~dpn$P2:i.pdb" ( - echo Unable to locate PDB file %%~dpn$P2:i.pdb. Aborting %filename% 1>&2 - exit /B 1 -) - -:VerifyPerfView -where /q perfview || ( - echo Please see the PerfView GitHub Download Page to download an up-to-date version 1>&2 - echo of PerfView and copy it to a directory in your path. 1>&2 - echo. 1>&2 - echo https://github.com/Microsoft/perfview/blob/master/documentation/Downloading.md 1>&2 - exit /B 2 -) - -:: Generate output filenames -if NOT "%_NTUSER%" == "" ( - set perfviewfilename=%_NTUSER%-%~n1-%2 -) ELSE ( - if NOT "%USERNAME%" == "" ( - set perfviewfilename=%USERNAME%-%~n1-%2 - ) ELSE ( - set perfviewfilename=%~n1-%2 - ) -) -set perfviewstartlog=%perfviewfilename%.start.log.txt -set perfviewstoplog=%perfviewfilename%.end.log.txt - -:: Capture the perfview without requiring any human intervention -:CapturePerfView -echo Capture perf view for '%*'... -perfview start /AcceptEULA /NoGui /NoNGenRundown /Merge /Zip /Providers:*Microsoft.Git.GVFS:@StacksEnabled=true,*Microsoft.Internal.Git.Plugin:@StacksEnabled=true,*Microsoft.OSGENG.Testing.GitMsWrapper:@StacksEnabled=true /kernelEvents=default+FileIOInit /logfile:"%perfviewstartlog%" "%perfviewfilename%" || goto :HandlePerfViewStartError -echo. -set STARTTIME=%TIME% -%* -set ENDTIME=%TIME% -echo. -CALL :PrintElapsedTime - -:: Merge perfview into ZIP file -echo Merging and compressing perf view... -perfview stop /AcceptEULA /NoGui /NoNGenRundown /Merge /Zip /Providers:*Microsoft.Git.GVFS:@StacksEnabled=true,*Microsoft.Internal.Git.Plugin:@StacksEnabled=true,*Microsoft.OSGENG.Testing.GitMsWrapper:@StacksEnabled=true /kernelEvents=default+FileIOInit /logfile:"%perfviewstoplog%" || goto :HandlePerfViewStopError -CALL :CheckForFile -echo PerfView trace can be found in "%perfviewfilename%.etl.zip" -goto :end - -:HandlePerfViewStartError -echo Could not start perfview, please see %perfviewstartlog% for details. -EXIT /B 3 - -:HandlePerfViewStopError -echo Could not stop perfview, please see %perfviewstoplog% for details. -EXIT /B 4 - -:: Now wait for perfview to complete writing out the file -:CheckForFile -IF EXIST "%perfviewfilename%.etl.zip" EXIT /B 0 -TIMEOUT /T 1 >nul -goto :CheckForFile - -:PrintElapsedTime -:: Change formatting for the start and end times -for /F "tokens=1-4 delims=:.," %%a in ("%STARTTIME%") do ( - set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100" -) - -for /F "tokens=1-4 delims=:.," %%a in ("%ENDTIME%") do ( - set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100" -) - -:: Calculate the elapsed time by subtracting values -set /A elapsed=end-start - -:: Format the results for output -set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100 -if %hh% lss 10 set hh=0%hh% -if %mm% lss 10 set mm=0%mm% -if %ss% lss 10 set ss=0%ss% -if %cc% lss 10 set cc=0%cc% - -set DURATION=%hh%:%mm%:%ss%.%cc% -echo Command duration : %DURATION% -EXIT /B 0 - -:end -endlocal diff --git a/Scripts/NukeBuildOutputs.bat b/Scripts/NukeBuildOutputs.bat deleted file mode 100644 index f0eca0ac9f..0000000000 --- a/Scripts/NukeBuildOutputs.bat +++ /dev/null @@ -1,42 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -taskkill /f /im GVFS.Mount.exe 2>&1 -verify >nul - -powershell -NonInteractive -NoProfile -Command "& { (Get-MpPreference).ExclusionPath | ? {$_.StartsWith('C:\Repos\')} | %%{Remove-MpPreference -ExclusionPath $_} }" - -IF EXIST C:\Repos\GVFSFunctionalTests\enlistment ( - rmdir /s /q C:\Repos\GVFSFunctionalTests\enlistment -) ELSE ( - ECHO no test enlistment found -) - -IF EXIST C:\Repos\GVFSPerfTest ( - rmdir /s /q C:\Repos\GVFSPerfTest -) ELSE ( - ECHO no perf test enlistment found -) - -IF EXIST %VFS_OUTPUTDIR% ( - ECHO deleting build outputs - rmdir /s /q %VFS_OUTPUTDIR% -) ELSE ( - ECHO no build outputs found -) - -IF EXIST %VFS_PUBLISHDIR% ( - ECHO deleting published output - rmdir /s /q %VFS_PUBLISHDIR% -) ELSE ( - ECHO no packages found -) - -IF EXIST %VFS_PACKAGESDIR% ( - ECHO deleting packages - rmdir /s /q %VFS_PACKAGESDIR% -) ELSE ( - ECHO no packages found -) - -call %VFS_SCRIPTSDIR%\StopAllServices.bat diff --git a/Scripts/ReinstallGVFS.bat b/Scripts/ReinstallGVFS.bat deleted file mode 100644 index 29fb026a1a..0000000000 --- a/Scripts/ReinstallGVFS.bat +++ /dev/null @@ -1,33 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1") - -REM Passing the remove prjflt flag to the uninstall script -call %VFS_SCRIPTSDIR%\UninstallGVFS.bat "%2" - -if not exist "c:\Program Files\Git" goto :noGit -for /F "delims=" %%g in ('dir "c:\Program Files\Git\unins*.exe" /B /S /O:-D') do %%g /VERYSILENT /SUPPRESSMSGBOXES /NORESTART & goto :deleteGit - -:deleteGit -rmdir /q/s "c:\Program Files\Git" - -:noGit -REM This is a hacky way to sleep for 2 seconds in a non-interactive window. The timeout command does not work if it can't redirect stdin. -ping 1.1.1.1 -n 1 -w 2000 >NUL - -call %VFS_SCRIPTSDIR%\StopService.bat gvflt -call %VFS_SCRIPTSDIR%\StopService.bat prjflt - -if not exist c:\Windows\System32\drivers\gvflt.sys goto :removePrjFlt -del c:\Windows\System32\drivers\gvflt.sys - -:removePrjFlt -if not "%2"=="--remove-prjflt" goto :runInstallers -if not exist c:\Windows\System32\drivers\PrjFlt.sys goto :runInstallers -sc delete prjflt -verify >nul -del c:\Windows\System32\drivers\PrjFlt.sys - -:runInstallers -call %VFS_OUTPUTDIR%\GVFS.Build\InstallProduct.bat diff --git a/Scripts/RestorePackages.bat b/Scripts/RestorePackages.bat deleted file mode 100644 index 653182076b..0000000000 --- a/Scripts/RestorePackages.bat +++ /dev/null @@ -1,19 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -SETLOCAL - -IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1") - -SET SolutionConfiguration=%Configuration%.Windows - -FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO ( - SET nuget=%%F - ECHO Found nuget.exe at '%%F' -) - -dotnet restore %VFS_SRCDIR%\GVFS.sln /p:Configuration=%SolutionConfiguration% /p:VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140" --packages %VFS_PACKAGESDIR% || exit /b 1 - -%nuget% restore %VFS_SRCDIR%\GVFS.sln || exit /b 1 - -ENDLOCAL \ No newline at end of file diff --git a/Scripts/RunFunctionalTests.bat b/Scripts/RunFunctionalTests.bat deleted file mode 100644 index aa858d3b9a..0000000000 --- a/Scripts/RunFunctionalTests.bat +++ /dev/null @@ -1,50 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1") - -SETLOCAL -SET PATH=C:\Program Files\GVFS;C:\Program Files\Git\cmd;%PATH% - -if not "%2"=="--test-gvfs-on-path" goto :startFunctionalTests - -REM Force GVFS.FunctionalTests.exe to use the installed version of GVFS -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GitHooksLoader.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.Hooks.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.ReadObjectHook.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.VirtualFileSystemHook.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.PostIndexChangedHook.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.Mount.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.Service.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.Service.UI.exe - -REM Same for GVFS.FunctionalTests.Windows.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GitHooksLoader.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.Hooks.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.ReadObjectHook.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.VirtualFileSystemHook.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.PostIndexChangedHook.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.Mount.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.Service.exe -del %VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.Service.UI.exe - -echo PATH = %PATH% -echo gvfs location: -where gvfs -echo GVFS.Service location: -where GVFS.Service -echo git location: -where git - -:startFunctionalTests -dotnet %VFS_OUTPUTDIR%\GVFS.FunctionalTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.FunctionalTests.dll /result:TestResultNetCore.xml %2 %3 %4 %5 || goto :endFunctionalTests -%VFS_OUTPUTDIR%\GVFS.FunctionalTests.Windows\bin\x64\%Configuration%\GVFS.FunctionalTests.Windows.exe /result:TestResultNetFramework.xml --windows-only %2 %3 %4 %5 || goto :endFunctionalTests - -:endFunctionalTests -set error=%errorlevel% - -call %VFS_SCRIPTSDIR%\StopAllServices.bat - -exit /b %error% \ No newline at end of file diff --git a/Scripts/RunUnitTests.bat b/Scripts/RunUnitTests.bat deleted file mode 100644 index 3e9af434d6..0000000000 --- a/Scripts/RunUnitTests.bat +++ /dev/null @@ -1,11 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1") - -set RESULT=0 - -%VFS_OUTPUTDIR%\GVFS.UnitTests.Windows\bin\x64\%Configuration%\GVFS.UnitTests.Windows.exe || set RESULT=1 -dotnet %VFS_OUTPUTDIR%\GVFS.UnitTests\bin\x64\%Configuration%\netcoreapp2.1\GVFS.UnitTests.dll || set RESULT=1 - -exit /b %RESULT% \ No newline at end of file diff --git a/Scripts/StopAllServices.bat b/Scripts/StopAllServices.bat deleted file mode 100644 index 7aed517dbb..0000000000 --- a/Scripts/StopAllServices.bat +++ /dev/null @@ -1,5 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -call %VFS_SCRIPTSDIR%\StopService.bat GVFS.Service -call %VFS_SCRIPTSDIR%\StopService.bat Test.GVFS.Service diff --git a/Scripts/UninstallGVFS.bat b/Scripts/UninstallGVFS.bat deleted file mode 100644 index 66538f16ce..0000000000 --- a/Scripts/UninstallGVFS.bat +++ /dev/null @@ -1,28 +0,0 @@ -@ECHO OFF -CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 - -taskkill /F /T /FI "IMAGENAME eq git.exe" -taskkill /F /T /FI "IMAGENAME eq GVFS.exe" -taskkill /F /T /FI "IMAGENAME eq GVFS.Mount.exe" - -if not exist "c:\Program Files\GVFS" goto :end - -call %VFS_SCRIPTSDIR%\StopAllServices.bat - -if not "%2"=="--remove-prjflt" goto :uninstallGVFS -REM The GVFS uninstaller will not remove prjflt, and so we must remove it ourselves first. If we don't, the non-inbox ProjFS -REM will cause problems next time the inbox ProjFS is enabled -call %VFS_SCRIPTSDIR%\StopService.bat prjflt -rundll32.exe SETUPAPI.DLL,InstallHinfSection DefaultUninstall 128 C:\Program Files\GVFS\Filter\prjflt.inf - -:uninstallGVFS -REM Find the latest uninstaller file by date and run it. Goto the next step after a single execution. -for /F "delims=" %%f in ('dir "c:\Program Files\GVFS\unins*.exe" /B /S /O:-D') do %%f /VERYSILENT /SUPPRESSMSGBOXES /NORESTART & goto :deleteGVFS - -:deleteGVFS -rmdir /q/s "c:\Program Files\GVFS" - -REM Delete ProgramData\GVFS directory (logs, downloaded upgrades, repo-registry, gvfs.config). It can affect the behavior of a future GVFS install. -if exist "C:\ProgramData\GVFS" rmdir /q/s "C:\ProgramData\GVFS" - -:end diff --git a/Scripts/push-all-packages.sh b/Scripts/push-all-packages.sh deleted file mode 100644 index 635314f39b..0000000000 --- a/Scripts/push-all-packages.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Run this script from the repo root (in Git Bash) to -# push all local packages to the custom package repository. - -for pkg in $(find /c/Users/dstolee/.nuget/packages -type f -name '*.nupkg') -do - nuget push -Source "Dependencies" -SkipDuplicate -ApiKey az "$pkg" -done diff --git a/Version.props b/Version.props new file mode 100644 index 0000000000..8dc2eb7738 --- /dev/null +++ b/Version.props @@ -0,0 +1,25 @@ + + + + + 0.2.173.2 + + + 2.20210701.3 + v2.31.0.vfs.0.1 + + + diff --git a/global.json b/global.json new file mode 100644 index 0000000000..f7ef5e1e9e --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "msbuild-sdks": { + "Microsoft.Build.Traversal": "2.0.19", + "Microsoft.Build.NoTargets": "1.0.85" + } +} diff --git a/nuget.config b/nuget.config index fd92d2c47a..a8ec2d485a 100644 --- a/nuget.config +++ b/nuget.config @@ -1,16 +1,14 @@ - + - + - - - - - - + + + + diff --git a/scripts/Build.bat b/scripts/Build.bat new file mode 100644 index 0000000000..a8f263e78a --- /dev/null +++ b/scripts/Build.bat @@ -0,0 +1,98 @@ +@ECHO OFF +CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 +SETLOCAL +SETLOCAL EnableDelayedExpansion + +IF "%~1"=="" ( + SET CONFIGURATION=Debug +) ELSE ( + SET CONFIGURATION=%1 +) + +IF "%~2"=="" ( + SET GVFSVERSION=0.2.173.2 +) ELSE ( + SET GVFSVERSION=%2 +) + +IF "%~3"=="" ( + SET VERBOSITY=minimal +) ELSE ( + SET VERBOSITY=%3 +) + +REM If we have MSBuild on the PATH then go straight to the build phase +FOR /F "tokens=* USEBACKQ" %%F IN (`where msbuild.exe`) DO ( + SET MSBUILD_EXEC=%%F + ECHO INFO: Found msbuild.exe at '%%F' + GOTO :BUILD +) + +:LOCATE_MSBUILD +REM Locate MSBuild via the vswhere tool +FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO ( + SET NUGET_EXEC=%%F + ECHO INFO: Found nuget.exe at '%%F' +) + +REM NuGet is required to be on the PATH to install vswhere +IF NOT EXIST "%NUGET_EXEC%" ( + ECHO ERROR: Could not find nuget.exe on the PATH + EXIT /B 10 +) + +REM Acquire vswhere to find VS installations reliably +SET VSWHERE_VER=2.6.7 +"%NUGET_EXEC%" install vswhere -Version %VSWHERE_VER% || exit /b 1 +SET VSWHERE_EXEC=%VFS_PACKAGESDIR%\vswhere.%VSWHERE_VER%\tools\vswhere.exe + +REM Assumes default installation location for Windows 10 SDKs +IF NOT EXIST "C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0" ( + ECHO ERROR: Could not find Windows 10 SDK Version 16299 + EXIT /B 1 +) + +REM Use vswhere to find the latest VS installation with the MSBuild component +REM See https://github.com/Microsoft/vswhere/wiki/Find-MSBuild +FOR /F "tokens=* USEBACKQ" %%F IN (`%VSWHERE_EXEC% -all -prerelease -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\amd64\MSBuild.exe`) DO ( + SET MSBUILD_EXEC=%%F + ECHO INFO: Found msbuild.exe at '%%F' +) + +:BUILD +IF NOT DEFINED MSBUILD_EXEC ( + ECHO ERROR: Could not locate a Visual Studio installation with required components. + ECHO Refer to Readme.md for a list of the required Visual Studio components. + EXIT /B 10 +) + +ECHO ^********************** +ECHO ^* Restoring Packages * +ECHO ^********************** +"%MSBUILD_EXEC%" %VFS_SRCDIR%\GVFS.sln ^ + /t:Restore ^ + /v:%VERBOSITY% ^ + /p:Configuration=%CONFIGURATION% || GOTO ERROR + +ECHO ^********************* +ECHO ^* Building Solution * +ECHO ^********************* +"%MSBUILD_EXEC%" %VFS_SRCDIR%\GVFS.sln ^ + /t:Build ^ + /v:%VERBOSITY% ^ + /p:Configuration=%CONFIGURATION% || GOTO ERROR + +GOTO :EOF + +:USAGE +ECHO usage: %~n0%~x0 [^] [^] [^] +ECHO. +ECHO configuration Solution configuration (default: Debug). +ECHO version GVFS version (default: 0.2.173.2). +ECHO verbosity MSBuild verbosity (default: minimal). +ECHO. +EXIT 1 + +:ERROR +ECHO ERROR: Build failed with exit code %ERRORLEVEL% +EXIT /B %ERRORLEVEL% diff --git a/scripts/CreateBuildArtifacts.bat b/scripts/CreateBuildArtifacts.bat new file mode 100644 index 0000000000..a7ba9795e5 --- /dev/null +++ b/scripts/CreateBuildArtifacts.bat @@ -0,0 +1,88 @@ +@ECHO OFF +CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 +SETLOCAL + +IF "%~1"=="" ( + SET CONFIGURATION=Debug +) ELSE ( + SET CONFIGURATION=%1 +) + +IF "%~2"=="" ( + SET OUTROOT=%VFS_PUBLISHDIR% +) ELSE ( + SET OUTROOT=%2 +) + +REM Check NuGet is on the PATH +where /q nuget.exe +IF ERRORLEVEL 1 ( + ECHO ERROR: Could not find nuget.exe on the PATH + EXIT /B 1 +) + +IF EXIST %OUTROOT% ( + rmdir /s /q %OUTROOT% +) + +ECHO ^********************** +ECHO ^* Collecting Symbols * +ECHO ^********************** +mkdir %OUTROOT%\Symbols +SET COPY_SYM_CMD="&{Get-ChildItem -Recurse -Path '%VFS_OUTDIR%' -Include *.pdb | Where-Object FullName -Match '\\bin\\.*\\?%CONFIGURATION%\\' | Copy-Item -Destination '%OUTROOT%\Symbols'}" +powershell ^ + -NoProfile ^ + -ExecutionPolicy Bypass ^ + -Command %COPY_SYM_CMD% || GOTO ERROR + +ECHO ^****************************** +ECHO ^* Collecting GVFS.Installers * +ECHO ^****************************** +mkdir %OUTROOT%\GVFS.Installers +xcopy /S /Y ^ + %VFS_OUTDIR%\GVFS.Installers\bin\%CONFIGURATION%\win-x64 ^ + %OUTROOT%\GVFS.Installers\ || GOTO ERROR + +ECHO ^************************ +ECHO ^* Collecting FastFetch * +ECHO ^************************ +ECHO Collecting FastFetch... +mkdir %OUTROOT%\FastFetch +xcopy /S /Y ^ + %VFS_OUTDIR%\FastFetch\bin\%CONFIGURATION%\net461\win-x64 ^ + %OUTROOT%\FastFetch\ || GOTO ERROR + +ECHO ^*********************************** +ECHO ^* Collecting GVFS.FunctionalTests * +ECHO ^*********************************** +mkdir %OUTROOT%\GVFS.FunctionalTests +xcopy /S /Y ^ + %VFS_OUTDIR%\GVFS.FunctionalTests\bin\%CONFIGURATION%\net461\win-x64 ^ + %OUTROOT%\GVFS.FunctionalTests\ || GOTO ERROR + +ECHO ^************************************* +ECHO ^* Creating Installers NuGet Package * +ECHO ^************************************* +mkdir %OUTROOT%\NuGetPackages +nuget.exe pack ^ + %VFS_OUTDIR%\GVFS.Installers\bin\%CONFIGURATION%\win-x64\GVFS.Installers.nuspec ^ + -BasePath %VFS_OUTDIR%\GVFS.Installers\bin\%CONFIGURATION%\win-x64 ^ + -OutputDirectory %OUTROOT%\NuGetPackages || GOTO ERROR + +REM Move the nuspec file to the NuGetPackages artifact directory +move %OUTROOT%\GVFS.Installers\GVFS.Installers.nuspec ^ + %OUTROOT%\NuGetPackages + +GOTO :EOF + +:USAGE +ECHO usage: %~n0%~x0 [^] [^] +ECHO. +ECHO configuration Solution configuration (default: Debug). +ECHO destination Destination directory to copy artifacts (default: %VFS_PUBLISHDIR%). +ECHO. +EXIT 1 + +:ERROR +ECHO ERROR: Create build artifacts failed with exit code %ERRORLEVEL% +EXIT /B %ERRORLEVEL% diff --git a/Scripts/InitializeEnvironment.bat b/scripts/InitializeEnvironment.bat similarity index 70% rename from Scripts/InitializeEnvironment.bat rename to scripts/InitializeEnvironment.bat index ef6958a603..8bb31abb3c 100644 --- a/Scripts/InitializeEnvironment.bat +++ b/scripts/InitializeEnvironment.bat @@ -1,4 +1,4 @@ -@ECHO OFF +@IF "%_echo%"=="" (ECHO OFF) ELSE (ECHO ON) REM Set environment variables for interesting paths that scripts might need access to. PUSHD %~dp0 @@ -11,10 +11,9 @@ SET VFS_SRCDIR=%_PARSED_PATH_% CALL :RESOLVEPATH "%VFS_SRCDIR%\.." SET VFS_ENLISTMENTDIR=%_PARSED_PATH_% -SET VFS_OUTPUTDIR=%VFS_ENLISTMENTDIR%\BuildOutput +SET VFS_OUTDIR=%VFS_ENLISTMENTDIR%\out SET VFS_PACKAGESDIR=%VFS_ENLISTMENTDIR%\packages -SET VFS_PUBLISHDIR=%VFS_ENLISTMENTDIR%\Publish -SET VFS_TOOLSDIR=%VFS_ENLISTMENTDIR%\.tools +SET VFS_PUBLISHDIR=%VFS_ENLISTMENTDIR%\publish REM Clean up SET _PARSED_PATH_= diff --git a/scripts/RunFunctionalTests.bat b/scripts/RunFunctionalTests.bat new file mode 100644 index 0000000000..7ad871217d --- /dev/null +++ b/scripts/RunFunctionalTests.bat @@ -0,0 +1,34 @@ +@ECHO OFF +CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 + +IF "%1"=="" (SET "CONFIGURATION=Debug") ELSE (SET "CONFIGURATION=%1") + +REM Ensure GVFS installation is on the PATH for the Functional Tests to find +SETLOCAL +SET PATH=C:\Program Files\GVFS;C:\Program Files\Git\cmd;%PATH% + +ECHO PATH = %PATH% + +ECHO gvfs location: +where gvfs +IF NOT %ERRORLEVEL% == 0 ( + ECHO error: unable to locate GVFS on the PATH (has it been installed?) +) + +ECHO GVFS.Service location: +where GVFS.Service +IF NOT %ERRORLEVEL% == 0 ( + ECHO error: unable to locate GVFS.Service on the PATH (has it been installed?) +) + +ECHO git location: +where git +IF NOT %ERRORLEVEL% == 0 ( + ECHO error: unable to locate Git on the PATH (has it been installed?) +) + +%VFS_OUTDIR%\GVFS.FunctionalTests\bin\%CONFIGURATION%\net461\win-x64\GVFS.FunctionalTests.exe /result:TestResult.xml %2 %3 %4 %5 + +SET error=%ERRORLEVEL% +CALL %VFS_SCRIPTSDIR%\StopAllServices.bat +EXIT /b %error% diff --git a/scripts/RunUnitTests.bat b/scripts/RunUnitTests.bat new file mode 100644 index 0000000000..f9f6845806 --- /dev/null +++ b/scripts/RunUnitTests.bat @@ -0,0 +1,10 @@ +@ECHO OFF +CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 + +IF "%1"=="" (SET "CONFIGURATION=Debug") ELSE (SET "CONFIGURATION=%1") + +SET RESULT=0 + +%VFS_OUTDIR%\GVFS.UnitTests\bin\%CONFIGURATION%\net461\win-x64\GVFS.UnitTests.exe || SET RESULT=1 + +EXIT /b %RESULT% diff --git a/scripts/StopAllServices.bat b/scripts/StopAllServices.bat new file mode 100644 index 0000000000..237fb757f0 --- /dev/null +++ b/scripts/StopAllServices.bat @@ -0,0 +1,5 @@ +@ECHO OFF +CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 + +CALL %VFS_SCRIPTSDIR%\StopService.bat GVFS.Service +CALL %VFS_SCRIPTSDIR%\StopService.bat Test.GVFS.Service diff --git a/Scripts/StopService.bat b/scripts/StopService.bat similarity index 100% rename from Scripts/StopService.bat rename to scripts/StopService.bat