com.netflix.gradle.plugins.deb.validation.DebTaskPropertiesValidator.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-ospackage-plugin Show documentation
Show all versions of gradle-ospackage-plugin Show documentation
Provides a task similar to Tar and Zip for constructing RPM and DEB package files.
package com.netflix.gradle.plugins.deb.validation
import com.netflix.gradle.plugins.deb.Deb
import com.netflix.gradle.plugins.packaging.validation.SystemPackagingAttributeValidator
import com.netflix.gradle.plugins.packaging.validation.SystemPackagingTaskPropertiesValidator
import com.netflix.gradle.plugins.utils.DeprecationLoggerUtils
import org.gradle.api.InvalidUserDataException
class DebTaskPropertiesValidator implements SystemPackagingTaskPropertiesValidator {
private final SystemPackagingAttributeValidator versionValidator = new DebVersionAttributeValidator()
private final SystemPackagingAttributeValidator packageNameValidator = new DebPackageNameAttributeValidator()
@Override
void validate(Deb task) {
DeprecationLoggerUtils.whileDisabled {
if(!versionValidator.validate(task.getVersion())) {
throw new InvalidUserDataException(versionValidator.getErrorMessage(task.getVersion()))
}
if(!packageNameValidator.validate(task.getPackageName())) {
throw new InvalidUserDataException(packageNameValidator.getErrorMessage(task.getPackageName()))
}
}
}
}