Skip to content

Instantly share code, notes, and snippets.

@cdsap
cdsap / request.sh
Created March 7, 2025 01:46
Get Modules executed in a set Of builds
curl --location -G 'https://$DV_URL/api/builds?maxBuilds=50&models=gradle-build-cache-performance&reverse=true' --header "Authorization: Bearer $TOKEN" --data-urlencode 'query=project:nowinandroid_test gradle.requestedTasks:assembleDebug'
$RESPONSE | jq '[.[]
| {
id: .models.gradleBuildCachePerformance.model.id,
buildDuration: .models.gradleBuildCachePerformance.model.buildTime,
modules: (
(.models.gradleBuildCachePerformance.model.taskExecution // [])
| map(select(.taskType=="org.jetbrains.kotlin.gradle.tasks.KotlinCompile" and .avoidanceOutcome=="executed_cacheable")
| (.taskPath // "") | split(":")[:-1] | join(":")
@cdsap
cdsap / monitor.sh
Created March 25, 2025 20:32
JVM Memory process monitor
#!/bin/bash
PATTERNS=("GradleDaemon" "KotlinCompileDaemon" "GradleWorkerMain")
LOG_FILE="java_mem_monitor.log"
INTERVAL=5
echo "Starting memory monitor at $(date)" > "$LOG_FILE"
echo "Timestamp | PID | Name | Heap_Used_MB | Heap_Capacity_MB | RSS_MB" >> "$LOG_FILE"
while true; do
@cdsap
cdsap / gradle-user-home-size-report.sh
Created February 17, 2026 22:07
Gradle User Home storage breakdown
#!/usr/bin/env bash
set -euo pipefail
GRADLE_HOME="${1:-$HOME/.gradle}"
CACHES="$GRADLE_HOME/caches"
# human readable formatter (KB -> IEC)
human_kb() {
awk 'function human_bytes(b) {
s="B KB MB GB TB PB";
@cdsap
cdsap / post-process.py
Created June 1, 2026 21:32
Post-process iOS-source JUnit XML for Develocity GENERIC dialect import
#!/usr/bin/env python3
"""
Post-process iOS-source JUnit XML for Develocity GENERIC dialect import.
Handles output shapes from xcresultparser, Fastlane scan (trainer), and
Swift Testing (swift test --xunit-output). For each <testsuite>:
1. Add a timestamp attribute (synthesised from xcresult startTime if available)
2. Strip the .xctest suffix from suite names (xcresultparser only)
3. Reshape <failure> elements to FQCN-prefixed form with synthetic stack frame
4. Append <system-out/>