KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_downgrade.h File Reference

Go to the source code of this file.

Functions

COMPATIBILITY_REPORT ClassifyBoardForDowngrade (const BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false)
 Report what a board would lose if exported to an older KiCad.
 
void DowngradeBoardInPlace (BOARD *aBoard, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false)
 Approximate or remove, in place, what the target cannot represent.
 
void DowngradeFootprintInPlace (FOOTPRINT *aFootprint, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false)
 Footprint-scoped downgrade for standalone .kicad_mod files the board pass never sees.
 
bool ExportBoardToOlderVersion (const wxString &aSrcFile, const wxString &aDestFile, const DOWNGRADE_TARGET &aTarget, COMPATIBILITY_REPORT &aReport, wxString *aUnsupportedToken=nullptr, const wxString &aVariant=wxEmptyString, bool aDropInsteadOfApproximate=false)
 Load a board, downgrade the copy, and write it stamped for the target.
 
void FlattenBoardVariant (BOARD *aBoard, const wxString &aVariantName)
 Bake a variant's overrides into the base footprint attributes.
 
void SaveBoardForTarget (BOARD *aBoard, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
 Save a board stamped for the target, using the writer for that version.
 
void SaveFootprintForTarget (FOOTPRINT *aFootprint, const wxString &aPath, const DOWNGRADE_TARGET &aTarget)
 Save a single .kicad_mod footprint file for the target.
 
DOWNGRADE_FILE_RESULT DowngradeFootprintFileToTemp (const wxString &aSrcFile, const wxString &aTmpFile, const DOWNGRADE_TARGET &aTarget, bool aDropInsteadOfApproximate=false)
 Load one .kicad_mod, classify it against the rule table, and write the downgraded copy to aTmpFile.
 
wxString FindUnsupportedBoardToken (const wxString &aSerialized, const DOWNGRADE_TARGET &aTarget)
 Scan serialized board text for tokens the target cannot parse.
 
int BoardDowngradeCoveredVersion ()
 The format the denylist was generated against. A format bump forces a review.
 

Variables

constexpr int FIRST_FP_CUSTOM_STACKUP = 20250818
 First board format that stores custom footprint stackups.
 
constexpr int FIRST_PCB_VARIANTS = 20260101
 First board format that stores variants.
 

Function Documentation

◆ BoardDowngradeCoveredVersion()

int BoardDowngradeCoveredVersion ( )

The format the denylist was generated against. A format bump forces a review.

Definition at line 2876 of file board_downgrade.cpp.

References BOARD_DOWNGRADE_COVERED.

Referenced by BOOST_AUTO_TEST_CASE().

◆ ClassifyBoardForDowngrade()

COMPATIBILITY_REPORT ClassifyBoardForDowngrade ( const BOARD * aBoard,
const DOWNGRADE_TARGET & aTarget,
bool aDropInsteadOfApproximate = false )

Report what a board would lose if exported to an older KiCad.

Does not modify the board. aDropInsteadOfApproximate reports LOWER features as DROP and selects their omission transforms.

Definition at line 2641 of file board_downgrade.cpp.

References _, COMPATIBILITY_REPORT::Add(), BLOCK, BOARD_DOWNGRADE_COVERED, boardRules(), countLineEndings(), DROP, PCB_PLOT_PARAMS::GetFormat(), BOARD::GetPlotOptions(), LOWER, DOWNGRADE_TARGET::m_boardVersion, planBoardText(), PNG, SEXPR_BOARD_FILE_VERSION, text, VER_LINE_ENDINGS, and VER_PROPERTY_VARIABLES.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), checkTransformedBoardUsesOnlyKnownTokens(), classifyFootprintLibraries(), DowngradeFootprintFileToTemp(), ExportBoardToOlderVersion(), and PCBNEW_JOBS_HANDLER::JobDowngrade().

◆ DowngradeBoardInPlace()

void DowngradeBoardInPlace ( BOARD * aBoard,
const DOWNGRADE_TARGET & aTarget,
bool aDropInsteadOfApproximate = false )

