src/commit_id.py


Log

Author Commit Date CI Message
Robert Liao db71e8fa 2025-05-13T14:16:39 Use os.path.abspath for the cwd in commid_id.py os.path.realpath will resolve subst drives to the underlying path, which is inappropriate when the CWD is actually in the subst path. This causes os.path.relpath to fail due to a mismatched drive letter. Example mapping: D: -> S:\src\D E: -> S:\src\E Fixed: chromium:417529141 Change-Id: I70de53d511672dedf9cf2f77006526977b736526 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6546083 Auto-Submit: Robert Liao <robliao@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuxin Hu <yuxinhu@google.com>
Andrew Grieve 35356d95 2025-05-06T12:27:32 Use a depfile rather than exec_script to list inputs for commit_id.py Bug: chromium:416002047 Change-Id: Ia7ddd4e5e8ff7cc1e88cce6542f62a314c8e6430 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6511928 Auto-Submit: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Yuxin Hu 81c01d2f 2024-08-01T14:15:48 Add an option to output baked angle git hash to angle_commit.h We can leverage the ${rolling_to} hash value that is available in skia auto roller and use it as the ANGLE_COMMIT_HASH for Android Builds. Skia roller script can set ${rolling_to} hash to an environment variable ANGLE_UPSTREAM_HASH. In commit_id.py, check that if environment variable ANGLE_UPSTREAM_HASH is available, output the environment var into angle_commit.h. Bug: b/348044346 Bug: skia:356444755 Change-Id: I5232e4026d8b02d3ba603af0018060edb487566e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5758427 Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Roman Lavrov <romanl@google.com>
Victor Shutemov 58c20052 2024-02-22T23:58:25 Fix build error when git history not fully available Can happen when using repo tool shallow copy or mirror features Return default commit_id instead of empty when history is not avaiable though git. Bug: angleproject:8553 Change-Id: Iddc1f0c3507a14c15292545f07223dd0e666a3f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5319504 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Yuxin Hu e1bd0415 2023-02-03T16:58:21 Revert "Re-land fixing of commit ID for Android builds." This reverts commit e6662832af3c6394d0a0bbecd1e7a52581e88b12. After the commit https://github.com/google/angle/commit/61728827d2e5ecce685578bc54bb2c744b65fc9a, we no longer depends on git hash to determine if the program binary cache is valid. The reverted commit was added to handle unknown git hash. Android build infra does not guarantee access to git, and we needed GetANGLEHasBinaryLoading() check because we can't tell if ANGLE program changed if git hash remains "unknown" across different builds. Now that we used a different hash ANGLE_PROGRAM_VERSION as the cache key, which generates from a list of code files that affect program binary content and it won't be unknown on Android build, we can revert the commit and rely on ANGLE_PROGRAM_VERSION to reject invalid program binary cache. This fixes the dEQP test dEQP-GLES3.functional.shader_api.program_binary. simple.uniform_reset_on_binary_load, which failed because the GetANGLEHasBinaryLoading() is stopping Program::loadBinary() due to "unknown" git hash on Android build. This CL reverts most of the original commit, cleans up unused macros and variables, and reserves the change in program::loadBinary() that returns incomplete if binary format is not GL_PROGRAM_BINARY_ANGLE. This CL also reserves the changes in https://github.com/google/angle/commit/dd8021d98cd2909dfb85012f9b25010bd3ce2536 in case Sumsung parter still needs them. Bug: b/258445879 Change-Id: Ia4380de9362f7b8bed6de6a54943bec6600cb76b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4219368 Commit-Queue: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Roman Lavrov <romanl@google.com>
Igor Nazarov dd8021d9 2023-01-17T16:16:17 Added "git worktree" support into "commit_id.py". Bug: angleproject:7984 Change-Id: I097f2c0c310680ceaa7797916fd9a4cbbb1d17d5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4194176 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Doug Horn e6662832 2022-04-28T17:30:41 Re-land fixing of commit ID for Android builds. Android infra does not store the .git directory alongside the checked out code, instead using a gitdir directive to point elsewhere. This caused the commit_id script to fail, which could cause issues with disk-backed program caches on updates when the serialization format changes. Tested: 1) Verified that cached binaries do not load when the ANGLE hash is "unknown hash". This fixes a bug where the serialization format could change but we are unaware of a change because the hash is technically the same. 2) Verified that Android infra correctly generates the git hash. Bug: b/206109660 Test: Run script on Android infra, verify hash is gathered properly. Change-Id: I114fc8edb9459592cab45c6726f9d946cf6d17d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3615014 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Doug Horn <doughorn@google.com>
Jamie Madill f9729598 2022-04-28T16:36:50 Revert "Fix commit ID gathering on Android builds." This reverts commit 1835e5d895f7f75435c2eddf3f87a88ef534c237. Reason for revert: Breaks Skia integration in linkImpl. Original change's description: > Fix commit ID gathering on Android builds. > > Android infra does not store the .git directory alongside the > checked out code, instead using a gitdir directive to point > elsewhere. This caused the commit_id script to fail, which > could cause issues with disk-backed program caches on updates > when the serialization format changes. > > This CL also makes it a build failure to fail to get the commit id, > and removes the ANGLE_DISABLE_PROGRAM_BINARY_LOAD fallback (which > was broken anyway due to not being used anywhere). > > Bug: b/206109660 > Test: Run script on Android infra, verify hash is gathered properly. > Change-Id: Ie28dc9278b6fbd3dd4f09232c0a88d602fca6980 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3604710 > Commit-Queue: Doug Horn <doughorn@google.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Jamie Madill <jmadill@chromium.org> Bug: b/206109660 Change-Id: I64ac0831a46b9e1ff2e2738624650d67d0609f3c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3615009 Commit-Queue: Jamie Madill <jmadill@chromium.org> Auto-Submit: Jamie Madill <jmadill@chromium.org> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Doug Horn <doughorn@google.com>
Doug Horn 1835e5d8 2022-04-25T14:42:31 Fix commit ID gathering on Android builds. Android infra does not store the .git directory alongside the checked out code, instead using a gitdir directive to point elsewhere. This caused the commit_id script to fail, which could cause issues with disk-backed program caches on updates when the serialization format changes. This CL also makes it a build failure to fail to get the commit id, and removes the ANGLE_DISABLE_PROGRAM_BINARY_LOAD fallback (which was broken anyway due to not being used anywhere). Bug: b/206109660 Test: Run script on Android infra, verify hash is gathered properly. Change-Id: Ie28dc9278b6fbd3dd4f09232c0a88d602fca6980 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3604710 Commit-Queue: Doug Horn <doughorn@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Kenneth Russell 0ffa221c 2022-03-21T16:42:32 Update commit_id.py to use python3. This is blocking ANGLE rolls into WebKit. macOS no longer ships a "python" binary, only "python3". Bug: angleproject:7115 Change-Id: Ieb9473f393d006d64c18167bada2fe76ce996bb4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3537512 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 955b4620 2021-07-01T22:55:59 Fix angle_commit.h dependency when git packs refs If there are too many files in .git/refs/heads/, git packs them in .git/packed-refs. This breaks the build as gen/angle/angle_commit.h depends on .git/refs/heads/<branch-name>. With this change, when gn is run and the dependency to this file is set up, it's unpacked from .git/packed-refs if it's missing from .git/refs/heads/. One corner case not solved by this change is if a commit is amended with no changes and git packs the refs (and so the .git/refs/heads/<branch-name> file goes away), ninja doesn't rerun gn as it doesn't believe there to be any changes, yet fails the build as the dependency is now missing. Running `gn gen` manually fixes the issue. The issue is automatically fixed when switching branches. Bug: angleproject:6131 Change-Id: Ie2404e874a5cb3374a652b93faa143acb68eaa19 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3001906 Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya d3c8d543 2021-04-08T14:03:51 Consider AOSP ANGLE path as well during SHA generation Account for an in-tree AOSP build of ANGLE while generating ANGLE commit SHA Bug: angleproject:5838 Change-Id: I81d6d821810544c35daf6af9b167f18a4b095e99 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2815241 Commit-Queue: Mohan Maiya <m.maiya@samsung.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Dirk Pranke 5c79613f 2020-10-29T15:10:27 Make sure commit position is a string. In Python 3, you have to be careful to distinguish between bytes and strings when reading from subprocesses; the code to read the commit position was failing to do that in one place. Bug: chromium:1112471 Change-Id: Ifbfba6872f762d7e5d7e356772e93b4a7ee1dfeb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2508746 Commit-Queue: Dirk Pranke <dpranke@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 7bed2a5b 2020-09-22T23:37:54 Capture commit position into Android Manifest. Bug: b/168736059 Change-Id: I2ec1e284f0c51269a60f3b0e51036523258b501e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425198 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>
Jamie Madill 0725c1ed 2020-09-22T22:56:53 Add ANGLE commit position to version.h. Bug: b/168736059 Change-Id: If35210cfc91781cab6f40a1f03a4e82ada90690f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2425196 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang dd19d554 2020-03-02T09:41:22 Change commit_id 'check' back to looking for .git files. commit_id.py was change to try running 'git status' to confirm that git was present. This caused it to succeed if there was a git checkout somewhere above ANGLE if ANGLE's .git didn't exist, incorrectly adding a non-existant .git/HEAD file to the gn rule's inputs. Always verify that ANGLE's .git/HEAD is present in commit_id.py. BUG=angleproject:2344 Change-Id: I7e170f39c8d5cef73086ecf6d68925a1d3512de1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2082993 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Geoff Lang ba8ef68c 2020-02-24T14:13:40 Always use commit_id.py to generate commit.h commit_id_.py is capable of generating the default commit.h. This makes it so we always take a single path in gn. Remove the existing commit.h and generate it into the root generation folder (not the id subfolder) because Android blueprints can't handle generating into subfolders that don't exist. Make the <angle_dir> argument capable of taking a filename or directory name. This allows us to pass the .git/HEAD file which is a gn input. Android blueprints require all paths used as input or output to a script are listed as inputs or outputs in the genrule. BUG=angleproject:2344 Change-Id: I6600083fc400faf07808316c4a6244d6599df79a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2074924 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
Robert Liao 4a9ec2ef 2020-02-25T16:33:21 Revert "Always use commit_id.py to generate commit.h" This reverts commit 4dc19c38c0c5e307350ecd8b9f80d59573161df9. Causes a git error during 'gn gen': fatal: this operation must be run in a work tree BUG=chromium:1055991,angleproject:2344 Change-Id: I74dd36d557dcaf1bd1b13264d806a1c6b09e1a56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2073200 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
Geoff Lang 4dc19c38 2020-02-24T14:13:40 Always use commit_id.py to generate commit.h commit_id_.py is capable of generating the default commit.h. This makes it so we always take a single path in gn. Remove the existing commit.h and generate it into the root generation folder (not the id subfolder) because Android blueprints can't handle generating into subfolders that don't exist. Make the <angle_dir> argument capable of taking a filename or directory name. This allows us to pass the .git/HEAD file which is a gn input. Android blueprints require all paths used as input or output to a script are listed as inputs or outputs in the genrule. BUG=angleproject:2344 Change-Id: Ifd9c8331f421586db6f2c6e17faf3242376e11d0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2070600 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang d7d42395 2019-05-06T13:15:35 Format all of ANGLE's python code. BUG=angleproject:3421 Change-Id: I1d7282ac513c046de5d8ed87f7789290780d30a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1595440 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Courtney Goeltzenleuchter ed8d5ec7 2018-03-20T10:08:05 Add json build file generation gen_angle_gn_info_json.py can be used to generate a json description of the build for given targets. This information can then be used to generate build files for other tool chains (e.g. Android blueprint) Bug: angleproject:2418 Change-Id: Ief8f43e30ae1f469e3fcfa795306675e29a90a2f Reviewed-on: https://chromium-review.googlesource.com/967225 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Jamie Madill 949b4f07 2018-01-08T11:15:38 Vulkan: Allow for no .git directory in build. The SPIRV-Tools 'external revision generate' script is coded such that it assumes a .git folder is present. This causes a problem for the tarball build. We can fix this by using the same tooling we use for ANGLE's commit id script to check if the .git directory is present before running the generator. If it is missing, we insert a hard-coded dummy header. Also use the 'DEPS' file as a placeholder for .git/HEAD to check if the current revision needs updating. Bug: chromium:799620 Bug: angleproject:2237 Change-Id: Icea8e9c66f1600df7dca2aaa45fe449f687f5b55 Reviewed-on: https://chromium-review.googlesource.com/854255 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
anatoly techtonik 2766ecba 2016-06-02T09:44:14 Add cmdline help to commit_id.py Change-Id: I2b87e0b60f40d345388562e33ed8eb7010adf186 Reviewed-on: https://chromium-review.googlesource.com/349040 Reviewed-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 9c4b24a5 2014-06-12T13:41:17 Use commit_id.py on Windows, and handle missing git. This allows us to delete the Windows batch file. Changes the commit_id script to take the working directory so that it can be called from a different working directory than the angle repository is in. Renames the generated commit header to angle_commit.h. This is being written to the shared generated code directory for the entire build, and "commit.h" is insufficiently unique. BUG=angle:669 Change-Id: I35e80411a7e8ba1e02ce3f6a4fc54ed4dbc918f3 Reviewed-on: https://chromium-review.googlesource.com/202048 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
Jamie Madill 42f529e9 2014-02-24T12:45:32 Fix commit header generation on non-Windows platforms. Previously we relied on a batch file, which for obvious reasons isn't cross-platform. BUG=angle:529 Change-Id: Ia1e3944f8ed2096773e68c39d48ae2dd7370897b Reviewed-on: https://chromium-review.googlesource.com/186974 Reviewed-by: Geoff Lang <geofflang@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186985 Reviewed-by: Nicolas Capens <nicolascapens@chromium.org>