Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid redundant scans for legacy source files #11

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Version Control.accda.src/modules/clsAdpTable.cls
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Implements IDbComponent
'
Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Dim strContent As String
ClearFilesByExtension IDbComponent_BaseFolder, "tdf" ' Legacy extension
strContent = GetSource
WriteFile strContent, Nz2(strAlternatePath, IDbComponent_SourceFile)
VCSIndex.Update Me, IIf(strAlternatePath = vbNullString, eatExport, eatAltExport), GetStringHash(strContent, True)
Expand Down
1 change: 0 additions & 1 deletion Version Control.accda.src/modules/clsDbForm.cls
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Implements IDbComponent
'
Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Dim strHash As String
If Not Options.SavePrintVars Then ClearFilesByExtension IDbComponent_BaseFolder, "json"
strHash = SaveComponentAsText(acForm, m_Form.Name, Nz2(strAlternatePath, IDbComponent_SourceFile), Me)
VCSIndex.Update Me, IIf(strAlternatePath = vbNullString, eatExport, eatAltExport), _
strHash, GetCodeModuleHash(IDbComponent_ComponentType, m_Form.Name)
Expand Down
1 change: 0 additions & 1 deletion Version Control.accda.src/modules/clsDbRelation.cls
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ End Sub
'
Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Dim strContent As String
ClearFilesByExtension IDbComponent_BaseFolder, "txt" ' Legacy extension
strContent = GetSource
WriteFile strContent, Nz2(strAlternatePath, IDbComponent_SourceFile)
VCSIndex.Update Me, IIf(strAlternatePath = vbNullString, eatExport, eatAltExport), GetStringHash(strContent, True)
Expand Down
2 changes: 0 additions & 2 deletions Version Control.accda.src/modules/clsDbReport.cls
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ Implements IDbComponent
'
Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Dim strHash As String
ClearFilesByExtension IDbComponent_BaseFolder, "pv" ' Remove legacy files
If Not Options.SavePrintVars Then ClearFilesByExtension IDbComponent_BaseFolder, "json"
strHash = SaveComponentAsText(acReport, m_Report.Name, Nz2(strAlternatePath, IDbComponent_SourceFile), Me)
VCSIndex.Update Me, IIf(strAlternatePath = vbNullString, eatExport, eatAltExport), _
strHash, GetCodeModuleHash(IDbComponent_ComponentType, m_Report.Name)
Expand Down
5 changes: 0 additions & 5 deletions Version Control.accda.src/modules/clsDbTableDef.cls
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ Private Sub IDbComponent_Export(Optional strAlternatePath As String)
Exit Sub
End If

' Clear any legacy extensions
ClearFilesByExtension IDbComponent_BaseFolder, "LNKD"
ClearFilesByExtension IDbComponent_BaseFolder, "bas"
ClearFilesByExtension IDbComponent_BaseFolder, "tdf"

' Get the export file name
strFile = Nz2(strAlternatePath, IDbComponent_SourceFile)

Expand Down
33 changes: 33 additions & 0 deletions Version Control.accda.src/modules/modImportExport.bas
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Public Sub ExportSource(blnFullExport As Boolean, Optional intFilter As eContain
Log.Add "Updated VCS (" & Options.GetLoadedVersion & " -> " & GetVCSVersion & ")", , , "blue"
End Select

' Perform any needed upgrades to source files
If blnFullExport Then UpgradeSourceFiles

' Run any custom sub before export
If Options.RunBeforeExport <> vbNullString Then
Log.Add "Running " & Options.RunBeforeExport & "..."
Expand Down Expand Up @@ -1437,6 +1440,36 @@ Private Sub CheckForLegacyModules()
End Sub


'---------------------------------------------------------------------------------------
' Procedure : UpgradeSourceFiles
' Author : Adam Waller
' Date : 8/7/2024
' Purpose : Removes any legacy file formats used by earlier versions of this add-in.
'---------------------------------------------------------------------------------------
'
Private Sub UpgradeSourceFiles()

Dim strBase As String

strBase = Options.GetExportFolder

' Remove legacy files by extension
ClearFilesByExtension strBase & "sqltables", "tdf"
ClearFilesByExtension strBase & "relations", "txt" ' Relationships (pre-json)
ClearFilesByExtension strBase & "report", "pv" ' Print vars text file (pre-json)
ClearFilesByExtension strBase & "tbldefs", "LNKD" ' Formerly used for linked tables
ClearFilesByExtension strBase & "tbldefs", "bas" ' Moved to XML format
ClearFilesByExtension strBase & "tbldefs", "tdf"

' Clear any print settings files if not using this option
If Not Options.SavePrintVars Then
ClearFilesByExtension "forms", "json"
ClearFilesByExtension "reports", "json"
End If

End Sub


'---------------------------------------------------------------------------------------
' Procedure : PrepareRunBootstrap
' Author : Adam Waller
Expand Down