linebender / linebender/druid

cargo-druid

Open
#1,047 6 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion write-up
Dominant language
Rust
Stars
9.7k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

# cargo-druid

This is a very preliminary sketch of `cargo-druid`, a tool for managing druid projects.

`cargo-druid` is a cargo plugin. Although its scope will likely increase over time. Its initial focus is on bundling up various resources and generating native packages/app bundles for your target platform(s).

### Rationale

A desktop application is more than just an executable; it is also a collection of other assets such as an Icon, a set of entitlements and capabilities, localization files, etcetera. Significantly, different platforms have very different conventions around what constitutes an application package or bundle (from now on, an *app*) on that platform. `cargo-druid` is a tool that reads per-platform configuration options, and generates these packages.

### `Druid.toml`

Druid applications will have a `Druid.toml` file in their top-level directory; that is, alongside `Cargo.toml`. `Druid.toml` is responsible for describing various attributes or capabilities of your application, such as (possibly) the types of files it can open, the locales it supports, the permissions it requires, or the locations of its assets. Some of this stuff may be inferred, and some of it may be explicit; the exact structure of this manifest is very much TBD.

### The structure of a druid project

As part of `cargo-druid`, we will also standardize the structure of a druid project; that is, we will describe a directory structure with standard locations for things like localization files, images, and other assets. `cargo-druid` will be able to create an empty project for you.

### asset bundling

This has a separate issue (#397) but it will be tightly coupled with the `cargo-druid` project, since `cargo-druid` will be responsible for actually gathering up the required assets for a given platform and putting them in the places where druid can find them.

### capabilities

`cargo-druid` is intended to mimic the API we already know from `cargo`. Some examples of commands that might exist:

```sh
# create a new druid project in an existing directory?
$ cargo druid init
# create a new druid project, period
$ cargo druid new
# rebuild assets and put them somewhere we can find them, then run the app
$ cargo druid run
# does this do anything different from just cargo test?
$ cargo druid test
# create a native app bundle.
$ cargo druid package
# we can at least dream
$ cargo druid publish
# verify that our directory structure is right and files are in the right place
# maybe we want a different name for this?
$ cargo druid check
```

This is intended mostly to spark the imagination; much is possible!

### other things to consider:
- cross compilation: *This would be nice to have but I haven't thought about it at all.*
- code signing: how hard could this possibly be

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with this issue's proposed cargo druid commands, Druid.toml manifest, standardized project structure, and platform app-bundle requirements; also review the linked asset-bundling issue #397. The scope and manifest structure are explicitly TBD, so done would require an agreed design and implementation plan before coding can begin.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.