Approximate or remove, in place, what the target cannot represent.

When aDropInsteadOfApproximate is true, omit LOWER features without generating replacements.

Definition at line 2738 of file board_downgrade.cpp.

References applyTextPlan(), boardRules(), compensateReferenceImageScales(), GERBER, PCB_PLOT_PARAMS::GetFormat(), BOARD::GetPlotOptions(), LOWER, DOWNGRADE_TARGET::m_boardVersion, planBoardText(), PNG, PCB_PLOT_PARAMS::SetFormat(), BOARD::SetPlotOptions(), VER_IMAGE_PPI, and VER_PROPERTY_VARIABLES.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and ExportBoardToOlderVersion().

◆ DowngradeFootprintFileToTemp()

DOWNGRADE_FILE_RESULT DowngradeFootprintFileToTemp ( const wxString & aSrcFile,
const wxString & aTmpFile,
const DOWNGRADE_TARGET & aTarget,
bool aDropInsteadOfApproximate = false )

Load one .kicad_mod, classify it against the rule table, and write the downgraded copy to aTmpFile.

Refuses when a block rule fires.

Definition at line 2978 of file board_downgrade.cpp.

References BOARD::Add(), ClassifyBoardForDowngrade(), CONVERTED, DowngradeFootprintInPlace(), PCB_IO_KICAD_SEXPR::ImportFootprint(), REFUSED, BOARD::Remove(), SaveFootprintForTarget(), EDA_ITEM::SetParent(), and SKIPPED.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), checkNativeFootprintGolden(), and downgradeFootprintLibraries().

◆ DowngradeFootprintInPlace()

◆ ExportBoardToOlderVersion()

bool ExportBoardToOlderVersion ( const wxString & aSrcFile,
const wxString & aDestFile,
const DOWNGRADE_TARGET & aTarget,
COMPATIBILITY_REPORT & aReport,
wxString * aUnsupportedToken = nullptr,
const wxString & aVariant = wxEmptyString,
bool aDropInsteadOfApproximate = false )

◆ FindUnsupportedBoardToken()

wxString FindUnsupportedBoardToken ( const wxString & aSerialized,
const DOWNGRADE_TARGET & aTarget )

Scan serialized board text for tokens the target cannot parse.

Returns the first such token, or empty if the output is safe. Non-empty means refuse the export.

Definition at line 2944 of file board_downgrade.cpp.

References BOARD_TOKENS, BOARD_VALUES, containsGroupPlacementSource(), FindUnsupportedToken(), DOWNGRADE_TARGET::m_boardVersion, SEXPR_BOARD_FILE_VERSION, and VER_GROUP_PLACEMENT.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

◆ FlattenBoardVariant()

void FlattenBoardVariant ( BOARD * aBoard,
const wxString & aVariantName )

Bake a variant's overrides into the base footprint attributes.

Run before the variant registry is dropped, so the exported board matches the chosen variant.

Definition at line 2957 of file board_downgrade.cpp.

References BOARD::Footprints(), and name.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), ExportBoardToOlderVersion(), and PCBNEW_JOBS_HANDLER::JobDowngrade().

◆ SaveBoardForTarget()

◆ SaveFootprintForTarget()

void SaveFootprintForTarget ( FOOTPRINT * aFootprint,
const wxString & aPath,
const DOWNGRADE_TARGET & aTarget )

Variable Documentation

◆ FIRST_FP_CUSTOM_STACKUP

int FIRST_FP_CUSTOM_STACKUP = 20250818
constexpr

First board format that stores custom footprint stackups.

Definition at line 72 of file board_downgrade.h.

Referenced by boardRules().

◆ FIRST_PCB_VARIANTS

int FIRST_PCB_VARIANTS = 20260101
constexpr

First board format that stores variants.

Definition at line 75 of file board_downgrade.h.

Referenced by boardRules(), and PCBNEW_JOBS_HANDLER::JobDowngrade().