Skip to content

Instantly share code, notes, and snippets.

@gabrielfeo
gabrielfeo / .require-develocity-access-key.md
Last active January 26, 2026 19:44
A comprehensive example of how to require that developers provision a Develocity access key. Based on a snippet from @ribafish.

A comprehensive example of how to require that developers provision a Develocity access key. This sample throws a build failure if a usable key cannot be found and the current build is not to provision a key in the first place.

📖 Develocity Gradle plugin authentication docs

Firmly based on a snippet from @ribafish.

@gabrielfeo
gabrielfeo / .tag-ai-agent-gradle-builds.md
Last active January 31, 2026 00:22
tag-ai-agent-gradle-builds

The simplest way to distinguish AI agent builds is to simply ask. Observability and rich performance insights for both agent and human builds is possible with [Develocity][0] Build Scans®.

Why?

Tracking them is the first step to managing their impact on performance, cost, and quality. They still represent infrastructure usage and developer wait time. Read the whitepaper: [GenAI Won't Replace Your Continuous Delivery Pipeline — It Will Stress It][1].

How?

Ask agents via an instructions file to export or prefix their commands with a variable, then tag build scans accordingly. This approach works universally, even if some tools may offer other options (e.g. VS Code's [agent terminal profile settings][3]).

@jprinet
jprinet / process-scans.sh
Last active May 15, 2024 19:07
Get list of Github repositories in build scans
#!/bin/bash
# init parameters
readonly geUrl=$1
readonly bearerToken=$2
readonly daysAgo=$3
# init global vars
readonly maxBuildsPerBatch=100
readonly recoveryFile="$0.out.build-scan-id"
@ZacSweers
ZacSweers / Notes.md
Last active January 31, 2023 00:24
MergeFileTask Patch

The Problem

While doing some remote build cache fidelity testing in #66841, I found that our lint analysis tasks were consistently getting cache misses due to an esoteric intermediate proguard file contents change.

After a little digging, I found these files were generated by AGP as a "merged" file of all that project's generated proguard files. This was most notable in projects using Moshi, which generates proguard rules on the fly.

My hunch was that these files were being merged with non-deterministic order, as I couldn't find anything that ensured ordering and this input was purely a file contents check (so the same rules in different order would still constitute a miss).

I was able to verify this was the case via snagging merged proguard.txt files via github actions artifact uploads.

I filed this issue for it here: issuetracker.google.com/issues/266403349 (note it's been made private for some reason).

@jprinet
jprinet / capture.kts
Last active July 22, 2022 14:21
Capture Task inputs size
tasks.withType<JavaCompile>().configureEach {
doLast {
this.inputs.files.map { it ->
if(it.isFile) {
FileSize(it.length(), it.path)
} else {
FileSize(0, "DIR - " + it.path)
}
}.sortedBy {
it.size
@ghale
ghale / captureFingerprints.gradle
Last active March 13, 2025 17:59
Capture task classpath fingerprints
def fingerprinter = services.get(org.gradle.internal.fingerprint.classpath.ClasspathFingerprinter)
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { task ->
doFirst {
ClassLoader classLoader = task.getClass().classLoader
while (classLoader instanceof URLClassLoader) {
def fingerprints = [] as Set
def allFiles = [] as Set
classLoader.getURLs().each {
fingerprints.add(["${task.path}:${file(it.file).name}", "${fingerprinter.fingerprint(files(it.file)).hash}"])
allFiles.add(file(it.file))
/**
* 1) Change agpVersion
* 2) Run './gradlew dumpSources'
* 3) Check changeset into source control
*/
def agpVersion = 'UPDATE_THIS'
repositories {
google()
jcenter()
@suhtai
suhtai / Logger.kt
Last active May 17, 2018 10:35
Fluent Logging with Kotlin
inline fun <A> A.logWith(logger: Logger, block: Logger.(A) -> Unit) : A =
this.also { logger.block(it) }
// With interface injection
interface HasLog {
val log: Logger
fun <A> A.log(block: Logger.(A) -> Unit) : A =
logWith(logger, block)
}
/**
* Created by jjst on 21/03/16.
*/
object Floors {
def main(args: Array[String]): Unit = {
Console.println(floorNumber1("())"))
Console.println(floorNumber2("())"))
Console.println(floorNumber2(""))
}
@alxsimo
alxsimo / ResourceHelper.java
Created March 12, 2016 14:51
[Android] Load resources from unit test
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.net.URL;
public class ResourceHelper {
public String convertFileToString(File file) throws Exception {
BufferedReader reader = new BufferedReader(new FileReader(file));
StringBuilder sb = new StringBuilder();