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

Implement target type inference for embedding mode #200

Open
Tracked by #199
alilleybrinker opened this issue Aug 23, 2024 · 0 comments
Open
Tracked by #199

Implement target type inference for embedding mode #200

alilleybrinker opened this issue Aug 23, 2024 · 0 comments
Labels
crate: omnibor Relating to the omnibor crate type: feature New feature or request

Comments

@alilleybrinker
Copy link
Member

alilleybrinker commented Aug 23, 2024

In order to support embedding mode for manifest creation, we need to able to infer the "target type," the type of artifact for which the manifest is being created. This target type informs how the embedding should be performed.

In particular, today the TargetType enum looks like this:

#[derive(Debug)]
enum TargetType {
    KnownBinaryType(BinaryType),
    KnownTextType(TextType),
    Unknown,
}

#[derive(Debug)]
enum BinaryType {
    ElfFile,
}

#[derive(Debug)]
enum TextType {
    PrefixComments { prefix: String },
    WrappedComments { prefix: String, suffix: String },
}

As shown here, that means there's a need to support inference for three different types of targets:

  • ELF binaries
  • Text formats with prefix based comments
  • Text formats with wrapped comments

Of course, there are an enormous number of possible text formats that would support prefix comments or wrapped comments. For this we'll likely want to rely first on third-party projects which exist already and infer the format used for existing text files, things like GitHub's Linguist project (though that's in Ruby, I am unsure of what conceptually-equivalent things exist in Rust today), and then map any languages identified in that list to indicate they use prefix comments or wrapped comments as appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: omnibor Relating to the omnibor crate type: feature New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant