Skip to content

[v3] Refactor: separate extract and install step #1177

@crazywhalecc

Description

@crazywhalecc

While reviewing the v3 source code, I realized I had inadvertently confused the concept of extract. In source, it represents the source code path, but in binary, it becomes the installation path. This also conflicts with the concept in #1169. Basically in that PR shows that we need to define something about install.

Conclusion: we should declare installation step things explicitly:

zig:
  source: { ... }
  binary: custom

  metadata:
    license: MIT
    license-files: [LICENSE]
    source-root: null

  install:
    destination: zig      # default: {pkg_root_path}
    root: zig                 # default: {pkg_root_path}
    bin-dir: ''                  # default: {pkg_root_path}/bin
    bin: ''               # default: {bin-dir}/{artifact_name}

And we also need to extract in a temp dir anyway, and install stage we rename() it to the real target path. This completely resolves the confusing relationship between extract and install, with almost no performance impact because we're using rename.

Of course, we also have selective extract, which only requires one move and one delete, consistent with the current situation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRequest for commentshelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions