microsoft / axe-windows

Automated accessibility testing engine for Windows applications
MIT License
136 stars 62 forks source link

chore: Improve handling of generated files #848

Closed DaveTryon closed 1 year ago

DaveTryon commented 1 year ago

Details

This applies changes analogous to those included https://github.com/microsoft/accessibility-insights-windows/pull/1480 and https://github.com/microsoft/accessibility-insights-windows/pull/1486. The root issue is twofold:

  1. We generate some files during build and store them in the $(TEMP) folder. The problem here is that our build machines host multiple build agents, and the $(TEMP) folder is globally shared among all of them. As a result, there is a potential for collision if two or more of the build agents on a build machine happen to be running concurrent builds of Axe.Windows with different version information.
  2. We generate these files on every build, meaning that we build the entire solution a lot in the inner dev loop. Something as simple as rerunning a unit test from the IDE causes a full build of all projects that are in the dependency list for that unit test. That's only a few seconds each time, but it slows down the inner loop.

This PR does 3 things:

  1. Instead of putting the generated files in $(TEMP), we now put the generated files in .\src\bld. This gives each agent a private copy of the files, and since the folder is already listed in the .gitignore file, it has no side effects on the git state.
  2. One of the auto-generated files was always the same content. This file is now included as a checked-in file under .\src\Attributes and auto-injected into each shipping project.
  3. The auto-generated file that contains the version information now persists across builds and only gets rebuilt if the file doesn't already exist or if the contents of the file are different from what would otherwise be generated. This optimization dramatically speeds up the inner loop since it removes unnecessary compiles when nothing has changed.

Validation scenarios:

Motivation

Improve the inner dev loop, remove potentially hard-to-troubleshoot problems, and keep the code in sync with AIWin, where these changes will become more crucial as signed manifests come into play.

Context

Pull request checklist