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

rootProject.name = 'Apache Ignite 3'
include(':ignite-page-memory')
include(':ignite-storage-api')
include(':ignite-network-annotation-processor')
include(':ignite-client')
include(':ignite-jdbc')
include(':ignite-rocksdb-common')
include(':ignite-file-io')
include(':ignite-vault')
include(':ignite-workers')
include(':ignite-rest')
include(':ignite-examples')
include(':ignite-dev-utilities')
include(':ignite-network')
include(':ignite-configuration-api')
include(':ignite-raft-api')
include(':ignite-raft')
include(':ignite-schema')
include(':ignite-storage-page-memory')
include(':ignite-transactions')
include(':ignite-client-common')
include(':ignite-network-api')
include(':ignite-cluster-management')
include(':ignite-cli')
include(':ignite-table')
include(':ignite-api')
include(':ignite-client-handler')
include(':ignite-sql-engine-api')
include(':ignite-sql-engine')
include(':ignite-marshaller-common')
include(':ignite-configuration')
include(':ignite-configuration-presentation')
include(':ignite-core')
include(':ignite-partition-distribution')
include(':ignite-bytecode')
include(':ignite-runner')
include(':ignite-index')
include(':ignite-metastorage-api')
include(':ignite-metastorage')
include(':ignite-metastorage-cache')
include(':ignite-rest-api')
include(':ignite-storage-rocksdb')
include(':ignite-configuration-annotation-processor')
include(':ignite-compute')
include(':ignite-metrics')
include(':ignite-cluster-metrics')
include(':ignite-metrics-exporter-otlp')
include(':ignite-binary-tuple')
include(':platforms')
include(':packaging-cli')
include(':packaging-db')
include(':packaging-odbc')
include(':packaging-java-client')
include(':packaging-cpp-client')
include(':packaging-dotnet-client')
include(':packaging')
include(':ignite-replicator')
include(':ignite-distribution-zones')
include(':ignite-placement-driver')
include(':ignite-placement-driver-api')
include(':ignite-code-deployment')
include(':ignite-security-api')
include(':ignite-security')
include(':ignite-catalog')
include(':ignite-catalog-compaction')
include(":ignite-arch-test")
include(":ignite-file-transfer")
include(":ignite-system-view")
include(":ignite-system-view-api")
include(":ignite-error-code-annotation-processor")
include(':ignite-failure-handler')
include(":ignite-catalog-dsl")
include(":ignite-eventlog")
include(":ignite-low-watermark")
include(":ignite-partition-replicator")
include(':ignite-configuration-root')
include(':ignite-configuration-system')
include(':ignite-system-disaster-recovery')
include(':ignite-system-disaster-recovery-api')
include(':ignite-compatibility-tests')
include(':ignite-configuration-storage')

