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

Update OCaml stubs #9568

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mszabo-wikia
Copy link
Contributor

@mszabo-wikia mszabo-wikia commented Jan 7, 2025

The OSS OCaml stubs under src/stubs have become out of sync with the code referencing them.

Update the stubs to match.

Split from #9564.

@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. (Because this pull request was imported automatically, there will not be any future comments.)

(rule
(target remote_old_decls_ffi.ml)
(action
(copy# ../facebook/remote_old_decls/stubs/remote_old_decls_ffi.ml remote_old_decls_ffi.ml)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively if upgrading to Dune 3.17.0+ is fine, there's a file-available macro.

@Wilfred
Copy link
Contributor

Wilfred commented Jan 9, 2025

Could you run ocamlformat and update the PR?

@mszabo-wikia
Copy link
Contributor Author

Done, also added ocamlformat as an OSS dep in #9573.

@Wilfred
Copy link
Contributor

Wilfred commented Jan 14, 2025

The sandcastle module looks wrong, I'm seeing a compile error:

Error: Library sandcastle is defined twice:
- hack/src/utils/facebook/dune:6
- hack/src/stubs/dune:171

@mszabo-wikia
Copy link
Contributor Author

Yeah, looks like the OSS stub will need to be included conditionally in non-fbsource builds only. I'll see what I can do, there are some preexisting examples for this.

@facebook-github-bot
Copy link
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

@Wilfred
Copy link
Contributor

Wilfred commented Jan 24, 2025

FWIW this isn't passing our CI still:

Error: Library sandcastle is defined twice:
[...]
hphp/hack/facebook/redirect/dune_build/.dune/default/hack/src/stubs/sandcastle/dune:1
- hack/src/utils/facebook/dune:6

@mszabo-wikia
Copy link
Contributor Author

Yeah, the exclusion logic is definitely wrong. I'll look into this, thanks!

@mszabo-wikia
Copy link
Contributor Author

@Wilfred Sorry about the delay, finally had some time to take a look at this.

I think it will be necessary to rename the internal sandcastle library to sandcastle_fb as part of this patch. This is because src/stubs/sandcastle/dune now defines a shimmed sandcastle library that will either point to the internal library in fbsource builds or the stubbed version defined in src/stubs/dune in OSS builds, but this requires the internal version to have a different name from the shim, hence the suffix. This seems to be the pattern used for every stubbed internal OCaml library in the project.

Let me know if you have any questions!

Copy link
Contributor

@muglug muglug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worked for us, with three lines changed

~repo:_
~ignore_hh_version:_
~opts:_ =
let get_project_metadata ~repo:_ ~ignore_hh_version:_ ~opts:_ =
failwith "Not implemented"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to return Lwt.return (Error ("Not implemented", Telemetry.create ())) for the IDE integration to work.

Otherwise the init_with_find call terminates execution.

~watchman_opts:_
~ignore_hh_version:_
~saved_state_type:_ =
let load ~ssopt:_ ~progress_callback:_ ~watchman_opts:_ ~ignore_hh_version:_ =
failwith "Not implemented"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to return Lwt.return (Error "Not implemented") for the IDE integration to work

files_changed: Saved_state_loader.changed_files;
}

let load ~project_metadata:_ ~threshold:_ ~root:_ = failwith "Not implemented"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to return Error "Not implemented" for IDE integration to work — otherwise the init_with_fetch call terminates execution.

The OSS OCaml stubs under src/stubs have become out of sync with the
code referencing them.

Update the stubs to match.
@mszabo-wikia
Copy link
Contributor Author

This worked for us, with three lines changed

Thanks! Updated this branch now.

@facebook-github-bot
Copy link
Contributor

@mszabo-wikia has updated the pull request. You must reimport the pull request before landing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants