Skip to content

Instantly share code, notes, and snippets.

View jprinet's full-sized avatar

Jérôme Prinet jprinet

  • Bayonne, France
  • 07:06 (UTC +02:00)
View GitHub Profile
@jprinet
jprinet / build.gradle
Last active September 28, 2022 08:21
Ignore JavaCompile task input differences compilerArgumentProviders.$i.extractedJdkImage
// This normalization block should be combined with the Android cache fix plugin
// https://github.com/gradle/android-cache-fix-gradle-plugin#applying-the-plugin
normalization {
runtimeClasspath {
// See https://github.com/gradle/android-cache-fix-gradle-plugin/issues/341 for more details
ignore '**/java/lang/invoke/**'
}
}
@jprinet
jprinet / gradle-processor-arch.gradle
Last active August 4, 2022 11:00
CC compatible version of gradle-processor-arch.gradle
import java.nio.charset.Charset
import java.util.concurrent.TimeUnit
/**
* This Gradle script captures the processor architecture
* and adds these as a custom value.
* This should be applied to the root project:
* <code> apply from: file('gradle-processor-arch.gradle') </code>
*/
@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
@jprinet
jprinet / capture-classpath.gradle
Created July 20, 2022 08:24
Capture classpath entries with their size
import java.nio.file.Files
tasks.withType(JavaCompile) {
doLast {
def sizes = it.classpath.collect {
if (it.isFile()) {
return new FileSize(Files.size(it.toPath())/(1024*1024), "F ${it}")
} else {
return new FileSize(0, "D ${it}")
}
@jprinet
jprinet / build.gradle
Created July 7, 2022 11:18
Grab checkstyle issues in a configuration cache compatible way
abstract class CheckstyleReportAsCustomValueBuildService implements BuildService<CheckstyleReportAsCustomValueBuildService.Params>, OperationCompletionListener {
interface Params extends BuildServiceParameters {
ListProperty<FileSystemLocation> getReports()
Property<BuildScanExtension> getBuildScanApi()
}
@Override
void onFinish(FinishEvent finishEvent) {
if(finishEvent.getDescriptor().displayName.contains("checkstyle")){
@jprinet
jprinet / wait-until-ready.sh
Created January 20, 2020 21:36
wrapper script to launch command when dependency is ready
#!/bin/sh
readonly MAX_RETRY=10
readonly DELAY_BETWEEN_TRY_IN_SECONDS=10
readonly DEPENDENCY_CHECK_COMMAND=$1
readonly CONTAINER_RUN_COMMAND=$2
# wait until a command succeeds
#
# Usage: waitUntilReady "<command arg1...argN>"