project(":ignite-examples").projectDir = file('examples/java')
project(":ignite-dev-utilities").projectDir = file('dev-utilities')
project(":ignite-page-memory").projectDir = file('modules/page-memory')
project(":ignite-storage-api").projectDir = file('modules/storage-api')
project(":ignite-network-annotation-processor").projectDir = file('modules/network-annotation-processor')
project(":ignite-client").projectDir = file('modules/client')
project(":ignite-jdbc").projectDir = file('modules/jdbc')
project(":ignite-rocksdb-common").projectDir = file('modules/rocksdb-common')
project(":ignite-file-io").projectDir = file('modules/file-io')
project(":ignite-vault").projectDir = file('modules/vault')
project(":ignite-workers").projectDir = file('modules/workers')
project(":ignite-rest").projectDir = file('modules/rest')
project(":ignite-network").projectDir = file('modules/network')
project(":ignite-raft-api").projectDir = file('modules/raft-api')
project(":ignite-configuration-api").projectDir = file('modules/configuration-api')
project(":ignite-raft").projectDir = file('modules/raft')
project(":ignite-schema").projectDir = file('modules/schema')
project(":ignite-storage-page-memory").projectDir = file('modules/storage-page-memory')
project(":ignite-transactions").projectDir = file('modules/transactions')
project(":ignite-client-common").projectDir = file('modules/client-common')
project(":ignite-network-api").projectDir = file('modules/network-api')
project(":ignite-cluster-management").projectDir = file('modules/cluster-management')
project(":ignite-cli").projectDir = file('modules/cli')
project(":ignite-table").projectDir = file('modules/table')
project(":ignite-api").projectDir = file('modules/api')
project(":ignite-client-handler").projectDir = file('modules/client-handler')
project(":ignite-sql-engine-api").projectDir = file('modules/sql-engine-api')
project(":ignite-sql-engine").projectDir = file('modules/sql-engine')
project(":ignite-marshaller-common").projectDir = file('modules/marshaller-common')
project(":ignite-configuration").projectDir = file('modules/configuration')
project(":ignite-configuration-presentation").projectDir = file('modules/configuration-presentation')
project(":ignite-core").projectDir = file('modules/core')
project(":ignite-partition-distribution").projectDir = file('modules/partition-distribution')
project(":ignite-bytecode").projectDir = file('modules/bytecode')
project(":ignite-runner").projectDir = file('modules/runner')
project(":ignite-index").projectDir = file('modules/index')
project(":ignite-metastorage-api").projectDir = file('modules/metastorage-api')
project(":ignite-metastorage").projectDir = file('modules/metastorage')
project(":ignite-metastorage-cache").projectDir = file('modules/metastorage-cache')
project(":ignite-rest-api").projectDir = file('modules/rest-api')
project(":ignite-storage-rocksdb").projectDir = file('modules/storage-rocksdb')
project(":ignite-configuration-annotation-processor").projectDir = file('modules/configuration-annotation-processor')
project(":ignite-compute").projectDir = file('modules/compute')
project(":ignite-metrics").projectDir = file('modules/metrics')
project(":ignite-cluster-metrics").projectDir = file('modules/cluster-metrics')
project(":ignite-metrics-exporter-otlp").projectDir = file('modules/metrics-exporter-otlp')
project(":ignite-binary-tuple").projectDir = file('modules/binary-tuple')
project(":platforms").projectDir = file('modules/platforms')
project(":ignite-replicator").projectDir = file('modules/replicator')
project(":packaging-cli").projectDir = file('packaging/cli')
project(":packaging-db").projectDir = file('packaging/db')
project(':packaging-odbc').projectDir = file('packaging/odbc')
project(':packaging-java-client').projectDir = file('packaging/client/java')
project(':packaging-cpp-client').projectDir = file('packaging/client/cpp')
project(':packaging-dotnet-client').projectDir = file('packaging/client/dotnet')
project(":packaging").projectDir = file('packaging')
project(":ignite-distribution-zones").projectDir = file('modules/distribution-zones')
project(":ignite-placement-driver").projectDir = file('modules/placement-driver')
project(":ignite-placement-driver-api").projectDir = file('modules/placement-driver-api')
project(":ignite-code-deployment").projectDir = file('modules/code-deployment')
project(":ignite-security").projectDir = file('modules/security')
project(":ignite-security-api").projectDir = file('modules/security-api')
project(":ignite-catalog").projectDir = file('modules/catalog')
project(":ignite-catalog-compaction").projectDir = file('modules/catalog-compaction')
project(":ignite-arch-test").projectDir = file('modules/arch-test')
project(":ignite-file-transfer").projectDir = file('modules/file-transfer')
project(":ignite-system-view").projectDir = file('modules/system-view')
project(":ignite-system-view-api").projectDir = file('modules/system-view-api')
project(":ignite-error-code-annotation-processor").projectDir = file('modules/error-code-annotation-processor')
project(":ignite-failure-handler").projectDir = file('modules/failure-handler')
project(":ignite-catalog-dsl").projectDir = file('modules/catalog-dsl')
project(":ignite-eventlog").projectDir = file('modules/eventlog')
project(":ignite-low-watermark").projectDir = file('modules/low-watermark')
project(":ignite-partition-replicator").projectDir = file('modules/partition-replicator')
project(":ignite-configuration-root").projectDir = file('modules/configuration-root')
project(":ignite-configuration-system").projectDir = file('modules/configuration-system')
project(":ignite-system-disaster-recovery").projectDir = file('modules/system-disaster-recovery')
project(":ignite-system-disaster-recovery-api").projectDir = file('modules/system-disaster-recovery-api')
project(':ignite-compatibility-tests').projectDir = file('modules/compatibility-tests')
project(':ignite-configuration-storage').projectDir = file('modules/configuration-storage')

