ElasticsearchJavaPluginFuncTest.groovy 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
  3. * or more contributor license agreements. Licensed under the Elastic License
  4. * 2.0 and the Server Side Public License, v 1; you may not use this file except
  5. * in compliance with, at your election, the Elastic License 2.0 or the Server
  6. * Side Public License, v 1.
  7. */
  8. package org.elasticsearch.gradle.internal
  9. import org.elasticsearch.gradle.fixtures.AbstractGradleFuncTest
  10. class ElasticsearchJavaPluginFuncTest extends AbstractGradleFuncTest {
  11. def "compatibility options are resolved from from build params minimum runtime version"() {
  12. when:
  13. buildFile.text = """
  14. plugins {
  15. id 'elasticsearch.global-build-info'
  16. }
  17. import org.elasticsearch.gradle.Architecture
  18. import org.elasticsearch.gradle.internal.info.BuildParams
  19. BuildParams.init { it.setMinimumRuntimeVersion(JavaVersion.VERSION_1_10) }
  20. apply plugin:'elasticsearch.java'
  21. assert compileJava.sourceCompatibility == JavaVersion.VERSION_1_10.toString()
  22. assert compileJava.targetCompatibility == JavaVersion.VERSION_1_10.toString()
  23. """
  24. then:
  25. gradleRunner("help").build()
  26. }
  27. def "compile option --release is configured from targetCompatibility"() {
  28. when:
  29. buildFile.text = """
  30. plugins {
  31. id 'elasticsearch.java'
  32. }
  33. compileJava.targetCompatibility = "1.10"
  34. afterEvaluate {
  35. assert compileJava.options.release.get() == 10
  36. }
  37. """
  38. then:
  39. gradleRunner("help").build()
  40. }
  41. }