Skip to content

Commit

Permalink
added a script file for validating absence of pdb file
Browse files Browse the repository at this point in the history
  • Loading branch information
kerenr-jfrog committed Nov 6, 2024
1 parent ae48a20 commit 211424a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 30 deletions.
27 changes: 3 additions & 24 deletions .github/workflows/build-vsix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,11 @@ jobs:
- name: Build VSIX Project
run: msbuild JFrogVSExtension.sln /p:Configuration=Release /p:Platform="Any CPU" /p:BuildInParallel=true /m

# Verify that the PDB file is not included in the .vsix file
# Verify that the PDB file is not included in the .vsix file, this will expose unwanted debug information about the development env
- name: Check for PDB in VSIX
run: |
$vsixPath = "JFrogVSExtension/bin/Release/JfrogVSExtension.vsix"
$pdbExists = $false
# Check if the .vsix file contains the PDB file
if (Test-Path $vsixPath) {
$zipContent = [System.IO.Compression.ZipFile]::OpenRead($vsixPath)
foreach ($entry in $zipContent.Entries) {
if ($entry.FullName -like "*JfrogVSExtension.pdb") {
$pdbExists = $true
break
}
}
$zipContent.Dispose()
} else {
Write-Host "VSIX file does not exist."
}
if ($pdbExists) {
Write-Host "PDB file exists in VSIX. Please check your project settings."
exit 1 # Fail the workflow if the PDB file is found
} else {
Write-Host "PDB file not found in VSIX. Build is clean."
}
.\scripts\ValidatePDBFilesAbsenceInReleaseMode.ps1
shell: pwsh

# Upload vsix and unit test as artifacts for other workflows usage
- name: Upload vsix artifacts
Expand Down
8 changes: 4 additions & 4 deletions JFrogVSExtension.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Debug|Any CPU.Build.0 = Release|Any CPU
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Debug|x86.ActiveCfg = Debug|x86
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Debug|x86.Build.0 = Debug|x86
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|Any CPU.Build.0 = Release|Any CPU
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|x86.ActiveCfg = Release|x86
{6443B797-2478-4A1D-BECA-28E24C1F1F41}.Release|x86.Build.0 = Release|x86
{DB770B26-1629-45D0-8526-8902F83731B2}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{DB770B26-1629-45D0-8526-8902F83731B2}.Debug|Any CPU.Build.0 = Release|Any CPU
{DB770B26-1629-45D0-8526-8902F83731B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB770B26-1629-45D0-8526-8902F83731B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB770B26-1629-45D0-8526-8902F83731B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{DB770B26-1629-45D0-8526-8902F83731B2}.Debug|x86.Build.0 = Debug|Any CPU
{DB770B26-1629-45D0-8526-8902F83731B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
4 changes: 3 additions & 1 deletion JFrogVSExtension/JFrogVSExtension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>2</WarningLevel>
<DebugSymbols>true</DebugSymbols>
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Compile Include="Components\Component.cs" />
Expand Down
3 changes: 2 additions & 1 deletion UnitTestJfrogVSExtension/UnitTestJfrogVSExtension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Expand Down
27 changes: 27 additions & 0 deletions scripts/ValidatePDBFilesAbsenceInReleaseMode.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Define the path to the VSIX file - after building the project in Release mode
$vsixPath = "JfrogVSExtension\bin\Release\JfrogVSExtension.vsix"
$pdbExists = $false
$fileName = ""

# Check if the .vsix file contains the PDB file
if (Test-Path $vsixPath) {
$zipContent = [System.IO.Compression.ZipFile]::OpenRead($vsixPath)
foreach ($entry in $zipContent.Entries) {
if ($entry.FullName -like "*JfrogVSExtension.pdb") {
$pdbExists = $true
$fileName = $entry.FullName
break
}
}
$zipContent.Dispose()
} else {
Write-Error "VSIX file does not exist in the following path: $vsixPath."
exit 1 # Fail the workflow if the .vsix file is not found
}

if ($pdbExists) {
Write-Error "PDB file exists in VSIX. file name = $fileName Please check your project settings."
exit 1 # Fail the workflow if the PDB file is found
} else {
Write-Host "PDB file not found in VSIX. Build is clean."
}

0 comments on commit 211424a

Please sign in to comment.