Skip to content

Commit 2f24489

Browse files
committed
Split CLI into its own crate
- This allows using the library without depending on the `getopts` and `vergen` trees - Rename executable - Update CI for cargo workspace - Always run CI
1 parent 3d61bc5 commit 2f24489

File tree

12 files changed

+508
-431
lines changed

12 files changed

+508
-431
lines changed

.github/workflows/nightly_release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# uses: actions-rs/cargo@v1
3232
# with:
3333
# command: test
34-
# args: --release --verbose
34+
# args: --release --verbose --workspace
3535
#
3636
# - name: Get previous nightly Release info
3737
# uses: octokit/[email protected]
@@ -73,7 +73,7 @@
7373
# with:
7474
# use-cross: true
7575
# command: build
76-
# args: --release --verbose --target=x86_64-pc-windows-gnu
76+
# args: --release --verbose --package customasm-cli --target=x86_64-pc-windows-gnu
7777
#
7878
# - name: Create remote nightly tag
7979
# env:
@@ -114,4 +114,4 @@
114114
# upload_url: ${{ steps.create_release.outputs.upload_url }}
115115
# asset_path: ./pkg/pkg.zip
116116
# asset_name: customasm_${{ env.RELEASE_TAG }}_win64.zip
117-
# asset_content_type: application/zip
117+
# asset_content_type: application/zip

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
uses: actions-rs/cargo@v1
2626
with:
2727
command: test
28-
args: --release --verbose
28+
args: --release --verbose --workspace
2929

3030
- name: Build
3131
uses: actions-rs/cargo@v1
3232
with:
3333
use-cross: true
3434
command: build
35-
args: --release --verbose --target=x86_64-pc-windows-gnu
35+
args: --release --verbose --package customasm-cli --target=x86_64-pc-windows-gnu
3636

3737
- name: Create Release
3838
id: create_release
@@ -65,4 +65,4 @@ jobs:
6565
upload_url: ${{ steps.create_release.outputs.upload_url }}
6666
asset_path: ./pkg/pkg.zip
6767
asset_name: customasm_win64.zip
68-
asset_content_type: application/zip
68+
asset_content_type: application/zip

.github/workflows/test.yml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@ name: Test Build
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- dev
8-
- 'dev-*'
9-
- 'feature-*'
105
pull_request:
11-
branches:
12-
- master
13-
- dev
14-
- 'dev-*'
15-
- 'feature-*'
166

177
jobs:
188
build:
@@ -22,6 +12,6 @@ jobs:
2212
steps:
2313
- uses: actions/checkout@v2
2414
- name: Build
25-
run: cargo build --verbose
15+
run: cargo build --verbose --workspace
2616
- name: Run tests
27-
run: cargo test --verbose
17+
run: cargo test --verbose --workspace

Cargo.toml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repository = "https://github.com/hlorenzi/customasm"
99
readme = "README.md"
1010
license = "Apache-2.0"
1111
keywords = ["asm", "assembler", "assembly", "custom"]
12-
categories = ["command-line-utilities", "hardware-support"]
12+
categories = ["hardware-support"]
1313
exclude = ["web/*"]
1414
build = "src/build.rs"
1515

@@ -18,18 +18,15 @@ crate-type = ["lib", "cdylib"]
1818
name = "customasm"
1919
path = "src/lib.rs"
2020

21-
[[bin]]
22-
name = "customasm"
23-
path = "src/main.rs"
24-
2521
[dependencies]
26-
getopts = "0.2.17"
2722
num-bigint = { version = "0.1", default_features = false }
2823
num-traits = { version = "0.1", default_features = false }
2924
num-integer = { version = "0.1", default_features = false }
3025

3126
[dev-dependencies]
3227
sha2 = "0.9.1"
3328

34-
[build-dependencies]
35-
vergen = "3.1.0"
29+
[workspace]
30+
members = [
31+
"customasm-cli",
32+
]

customasm-cli/Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "customasm-cli"
3+
version = "0.11.10"
4+
edition = "2018"
5+
authors = ["hlorenzi <https://hlorenzi.com>"]
6+
description = "An assembler for custom, user-defined instruction sets!"
7+
homepage = "https://github.com/hlorenzi/customasm"
8+
repository = "https://github.com/hlorenzi/customasm"
9+
license = "Apache-2.0"
10+
keywords = ["asm", "assembler", "assembly", "custom"]
11+
categories = ["command-line-utilities", "hardware-support"]
12+
13+
[dependencies]
14+
customasm = { path = "../" }
15+
getopts = "0.2.17"
16+
17+
[build-dependencies]
18+
vergen = "3.1.0"
19+
20+
[[bin]]
21+
name = "customasm"
22+
path = "src/main.rs"

customasm-cli/build.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
extern crate vergen;
2+
3+
4+
use vergen::{generate_cargo_keys, ConstantsFlags};
5+
6+
7+
fn main()
8+
{
9+
let mut flags = ConstantsFlags::empty();
10+
flags.toggle(ConstantsFlags::REBUILD_ON_HEAD_CHANGE);
11+
flags.toggle(ConstantsFlags::SEMVER_LIGHTWEIGHT);
12+
flags.toggle(ConstantsFlags::COMMIT_DATE);
13+
flags.toggle(ConstantsFlags::TARGET_TRIPLE);
14+
15+
generate_cargo_keys(flags).expect("Unable to generate the cargo keys!");
16+
}

0 commit comments

Comments
 (0)