idl2k: read copyright from profile and put it in the generated files
Also reword autogenerated warning a bit.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.khronos.webgl
|
package org.khronos.webgl
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.dom.css
|
package org.w3c.dom.css
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.dom.events
|
package org.w3c.dom.events
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.dom
|
package org.w3c.dom
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.dom.parsing
|
package org.w3c.dom.parsing
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.dom.svg
|
package org.w3c.dom.svg
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.dom.url
|
package org.w3c.dom.url
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.fetch
|
package org.w3c.fetch
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.files
|
package org.w3c.files
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.notifications
|
package org.w3c.notifications
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.performance
|
package org.w3c.performance
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.workers
|
package org.w3c.workers
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Generated file
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
* DO NOT EDIT
|
* that can be found in the license/LICENSE.txt file.
|
||||||
*
|
|
||||||
* See libraries/tools/idl2k for details
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
|
||||||
|
// See libraries/tools/idl2k for details
|
||||||
|
|
||||||
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
@file:Suppress("NESTED_CLASS_IN_EXTERNAL_INTERFACE")
|
||||||
package org.w3c.xhr
|
package org.w3c.xhr
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.idl2k.util
|
||||||
|
|
||||||
|
import org.xml.sax.InputSource
|
||||||
|
import java.io.File
|
||||||
|
import javax.xml.xpath.XPathFactory
|
||||||
|
|
||||||
|
fun readCopyrightNoticeFromProfile(copyrightProfile: File): String {
|
||||||
|
val template = copyrightProfile.reader().use { reader ->
|
||||||
|
XPathFactory.newInstance().newXPath().evaluate("/component/copyright/option[@name='notice']/@value", InputSource(reader))
|
||||||
|
}
|
||||||
|
val yearTemplate = "$today.year"
|
||||||
|
val year = java.time.LocalDate.now().year.toString()
|
||||||
|
assert(yearTemplate in template)
|
||||||
|
|
||||||
|
return template.replace(yearTemplate, year).lines().joinToString("", prefix = "/*\n", postfix = " */\n") { " * $it\n" }
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package org.jetbrains.idl2k
|
package org.jetbrains.idl2k
|
||||||
|
|
||||||
import org.antlr.v4.runtime.ANTLRFileStream
|
import org.antlr.v4.runtime.ANTLRFileStream
|
||||||
|
import org.jetbrains.idl2k.util.readCopyrightNoticeFromProfile
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.net.*
|
import java.net.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -16,6 +17,8 @@ fun main(args: Array<String>) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val copyrightNotice = readCopyrightNoticeFromProfile(File("../../../.idea/copyright/apache.xml"))
|
||||||
|
|
||||||
val repositoryPre = srcDir.walkTopDown().filter { it.isDirectory || it.extension == "idl" }.asSequence().filter { it.isFile }.toList().sortedBy { it.absolutePath }.fold(Repository(emptyMap(), emptyMap(), emptyMap(), emptyMap())) { acc, e ->
|
val repositoryPre = srcDir.walkTopDown().filter { it.isDirectory || it.extension == "idl" }.asSequence().filter { it.isFile }.toList().sortedBy { it.absolutePath }.fold(Repository(emptyMap(), emptyMap(), emptyMap(), emptyMap())) { acc, e ->
|
||||||
System.err.flush()
|
System.err.flush()
|
||||||
System.err.println("Parsing ${e.absolutePath}")
|
System.err.println("Parsing ${e.absolutePath}")
|
||||||
@@ -82,12 +85,10 @@ fun main(args: Array<String>) {
|
|||||||
File(outDir, pkg + ".kt").bufferedWriter().use { w ->
|
File(outDir, pkg + ".kt").bufferedWriter().use { w ->
|
||||||
println("Generating for package $pkg...")
|
println("Generating for package $pkg...")
|
||||||
|
|
||||||
w.appendln("/*")
|
w.appendln(copyrightNotice)
|
||||||
w.appendln(" * Generated file")
|
|
||||||
w.appendln(" * DO NOT EDIT")
|
w.appendln("// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!")
|
||||||
w.appendln(" * ")
|
w.appendln("// See libraries/tools/idl2k for details")
|
||||||
w.appendln(" * See libraries/tools/idl2k for details")
|
|
||||||
w.appendln(" */")
|
|
||||||
|
|
||||||
w.appendln()
|
w.appendln()
|
||||||
w.appendln("@file:Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")")
|
w.appendln("@file:Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")")
|
||||||
|
|||||||
Reference in New Issue
Block a user