Handle warnings as errors (#271)

To handle warnings as errors when building, use `make`. To allow
warnings, use `make WARNINGS_AS_ERRORS=false test`.

Also see https://github.com/apple/container/pull/535.
This commit is contained in:
Dmitry Kovba
2025-08-28 10:39:17 -04:00
committed by GitHub
parent f92c0cd8c6
commit 6a31184ea5
2 changed files with 8 additions and 4 deletions
+5 -3
View File
@@ -15,6 +15,8 @@
# Build configuration variables
# The default version ID 0.0.0 indicates a local development build or PRB
BUILD_CONFIGURATION ?= debug
WARNINGS_AS_ERRORS ?= true
SWIFT_CONFIGURATION = $(if $(filter-out false,$(WARNINGS_AS_ERRORS)),-Xswiftc -warnings-as-errors)
# Commonly used locations
SWIFT := "/usr/bin/swift"
@@ -42,7 +44,7 @@ release: all
.PHONY: containerization
containerization:
@echo Building containerization binaries...
@$(SWIFT) build -c $(BUILD_CONFIGURATION)
@$(SWIFT) build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION)
@echo Copying containerization binaries...
@mkdir -p bin
@@ -71,7 +73,7 @@ cross-prep:
.PHONY: vminitd
vminitd:
@mkdir -p ./bin
@"$(MAKE)" -C vminitd BUILD_CONFIGURATION=$(BUILD_CONFIGURATION)
@"$(MAKE)" -C vminitd BUILD_CONFIGURATION=$(BUILD_CONFIGURATION) WARNINGS_AS_ERRORS=$(WARNINGS_AS_ERRORS)
.PHONY: update-libarchive-source
update-libarchive-source:
@@ -85,7 +87,7 @@ update-libarchive-source:
.PHONY: test
test:
@echo Testing all test targets...
@$(SWIFT) test --enable-code-coverage
@$(SWIFT) test --enable-code-coverage $(SWIFT_CONFIGURATION)
.PHONY: integration
integration:
+3 -1
View File
@@ -13,7 +13,9 @@
# limitations under the License.
BUILD_CONFIGURATION := debug
SWIFT_CONFIGURATION := --swift-sdk aarch64-swift-linux-musl
WARNINGS_AS_ERRORS ?= true
SWIFT_WARNING_CONFIG = $(if $(filter-out false,$(WARNINGS_AS_ERRORS)),-Xswiftc -warnings-as-errors)
SWIFT_CONFIGURATION := --swift-sdk aarch64-swift-linux-musl $(SWIFT_WARNING_CONFIG)
SWIFT_VERSION = 6.2-snapshot-2025-06-25
SWIFT_SDK_URL = https://download.swift.org/swift-6.2-branch/static-sdk/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-25-a/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-06-25-a_static-linux-0.0.1.artifactbundle.tar.gz