diff --git a/tools/hangar/.gitignore b/tools/hangar/.gitignore index ba8194ab6f..bdc7f8a119 100644 --- a/tools/hangar/.gitignore +++ b/tools/hangar/.gitignore @@ -1,6 +1,4 @@ .task bin frontend/dist -frontend/node_modules -build/linux/appimage/build -build/windows/nsis/MicrosoftEdgeWebview2Setup.exe \ No newline at end of file +frontend/node_modules \ No newline at end of file diff --git a/tools/hangar/Taskfile.yml b/tools/hangar/Taskfile.yml index 0fae44a5bc..95541ba971 100644 --- a/tools/hangar/Taskfile.yml +++ b/tools/hangar/Taskfile.yml @@ -41,28 +41,3 @@ tasks: # Wrapper script (real bash) traps Ctrl+C and frees the Vite port, which # wails3 dev otherwise orphans. See scripts/dev.sh. - bash scripts/dev.sh {{.VITE_PORT}} - - setup:docker: - summary: Builds Docker image for cross-compilation (~800MB download) - cmds: - - task: common:setup:docker - - build:server: - summary: Builds the application in server mode (no GUI, HTTP server only) - cmds: - - task: common:build:server - - run:server: - summary: Runs the application in server mode - cmds: - - task: common:run:server - - build:docker: - summary: Builds a Docker image for server mode deployment - cmds: - - task: common:build:docker - - run:docker: - summary: Builds and runs the Docker image - cmds: - - task: common:run:docker diff --git a/tools/hangar/build/Taskfile.yml b/tools/hangar/build/Taskfile.yml index 1f7f025c01..512a1270a5 100644 --- a/tools/hangar/build/Taskfile.yml +++ b/tools/hangar/build/Taskfile.yml @@ -126,43 +126,6 @@ tasks: vars: SCRIPT: "{{.SCRIPT}}" - frontend:vendor:puppertino: - summary: Fetches Puppertino CSS into frontend/public for consistent mobile styling - sources: - - frontend/public/puppertino/puppertino.css - generates: - - frontend/public/puppertino/puppertino.css - cmds: - - | - set -euo pipefail - mkdir -p frontend/public/puppertino - # If bundled Puppertino exists, prefer it. Otherwise, try to fetch, but don't fail build on error. - if [ ! -f frontend/public/puppertino/puppertino.css ]; then - echo "No bundled Puppertino found. Attempting to fetch from GitHub..." - if curl -fsSL https://raw.githubusercontent.com/codedgar/Puppertino/main/dist/css/full.css -o frontend/public/puppertino/puppertino.css; then - curl -fsSL https://raw.githubusercontent.com/codedgar/Puppertino/main/LICENSE -o frontend/public/puppertino/LICENSE || true - echo "Puppertino CSS downloaded to frontend/public/puppertino/puppertino.css" - else - echo "Warning: Could not fetch Puppertino CSS. Proceeding without download since template may bundle it." - fi - else - echo "Using bundled Puppertino at frontend/public/puppertino/puppertino.css" - fi - # Ensure index.html includes Puppertino CSS and button classes - INDEX_HTML=frontend/index.html - if [ -f "$INDEX_HTML" ]; then - if ! grep -q 'href="/puppertino/puppertino.css"' "$INDEX_HTML"; then - # Insert Puppertino link tag after style.css link - awk ' - /href="\/style.css"\/?/ && !x { print; print " "; x=1; next }1 - ' "$INDEX_HTML" > "$INDEX_HTML.tmp" && mv "$INDEX_HTML.tmp" "$INDEX_HTML" - fi - # Replace default .btn with Puppertino primary button classes if present - sed -E -i'' 's/class=\"btn\"/class=\"p-btn p-prim-col\"/g' "$INDEX_HTML" || true - fi - - - generate:bindings: label: generate:bindings (BUILD_FLAGS={{.BUILD_FLAGS}}) summary: Generates bindings for the frontend @@ -222,135 +185,3 @@ tasks: dir: build cmds: - wails3 update build-assets -name "{{.APP_NAME}}" -binaryname "{{.APP_NAME}}" -config config.yml -dir . - - build:server: - summary: Builds the application in server mode (no GUI, HTTP server only) - desc: | - Builds the application with the server build tag enabled. - Server mode runs as a pure HTTP server without native GUI dependencies. - Usage: task build:server - deps: - - task: build:frontend - vars: - BUILD_FLAGS: - ref: .BUILD_FLAGS - cmds: - - go build -tags server {{.BUILD_FLAGS}} -o {{.BIN_DIR}}/{{.APP_NAME}}-server{{exeExt}} - vars: - BUILD_FLAGS: "{{.BUILD_FLAGS}}" - - run:server: - summary: Builds and runs the application in server mode - deps: - - task: build:server - cmds: - - ./{{.BIN_DIR}}/{{.APP_NAME}}-server{{exeExt}} - - build:docker: - summary: Builds a Docker image for server mode deployment - desc: | - Creates a minimal Docker image containing the server mode binary. - The image is based on distroless for security and small size. - Usage: task build:docker [TAG=myapp:latest] - cmds: - - docker build -t {{.TAG | default (printf "%s:latest" .APP_NAME)}} -f build/docker/Dockerfile.server . - vars: - TAG: "{{.TAG}}" - preconditions: - - sh: docker info > /dev/null 2>&1 - msg: "Docker is required. Please install Docker first." - - sh: test -f build/docker/Dockerfile.server - msg: "Dockerfile.server not found. Run 'wails3 update build-assets' to generate it." - - run:docker: - summary: Builds and runs the Docker image - desc: | - Builds the Docker image and runs it, exposing port 8080. - Usage: task run:docker [TAG=myapp:latest] [PORT=8080] - Note: The internal container port is always 8080. The PORT variable - only changes the host port mapping. Ensure your app uses port 8080 - or modify the Dockerfile to match your ServerOptions.Port setting. - deps: - - task: build:docker - vars: - TAG: - ref: .TAG - cmds: - - docker run --rm -p {{.PORT | default "8080"}}:8080 {{.TAG | default (printf "%s:latest" .APP_NAME)}} - vars: - TAG: "{{.TAG}}" - PORT: "{{.PORT}}" - - setup:docker: - summary: Builds Docker image for cross-compilation (~800MB download) - desc: | - Builds the Docker image needed for cross-compiling to any platform. - Run this once to enable cross-platform builds from any OS. - cmds: - - docker build -t wails-cross -f build/docker/Dockerfile.cross build/docker/ - preconditions: - - sh: docker info > /dev/null 2>&1 - msg: "Docker is required. Please install Docker first." - - ios:device:list: - summary: Lists connected iOS devices (UDIDs) - cmds: - - xcrun xcdevice list - - ios:run:device: - summary: Build, install, and launch on a physical iPhone using Apple tools (xcodebuild/devicectl) - vars: - PROJECT: '{{.PROJECT}}' # e.g., build/ios/xcode/.xcodeproj - SCHEME: '{{.SCHEME}}' # e.g., ios.dev - CONFIG: '{{.CONFIG | default "Debug"}}' - DERIVED: '{{.DERIVED | default "build/ios/DerivedData"}}' - UDID: '{{.UDID}}' # from `task ios:device:list` - BUNDLE_ID: '{{.BUNDLE_ID}}' # e.g., com.yourco.wails.ios.dev - TEAM_ID: '{{.TEAM_ID}}' # optional, if your project is not already set up for signing - preconditions: - - sh: xcrun -f xcodebuild - msg: "xcodebuild not found. Please install Xcode." - - sh: xcrun -f devicectl - msg: "devicectl not found. Please update to Xcode 15+ (which includes devicectl)." - - sh: test -n '{{.PROJECT}}' - msg: "Set PROJECT to your .xcodeproj path (e.g., PROJECT=build/ios/xcode/App.xcodeproj)." - - sh: test -n '{{.SCHEME}}' - msg: "Set SCHEME to your app scheme (e.g., SCHEME=ios.dev)." - - sh: test -n '{{.UDID}}' - msg: "Set UDID to your device UDID (see: task ios:device:list)." - - sh: test -n '{{.BUNDLE_ID}}' - msg: "Set BUNDLE_ID to your app's bundle identifier (e.g., com.yourco.wails.ios.dev)." - cmds: - - | - set -euo pipefail - echo "Building for device: UDID={{.UDID}} SCHEME={{.SCHEME}} PROJECT={{.PROJECT}}" - XCB_ARGS=( - -project "{{.PROJECT}}" - -scheme "{{.SCHEME}}" - -configuration "{{.CONFIG}}" - -destination "id={{.UDID}}" - -derivedDataPath "{{.DERIVED}}" - -allowProvisioningUpdates - -allowProvisioningDeviceRegistration - ) - # Optionally inject signing identifiers if provided - if [ -n '{{.TEAM_ID}}' ]; then XCB_ARGS+=(DEVELOPMENT_TEAM={{.TEAM_ID}}); fi - if [ -n '{{.BUNDLE_ID}}' ]; then XCB_ARGS+=(PRODUCT_BUNDLE_IDENTIFIER={{.BUNDLE_ID}}); fi - # Prefer xcpretty for readable output, but only when it's installed — - # piping through a missing/failing xcpretty must not mask a real - # xcodebuild failure (pipefail propagates it in the xcpretty branch). - if command -v xcpretty >/dev/null 2>&1; then - xcodebuild "${XCB_ARGS[@]}" build | xcpretty - else - xcodebuild "${XCB_ARGS[@]}" build - fi - # Find built .app - APP_PATH=$(find "{{.DERIVED}}/Build/Products" -type d -name "*.app" -maxdepth 3 | head -n 1) - if [ -z "$APP_PATH" ]; then - echo "Could not locate built .app under {{.DERIVED}}/Build/Products" >&2 - exit 1 - fi - echo "Installing: $APP_PATH" - xcrun devicectl device install app --device "{{.UDID}}" "$APP_PATH" - echo "Launching: {{.BUNDLE_ID}}" - xcrun devicectl device process launch --device "{{.UDID}}" --stderr console --stdout console "{{.BUNDLE_ID}}" diff --git a/tools/hangar/build/config.yml b/tools/hangar/build/config.yml index 3d5d0962d0..4363691d56 100644 --- a/tools/hangar/build/config.yml +++ b/tools/hangar/build/config.yml @@ -1,5 +1,5 @@ # This file contains the configuration for this project. -# When you update `info` or `fileAssociations`, run `wails3 task common:update:build-assets` to update the assets. +# When you update `info`, run `wails3 task common:update:build-assets` to update the assets. # Note that this will overwrite any changes you have made to the assets. version: '3' @@ -16,20 +16,6 @@ info: # # Should match the name of your .icon file without the extension # # If not set and Assets.car exists, defaults to "appicon" -# iOS build configuration (uncomment to customise iOS project generation) -# Note: Keys under `ios` OVERRIDE values under `info` when set. -# ios: -# # The iOS bundle identifier used in the generated Xcode project (CFBundleIdentifier) -# bundleID: "com.mycompany.myproduct" -# # The display name shown under the app icon (CFBundleDisplayName/CFBundleName) -# displayName: "My Product" -# # The app version to embed in Info.plist (CFBundleShortVersionString/CFBundleVersion) -# version: "0.0.1" -# # The company/organisation name for templates and project settings -# company: "My Company" -# # Additional comments to embed in Info.plist metadata -# comments: "Some Product Comments" - # Dev mode configuration dev_mode: root_path: . @@ -57,23 +43,4 @@ dev_mode: - cmd: wails3 task common:dev:frontend type: background - cmd: wails3 task run - type: primary - -# File Associations -# More information at: https://v3.wails.io/noit/done/yet -fileAssociations: -# - ext: wails -# name: Wails -# description: Wails Application File -# iconName: wailsFileIcon -# role: Editor -# - ext: jpg -# name: JPEG -# description: Image File -# iconName: jpegFileIcon -# role: Editor -# mimeType: image/jpeg # (optional) - -# Other data -other: - - name: My Other Data \ No newline at end of file + type: primary \ No newline at end of file diff --git a/tools/hangar/build/darwin/Taskfile.yml b/tools/hangar/build/darwin/Taskfile.yml index 8148a7ad0c..5add15bea8 100644 --- a/tools/hangar/build/darwin/Taskfile.yml +++ b/tools/hangar/build/darwin/Taskfile.yml @@ -4,19 +4,17 @@ includes: common: ../Taskfile.yml vars: - # Signing configuration - edit these values for your project - # SIGN_IDENTITY: "Developer ID Application: Your Company (TEAMID)" - # KEYCHAIN_PROFILE: "my-notarize-profile" - # ENTITLEMENTS: "build/darwin/entitlements.plist" - - # Docker image for cross-compilation (used when building on non-macOS) - CROSS_IMAGE: wails-cross + # Signing configuration - fill these in for Developer ID signing / notarization + # (or override on the CLI). Leave empty for ad-hoc signing via `task package`. + SIGN_IDENTITY: "" # e.g. "Developer ID Application: Your Company (TEAMID)" + KEYCHAIN_PROFILE: "" # e.g. "my-notarize-profile" + ENTITLEMENTS: "" # e.g. "build/darwin/entitlements.plist" tasks: build: - summary: Builds the application + summary: Builds the application (macOS-only, native) cmds: - - task: '{{if eq OS "darwin"}}build:native{{else}}build:docker{{end}}' + - task: build:native vars: ARCH: '{{.ARCH}}' DEV: '{{.DEV}}' @@ -59,37 +57,6 @@ tasks: CGO_LDFLAGS: "-mmacosx-version-min=12.0" MACOSX_DEPLOYMENT_TARGET: "12.0" - build:docker: - summary: Cross-compiles for macOS using Docker (for Linux/Windows hosts) - internal: true - deps: - - task: common:build:frontend - vars: - OBFUSCATED: - ref: .OBFUSCATED - - task: common:generate:icons - preconditions: - - sh: docker info > /dev/null 2>&1 - msg: "Docker is required for cross-compilation. Please install Docker." - - sh: docker image inspect {{.CROSS_IMAGE}} > /dev/null 2>&1 - msg: | - Docker image '{{.CROSS_IMAGE}}' not found. - Build it first: wails3 task setup:docker - cmds: - - docker run --rm -v "{{.ROOT_DIR}}:/app" {{.DOCKER_MOUNTS}} -e APP_NAME="{{.APP_NAME}}" {{if .EXTRA_TAGS}}-e EXTRA_TAGS="{{.EXTRA_TAGS}}"{{end}} {{if eq .OBFUSCATED "true"}}-e OBFUSCATED=true{{end}} {{if .GARBLE_ARGS}}-e GARBLE_ARGS="{{.GARBLE_ARGS}}"{{end}} {{.CROSS_IMAGE}} darwin {{.DOCKER_ARCH}} - - cmd: docker run --rm -v "{{.ROOT_DIR}}:/app" alpine chown -R $(id -u):$(id -g) /app/bin - platforms: [linux, darwin] - - mkdir -p {{.BIN_DIR}} - - mv "bin/{{.APP_NAME}}-darwin-{{.DOCKER_ARCH}}" "{{.OUTPUT}}" - vars: - DOCKER_ARCH: '{{if eq .ARCH "arm64"}}arm64{{else if eq .ARCH "amd64"}}amd64{{else}}arm64{{end}}' - DEFAULT_OUTPUT: '{{.BIN_DIR}}/{{.APP_NAME}}' - OUTPUT: '{{ .OUTPUT | default .DEFAULT_OUTPUT }}' - # Generate Docker volume mounts: Go module cache + go.mod replace directives - # Uses wails3 tool docker-mounts for cross-platform compatibility (Windows/Linux/macOS) - DOCKER_MOUNTS: - sh: 'wails3 tool docker-mounts' - build:universal: summary: Builds darwin universal binary (arm64 + amd64) deps: @@ -102,7 +69,7 @@ tasks: ARCH: arm64 OUTPUT: "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" cmds: - - task: '{{if eq OS "darwin"}}build:universal:lipo:native{{else}}build:universal:lipo:go{{end}}' + - task: build:universal:lipo:native build:universal:lipo:native: summary: Creates universal binary using native lipo (macOS) @@ -111,13 +78,6 @@ tasks: - lipo -create -output "{{.BIN_DIR}}/{{.APP_NAME}}" "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" - rm "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" - build:universal:lipo:go: - summary: Creates universal binary using wails3 tool lipo (Linux/Windows) - internal: true - cmds: - - wails3 tool lipo -output "{{.BIN_DIR}}/{{.APP_NAME}}" -input "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" -input "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" - - rm -f "{{.BIN_DIR}}/{{.APP_NAME}}-amd64" "{{.BIN_DIR}}/{{.APP_NAME}}-arm64" - package: summary: Packages the application into a `.app` bundle deps: