Skip to content

Commit

Permalink
Add script to set AX_ROOT
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 committed Jul 22, 2024
1 parent 053405c commit b237bd5
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .cargo/config.toml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, clippy, rustfmt
- name: Setup ArceOS
run: ./scripts/setup.sh
run: ./scripts/get_deps.sh
- name: Check rust version
run: rustc --version --verbose
- name: Check code format
Expand All @@ -41,7 +41,7 @@ jobs:
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- run: ./scripts/setup.sh
- run: ./scripts/get_deps.sh

- name: Build rust/helloworld
run: make ARCH=${{ matrix.arch }} A=rust/helloworld
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
arch: ${{ matrix.arch }}
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- run: ./scripts/setup.sh
- run: ./scripts/get_deps.sh

- name: Build c/helloworld
run: make ARCH=${{ matrix.arch }} A=c/helloworld
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
arch: x86_64
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- run: ./scripts/setup.sh
- run: ./scripts/get_deps.sh

- name: Build rust/helloworld for x86_64-pc-oslab
run: make PLATFORM=x86_64-pc-oslab A=rust/helloworld
Expand Down Expand Up @@ -162,5 +162,5 @@ jobs:
toolchain: ${{ matrix.rust-toolchain }}
- name: Build apps for std
run: |
./scripts/setup.sh
./scripts/get_deps.sh
cargo build --all --exclude arceos-display
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
arch: ${{ matrix.arch }}
- name: Run app tests
run: |
./scripts/setup.sh
./scripts/get_deps.sh
make disk_img
make test ARCH=${{ matrix.arch }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target
/.vscode
/.arceos
/.cargo
.DS_Store
Cargo.lock
*.o
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ ifeq ($(filter /%,$(A)),)
endif
endif

all:
@make -C $(AX_ROOT) A=$(APP)
all: build

$(MAKECMDGOALS):
@make -C $(AX_ROOT) A=$(APP) $(MAKECMDGOALS)
ax_root:
@./scripts/set_ax_root.sh $(AX_ROOT)

build run justrun debug disasm fmt clean clean_c: ax_root
@make -C $(AX_ROOT) A=$(APP) $@

test:
ifneq ($(filter command line,$(origin A)),)
./scripts/app_test.sh $(A)
else
./scripts/app_test.sh
endif

.PHONY: all ax_root build run justrun debug disasm fmt clean clean_c test
3 changes: 3 additions & 0 deletions scripts/config.toml.temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[patch.'https://github.com/arceos-org/arceos.git']
axstd = { path = "%AX_ROOT%/ulib/axstd" }
axnet = { path = "%AX_ROOT%/modules/axnet" }
4 changes: 3 additions & 1 deletion scripts/setup.sh → scripts/get_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
AX_ROOT=.arceos

test ! -d "$AX_ROOT" && echo "Cloning repositories ..." || true
test ! -d "$AX_ROOT" && git clone https://github.com/arceos-org/arceos .arceos || true
test ! -d "$AX_ROOT" && git clone https://github.com/arceos-org/arceos -b separate-apps .arceos || true

./scripts/set_ax_root.sh $AX_ROOT
13 changes: 13 additions & 0 deletions scripts/set_ax_root.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#/bin/bash

if [ "$#" -ne 1 ]; then
echo "Usage: $0 <AX_ROOT>"
exit 1
fi

AX_ROOT=$1

mkdir -p .cargo
sed -e "s|%AX_ROOT%|$AX_ROOT|g" scripts/config.toml.temp > .cargo/config.toml

echo "Set AX_ROOT (ArceOS directory) to $AX_ROOT"

0 comments on commit b237bd5

Please sign in to comment.