Skip to content

Add pre build command to Windows to remove potentially stale json files #2208#2209

Merged
brtietz merged 4 commits into
developfrom
SAM_2208
Jun 17, 2026
Merged

Add pre build command to Windows to remove potentially stale json files #2208#2209
brtietz merged 4 commits into
developfrom
SAM_2208

Conversation

@sjanzou

@sjanzou sjanzou commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Removes the api/api_autogen/library/defaults folder before regenerating json files when the Release build of export_config is run

@sjanzou sjanzou self-assigned this Jun 9, 2026
@sjanzou sjanzou requested a review from brtietz June 9, 2026 09:02
@sjanzou sjanzou linked an issue Jun 9, 2026 that may be closed by this pull request
@sjanzou sjanzou added this to the SAM 2026 Release milestone Jun 10, 2026
@brtietz

brtietz commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks for adding this! I'm seeing more deletions than I expected:

image

Has there been a change to the api autogen defaults that would lead to this?

@sjanzou

sjanzou commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for adding this! I'm seeing more deletions than I expected:

image Has there been a change to the api autogen defaults that would lead to this?

@brtietz , that is the expected behavior - to remove all of the .json files in the prebuild and then regenerate only the active ones. Were there any change to commit after you built the Release version of export_config (where the .json files are regenerated in the post-build event)?

@brtietz

brtietz commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Thanks for adding this! I'm seeing more deletions than I expected:
image
Has there been a change to the api autogen defaults that would lead to this?

@brtietz , that is the expected behavior - to remove all of the .json files in the prebuild and then regenerate only the active ones. Were there any change to commit after you built the Release version of export_config (where the .json files are regenerated in the post-build event)?

Yes, the screenshot is post-build after export_config has run.

@sjanzou

sjanzou commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for adding this! I'm seeing more deletions than I expected:
image
Has there been a change to the api autogen defaults that would lead to this?

@brtietz , that is the expected behavior - to remove all of the .json files in the prebuild and then regenerate only the active ones. Were there any change to commit after you built the Release version of export_config (where the .json files are regenerated in the post-build event)?

Yes, the screenshot is post-build after export_config has run.

I do get the files deleted but then are recreated and there are no changes to commit when I do a full rebuild - can you please provide the steps to reproduce the deleted json files when you go to commit changes? Thanks

@brtietz

brtietz commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

I do get the files deleted but then are recreated and there are no changes to commit when I do a full rebuild - can you please provide the steps to reproduce the deleted json files when you go to commit changes? Thanks

I tried a clean build this morning and get the same result:

image

CMake command used (adjusted for git bash):
cmake -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DSAMAPI_EXPORT=1 -DSAMPRIVATE=1 -DSAM_SKIP_AUTOGEN=0 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PREFIX_PATH=$ORTOOLSDIR -Dabsl_DIR=$ORTOOLSDIR"\lib\cmake\absl" Dutf8_range_DIR=$ORTOOLSDIR"\lib\cmake\utf8_range" -Dortools_DIR=$ORTOOLSDIR"\lib\cmake\ortools" ..

Then run all configurations (except export config and sam api debug) in batch build:
image

git status shows the missing files:
image

A full build log is here:
build_log_260615.txt

It looks like the issue is that export config builds and runs, and then (despite leaving the box unchecked in batch build) export_configd builds but does not run. Simply re-running batch build with both boxes checked does not solve the problem.

Thoughts on whether this is easier to correct in batch build settings or CMakeLists?

@sjanzou

sjanzou commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

I do get the files deleted but then are recreated and there are no changes to commit when I do a full rebuild - can you please provide the steps to reproduce the deleted json files when you go to commit changes? Thanks

I tried a clean build this morning and get the same result:

image CMake command used (adjusted for git bash): `cmake -G "Visual Studio 17 2022" -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DSAMAPI_EXPORT=1 -DSAMPRIVATE=1 -DSAM_SKIP_AUTOGEN=0 -DUSE_XPRESS=0 -DUSE_COINOR=1 -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PREFIX_PATH=$ORTOOLSDIR -Dabsl_DIR=$ORTOOLSDIR"\lib\cmake\absl" Dutf8_range_DIR=$ORTOOLSDIR"\lib\cmake\utf8_range" -Dortools_DIR=$ORTOOLSDIR"\lib\cmake\ortools" .. `

Then run all configurations (except export config and sam api debug) in batch build: image

git status shows the missing files: image

A full build log is here: build_log_260615.txt

It looks like the issue is that export config builds and runs, and then (despite leaving the box unchecked in batch build) export_configd builds but does not run. Simply re-running batch build with both boxes checked does not solve the problem.

Thoughts on whether this is easier to correct in batch build settings or CMakeLists?

@brtietz , thanks for the detailed workflow....

You are correct on the debug version causing the issue.

With the latest commit, the json files are only deleted for the release build of api_autogen, so the debug version should not cause the issue regardless of the batch build options - working for me...

@brtietz

brtietz commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

@brtietz , thanks for the detailed workflow....

You are correct on the debug version causing the issue.

With the latest commit, the json files are only deleted for the release build of api_autogen, so the debug version should not cause the issue regardless of the batch build options - working for me...

Thanks for adding that. It looks like there was a second problem: if the defaults folder doesn't exist, my machine will silently fail to write the files to the folder. Deleting all of the files within the defaults folder (rather than the folder itself) solves that problem for me.

Does the latest commit work for you?

@sjanzou

sjanzou commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@brtietz , thanks for the detailed workflow....
You are correct on the debug version causing the issue.
With the latest commit, the json files are only deleted for the release build of api_autogen, so the debug version should not cause the issue regardless of the batch build options - working for me...

Thanks for adding that. It looks like there was a second problem: if the defaults folder doesn't exist, my machine will silently fail to write the files to the folder. Deleting all of the files within the defaults folder (rather than the folder itself) solves that problem for me.

Does the latest commit work for you?

Complete rebuild working for me - 836 files deleted and one changed during rebuild
image
Note - the one changed file is due to overwriting the api/modules - during the rebuild one of the files is listed as changed as it is regenerated...

after rebuild - no overall changes and nothing to commit
image

So, yes, the last commit is working for me!

Thanks! Feel free to merge after you approve ;-)

@brtietz brtietz merged commit e9a3394 into develop Jun 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove api_autogen json files during build process

2 participants