Skip to content

Commit

Permalink
Rename OciLayerTask.tarFile -> file
Browse files Browse the repository at this point in the history
Rename OciComponentTask.componentFile -> file
  • Loading branch information
SgtSilvio committed May 12, 2024
1 parent ac1f046 commit dc7c187
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ abstract class OciComponentTask : DefaultTask() {
val classifier = project.objects.property<String>()

@get:OutputFile
val componentFile: RegularFileProperty =
val file: RegularFileProperty =
project.objects.fileProperty().convention(destinationDirectory.file(classifier.map { "$it.json" }))

@TaskAction
protected fun run() {
componentFile.get().asFile.writeText(encodedComponent.get())
file.get().asFile.writeText(encodedComponent.get())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract class OciLayerTask : DefaultTask() {
val extension: Property<String> = project.objects.property<String>().convention(compression.map { it.extension })

@get:OutputFile
val tarFile: RegularFileProperty = project.objects.fileProperty()
val file: RegularFileProperty = project.objects.fileProperty()
.convention(destinationDirectory.file(classifier.zip(extension) { classifier, ext -> "$classifier.$ext" }))

@get:OutputFile
Expand Down Expand Up @@ -84,11 +84,11 @@ abstract class OciLayerTask : DefaultTask() {
val copySpecInput = copySpecInput.get()
val digestAlgorithm = digestAlgorithm.get()
val compression = compression.get()
val tarFile = tarFile.get().asFile
val file = file.get().asFile
val propertiesFile = propertiesFile.get().asFile

val diffId: OciDigest
val digest = FileOutputStream(tarFile).calculateOciDigest(digestAlgorithm) { compressedDos ->
val digest = FileOutputStream(file).calculateOciDigest(digestAlgorithm) { compressedDos ->
diffId = compression.createOutputStream(compressedDos).calculateOciDigest(digestAlgorithm) { dos ->
TarArchiveOutputStream(dos, StandardCharsets.UTF_8.name()).use { tos ->
tos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX)
Expand Down Expand Up @@ -123,7 +123,7 @@ abstract class OciLayerTask : DefaultTask() {
}
}
}
propertiesFile.writeText("digest=$digest\nsize=${tarFile.length()}\ndiffId=$diffId")
propertiesFile.writeText("digest=$digest\nsize=${file.length()}\ndiffId=$diffId")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ internal abstract class OciImageDefinitionImpl @Inject constructor(
val layerTasks = LinkedHashMap<String, TaskProvider<OciLayerTask>>()
getBundleOrPlatformBundles().collectLayerTasks(layerTasks)
listOf(LazyPublishArtifact(objectFactory).apply {
file.set(componentTask.flatMap { it.componentFile })
file.set(componentTask.flatMap { it.file })
name.set(project.name)
classifier.set(componentTask.flatMap { it.classifier })
extension.set("json")
}) + layerTasks.map { (_, layerTask) ->
LazyPublishArtifact(objectFactory).apply {
file.set(layerTask.flatMap { it.tarFile })
file.set(layerTask.flatMap { it.file })
name.set(project.name)
classifier.set(layerTask.flatMap { it.classifier })
extension.set(layerTask.flatMap { it.extension })
Expand Down

0 comments on commit dc7c187

Please sign in to comment.