This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath("commons-io:commons-io:2.5") | |
classpath("commons-codec:commons-codec:1.9") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repositories { | |
mavenCentral() | |
} | |
configurations { | |
foo | |
} | |
dependencies { | |
foo 'org.scala-lang:scala-library:latest.2_12' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { p -> | |
rootProject.buildScan.buildFinished { | |
def field = getAccessibleField(org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy.DefaultCachePolicy, "keepDynamicVersionsFor") | |
p.configurations.each { config -> | |
rootProject.buildScan.value "${p.name}.${config.name}.keepDynamicVersionsFor", "${field.get(config.resolutionStrategy.cachePolicy)/1000}s" | |
} | |
} | |
} | |
def getAccessibleField(Class<?> clazz, String fieldName) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def maxThreads = session.request.degreeOfConcurrency | |
if (maxThreads > 1) { | |
buildScan.tag "PARALLEL" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subprojects { | |
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompileWithWorkers).configureEach { task -> | |
doFirst { | |
task.inputs.visitRegisteredProperties(new PropertyVisitor(task)) | |
} | |
} | |
} | |
import org.gradle.api.internal.tasks.properties.* | |
class PropertyVisitor extends PropertyVisitor.Adapter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
tasks.withType(JavaCompile).configureEach { task -> | |
doFirst { | |
rootProject.buildScan.value "${task.path}.compilerArgs", options.compilerArgs.join("\n") | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.gradle.api.services.BuildService | |
import org.gradle.api.services.BuildServiceParameters | |
import java.nio.charset.Charset | |
import java.util.concurrent.Executors | |
import java.util.concurrent.ScheduledExecutorService | |
import java.util.concurrent.TimeUnit | |
/** | |
* This Gradle script captures the thermal stats as reported by the OS 'pmset' command, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gradle.taskGraph.whenReady { graph -> | |
graph.beforeTask { task -> | |
if (task instanceof org.jetbrains.kotlin.gradle.internal.KaptTask) { | |
if (task.destinationDir.exists()) { | |
if (task.destinationDir.listFiles().length == 0) { | |
logger.warn("Cleaning empty output directory at ${task.destinationDir}") | |
assert task.destinationDir.delete() | |
} else { | |
logger.warn("Not cleaning output directory at ${task.destinationDir} as it exists and is not empty. See the '${task.path}.destinationDir' custom value to see contents.") | |
captureOutputDirContents(task) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task checkForUntrackedOutput | |
gradle.taskGraph.whenReady { graph -> | |
def kaptTasks = [] | |
graph.allTasks.findAll { it instanceof org.jetbrains.kotlin.gradle.internal.KaptTask }.each { task -> | |
kaptTasks << task | |
} | |
if (graph.hasTask(':checkForUntrackedOutput')) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
plugins.withId('io.quarkus') { | |
tasks.withType(io.quarkus.gradle.tasks.QuarkusGenerateCode).configureEach { task -> | |
def sourcesDirectories = getAccessibleField(task.class, 'sourcesDirectories') | |
def sources = sourcesDirectories.get(task).collect { it.toFile() } | |
task.inputs.files(sources) | |
.withPropertyName('sources') | |
.withPathSensitivity(PathSensitivity.RELATIVE) | |
def test = getAccessibleField(task.class, 'test') |
NewerOlder