This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 886
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6d3236
commit 9f959b8
Showing
3 changed files
with
58 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
gradle/build-logic/convention/src/main/kotlin/app/tivi/gradle/AssetCopyTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2023, Christopher Banes and the Tivi project contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package app.tivi.gradle | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.DirectoryProperty | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.logging.LogLevel | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.CacheableTask | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.OutputDirectory | ||
import org.gradle.api.tasks.PathSensitive | ||
import org.gradle.api.tasks.PathSensitivity | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
@CacheableTask | ||
abstract class AssetCopyTask : DefaultTask() { | ||
@get:OutputDirectory | ||
abstract val outputDirectory: DirectoryProperty | ||
|
||
@get:PathSensitive(PathSensitivity.RELATIVE) | ||
@get:InputFile | ||
abstract val inputFile: RegularFileProperty | ||
|
||
@get:Input | ||
abstract val outputFilename: Property<String> | ||
|
||
@TaskAction | ||
fun action() { | ||
val input = inputFile.get().asFile | ||
val output = outputDirectory.get() | ||
.file(outputFilename.get()) | ||
.asFile | ||
|
||
logger.log(LogLevel.WARN, "Copying ${input.canonicalPath} to ${output.canonicalPath}") | ||
|
||
input.copyTo(target = output, overwrite = true) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters