Remove unused WriteCopyrightToFile gradle task
#KTI-758
This commit is contained in:
committed by
Space Team
parent
fbb0d6d805
commit
fce8b877c8
@@ -23,22 +23,13 @@ dependencies {
|
||||
implementation(project(":compiler:psi"))
|
||||
}
|
||||
|
||||
val writeCopyright by task<tasks.WriteCopyrightToFile> {
|
||||
outputFile.set(file("$buildDir/copyright/notice.txt"))
|
||||
commented.set(true)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.jetbrains.kotlin.analysis.api.fir.generator.MainKt")
|
||||
}
|
||||
|
||||
val processResources by tasks
|
||||
processResources.dependsOn(writeCopyright)
|
||||
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
resources.srcDir("$buildDir/copyright")
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package tasks
|
||||
|
||||
import groovy.util.Node
|
||||
import groovy.xml.XmlParser
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.file.RegularFileProperty
|
||||
import org.gradle.api.provider.Property
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFile
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
import java.util.*
|
||||
|
||||
abstract class WriteCopyrightToFile : DefaultTask() {
|
||||
@InputFile
|
||||
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
|
||||
|
||||
@get:OutputFile
|
||||
abstract val outputFile: RegularFileProperty
|
||||
|
||||
@get:Input
|
||||
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
|
||||
|
||||
@TaskAction
|
||||
fun write() {
|
||||
val file = outputFile.asFile.get()
|
||||
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
|
||||
}
|
||||
|
||||
private fun readCopyright(): String {
|
||||
assert(path.exists()) {
|
||||
"File $path with copyright not found"
|
||||
}
|
||||
|
||||
val xmlParser = XmlParser()
|
||||
val node = xmlParser.parse(path)
|
||||
assert(node.attribute("name") == "CopyrightManager") {
|
||||
"Format changed occasionally?"
|
||||
}
|
||||
|
||||
val copyrightBlock = node.children().filterIsInstance<Node>().single()
|
||||
val noticeNode = copyrightBlock.children().filterIsInstance<Node>().single { it.attribute("name") == "notice" }
|
||||
return noticeNode.attribute("value").toString().replace("$today.year", GregorianCalendar()[Calendar.YEAR].toString())
|
||||
}
|
||||
|
||||
private fun readCopyrightCommented(): String {
|
||||
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
|
||||
}
|
||||
}
|
||||
@@ -21,22 +21,13 @@ dependencies {
|
||||
implementation(project(":compiler:psi"))
|
||||
}
|
||||
|
||||
val writeCopyright by task<tasks.WriteCopyrightToFile> {
|
||||
outputFile.set(file("$buildDir/copyright/notice.txt"))
|
||||
commented.set(true)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.jetbrains.kotlin.fir.checkers.generator.MainKt")
|
||||
}
|
||||
|
||||
val processResources by tasks
|
||||
processResources.dependsOn(writeCopyright)
|
||||
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
resources.srcDir("$buildDir/copyright")
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import tasks.WriteCopyrightToFile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
@@ -22,22 +20,13 @@ dependencies {
|
||||
runtimeOnly(commonDependency("org.jetbrains.intellij.deps:jdom"))
|
||||
}
|
||||
|
||||
val writeCopyright by task<WriteCopyrightToFile> {
|
||||
outputFile.set(file("$buildDir/copyright/notice.txt"))
|
||||
commented.set(true)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.jetbrains.kotlin.fir.tree.generator.MainKt")
|
||||
}
|
||||
|
||||
val processResources by tasks
|
||||
processResources.dependsOn(writeCopyright)
|
||||
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
resources.srcDir("$buildDir/copyright")
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import tasks.WriteCopyrightToFile
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
@@ -21,22 +19,13 @@ dependencies {
|
||||
runtimeOnly(commonDependency("org.jetbrains.intellij.deps:jdom"))
|
||||
}
|
||||
|
||||
val writeCopyright by task<WriteCopyrightToFile> {
|
||||
outputFile.set(file("$buildDir/copyright/notice.txt"))
|
||||
commented.set(true)
|
||||
}
|
||||
|
||||
application {
|
||||
mainClassName = "org.jetbrains.kotlin.ir.generator.MainKt"
|
||||
}
|
||||
|
||||
val processResources by tasks
|
||||
processResources.dependsOn(writeCopyright)
|
||||
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
resources.srcDir("$buildDir/copyright")
|
||||
}
|
||||
"test" {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user