使用Nebula RPM插件,对于ospackage扩展属性,我在增量构建支持方面存在一些问题。
请参阅下面的简单示例:
plugins {
id "nebula.ospackage" version "9.1.1"
}
ospackage {
packageDescription = "my sample package"
user "root"
createDirectoryEntry true
addParentDirs true
}当更改createDirectoryEntry属性值时,Gradle正确地检测更改并将任务视为不最新的,如预期的那样:
> Task :buildRpm
Caching disabled for task ':buildRpm' because:
Build cache is disabled
Task ':buildRpm' is not up-to-date because:
Value of input property 'createDirectoryEntry' has changed for task ':buildRpm'
Created rpm java.io.RandomAccessFile@25ee06fa
:buildRpm (Thread[Execution worker for ':',5,main]) completed. Took 0.02 secs.但是当更改addParentDirs属性值时,不会检测到更改,并且任务被认为是最新的!
> Task :buildRpm UP-TO-DATE
Caching disabled for task ':buildRpm' because:
Build cache is disabled
Skipping task ':buildRpm' as it is up-to-date.
:buildRpm (Thread[Execution worker for ':',5,main]) completed. Took 0.007 secs.addParentDirs和createDirectoryEntry都是简单的布尔属性,它们的getter和@createDirectoryEntry都正确地注明了,参见https://github.com/nebula-plugins/gradle-ospackage-plugin/blob/main/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingExtension.groovy#L71。
我们如何在这两个属性的最新检查中解释不同的行为?
备注
使用或不使用属性赋值时的相同行为(例如:addParentDirs true与addParentDirs = true相同);似乎存在与所使用的语法相关的问题,请参阅https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/82和https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/39
(使用Gradle v7.4,ospackage v9.1.1)
发布于 2022-10-29 11:57:31
根本原因是在addParentDirs中定义的ospackage属性被nebula插件忽略了,这是因为发布了https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/246。
因此,无论在这个扩展中为这个属性定义什么值,它都不会影响任务配置,我猜这就是最新的检查机制忽略它的原因。
https://stackoverflow.com/questions/71063821
复制相似问题