summaryrefslogtreecommitdiff
path: root/deploy/buildbot/worker/prepare-build-dirs.sh
blob: e8e7cdb10235284b98ca4b01c157bdd2003d53ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/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 '<mod>/build' when creating directory
#    '<mod>/build/reports/<tool>'"
# 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"