Skip to content

Commit

Permalink
Refactor preview feature task to better support composite builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-vieira committed Nov 26, 2024
1 parent e9f899e commit 99345df
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions build-tools-internal/src/main/groovy/elasticsearch.ide.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,18 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
description = 'Enables preview features on native library module'
dependsOn tasks.named("enableExternalConfiguration")

doLast {
['main', 'test'].each { sourceSet ->
modifyXml(".idea/modules/libs/native/elasticsearch.libs.native.${sourceSet}.iml") { xml ->
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = 'JDK_21_PREVIEW'
ext {
enablePreview = { moduleFile, languageLevel ->
modifyXml(moduleFile) { xml ->
xml.component.find { it.'@name' == 'NewModuleRootManager' }?.'@LANGUAGE_LEVEL' = languageLevel
}
}
}

doLast {
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.main.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.test.iml', 'JDK_21_PREVIEW')
}
}

tasks.register('buildDependencyArtifacts') {
Expand Down

0 comments on commit 99345df

Please sign in to comment.