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

plugins {
    id "com.gradle.enterprise" version "3.15.1"
    id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1'
}

gradleEnterprise {
    server = 'https://ge.grails.org'
    buildScan {
        publishAlwaysIf(System.getenv('CI') == 'true')
        publishIfAuthenticated()
        uploadInBackground = System.getenv("CI") == null
        capture {
            taskInputFiles = true
        }
    }
}

buildCache {
    local { enabled = System.getenv('CI') != 'true' }
    remote(gradleEnterprise.buildCache) {
        def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY')
        push = System.getenv('CI') == 'true' && isAuthenticated
        enabled = true
    }}

include 'core'
include 'plugin'
include 'docs'

include 'examples-grails-test-app'
project(":examples-grails-test-app").projectDir = new File(settingsDir, "examples/grails-test-app")

include 'examples-grails-docs-app'
project(":examples-grails-docs-app").projectDir = new File(settingsDir, "examples/grails-docs-app")

include 'examples-grails-tenant-app'
project(":examples-grails-tenant-app").projectDir = new File(settingsDir, "examples/grails-tenant-app")

include 'examples-grails-multi-datastore-app'
project(":examples-grails-multi-datastore-app").projectDir = new File(settingsDir, "examples/grails-multi-datastore-app")

include 'examples-spring-boot-app'
project(":examples-spring-boot-app").projectDir = new File(settingsDir, "examples/spring-boot-app")

rootProject.name = 'gorm-graphql-root'

findProject(':core').name = 'gorm-graphql'
findProject(':plugin').name = 'grails-plugin-gorm-graphql-plugin'
