asonix / release-manager

A utility to manage releasing rust programs for multiple platforms
1 stars 1 forks source link

Don't hardcode Readme and License for copying to resulting zip #3

Closed asonix closed 6 years ago

asonix commented 6 years ago

Maybe provide a list of paths to files that should be provided in the resulting zip file with the binary.

Instead of

readme = "README.md"
license = "LICENSE"

a Release.toml could look like the following:

included_files = ["README.md", "LICENSE", "acknowledgements.txt"]
asonix commented 6 years ago

This change will not be backwards compatible, but I could fix this by changing the Config struct to look like the following:

Config {
    readme: Option<String>,
    license: Option<String>,
    included_files: Option<Vec<String>>,
    ...
}

And this would be valid for the new and old Release.toml versions.

Alternatively, I could introduce versioned Config files with upgrade paths. For example:

// original config struct
Config {
    readme: String,
    license: String,
    ...
}

// New config struct
mod v1 {
    Config {
        included_files: Vec<String>,
        ...
    }

    impl From<config::Config> for config::v1::Config {
        fn from(old: config::Config) -> Self {
            // some implementation
        }
    }
}

I feel like the one that introduces versioned config layouts makes the most sense, since we get the guarantees that things will be as expected instead of needing to deal with Option<>s everywhere. Since we can write-out TOML, we can also in-place upgrade the target Release.toml as well. This will help alleviate future issues with upgrading the Release.toml format.