Skip to content

Instantly share code, notes, and snippets.

@alllex
alllex / aggregate-report.md
Created March 5, 2024 05:53
Usages of before/afterResolve by Gradle Plugins

Plugin validation report

Produced at 2024-03-05 13:49:38

Calls any of beforeResolve, afterResolve on Lorg/gradle/api/artifacts/ResolvableDependencies; (5)

  • 💬 method com.android.build.gradle.internal.DependencyConfigurator$configureDependencyChecks$1.execute(Configuration) calls afterResolve on org.gradle.api.artifacts.ResolvableDependencies
  • 💬 method com.android.build.gradle.internal.DependencyResolutionChecks$registerDependencyCheck$4.execute(Configuration) calls beforeResolve on org.gradle.api.artifacts.ResolvableDependencies
@alllex
alllex / notes.md
Last active January 23, 2024 03:53
Gradle service graph visualization

Gradle service graph visualization

Branch: https://github.com/gradle/gradle/compare/alllex/service-registry-graph-tracing

On the branch, run any test, grep the test output for lines starting with YYY:. This provides a Mermaid diagram sources.

Caution

The graph is not correct, because it conflates nodes from different classloaders and processes

@alllex
alllex / MyWrapperIntegrationTest.java
Created December 9, 2023 22:45
Test that allows extending a built-in Wrapper task by a non abstract user-defined class
class TmpIntegrationTest extends AbstractIntegrationSpec {
def "tmp test"() {
settingsFile << """
rootProject.name = "root"
"""
buildFile << """
class MyWrapper extends Wrapper {
// Just to make MyWrapper compile
@alllex
alllex / idea-sync-models-simple-java.csv
Created November 22, 2023 18:28
Idea sync models for a simple Java project
'org.gradle.tooling.model.gradle.GradleBuild' build ':'
'org.gradle.tooling.model.build.BuildEnvironment' root project 'my-project'
'org.jetbrains.plugins.gradle.model.internal.DummyModel' root project 'my-project'
'org.gradle.tooling.model.build.BuildEnvironment' root project 'my-project'
'org.jetbrains.kotlin.idea.gradleTooling.PrepareKotlinIdeImportTaskModel' root project 'my-project'
'org.jetbrains.kotlin.idea.gradleTooling.PrepareKotlinIdeImportTaskModel' project ':app'
'org.jetbrains.kotlin.idea.gradleTooling.PrepareKotlinIdeImportTaskModel' project ':lib'
'org.jetbrains.kotlin.idea.gradleTooling.KotlinDslScriptAdditionalTask' root project 'my-project'
'org.jetbrains.plugins.gradle.model.internal.TurnOffDefaultTasks' root project 'my-project'
'org.gradle.tooling.model.build.BuildEnvironment' root project 'my-project'
@alllex
alllex / build.gradle.kts
Created October 3, 2023 12:34
Maven Central Snapshot repository in Gradle
repositories {
// Maven Central Snapshots
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
content {
includeGroup("me.alllex.some.group")
}
}
mavenCentral()
}
@alllex
alllex / links.yml
Last active March 28, 2024 08:25
Link sink
@alllex
alllex / public_package_matches.txt
Created September 29, 2023 12:23
Directories that contains matches for `package org.gradle.somepackage` strings per each package listed in the Public API
Searching for 'org.gradle'
build-logic/kotlin-dsl/src/main/kotlin/gradlebuild/kotlindsl/generator/tasks
platforms/core-configuration/base-services-groovy/src/main/java/org/gradle/api/specs
platforms/core-configuration/base-services-groovy/src/main/java/org/gradle/groovy/scripts
platforms/core-configuration/configuration-cache/src/main/kotlin/org/gradle/configurationcache/cacheentry
platforms/core-configuration/configuration-cache/src/main/kotlin/org/gradle/configurationcache/extensions
platforms/core-configuration/configuration-cache/src/main/kotlin/org/gradle/configurationcache/fingerprint
platforms/core-configuration/configuration-cache/src/main/kotlin/org/gradle/configurationcache/flow
platforms/core-configuration/configuration-cache/src/main/kotlin/org/gradle/configurationcache/initialization
import java.util.concurrent.atomic.AtomicInteger
import kotlin.concurrent.thread
class FizzBuzzRace(private val n: Int) {
private enum class Owner { Fizz, Buzz, FizzBuzz, Num }
private val state = AtomicInteger(1)
private fun getOwner(k: Int) = when {
@alllex
alllex / parsus-using-deep-recursive.kt
Created March 4, 2023 12:02
Kotlin coroutine-based parser combinators implemented on top of DeepRecursiveFunction
data class Token(val value: String)
data class TokenMatch(val token: Token, val offset: Int)
sealed class SyntaxTree
data class Node(val children: List<SyntaxTree>) : SyntaxTree() {
constructor(vararg children: SyntaxTree) : this(children.toList())
override fun toString(): String = "Node($children)"
@alllex
alllex / obsidian-style-tweaks.css
Last active February 23, 2024 17:35
Drop-in style tweaks for Obsidian making Live Preview as close as possible to the rendered Preview.
/* Obsdian styles */
/* Tested on v0.14.2 */
/*
Partially based on:
- https://github.com/Dmitriy-Shulha/obsidian-css-snippets
*/
/* tags */
/* ---- */