Skip to content

Commit

Permalink
Replace justfile with makefile and unify project naming
Browse files Browse the repository at this point in the history
  • Loading branch information
qianlifeng committed Dec 19, 2024
1 parent 8d39729 commit 975b268
Show file tree
Hide file tree
Showing 441 changed files with 2,413 additions and 1,605 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Check plugin updates
run: just ci_plugin
run: make plugins
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
Expand Down
22 changes: 8 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
*.diagsession
Output-Performance.txt
*.diff
.idea
.DS_Store
publish
Wox/resource/hosts/
Wox.Plugin.Host.Python/python-host/
Wox.Plugin.Host.Python/python-host.pyz
Wox.Plugin.Host.Python/venv/
wox.core/resource/hosts/
wox.plugin.host.python/python-host/
wox.plugin.host.python/python-host.pyz
*.pyz
Wox/resource/ui/wox
Plugins/Wox.Plugin.Chatgpt/dist/
Wox/resource/ui/react/
Wox/resource/ui/electron/
Wox/resource/ui/flutter/
Wox.UI.React/dist/
wox.core/resource/ui/flutter/
node_modules/
__pycache__/
Release/
__debug_bin*
Wox/log/
Wox.Plugin.Python/dist/
Wox.Plugin.Python/wox_plugin.egg-info/
wox.core/log/
wox.plugin.python/dist/
wox.plugin.python/wox_plugin.egg-info/
.venv/
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
{
"dart.lineLength": 200,
"python.languageServer": "Pylance",
"python.analysis.typeCheckingMode": "strict",
"python.analysis.diagnosticMode": "workspace",
"python.analysis.inlayHints.functionReturnTypes": true,
"python.analysis.inlayHints.variableTypes": true,
"python.analysis.autoFormatStrings": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.diagnosticSeverityOverrides": {
"reportUnknownMemberType": "error",
"reportUnknownVariableType": "error",
"reportUnknownArgumentType": "error",
"reportUnknownParameterType": "error",
"reportMissingTypeStubs": "error",
"reportUnknownLambdaType": "error",
"reportOptionalCall": "error",
"reportOptionalMemberAccess": "error",
"reportOptionalSubscript": "error",
"reportOptionalIterable": "error",
"reportOptionalContextManager": "error",
"reportOptionalOperand": "error"
},
"files.exclude": {
"wox.plugin.host.nodejs": true,
"wox.plugin.host.python": true,
"wox.plugin.nodejs": true,
"wox.plugin.python": true,
"wox.ui.flutter": true,
"wox.core": true
}
}
104 changes: 104 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
.PHONY: publish clean _bundle_mac_app plugins help dev test check_deps

# Determine the current platform
ifeq ($(OS),Windows_NT)
PLATFORM := windows
ARCH := amd64
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
PLATFORM := linux
ARCH := amd64
endif
ifeq ($(UNAME_S),Darwin)
PLATFORM := macos
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),arm64)
ARCH := arm64
else
ARCH := amd64
endif
endif
endif

RELEASE_DIR := release

help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " help Show this help message"
@echo " dev Setup development environment"
@echo " test Run tests"
@echo " publish Build and publish all components"
@echo " plugins Update plugin store"
@echo " clean Clean release directory"

_check_deps:
@echo "Checking required dependencies..."
@command -v go >/dev/null 2>&1 || { echo "❌ go is required but not installed. Visit https://golang.org/doc/install" >&2; exit 1; }
@command -v flutter >/dev/null 2>&1 || { echo "❌ flutter is required but not installed. Visit https://flutter.dev/docs/get-started/install" >&2; exit 1; }
@command -v node >/dev/null 2>&1 || { echo "❌ nodejs is required but not installed. Visit https://nodejs.org/" >&2; exit 1; }
@command -v pnpm >/dev/null 2>&1 || { echo "❌ pnpm is required but not installed. Run: npm install -g pnpm" >&2; exit 1; }
@command -v uv >/dev/null 2>&1 || { echo "❌ uv is required but not installed. Visit https://github.com/astral-sh/uv" >&2; exit 1; }
ifeq ($(PLATFORM),macos)
@command -v create-dmg >/dev/null 2>&1 || { echo "❌ create-dmg is required but not installed. Visit https://github.com/create-dmg/create-dmg" >&2; exit 1; }
else
@command -v upx >/dev/null 2>&1 || { echo "❌ upx is required but not installed. Visit https://upx.github.io/" >&2; exit 1; }
endif

clean:
rm -rf $(RELEASE_DIR)

plugins:
cd ci && go run plugin.go

dev: _check_deps
# Install lefthook
go install github.com/evilmartians/lefthook@latest
lefthook install -f

# Build hosts and flutter
$(MAKE) -C wox.plugin.host.nodejs build
$(MAKE) -C wox.plugin.host.python build
$(MAKE) -C wox.ui.flutter/wox build

test: dev
cd wox.core && go test ./...

publish: clean dev
$(MAKE) -C wox.core build

ifeq ($(PLATFORM),windows)
upx $(RELEASE_DIR)/wox-windows-amd64.exe
else ifeq ($(PLATFORM),linux)
upx $(RELEASE_DIR)/wox-linux-amd64
else ifeq ($(PLATFORM),macos)
# to make sure the working directory is the release directory
cd $(RELEASE_DIR) && $(MAKE) -f ../Makefile _bundle_mac_app APP_NAME=wox-mac-$(ARCH)
endif

_bundle_mac_app:
chmod +x $(APP_NAME)
rm -rf $(APP_NAME).app Wox.app
mkdir -p $(APP_NAME).app/Contents/MacOS
mkdir -p $(APP_NAME).app/Contents/Resources
cp $(APP_NAME) $(APP_NAME).app/Contents/MacOS/wox
cp ../assets/mac/Info.plist $(APP_NAME).app/Contents/Info.plist
cp ../assets/mac/app.icns $(APP_NAME).app/Contents/Resources/app.icns
mv $(APP_NAME).app Wox.app
security unlock-keychain -p $(KEYCHAINPWD) login.keychain
codesign --options=runtime --force --deep --sign "Developer ID Application: jiajuan mao (AGYCFD2ZGN)" Wox.app/Contents/MacOS/wox
create-dmg \
--codesign "Developer ID Application: jiajuan mao (AGYCFD2ZGN)" \
--notarize "wox" \
--volname "Wox Installer" \
--volicon "../assets/mac/app.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "Wox.app" 200 190 \
--hide-extension "Wox.app" \
--app-drop-link 600 185 \
Wox.dmg Wox.app
mv "Wox.dmg" $(APP_NAME).dmg
5 changes: 0 additions & 5 deletions Wox.Plugin.Host.Python/Makefile

This file was deleted.

11 changes: 0 additions & 11 deletions Wox.Plugin.Host.Python/pyproject.toml

This file was deleted.

Loading

0 comments on commit 975b268

Please sign in to comment.