Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lpenz/rust-sourcebundler
Bundle the source code of a binary in a crate into a single .rs file to be used in single-file programming competition sites
https://github.com/lpenz/rust-sourcebundler
codingame rust
Last synced: 14 days ago
JSON representation
Bundle the source code of a binary in a crate into a single .rs file to be used in single-file programming competition sites
- Host: GitHub
- URL: https://github.com/lpenz/rust-sourcebundler
- Owner: lpenz
- License: mit
- Created: 2017-06-13T20:41:39.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-07-15T07:22:26.000Z (4 months ago)
- Last Synced: 2024-09-19T06:42:08.124Z (about 2 months ago)
- Topics: codingame, rust
- Language: Rust
- Homepage: https://crates.io/crates/rustsourcebundler
- Size: 85 KB
- Stars: 58
- Watchers: 4
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![CI](https://github.com/lpenz/rust-sourcebundler/actions/workflows/ci.yml/badge.svg)](https://github.com/lpenz/rust-sourcebundler/actions/workflows/ci.yml)
[![coveralls](https://coveralls.io/repos/github/lpenz/rust-sourcebundler/badge.svg?branch=main)](https://coveralls.io/github/lpenz/rust-sourcebundler?branch=main)
[![crates.io](https://img.shields.io/crates/v/rustsourcebundler.svg)](https://crates.io/crates/rustsourcebundler)# rust-sourcebundler
Bundle the source code of a rust cargo crate in a single source file.
Very useful for sending the source code to a competitive programming site that
accept only a single file ([codingame](https://codingame.com), I'm looking at
you) and still keeping the cargo structure locally.## Usage
Add the following snippet to your *Cargo.toml*:
```toml
[package]
(...)
build = "build.rs"[build-dependencies]
rustsourcebundler = { git = "https://github.com/lpenz/rust-sourcebundler" }
```And create the file *build.rs* with the following:
```rust
//! Bundle mybin.rs and the crate libraries into singlefile.rsuse std::path::Path;
extern crate rustsourcebundler;
use rustsourcebundler::Bundler;fn main() -> Result<(), Box> {
let mut bundler: Bundler = Bundler::new(Path::new("src/bin/mybin.rs"),
Path::new("src/bin/singlefile.rs"));
bundler.crate_name("");
bundler.run()?;
Ok(())
}
```You can use the code inside the *example* directory of this repository
as a starting point.## Similar Projects
* [slava-sh/rust-bundler](https://github.com/slava-sh/rust-bundler)
* [Endle/rust-bundler-cp](https://github.com/Endle/rust-bundler-cp)
* [MarcosCosmos/cg-rust-bundler](https://github.com/MarcosCosmos/cg-rust-bundler)
written in python