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

Refactor Jvm methods to match specified signatures #3977

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

Conversation

vishwamartur
Copy link

Related to #3772

Refactor Jvm.scala to consolidate subprocess and classloader spawning operations into four specified signatures.

  • Refactor callSubprocess method:

    • Rename to call.
    • Update parameters to match the specified call signature.
    • Use jvmCommandArgs to generate command arguments.
    • Call os.call with the updated parameters.
  • Refactor runSubprocess method:

    • Rename to spawn.
    • Update parameters to match the specified spawn signature.
    • Use jvmCommandArgs to generate command arguments.
    • Call os.spawn with the updated parameters.
  • Add spawnClassloader method:

    • Create a new method to match the specified spawnClassloader signature.
    • Use mill.api.ClassLoader.create to create a classloader.
  • Add callClassloader method:

    • Create a new method to match the specified callClassloader signature.
    • Use spawnClassloader to create a classloader and set it as the context classloader.
    • Execute the provided function with the new classloader and restore the old classloader afterward.
  • Add tests in JvmTests.scala:

    • Add tests for the new call method.
    • Add tests for the new spawn method.
    • Add tests for the new callClassloader method.
    • Add tests for the new spawnClassloader method.

Related to com-lihaoyi#3772

Refactor `Jvm.scala` to consolidate subprocess and classloader spawning operations into four specified signatures.

* **Refactor `callSubprocess` method:**
  - Rename to `call`.
  - Update parameters to match the specified `call` signature.
  - Use `jvmCommandArgs` to generate command arguments.
  - Call `os.call` with the updated parameters.

* **Refactor `runSubprocess` method:**
  - Rename to `spawn`.
  - Update parameters to match the specified `spawn` signature.
  - Use `jvmCommandArgs` to generate command arguments.
  - Call `os.spawn` with the updated parameters.

* **Add `spawnClassloader` method:**
  - Create a new method to match the specified `spawnClassloader` signature.
  - Use `mill.api.ClassLoader.create` to create a classloader.

* **Add `callClassloader` method:**
  - Create a new method to match the specified `callClassloader` signature.
  - Use `spawnClassloader` to create a classloader and set it as the context classloader.
  - Execute the provided function with the new classloader and restore the old classloader afterward.

* **Add tests in `JvmTests.scala`:**
  - Add tests for the new `call` method.
  - Add tests for the new `spawn` method.
  - Add tests for the new `callClassloader` method.
  - Add tests for the new `spawnClassloader` method.
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

Successfully merging this pull request may close these issues.

1 participant