Skip to content

filename handling for MSVC #61

@dothebart

Description

@dothebart

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) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions