Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Gradle 8.12 deprecation warning #455

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/main/groovy/com/netflix/gradle/plugins/deb/Deb.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction
import com.netflix.gradle.plugins.packaging.Dependency
import com.netflix.gradle.plugins.packaging.SystemPackagingTask
import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils
import org.gradle.api.file.ProjectLayout
import org.gradle.api.internal.ConventionMapping
import org.gradle.api.internal.IConventionAware
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.work.DisableCachingByDefault

import javax.inject.Inject

@DisableCachingByDefault
class Deb extends SystemPackagingTask {
Deb() {
super()

@Inject
Deb(ProjectLayout projectLayout) {
super(projectLayout)
archiveExtension.set 'deb'
notCompatibleWithConfigurationCache("nebula.ospackage does not support configuration cache")
}
Expand All @@ -51,7 +55,7 @@ class Deb extends SystemPackagingTask {

@Override
AbstractPackagingCopyAction createCopyAction() {
return new DebCopyAction(this)
return new DebCopyAction(this, new File(projectLayout.buildDirectory.getAsFile().get(), "debian"))
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DebCopyAction extends AbstractPackagingCopyAction<Deb> {
private final MaintainerScriptsGenerator maintainerScriptsGenerator
private final InstallLineGenerator installLineGenerator

DebCopyAction(Deb debTask) {
DebCopyAction(Deb debTask, File debianDir) {
super(debTask)
debTaskPropertiesValidator.validate(debTask)
dependencies = []
Expand All @@ -82,7 +82,7 @@ class DebCopyAction extends AbstractPackagingCopyAction<Deb> {
dataProducers = []
installDirs = []
provides = []
debianDir = new File(task.project.layout.buildDirectory.getAsFile().get(), "debian")
this.debianDir = debianDir
debFileVisitorStrategy = new DebFileVisitorStrategy(dataProducers, installDirs)
maintainerScriptsGenerator = new MaintainerScriptsGenerator(debTask, new TemplateHelper(debianDir, '/deb'), debianDir, new ApacheCommonsFileSystemActions())
installLineGenerator = new InstallLineGenerator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ package com.netflix.gradle.plugins.docker

import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction
import com.netflix.gradle.plugins.packaging.SystemPackagingTask
import org.gradle.api.file.ProjectLayout
import org.gradle.tooling.model.UnsupportedMethodException
import org.gradle.work.DisableCachingByDefault

import javax.inject.Inject

@DisableCachingByDefault
class SystemPackageDockerfile extends SystemPackagingTask {
private final DockerfileInstructionManager dockerfileInstructionManager
private static final ARCHIVE_NAME = 'Dockerfile'

SystemPackageDockerfile() {
@Inject
SystemPackageDockerfile(ProjectLayout projectLayout) {
super(projectLayout)
dockerfileInstructionManager = new DockerfileInstructionManager()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils
import groovy.transform.CompileDynamic
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.file.FileCollection
import org.gradle.api.file.ProjectLayout
import org.gradle.api.file.RegularFile
import org.gradle.api.internal.ConventionMapping
import org.gradle.api.internal.IConventionAware
Expand Down Expand Up @@ -50,11 +51,14 @@ abstract class SystemPackagingTask extends OsPackageAbstractArchiveTask {
@Internal
ProjectPackagingExtension parentExten

@Internal
ProjectLayout projectLayout

// TODO Add conventions to pull from extension
SystemPackagingTask() {
SystemPackagingTask(ProjectLayout projectLayout) {
super()
exten = new SystemPackagingExtension()

this.projectLayout = projectLayout
// I have no idea where Project came from
parentExten = project.extensions.findByType(ProjectPackagingExtension)
if (parentExten) {
Expand Down
8 changes: 6 additions & 2 deletions src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.netflix.gradle.plugins.rpm
import com.netflix.gradle.plugins.packaging.AbstractPackagingCopyAction
import com.netflix.gradle.plugins.packaging.SystemPackagingTask
import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils
import org.gradle.api.file.ProjectLayout
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.PathSensitive
Expand All @@ -30,15 +31,18 @@ import org.redline_rpm.header.RpmType
import org.gradle.api.internal.ConventionMapping
import org.gradle.api.internal.IConventionAware

import javax.inject.Inject

@DisableCachingByDefault
class Rpm extends SystemPackagingTask {
@InputFile
@Optional
@PathSensitive(PathSensitivity.NONE)
File changeLogFile

Rpm() {
super()
@Inject
Rpm(ProjectLayout projectLayout) {
super(projectLayout)
archiveExtension.set 'rpm'
notCompatibleWithConfigurationCache("nebula.ospackage does not support configuration cache")
}
Expand Down
Loading