Skip to content

Commit 82be243

Browse files
authored
Refactor preview feature task to better support composite builds (#117594)
1 parent 2e9ef40 commit 82be243

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

build-tools-internal/src/main/groovy/elasticsearch.ide.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,18 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
142142
description = 'Enables preview features on native library module'
143143
dependsOn tasks.named("enableExternalConfiguration")
144144

145-
doLast {
146-
['main', 'test'].each { sourceSet ->
147-
modifyXml(".idea/modules/libs/native/elasticsearch.libs.native.${sourceSet}.iml") { xml ->
148-
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = 'JDK_21_PREVIEW'
145+
ext {
146+
enablePreview = { moduleFile, languageLevel ->
147+
modifyXml(moduleFile) { xml ->
148+
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = languageLevel
149149
}
150150
}
151151
}
152+
153+
doLast {
154+
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.main.iml', 'JDK_21_PREVIEW')
155+
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.test.iml', 'JDK_21_PREVIEW')
156+
}
152157
}
153158

154159
tasks.register('buildDependencyArtifacts') {

0 commit comments

Comments
 (0)