JacocoPlugin.groovy 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright 2016-2018 the original author or authors.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * https://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package io.spring.gradle.convention
  17. import org.gradle.api.Plugin
  18. import org.gradle.api.Project
  19. import org.gradle.api.plugins.JavaPlugin
  20. /**
  21. * Adds a version of jacoco to use and makes check depend on jacocoTestReport.
  22. *
  23. * @author Rob Winch
  24. */
  25. class JacocoPlugin implements Plugin<Project> {
  26. @Override
  27. void apply(Project project) {
  28. project.plugins.withType(JavaPlugin) {
  29. project.getPluginManager().apply("jacoco")
  30. project.tasks.check.dependsOn project.tasks.jacocoTestReport
  31. project.jacoco {
  32. toolVersion = '0.8.2'
  33. }
  34. }
  35. }
  36. }