Skip to content

Commit

Permalink
Merge pull request #265 from octylFractal/fix/avoid-internal-gradle-a…
Browse files Browse the repository at this point in the history
…pis-3.x

Replace internal Gradle API usage with public API
  • Loading branch information
boris-petrov authored Sep 14, 2022
2 parents 69d250f + 2cd2710 commit 6e2b96f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.akhikhl.gretty

import org.gradle.api.internal.TaskInputsInternal
import org.gradle.api.internal.TaskInternal
import org.gradle.api.internal.TaskOutputsInternal
import org.gradle.api.internal.tasks.TaskStateInternal
import org.gradle.api.Task
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.TaskInputs
import org.gradle.api.tasks.TaskOutputs
import org.gradle.api.tasks.TaskState
import org.gradle.process.JavaForkOptions
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension

interface JacocoHelper extends TaskInternal, JavaForkOptions, ExtensionAware {
interface JacocoHelper extends Task, JavaForkOptions, ExtensionAware {
@Internal
JacocoTaskExtension getJacoco()

Expand All @@ -23,17 +23,17 @@ interface JacocoHelper extends TaskInternal, JavaForkOptions, ExtensionAware {

@Internal
@Override
TaskInputsInternal getInputs()
TaskInputs getInputs()

@Internal
@Override
TaskOutputsInternal getOutputs()
TaskOutputs getOutputs()

@Internal
@Override
TaskStateInternal getState()
TaskState getState()

@Internal
@Override
File getWorkingDir()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.FileCollection
import org.gradle.api.internal.artifacts.dsl.dependencies.DependencyFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
/**
Expand All @@ -30,7 +29,7 @@ final class ProjectUtils {
// #231 If we decide to drop Gradle 6 / Groovy 2 support, we can drop choosing Groovy versions at runtime again.
static Configuration getCurrentGroovy(Project project) {
project.configurations.detachedConfiguration(
project.dependencies.create(DependencyFactory.ClassPathNotation.LOCAL_GROOVY),
project.dependencies.localGroovy(),
project.dependencies.create("org.codehaus.groovy:groovy-cli-commons:${GroovySystem.version}"),
project.dependencies.create("org.codehaus.groovy:groovy-json:${GroovySystem.version}"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ import groovy.transform.TypeCheckingMode
import org.akhikhl.gretty.scanner.JDKScannerManager
import org.gradle.api.DefaultTask
import org.gradle.api.Task
import org.gradle.api.internal.TaskInternal
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction
import org.gradle.process.JavaForkOptions
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
Expand Down Expand Up @@ -156,7 +153,7 @@ abstract class StartBaseTask extends DefaultTask {
private void initJacoco() {
if(project.extensions.findByName('jacoco') && project.gretty.jacocoEnabled) {
Task startTask = this
jacocoHelper = (TaskInternal.methods.collectEntries({ [it.name, {} ] }) +
jacocoHelper = (Task.methods.collectEntries({ [it.name, {} ] }) +
JavaForkOptions.methods.collectEntries({ [it.name, {} ] }) +
ExtensionAware.methods.collectEntries({ [it.name, {} ] }) + [
getExtensions: { startTask.getExtensions() },
Expand Down

0 comments on commit 6e2b96f

Please sign in to comment.