forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
[8.2.0] Always run Turbine native image with a UTF-8 code page on Windows #6
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
arvi18
wants to merge
1
commit into
release-8.2.0
Choose a base branch
from
clone-cp25493
base: release-8.2.0
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.
+226
−117
Open
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions
19
..._tools/buildjar/java/com/google/devtools/build/java/turbine/turbine_direct_graal.manifest
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" | ||
manifestVersion="1.0" | ||
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" | ||
> | ||
<assemblyIdentity | ||
name="turbine_direct_graal.exe" | ||
version = "1.0.0.0" | ||
type="win32" | ||
/> | ||
<description>Turbine</description> | ||
|
||
<asmv3:application> | ||
<asmv3:windowsSettings> | ||
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage> | ||
</asmv3:windowsSettings> | ||
</asmv3:application> | ||
|
||
</assembly> |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2024 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
|
||
#include <string> | ||
|
||
// Extracts the app manifest of a Windows executable and prints it to stdout. | ||
int wmain(int argc, wchar_t *argv[]) { | ||
if (argc != 2) { | ||
fwprintf(stderr, L"Usage: %ls <filename>\n", argv[0]); | ||
return 1; | ||
} | ||
|
||
// Read the app manifest (aka side-by-side or fusion manifest) from the | ||
// executable, which requires loading it as a "module". | ||
HMODULE exe = LoadLibraryExW(argv[1], nullptr, LOAD_LIBRARY_AS_DATAFILE); | ||
if (!exe) { | ||
fwprintf(stderr, L"Error loading file %ls: %d\n", argv[1], GetLastError()); | ||
return 1; | ||
} | ||
HRSRC manifest_resource = FindResourceA(exe, MAKEINTRESOURCE(1), RT_MANIFEST); | ||
if (!manifest_resource) { | ||
fwprintf(stderr, L"Resource not found: %d\n", GetLastError()); | ||
return 1; | ||
} | ||
HGLOBAL manifest_handle = LoadResource(exe, manifest_resource); | ||
if (!manifest_handle) { | ||
fwprintf(stderr, L"Error loading resource: %d\n", GetLastError()); | ||
return 1; | ||
} | ||
LPVOID manifest_data = LockResource(manifest_handle); | ||
if (!manifest_data) { | ||
fwprintf(stderr, L"Error locking resource: %d\n", GetLastError()); | ||
return 1; | ||
} | ||
DWORD manifest_len = SizeofResource(exe, manifest_resource); | ||
|
||
// Write the manifest to stdout. | ||
fwrite(manifest_data, 1, manifest_len, stdout); | ||
|
||
UnlockResource(manifest_handle); | ||
FreeResource(manifest_handle); | ||
FreeLibrary(exe); | ||
|
||
return 0; | ||
} |
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
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.
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.
Resource Management: The code doesn't check return values for UnlockResource and FreeResource calls, which could lead to resource leaks in error conditions. While these Windows API functions typically don't fail when properly initialized, it's best practice to add error handling: