From aa13936cb2ebe24cf267b5096464e1e2c4063ff9 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 13 May 2021 16:25:33 +0200 Subject: [PATCH] Move GenerateProtoBuf to separate source set with no dependencies Also move GenerateProtoBufCompare to a new source set with a dependency only on build-common. #KTI-79 Fixed --- generators/build.gradle.kts | 10 ++++- .../protobuf/GenerateProtoBuf.kt | 38 ++++++++++--------- .../GenerateProtoBufCompare.kt | 21 +++------- 3 files changed, 35 insertions(+), 34 deletions(-) rename generators/{tests/org/jetbrains/kotlin/generators => }/protobuf/GenerateProtoBuf.kt (87%) rename generators/{tests/org/jetbrains/kotlin/generators/protobuf => protobufCompare}/GenerateProtoBufCompare.kt (96%) diff --git a/generators/build.gradle.kts b/generators/build.gradle.kts index efdb525f718..caef984bc29 100644 --- a/generators/build.gradle.kts +++ b/generators/build.gradle.kts @@ -24,6 +24,8 @@ fun extraSourceSet(name: String, extendMain: Boolean = true): Pair + javaFile.readLines().joinToString(System.lineSeparator()) { line -> line.replace("com.google.protobuf", "org.jetbrains.kotlin.protobuf") // Memory footprint optimizations: do not allocate too big bytes buffers that effectively remain unused .replace(" unknownFieldsOutput);", " unknownFieldsOutput, 1);") diff --git a/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt b/generators/protobufCompare/GenerateProtoBufCompare.kt similarity index 96% rename from generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt rename to generators/protobufCompare/GenerateProtoBufCompare.kt index c56d4faacde..d72e220b5ba 100644 --- a/generators/tests/org/jetbrains/kotlin/generators/protobuf/GenerateProtoBufCompare.kt +++ b/generators/protobufCompare/GenerateProtoBufCompare.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-2021 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 org.jetbrains.kotlin.generators.protobuf @@ -39,8 +28,10 @@ class GenerateProtoBufCompare { } fun generate(destFile: File, forbidGenerationOnTeamcity: Boolean = true) { - GeneratorsFileUtil.writeFileIfContentChanged(destFile, GenerateProtoBufCompare().generate(), - forbidGenerationOnTeamcity = forbidGenerationOnTeamcity) + GeneratorsFileUtil.writeFileIfContentChanged( + destFile, GenerateProtoBufCompare().generate(), + forbidGenerationOnTeamcity = forbidGenerationOnTeamcity + ) } }