-
Notifications
You must be signed in to change notification settings - Fork 102
feat: Copy/archive input XML files into the output directory #4030
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
Open
kdrienCG
wants to merge
35
commits into
develop
Choose a base branch
from
feature/kdrienCG/archiveInputDeck
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 28 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
20b501c
add functions to collect included XML files
kdrienCG 3db8b1a
add archiveInputDeck function
kdrienCG 8afead3
call archiveInputDeck() in ProblemManager
kdrienCG 25c325b
modify archive directory name
kdrienCG 1cf33d5
add tests for collectIncluded functions
kdrienCG a4b35d0
fix typo in archiveInputDeck documentation
kdrienCG c873915
fix typo in collectIncludedRecursive documentation
kdrienCG 6efbe14
add missing header includes
kdrienCG 140aa51
add filter on collectIncluded iteration
kdrienCG 9ed7c03
add MPI rank 0 condition for archiveInputDeck call
kdrienCG 5c30635
add output directory invariant for archiveInputDeck
kdrienCG 0c5fb2d
add tests for archiveInputDeck
kdrienCG bf1ca66
modify archive's logic to flatten inputs
kdrienCG 6b35d1b
strip metadata attributes from the archived XML
kdrienCG a61d8c7
sort XML attributes in the archived XML
kdrienCG 8738084
copy schema.xsd to the archive
kdrienCG 93e2806
uncrustify
kdrienCG dbfa0fb
relocate archiveInputDeck call to generate the XSD schema
kdrienCG 5a7c196
add command line option to trigger the archiving
kdrienCG d745bf6
add levels to archiving command line option
kdrienCG f8acdb4
Merge branch 'develop' into feature/kdrienCG/archiveInputDeck
kdrienCG c97394d
remove surrounding characters in a comment
kdrienCG aa5a851
set default archive strategy level to 1
kdrienCG 7041f73
remove XSD schema generation
kdrienCG 135e3a9
relocate archiving in the ProblemManager
kdrienCG 377ebdf
log archive's creation
kdrienCG d498048
add option to copy the XSD schema
kdrienCG 6e229b8
modify order of schema candidates
kdrienCG c388276
add missing comma
kdrienCG 81084b8
remove collectIncluded* methods
kdrienCG 4eb17c7
add archive command line parameter to quick start example
kdrienCG 2413b78
add documentation to the Input Files page
kdrienCG 8ca1a6c
set default level to 0
kdrienCG 83e59d2
add range check for -a level parameter
kdrienCG 5db3b4d
Merge branch 'develop' into feature/kdrienCG/archiveInputDeck
kdrienCG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| #include "common/format/StringUtilities.hpp" | ||
| #include "common/MpiWrapper.hpp" | ||
| #include "dataRepository/KeyNames.hpp" | ||
| #include "common/Path.hpp" | ||
|
|
||
| namespace geos | ||
| { | ||
|
|
@@ -268,6 +269,91 @@ string buildMultipleInputXML( string_array const & inputFileList, | |
| return inputFileName; | ||
| } | ||
|
|
||
| void collectIncluded( string const & filePath, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these 2 functions still needed for the current flattening strategy?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed in 81084b8 |
||
| std::set< string > & collection ) | ||
| { | ||
| xmlDocument doc; | ||
| xmlResult result = doc.loadFile( filePath ); | ||
| GEOS_THROW_IF( !result, | ||
| GEOS_FMT( "Could not load XML file '{}': {}", filePath, result.description() ), | ||
| InputError ); | ||
| xmlNode rootNode = doc.getFirstChild(); | ||
|
|
||
| string const currentDir = splitPath( filePath ).first; | ||
|
|
||
| for( auto & includedNode : rootNode.children( includedListTag ) ) | ||
| { | ||
| for( auto & fileNode : includedNode.children( includedFileTag ) ) | ||
| { | ||
| string const fileName = fileNode.attribute( "name" ).value(); | ||
|
|
||
| GEOS_THROW_IF( fileName.empty(), | ||
| GEOS_FMT( "An included file entry in '{}' has an empty or missing 'name' attribute.", filePath ), | ||
| InputError ); | ||
|
|
||
| string absolutePath = isAbsolutePath( fileName ) | ||
| ? getAbsolutePath( fileName ) | ||
| : getAbsolutePath( joinPath( currentDir, fileName ) ); | ||
| collection.insert( absolutePath ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| std::set< string > collectIncluded( string const & filePath ) | ||
| { | ||
| std::set< string > collection; | ||
| collectIncluded( filePath, collection ); | ||
| return collection; | ||
| } | ||
|
|
||
| void collectIncludedRecursive( string const & filePath, | ||
| std::set< string > & collection ) | ||
| { | ||
| // We want absolute paths | ||
| string const absFilePath = getAbsolutePath( filePath ); | ||
|
|
||
| if( collection.count( absFilePath ) > 0 ) | ||
| { | ||
| return; | ||
| } | ||
| collection.insert( absFilePath ); | ||
|
|
||
| xmlDocument doc; | ||
| xmlResult result = doc.loadFile( absFilePath ); | ||
| GEOS_THROW_IF( !result, | ||
| GEOS_FMT( "Could not load XML file '{}': {}", filePath, result.description() ), | ||
| InputError ); | ||
| xmlNode rootNode = doc.getFirstChild(); | ||
|
|
||
| string const currentDir = splitPath( filePath ).first; | ||
|
|
||
| for( auto & includedNode : rootNode.children( includedListTag ) ) | ||
| { | ||
| for( auto & fileNode : includedNode.children( includedFileTag ) ) | ||
| { | ||
| string const includedFilePath = fileNode.attribute( "name" ).value(); | ||
|
|
||
| if( includedFilePath.empty() ) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| string includedAbsPath = isAbsolutePath( includedFilePath ) | ||
| ? getAbsolutePath( includedFilePath ) | ||
| : getAbsolutePath( joinPath( currentDir, includedFilePath ) ); | ||
| collectIncludedRecursive( includedAbsPath, | ||
| collection ); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| std::set< string > collectIncludedRecursive( string const & filePath ) | ||
| { | ||
| std::set< string > collection; | ||
| collectIncludedRecursive( filePath, collection ); | ||
| return collection; | ||
| } | ||
|
|
||
| bool isFileMetadataAttribute( string const & name ) | ||
| { | ||
| static const std::set< string > fileMetadataAttributes { | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature will be incredibly useful in our production environment. That said, I would personally keep the existing GEOS default behavior (no archiving) unchanged for regular usage, CI, etc.
Same for example as CSV output, which isn't on by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I echo @bd713. Please keep
0 = no archivingas default