Skip to content

Commit

Permalink
run code generators during Eclipse project synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Sep 3, 2024
1 parent 2e31df3 commit 50d70d0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
21 changes: 12 additions & 9 deletions caffeine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -291,17 +291,20 @@ for (scenario in Scenario.all()) {
}
}

eclipse.classpath {
plusConfigurations.add(configurations["javaPoetCompileClasspath"])

file.whenMerged {
if (this is EclipseClasspath) {
val regex = ".*collections4.*-tests.jar".toRegex()
entries.filterIsInstance<Library>()
.filter { regex.matches(it.path) }
.forEach { it.sourcePath = fileReference(file(collections4Sources.asPath)) }
eclipse {
classpath {
plusConfigurations.add(configurations["javaPoetCompileClasspath"])

file.whenMerged {
if (this is EclipseClasspath) {
val regex = ".*collections4.*-tests.jar".toRegex()
entries.filterIsInstance<Library>()
.filter { regex.matches(it.path) }
.forEach { it.sourcePath = fileReference(file(collections4Sources.asPath)) }
}
}
}
synchronizationTasks(generateLocalCaches, generateNodes)
}

idea.module {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
eclipse
`java-library`
}

Expand All @@ -14,3 +15,7 @@ dependencies {
tasks.named<Jar>("sourcesJar").configure {
dependsOn(tasks.compileJava)
}

eclipse {
synchronizationTasks(tasks.compileJava)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {

val eclipsePreferences by tasks.registering {
description = "Generates the Eclipse preferences files."
incompatibleWithConfigurationCache()
doFirst {
addPreferences("org.eclipse.core.resources.prefs", mapOf(
"encoding/<project>" to "UTF-8"))
Expand Down Expand Up @@ -41,6 +42,7 @@ fun addPreferences(path: String, preferences: Map<String, String>) {
val settings = file(".settings/$path")
if (!settings.exists()) {
settings.parentFile.mkdirs()
settings.createNewFile()
}
val updates = preferences + ("eclipse.preferences.version" to "1")
val text = settings.readLines()
Expand Down
15 changes: 9 additions & 6 deletions jcache/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ tasks.named<CheckForbiddenApis>("forbiddenApisTest").configure {
"jdk-non-portable", "jdk-reflection", "jdk-unsafe"))
}

eclipse.classpath.file.whenMerged {
if (this is Classpath) {
val regex = ".*cache-tests.*-tests.jar".toRegex()
entries.filterIsInstance<Library>()
.filter { regex.matches(it.path) }
.forEach { it.sourcePath = fileReference(file(jcacheTckSources.asPath)) }
eclipse {
classpath.file.whenMerged {
if (this is Classpath) {
val regex = ".*cache-tests.*-tests.jar".toRegex()
entries.filterIsInstance<Library>()
.filter { regex.matches(it.path) }
.forEach { it.sourcePath = fileReference(file(jcacheTckSources.asPath)) }
}
}
synchronizationTasks(testResourcesJar)
}

0 comments on commit 50d70d0

Please sign in to comment.