#!/bin/sh # Pre-create the Gradle build directories this tree will write into. # # WHY: this worker may run under FreeBSD's Linuxulator (podman on FreeBSD, no # Linux kernel). There, Java NIO's Files.createDirectories - which Gradle uses # to create build/reports/... - fails with # "Failed to create parent directory '/build' when creating directory # '/build/reports/'" # even though a plain `mkdir -p` of the same path succeeds. The workaround is # to create the parent directories before Gradle runs; Gradle then finds them # existing and does not need the failing path. On a real Linux kernel this # script is a harmless no-op. # # Usage: prepare-build-dirs.sh [root] # root defaults to the current directory. set -e ROOT="${1:-.}" cd "$ROOT" count=0 for mod in \ apps/android apps/desktop modules/orgflow-domain modules/orgflow-ui \ modules/zero-bridge-android modules/fsmp-transport \ modules/orgflow-content-store modules/zero-bridge do if [ -d "$mod" ]; then for sub in build build/reports build/reports/detekt build/test-results \ build/classes build/libs build/outputs build/outputs/logs \ build/distributions build/bin build/tmp build/screenshots \ build/intermediates build/generated build/processed_res do mkdir -p "$mod/$sub" && count=$((count + 1)) done fi done # Root-level aggregate dirs Gradle writes to. for sub in build build/reports build/reports/problems build/tmp; do mkdir -p "$sub" && count=$((count + 1)) done echo "prepare-build-dirs: created $count directories under $ROOT"