-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR contains the work done to address the issue #12, with regards to provide basic support of non Apple platforms. To provide further details about the work done: - [x] flattened the folder structure, especially now that the idea to filter folders based on platform is being discarded; - [x] implemented precompiler processors to filter out platform-specific source code; - [x] updated the `Package` file to provide basic support for non-Apple platforms; - [x] added and also improved some targets to the `Makefile` file to smooth the current development workflows; - [x] updated the `.gitignore` file with references to the `.vscode` folder and the `.env` file; - [x] updated the Swift tools version to v5.7. Co-authored-by: Javier Cicchelli <[email protected]> Reviewed-on: https://repo.rock-n-code.com/rock-n-code/swift-libs/pulls/13
- Loading branch information
Showing
21 changed files
with
232 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
.DS_Store | ||
/.build | ||
/.vscode | ||
/Packages | ||
/*.xcodeproj | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/config/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# --- IMPORTS --- | ||
|
||
# Imports environment variables. | ||
environment_vars ?= .env | ||
|
||
include $(environment_vars) | ||
export $(shell sed 's/=.*//' $(environment_vars)) | ||
|
||
# --- ARGUMENTS --- | ||
|
||
override docker?=${CLI_USE_DOCKER} | ||
override tag?=${DOCKER_IMAGE_TAG} | ||
override platform?=${DOCKER_IMAGE_PLATFORM} | ||
override config?=${SWIFT_BUILD_CONFIGURATION} | ||
override clean?=${DOCKER_IMAGE_CLEAN} | ||
|
||
# --- DEPENDENCIES --- | ||
|
||
outdated: ## List the package dependencies that can be updated. | ||
@swift package update --dry-run | ||
|
||
update: ## Update the package dependencies defined in the project. | ||
@swift package update | ||
|
||
# --- DEVELOPMENT --- | ||
|
||
build: ## Build this package with Swift either locally or in a Docker image. | ||
ifeq ($(docker),yes) | ||
@-docker run \ | ||
--rm \ | ||
--volume ${PWD}:${DOCKER_VOLUME_TARGET} \ | ||
--workdir ${DOCKER_VOLUME_TARGET} \ | ||
--platform ${platform} \ | ||
${DOCKER_IMAGE_NAME}:${tag} \ | ||
swift build --configuration ${config} | ||
ifeq ($(clean),yes) | ||
@docker rmi ${DOCKER_IMAGE_NAME}:${tag} | ||
endif | ||
else | ||
@swift build --configuration ${config} | ||
endif | ||
|
||
# --- TESTING --- | ||
|
||
test: ## Test this package with Swift either locally or in a Docker image. | ||
ifeq ($(docker),yes) | ||
@-docker run \ | ||
--rm \ | ||
--volume ${PWD}:${DOCKER_VOLUME_TARGET} \ | ||
--workdir ${DOCKER_VOLUME_TARGET} \ | ||
--platform ${platform} \ | ||
${DOCKER_IMAGE_NAME}:${tag} \ | ||
swift test --configuration ${config} | ||
ifeq ($(clean),yes) | ||
@docker rmi ${DOCKER_IMAGE_NAME}:${tag} | ||
endif | ||
else | ||
@swift test --configuration ${config} | ||
endif | ||
|
||
# --- HOUSE-KEEPING --- | ||
|
||
clean: ## Clean the build artifacts of the package. | ||
@swift package clean | ||
|
||
reset: ## Reset the build folder of the package. | ||
@swift package reset | ||
|
||
flush-images: ## Flush all outstanding Swift docker images. | ||
@docker images \ | ||
--all | grep ${DOCKER_IMAGE_NAME} | awk '{print $$3}' | xargs docker rmi --force | ||
|
||
# --- MISCELLANEOUS --- | ||
|
||
xcode: ## Open this package in Xcode. | ||
@open -a Xcode Package.swift | ||
|
||
# --- HELP --- | ||
|
||
# Outputs the documentation for each of the defined tasks when `help` is called. | ||
# Reference: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | ||
.PHONY: help | ||
|
||
help: ## Prints the written documentation for all the defined tasks. | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
||
.DEFAULT_GOAL := help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.