libs: convert to a cargo workspace

Convert libs into a Cargo workspace, so all libraries could share the
build infrastructure.

Fixes #3282

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
This commit is contained in:
Liu Jiang 2021-12-16 16:26:37 +08:00 committed by Fupan Li
parent 575df4dc4d
commit 392f1ecdf5
6 changed files with 18 additions and 16 deletions

View File

@ -21,10 +21,10 @@ STANDARD_TARGETS = build check clean install test vendor
default: all default: all
all: logging-crate-tests build all: libs-crate-tests build
logging-crate-tests: libs-crate-tests:
make -C src/libs/logging make -C src/libs
include utils.mk include utils.mk
include ./tools/packaging/kata-deploy/local-build/Makefile include ./tools/packaging/kata-deploy/local-build/Makefile
@ -49,7 +49,7 @@ docs-url-alive-check:
binary-tarball \ binary-tarball \
default \ default \
install-binary-tarball \ install-binary-tarball \
logging-crate-tests \ libs-crate-tests \
static-checks \ static-checks \
docs-url-alive-check docs-url-alive-check

View File

@ -117,6 +117,8 @@ The table below lists the core parts of the project:
|-|-|-| |-|-|-|
| [runtime](src/runtime) | core | Main component run by a container manager and providing a containerd shimv2 runtime implementation. | | [runtime](src/runtime) | core | Main component run by a container manager and providing a containerd shimv2 runtime implementation. |
| [agent](src/agent) | core | Management process running inside the virtual machine / POD that sets up the container environment. | | [agent](src/agent) | core | Management process running inside the virtual machine / POD that sets up the container environment. |
| [libraries](src/libs) | core | Library crates shared by multiple Kata Container components or published to [`crates.io`](https://crates.io/index.ht
ml) |
| [documentation](docs) | documentation | Documentation common to all components (such as design and install documentation). | | [documentation](docs) | documentation | Documentation common to all components (such as design and install documentation). |
| [libraries](src/libs) | core | Library crates shared by multiple Kata Container components or published to [`crates.io`](https://crates.io/index.html) | | [libraries](src/libs) | core | Library crates shared by multiple Kata Container components or published to [`crates.io`](https://crates.io/index.html) |
| [tests](https://github.com/kata-containers/tests) | tests | Excludes unit tests which live with the main code. | | [tests](https://github.com/kata-containers/tests) | tests | Excludes unit tests which live with the main code. |

View File

@ -107,10 +107,10 @@ endef
##TARGET default: build code ##TARGET default: build code
default: $(TARGET) show-header default: $(TARGET) show-header
$(TARGET): $(GENERATED_CODE) logging-crate-tests $(TARGET_PATH) $(TARGET): $(GENERATED_CODE) libs-crate-tests $(TARGET_PATH)
logging-crate-tests: libs-crate-tests:
make -C $(CWD)/../libs/logging make -C $(CWD)/../libs
$(TARGET_PATH): show-summary $(TARGET_PATH): show-summary
@RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) $(EXTRA_RUSTFEATURES) @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) $(EXTRA_RUSTFEATURES)
@ -203,7 +203,7 @@ codecov-html: check_tarpaulin
.PHONY: \ .PHONY: \
help \ help \
logging-crate-tests \ libs-crate-tests \
optimize \ optimize \
show-header \ show-header \
show-summary \ show-summary \

View File

@ -8,11 +8,11 @@ include ../../../utils.mk
.DEFAULT_GOAL := default .DEFAULT_GOAL := default
default: build default: build
build: logging-crate-tests build: libs-crate-tests
@RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE)
logging-crate-tests: libs-crate-tests:
make -C $(CWD)/../../libs/logging make -C $(CWD)/../../libs
clean: clean:
cargo clean cargo clean
@ -32,6 +32,6 @@ check: standard_rust_check
check \ check \
clean \ clean \
install \ install \
logging-crate-tests \ libs-crate-tests \
test \ test \
vendor vendor

View File

@ -8,11 +8,11 @@ include ../../../utils.mk
.DEFAULT_GOAL := default .DEFAULT_GOAL := default
default: build default: build
build: logging-crate-tests build: libs-crate-tests
@RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE) @RUSTFLAGS="$(EXTRA_RUSTFLAGS) --deny warnings" cargo build --target $(TRIPLE) --$(BUILD_TYPE)
logging-crate-tests: libs-crate-tests:
make -C $(CWD)/../../libs/logging make -C $(CWD)/../../libs
clean: clean:
cargo clean cargo clean
@ -32,6 +32,6 @@ check: standard_rust_check
check \ check \
clean \ clean \
install \ install \
logging-crate-tests \ libs-crate-tests \
test \ test \
vendor vendor