diff --git a/core/builtins/native/kotlin/Arrays.kt b/core/builtins/native/kotlin/Arrays.kt index b7d8fc24b56..f6d8d28ab8c 100644 --- a/core/builtins/native/kotlin/Arrays.kt +++ b/core/builtins/native/kotlin/Arrays.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/core/builtins/native/kotlin/Primitives.kt b/core/builtins/native/kotlin/Primitives.kt index 93e2e18d31d..9798374d876 100644 --- a/core/builtins/native/kotlin/Primitives.kt +++ b/core/builtins/native/kotlin/Primitives.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/core/builtins/src/kotlin/Iterators.kt b/core/builtins/src/kotlin/Iterators.kt index 7ea09675627..7b63ce377c9 100644 --- a/core/builtins/src/kotlin/Iterators.kt +++ b/core/builtins/src/kotlin/Iterators.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/core/builtins/src/kotlin/ProgressionIterators.kt b/core/builtins/src/kotlin/ProgressionIterators.kt index 058eeba1a68..1850f559e62 100644 --- a/core/builtins/src/kotlin/ProgressionIterators.kt +++ b/core/builtins/src/kotlin/ProgressionIterators.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/core/builtins/src/kotlin/Progressions.kt b/core/builtins/src/kotlin/Progressions.kt index 6fab56f90c0..7dc89552325 100644 --- a/core/builtins/src/kotlin/Progressions.kt +++ b/core/builtins/src/kotlin/Progressions.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/core/builtins/src/kotlin/Ranges.kt b/core/builtins/src/kotlin/Ranges.kt index b7e70f2eaca..afe3d32d1bf 100644 --- a/core/builtins/src/kotlin/Ranges.kt +++ b/core/builtins/src/kotlin/Ranges.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/generators/tests/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt b/generators/tests/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt index 6d600e9b4bf..d6be5e95910 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt +++ b/generators/tests/org/jetbrains/kotlin/generators/builtins/generateBuiltIns.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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.kotlin.generators.builtins.generateBuiltIns @@ -24,8 +13,10 @@ import org.jetbrains.kotlin.generators.builtins.progressionIterators.GeneratePro import org.jetbrains.kotlin.generators.builtins.progressions.GenerateProgressions import org.jetbrains.kotlin.generators.builtins.ranges.GeneratePrimitives import org.jetbrains.kotlin.generators.builtins.ranges.GenerateRanges +import org.xml.sax.InputSource import java.io.File import java.io.PrintWriter +import javax.xml.xpath.XPathFactory fun assertExists(file: File) { if (!file.exists()) error("Output dir does not exist: ${file.absolutePath}") @@ -46,7 +37,7 @@ abstract class BuiltInsSourceGenerator(val out: PrintWriter) { } fun generate() { - out.println(File("license/LICENSE.txt").readText()) + out.println(readCopyrightNoticeFromProfile(File(".idea/copyright/apache.xml"))) // Don't include generator class name in the message: these are built-in sources, // and we don't want to scare users with any internal information about our project out.println("// Auto-generated file. DO NOT EDIT!") @@ -59,6 +50,17 @@ abstract class BuiltInsSourceGenerator(val out: PrintWriter) { } } +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" } +} + fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsSourceGenerator) -> Unit) { assertExists(BUILT_INS_NATIVE_DIR) assertExists(BUILT_INS_SRC_DIR) diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/functions/Functions.kt b/libraries/stdlib/jvm/runtime/kotlin/jvm/functions/Functions.kt index c53438eb358..f316b23b9fe 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/functions/Functions.kt +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/functions/Functions.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT! diff --git a/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/ArrayIterators.kt b/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/ArrayIterators.kt index 89bab71076e..eff87d19f62 100644 --- a/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/ArrayIterators.kt +++ b/libraries/stdlib/jvm/runtime/kotlin/jvm/internal/ArrayIterators.kt @@ -1,17 +1,6 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * 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. */ // Auto-generated file. DO NOT EDIT!