2023-03-20T03:50:51
This commit is contained in:
60
05_tasks/build.gradle.kts
Normal file
60
05_tasks/build.gradle.kts
Normal file
@@ -0,0 +1,60 @@
|
||||
import java.io.FileOutputStream
|
||||
import java.io.FileWriter
|
||||
|
||||
plugins {
|
||||
id("base")
|
||||
id ("java")
|
||||
}
|
||||
|
||||
tasks.create<Copy>("copy") {
|
||||
description = "'src'의 파일들을 'dest'로 복사"
|
||||
group = "my tasks"
|
||||
|
||||
from("src") {
|
||||
include("**/*.txt")
|
||||
}
|
||||
from("src2") {
|
||||
exclude("**/*.tmp")
|
||||
}
|
||||
into("dest")
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
|
||||
tasks.create<Delete>("delete") {
|
||||
description = "'dest'의 파일들을 삭제"
|
||||
group = "my tasks"
|
||||
|
||||
delete("dest")
|
||||
delete("exec_result.txt")
|
||||
isFollowSymlinks = true
|
||||
}
|
||||
|
||||
tasks.create<Zip>("zip") {
|
||||
description = "Archive source files in a zip file."
|
||||
group = "my tasks"
|
||||
|
||||
from("src")
|
||||
|
||||
}
|
||||
|
||||
tasks.create<Exec>("execute") {
|
||||
description = "CLI 명령을 실행"
|
||||
group = "my tasks"
|
||||
|
||||
workingDir = file(projectDir)
|
||||
commandLine = listOf("ls", "-al")
|
||||
// 표준 출력 대신 파일로 출력
|
||||
standardOutput = FileOutputStream(file("exec_result.txt"))
|
||||
}
|
||||
|
||||
tasks.create<Sync>("sync") {
|
||||
description = "'src'의 파일들을 'dest'로 동기화"
|
||||
group = "my tasks"
|
||||
|
||||
from("src")
|
||||
into("src2")
|
||||
preserve {
|
||||
include("*.txt")
|
||||
exclude("*.tmp")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user