include(":migration-tools-ignite2-repack")
include(":migration-tools-ignite3-repack")
include(":migration-tools-ignite3-slim-repack")
include(":migration-tools-ai2-test-fixtures")
include(":migration-tools-commons-tests")
include(":migration-tools-commons")
include(":migration-tools-config-converter")
include(":migration-tools-persistence")
include(":migration-tools-cli")
include(":migration-tools-packaging-cli")
// End 2 End test stuff
include(":migration-tools-e2e-core")
include(":migration-tools-e2e-implementations")
include(":migration-tools-e2e-ai2-runner")
include(":migration-tools-e2e-ai3-tests")

project(":migration-tools-ignite2-repack").projectDir = file('migration-tools/modules/ignite2-repack')
project(":migration-tools-ignite3-repack").projectDir = file('migration-tools/modules/ignite3-repack')
project(":migration-tools-ignite3-slim-repack").projectDir = file('migration-tools/modules/ignite3-slim-repack')
project(":migration-tools-ai2-test-fixtures").projectDir = file('migration-tools/modules/migration-tools-ai2-test-fixtures')
project(":migration-tools-commons-tests").projectDir = file('migration-tools/modules/migration-tools-commons-tests')
project(":migration-tools-commons").projectDir = file('migration-tools/modules/migration-tools-commons')
project(":migration-tools-config-converter").projectDir = file('migration-tools/modules/migration-tools-config-converter')
project(":migration-tools-persistence").projectDir = file('migration-tools/modules/migration-tools-persistence')
project(":migration-tools-cli").projectDir = file('migration-tools/modules/migration-tools-cli')
project(":migration-tools-packaging-cli").projectDir = file('migration-tools/packaging/cli')
project(":migration-tools-e2e-core").projectDir = file('migration-tools/tools/e2e-tests-framework/framework-core')
project(":migration-tools-e2e-implementations").projectDir = file('migration-tools/tools/e2e-tests-framework/implementations')
project(":migration-tools-e2e-ai2-runner").projectDir = file('migration-tools/tools/e2e-tests-framework/ai2-runner')
project(":migration-tools-e2e-ai3-tests").projectDir = file('migration-tools/modules/e2e-ai3-tests')

def ignite2Version = properties["ignite2.version"].toString()
def ignite2Vendor = properties["ignite2.vendor"].toString()

dependencyResolutionManagement {
    versionCatalogs {
        libs {
            version('ignite2', ignite2Version)

            library("ignite2-core", ignite2Vendor, "ignite-core").versionRef('ignite2')
            library("ignite2-spring", ignite2Vendor, "ignite-spring").versionRef('ignite2')
            library("ignite2-calcite", "org.apache.ignite", "ignite-calcite").version("2.15.0")
        }
        "runtimeApacheIgnite2" {
            version('ignite2', ignite2Version)
            library('ignite2-core', "org.apache.ignite", "ignite-core").versionRef('ignite2')
            library('ignite2-spring', "org.apache.ignite", "ignite-spring").versionRef('ignite2')
        }
    }
}

if (JavaVersion.current() >= JavaVersion.VERSION_17) {
    include(':spring-boot-ignite-client-autoconfigure')
    include(':spring-boot-starter-ignite-client')
    include(':spring-boot-starter-ignite-client-example')
    include(':spring-data-ignite')

    project(":spring-boot-starter-ignite-client-example").projectDir = file('modules/spring/spring-boot-starter-ignite-client-example')
    project(":spring-boot-ignite-client-autoconfigure").projectDir = file('modules/spring/spring-boot-ignite-client-autoconfigure')
    project(":spring-boot-starter-ignite-client").projectDir = file('modules/spring/spring-boot-starter-ignite-client')
    project(":spring-data-ignite").projectDir = file('modules/spring/spring-data-ignite')
}

ext.isCiServer = System.getenv().containsKey("IGNITE_CI")

buildCache {
    local {
        enabled = !isCiServer
        push = !isCiServer
    }
    remote(HttpBuildCache) {
        enabled = isCiServer
        push = isCiServer
        url = System.getenv()["GRADLE_BUILD_CACHE_URI"] + "/cache/"
        allowInsecureProtocol = true
        credentials {
            username = System.getenv()["GRADLE_BUILD_CACHE_USERNAME"]
            password = System.getenv()["GRADLE_BUILD_CACHE_PASSWORD"]
        }
    }
}
