Skip to content
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

filename handling for MSVC #61

Open
dothebart opened this issue Nov 12, 2019 · 3 comments
Open

filename handling for MSVC #61

dothebart opened this issue Nov 12, 2019 · 3 comments

Comments

@dothebart
Copy link

The v8 torque transpiler expects filenames relative to -v8-root. This seems to work on linux with makefile target - "<(V8_ROOT)/src/builtins/array.tq", will become ../src/builtins/array.tq - all good.
However, the msbuild generator tries to make this path absolute when its put through:

          'inputs': [  # Order matters.
            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
            '<@(torque_files)',
          ],

I failed to get any solution working which would give me a working run_torque target.

I ended up patching that stupid behaviour out of torque by improving the error message, and making it attempt to simply directly opening the path instead of running it through its own vodoo:

void ReadAndParseTorqueFile(const std::string& path) {
  SourceId source_id = SourceFileMap::AddSource(path);
  CurrentSourceFile::Scope source_id_scope(source_id);

  // path might be either a normal file path or an encoded URI.
  auto fn = SourceFileMap::AbsolutePath(source_id);
  auto maybe_content = ReadFile(fn);
  std::string maybe_path;
  if (!maybe_content) {
    if (auto mmmaybe_path = FileUriDecode(path)) {
      maybe_path = *mmmaybe_path;
      maybe_content = ReadFile(maybe_path);
    }
  }
  if (!maybe_content) {
    maybe_content = ReadFile(path);
  }
  if (!maybe_content) {
    std::string allPaths = path + " - " + fn + " - " + maybe_path;
    Error("Cannot open file path/uri: ", allPaths).Throw();
  }

  ParseTorque(*maybe_content);
}

whats the best way ahead here? Find a fix for gyp3? Propose the torque fix upstream (if yes - is there somebody willing to do it? I hereby put my changes into public domain) ?

@dothebart
Copy link
Author

hm, yes, its an issue of the msbuild target. Using the make generator on windows will not produce this.

@dothebart
Copy link
Author

OK, now I got something that works:

--- a/generator/msvs.py
+++ b/generator/msvs.py
@@ -151,6 +151,9 @@ def _FixPath(path):
   Returns:
     The path with all slashes made into backslashes.
   """
+  if (path.endswith('.tq')):
+    return path

This is obviously a dirty hack - where could a more clever solution start?

@dothebart
Copy link
Author

WDYT about having a regex in the toolchain settings - like here: https://github.com/arangodb/arangodb/blob/feature/upgrade-v8/3rdParty/V8/gypfiles/toolchain.gypi#L1378
and using the regex in the if above?
something like msvs_filename_expansion_blacklist_regex ?

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

No branches or pull requests

1 participant