Skip to content

Commit

Permalink
Remove some unused xtask code
Browse files Browse the repository at this point in the history
Change-Id: I70313a00604b984417c6d990d8a76424ecaf6f5f
  • Loading branch information
jblebrun committed May 24, 2024
1 parent 3e72607 commit 1f1655b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 285 deletions.
182 changes: 2 additions & 180 deletions .xtask_bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ _xtask() {
",$1")
cmd="xtask"
;;
xtask,build-enclave-binary)
cmd="xtask__build__enclave__binary"
;;
xtask,check-format)
cmd="xtask__check__format"
;;
Expand All @@ -27,9 +24,6 @@ _xtask() {
xtask,help)
cmd="xtask__help"
;;
xtask,run-cargo-clean)
cmd="xtask__run__cargo__clean"
;;
xtask,run-cargo-clippy)
cmd="xtask__run__cargo__clippy"
;;
Expand All @@ -39,24 +33,12 @@ _xtask() {
xtask,run-cargo-fuzz)
cmd="xtask__run__cargo__fuzz"
;;
xtask,run-cargo-tests)
cmd="xtask__run__cargo__tests"
;;
xtask,run-cargo-udeps)
cmd="xtask__run__cargo__udeps"
;;
xtask,run-ci)
cmd="xtask__run__ci"
;;
xtask,run-oak-functions-example)
cmd="xtask__run__oak__functions__example"
;;
xtask,run-tests)
cmd="xtask__run__tests"
;;
xtask__help,build-enclave-binary)
cmd="xtask__help__build__enclave__binary"
;;
xtask__help,check-format)
cmd="xtask__help__check__format"
;;
Expand All @@ -69,9 +51,6 @@ _xtask() {
xtask__help,help)
cmd="xtask__help__help"
;;
xtask__help,run-cargo-clean)
cmd="xtask__help__run__cargo__clean"
;;
xtask__help,run-cargo-clippy)
cmd="xtask__help__run__cargo__clippy"
;;
Expand All @@ -81,18 +60,9 @@ _xtask() {
xtask__help,run-cargo-fuzz)
cmd="xtask__help__run__cargo__fuzz"
;;
xtask__help,run-cargo-tests)
cmd="xtask__help__run__cargo__tests"
;;
xtask__help,run-cargo-udeps)
cmd="xtask__help__run__cargo__udeps"
;;
xtask__help,run-ci)
cmd="xtask__help__run__ci"
;;
xtask__help,run-oak-functions-example)
cmd="xtask__help__run__oak__functions__example"
;;
xtask__help,run-tests)
cmd="xtask__help__run__tests"
;;
Expand All @@ -103,7 +73,7 @@ _xtask() {

case "${cmd}" in
xtask)
opts="-h --dry-run --logs --keep-going --help build-enclave-binary run-oak-functions-example format check-format run-tests run-cargo-clippy run-cargo-tests run-cargo-fuzz run-cargo-deny run-cargo-udeps run-ci run-cargo-clean completion help"
opts="-h --dry-run --logs --keep-going --help format check-format run-tests run-cargo-clippy run-cargo-fuzz run-cargo-deny run-cargo-udeps completion help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -116,20 +86,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__build__enclave__binary)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__check__format)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down Expand Up @@ -177,7 +133,7 @@ _xtask() {
return 0
;;
xtask__help)
opts="build-enclave-binary run-oak-functions-example format check-format run-tests run-cargo-clippy run-cargo-tests run-cargo-fuzz run-cargo-deny run-cargo-udeps run-ci run-cargo-clean completion help"
opts="format check-format run-tests run-cargo-clippy run-cargo-fuzz run-cargo-deny run-cargo-udeps completion help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -190,20 +146,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__build__enclave__binary)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__check__format)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -260,20 +202,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__cargo__clean)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__cargo__clippy)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -316,20 +244,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__cargo__tests)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__cargo__udeps)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand All @@ -344,34 +258,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__ci)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__oak__functions__example)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__help__run__tests)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand All @@ -386,20 +272,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__cargo__clean)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__cargo__clippy)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down Expand Up @@ -446,20 +318,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__cargo__tests)
opts="-h --cleanup --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__cargo__udeps)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand All @@ -474,42 +332,6 @@ _xtask() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__ci)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__oak__functions__example)
opts="-h --example-name --lookup-data-path --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--example-name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--lookup-data-path)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
xtask__run__tests)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
40 changes: 1 addition & 39 deletions xtask/src/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
// limitations under the License.
//

use crate::{
internal::*,
launcher,
launcher::{
build_binary, build_stage0, run_oak_functions_launcher_example_with_lookup_data,
MOCK_LOOKUP_DATA_PATH,
},
};
use crate::internal::*;

/// Build the Rust crate that will be used as the Wasm module for the Oak
/// Functions server.
Expand All @@ -39,34 +32,3 @@ pub fn build_rust_crate_wasm(crate_name: &str) -> Step {
),
}
}

pub fn run_oak_functions_example(opt: &RunOakExampleOpt) -> Step {
let app = launcher::App::from_crate_name("oak_functions_enclave_app");

let wasm_path = oak_functions_test_utils::rust_crate_wasm_out_path(&opt.example_name);

Step::Multiple {
name: "run Oak Functions example".to_string(),
steps: vec![
build_stage0(),
crate::launcher::just_build("oak_restricted_kernel_wrapper"),
build_binary(
"build Oak Restricted Kernel orchestrator",
&launcher::App::from_crate_name("oak_orchestrator").enclave_crate_path(),
),
build_binary("build Oak Functions enclave app", &app.enclave_crate_path()),
build_rust_crate_wasm(&opt.example_name),
Step::Single {
name: "server".to_string(),
command: run_oak_functions_launcher_example_with_lookup_data(
&app,
&wasm_path,
8080,
&opt.lookup_data_path
.clone()
.unwrap_or(MOCK_LOOKUP_DATA_PATH.to_str().unwrap().to_string()),
),
},
],
}
}
5 changes: 0 additions & 5 deletions xtask/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@ pub struct Opt {

#[derive(Subcommand, Clone, Debug)]
pub enum Command {
BuildEnclaveBinary,
RunOakFunctionsExample(RunOakExampleOpt),
Format,
CheckFormat,
RunTests,
RunCargoClippy,
RunCargoTests(RunTestsOpt),
RunCargoFuzz(RunCargoFuzz),
RunCargoDeny,
RunCargoUdeps,
RunCi,
RunCargoClean,
#[command(about = "generate bash completion script to stdout")]
Completion(Completion),
}
Expand Down
11 changes: 0 additions & 11 deletions xtask/src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,6 @@ impl App {
}
}

pub fn build_enclave_binary() -> Step {
Step::Single {
name: "Build enclave binary variants".to_string(),
command: Cmd::new_in_dir(
"cargo",
vec!["build", "--release"],
Path::new(&App::from_crate_name("").enclave_crate_path()),
),
}
}

pub fn build_stage0() -> Step {
Step::Single {
name: "build stage0".to_string(),
Expand Down
Loading

0 comments on commit 1f1655b

Please sign in to comment.