All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.gradle.plugins.deb.validation.DebTaskPropertiesValidator.groovy Maven / Gradle / Ivy

There is a newer version: 11.10.0
Show newest version
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()))
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy