Revert "Fix commit ID gathering on Android builds."

This reverts commit 1835e5d895.

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>
This commit is contained in:
Jamie Madill 2022-04-28 16:36:50 +00:00 коммит произвёл Angle LUCI CQ
Родитель c1d0e139d9
Коммит f9729598a6
5 изменённых файлов: 20 добавлений и 28 удалений

Просмотреть файл

@ -6,7 +6,6 @@
# Generate commit.h with git commit hash.
#
import logging
import subprocess as sp
import sys
import os
@ -28,14 +27,6 @@ def get_commit_position(cwd):
return grab_output('git rev-list HEAD --count', cwd)
def does_git_dir_exist(cwd, aosp):
ret = os.path.exists(os.path.join(cwd, '.git', 'HEAD'))
# If we're on Android, .git may be a file with a gitdir directive pointing elsewhere.
if aosp and not ret and os.path.exists(os.path.join(cwd, '.git')):
ret = 'true' == grab_output('git rev-parse --is-inside-work-tree', cwd)
return ret
def unpack_ref(ref_file, ref_file_full_path, packed_refs_full_path):
with open(packed_refs_full_path) as fin:
@ -60,10 +51,12 @@ if len(sys.argv) < 2:
operation = sys.argv[1]
# Set the root of ANGLE's repo as the working directory
cwd = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
aosp_angle_path = os.path.join(os.path.dirname('.'), 'external', 'angle')
aosp = os.path.exists(aosp_angle_path)
cwd = aosp_angle_path if aosp else os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
git_dir_exists = does_git_dir_exist(cwd, aosp)
if os.path.exists(aosp_angle_path):
cwd = aosp_angle_path
git_dir_exists = os.path.exists(os.path.join(cwd, '.git', 'HEAD'))
if operation == 'check':
if git_dir_exists:
@ -96,26 +89,28 @@ if len(sys.argv) < 3 or operation != 'gen':
output_file = sys.argv[2]
commit_id_size = 12
commit_id_unknown = 'unknown hash'
commit_id = commit_id_unknown
commit_id = 'unknown hash'
commit_date = 'unknown date'
commit_position = '0'
enable_binary_loading = False
if git_dir_exists:
try:
commit_id = grab_output('git rev-parse --short=%d HEAD' % commit_id_size, cwd)
commit_date = grab_output('git show -s --format=%ci HEAD', cwd)
commit_position = get_commit_position(cwd)
enable_binary_loading = True
except:
pass
hfile = open(output_file, 'w')
logging.info('ANGLE hash: {}'.format(commit_id))
hfile.write('#define ANGLE_COMMIT_HASH "%s"\n' % commit_id)
hfile.write('#define ANGLE_COMMIT_HASH_SIZE %d\n' % commit_id_size)
hfile.write('#define ANGLE_COMMIT_DATE "%s"\n' % commit_date)
hfile.write('#define ANGLE_COMMIT_POSITION %s\n' % commit_position)
hfile.write('#define ANGLE_COMMIT_HASH_UNKNOWN "%s"\n' % commit_id_unknown)
if not enable_binary_loading:
hfile.write('#define ANGLE_DISABLE_PROGRAM_BINARY_LOAD\n')
hfile.close()

Просмотреть файл

@ -28,9 +28,4 @@ int GetANGLECommitHashSize()
{
return ANGLE_COMMIT_HASH_SIZE;
}
const char *GetANGLEUnknownHash()
{
return ANGLE_COMMIT_HASH_UNKNOWN;
}
} // namespace angle

Просмотреть файл

@ -14,7 +14,6 @@ int GetANGLERevision();
const char *GetANGLEVersionString();
const char *GetANGLECommitHash();
int GetANGLECommitHashSize();
const char *GetANGLEUnknownHash();
} // namespace angle
#endif // COMMON_VERSION_H_

Просмотреть файл

@ -1550,6 +1550,9 @@ angle::Result Program::loadBinary(const Context *context,
unlink();
InfoLog &infoLog = mState.mExecutable->getInfoLog();
#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
return angle::Result::Continue;
#else
ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE);
if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
{
@ -1601,6 +1604,7 @@ angle::Result Program::loadBinary(const Context *context,
mLinkingState = std::move(linkingState);
return result;
#endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
}
angle::Result Program::saveBinary(Context *context,
@ -3671,12 +3675,6 @@ angle::Result Program::deserialize(const Context *context,
{
std::vector<uint8_t> commitString(angle::GetANGLECommitHashSize(), 0);
stream.readBytes(commitString.data(), commitString.size());
if (memcmp(commitString.data(), angle::GetANGLEUnknownHash(), commitString.size()) == 0)
{
infoLog << "Binary program loading is disabled due to unknown program binary version";
return angle::Result::Stop;
}
if (memcmp(commitString.data(), angle::GetANGLECommitHash(), commitString.size()) != 0)
{
infoLog << "Invalid program binary version.";

Просмотреть файл

@ -29,6 +29,11 @@
# define ANGLE_VSYNC ANGLE_ENABLED
#endif
// Program binary loading
#if !defined(ANGLE_PROGRAM_BINARY_LOAD)
# define ANGLE_PROGRAM_BINARY_LOAD ANGLE_ENABLED
#endif
// Append HLSL assembly to shader debug info. Defaults to enabled in Debug and off in Release.
#if !defined(ANGLE_APPEND_ASSEMBLY_TO_SHADER_DEBUG_INFO)
# if !defined(NDEBUG)