/*
 * 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.
 */

// Following Gradle best practices to keep build logic organized

// Keep this as an optional feature for now, disabled by default
if (Boolean.parseBoolean(project.cloverEnabled)) {
    apply plugin: 'com.bmuschko.clover'

    dependencies {
        clover 'org.openclover:clover:4.2.+'
    }

    clover {

        testIncludes = ['**/Test*.java']
        // Exclude the generated test code from code coverage
        testExcludes = ['thrift/test/Test*.java']

        compiler {
            encoding = 'UTF-8'
            debug = true
        }

        report {
            html = true
            pdf = true
        }
    }

    build.dependsOn cloverGenerateReport
}
