/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
pluginManagement {
    plugins {
        kotlin("jvm") version "1.6.10"
        // per https://github.com/cortinico/ktfmt-gradle/tags the latest version requires Gradle 7.4 which in turn
        // requires Java 11, failing the xenial build which is still on Java 8. Here we both configure the plugin
        // but with different version, and only enabling ktfmt configure for Java 11+, to make the legacy build happy
        if (JavaVersion.current().isJava11Compatible) {
            id("com.ncorti.ktfmt.gradle") version "0.8.0"
        } else {
            id("com.ncorti.ktfmt.gradle") version "0.5.0"
        }
    }
}

rootProject.name = "libthrift-kotlin"

include("cross-test-client", "cross-test-server")

includeBuild("../java")
