/*
    The Develocity gradle plugin MUST be applied here.
 */
plugins {
    id "com.gradle.develocity" version "4.2.1"
    id "com.gradle.common-custom-user-data-gradle-plugin" version "2.4.0"
}

ext.isCiServer = System.getenv().containsKey("CI")
ext.githubPackageRegistryUser = System.getenv("GH_PACKAGE_REGISTRY_USER")
ext.githubPackageRegistryPassword = System.getenv("GH_PACKAGE_REGISTRY_TOKEN")


buildCache {
    local { enabled = true }
    remote(develocity.buildCache) {
        enabled = true
        // Also check access key to avoid warning logs
        def accessKey = System.getenv("DEVELOCITY_ACCESS_KEY")
        push = isCiServer && accessKey != null && !accessKey.isEmpty()
    }
}

develocity {
    server = "${develocityApereoServerUrl}"
    buildScan {
        publishing.onlyIf { it.authenticated }
        uploadInBackground = !isCiServer
        tag(isCiServer ? "CI" : "LOCAL")
        tag(System.getProperty("os.name"))
        tag(System.getProperty("os.arch"))
        tag(Boolean.valueOf(System.getProperty("PTS_ENABLED")) ? "PTS_ENABLED" : "PTS_DISABLED")
    }
}

dependencyResolutionManagement {
    repositories {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        ivy {
            name = "Node.js"
            setUrl("https://nodejs.org/dist/")
            patternLayout {
                artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]")
            }
            metadataSources {
                artifact()
            }
            content {
                includeModule("org.nodejs", "node")
            }
        }
        mavenCentral()
        maven {
            url = "https://build.shibboleth.net/maven/snapshots"
            mavenContent { snapshotsOnly() }
            content {
                includeGroupByRegex "org\\.opensaml.*"
                includeGroupByRegex "net\\.shibboleth.*"
            }
        }
        maven {
            url = "https://build.shibboleth.net/maven/releases/"
            mavenContent {releasesOnly() }
            content {
                includeGroupByRegex "org\\.opensaml.*"
                includeGroupByRegex "net\\.shibboleth.*"
            }
        }
        maven {
            url = "https://oss.sonatype.org/content/repositories/snapshots"
            mavenContent { snapshotsOnly() }
        }
        maven {
            url = "https://repository.apache.org/content/repositories/snapshots"
            mavenContent { snapshotsOnly() }
        }
        maven {
            url = "https://repository.apache.org/content/repositories/releases"
            mavenContent { releasesOnly() }
        }
        maven {
            url = "https://oss.sonatype.org/content/repositories/releases"
            mavenContent { releasesOnly() }
        }
        maven {
            url = "https://splunk.jfrog.io/splunk/ext-releases-local"
            content {
                includeGroupByRegex ".*splunk.*"
            }
            mavenContent { releasesOnly() }
        }
        maven {
            url = "https://repo.spring.io/milestone"
            content {
                includeGroupByRegex ".*springframework.*"
                includeGroupByRegex ".*projectreactor.*"
                includeGroupByRegex ".*micrometer.*"
            }
            mavenContent { releasesOnly() }
        }
        maven {
            url = "https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates"
            content {
                includeGroupByRegex ".*netflix.*"
            }
            mavenContent { releasesOnly() }
        }
    }
}

rootProject.name = "cas-server"

include "api:cas-server-core-api"
include "api:cas-server-core-api-audit"
include "api:cas-server-core-api-authentication"
include "api:cas-server-core-api-cookie"
include "api:cas-server-core-api-configuration"
include "api:cas-server-core-api-configuration-model"
include "api:cas-server-core-api-events"
include "api:cas-server-core-api-logout"
include "api:cas-server-core-api-mfa"
include "api:cas-server-core-api-monitor"
include "api:cas-server-core-api-multitenancy"
include "api:cas-server-core-api-protocol"
include "api:cas-server-core-api-scripting"
include "api:cas-server-core-api-services"
include "api:cas-server-core-api-throttle"
include "api:cas-server-core-api-ticket"
include "api:cas-server-core-api-util"
include "api:cas-server-core-api-validation"
include "api:cas-server-core-api-web"
include "api:cas-server-core-api-webflow"

include "core:cas-server-core"
include "core:cas-server-core-audit"
include "core:cas-server-core-audit-api"
include "core:cas-server-core-authentication"
include "core:cas-server-core-authentication-api"
include "core:cas-server-core-authentication-attributes"
include "core:cas-server-core-authentication-mfa"
include "core:cas-server-core-authentication-mfa-api"
include "core:cas-server-core-authentication-throttle"
include "core:cas-server-core-configuration"
include "core:cas-server-core-configuration-api"
include "core:cas-server-core-cookie"
include "core:cas-server-core-cookie-api"
include "core:cas-server-core-events-api"
include "core:cas-server-core-events"
include "core:cas-server-core-events-configuration"
include "core:cas-server-core-events-configuration-cloud-bus"
include "core:cas-server-core-logging"
include "core:cas-server-core-logging-api"
include "core:cas-server-core-logout"
include "core:cas-server-core-logout-api"
include "core:cas-server-core-monitor"
include "core:cas-server-core-multitenancy"
include "core:cas-server-core-notifications-api"
include "core:cas-server-core-notifications"
include "core:cas-server-core-rest"
include "core:cas-server-core-rest-api"
include "core:cas-server-core-scripting"
include "core:cas-server-core-services"
include "core:cas-server-core-services-api"
include "core:cas-server-core-services-authentication"
include "core:cas-server-core-services-registry"
include "core:cas-server-core-tickets"
include "core:cas-server-core-tickets-api"
include "core:cas-server-core-util"
include "core:cas-server-core-util-api"
include "core:cas-server-core-validation"
include "core:cas-server-core-validation-api"
include "core:cas-server-core-web"
include "core:cas-server-core-web-api"
include "core:cas-server-core-webflow"
include "core:cas-server-core-webflow-api"
include "core:cas-server-core-webflow-mfa"
include "core:cas-server-core-webflow-mfa-api"

include "docs:cas-server-documentation-processor"
include "docs:cas-server-documentation"

include "support:cas-server-support-account-mgmt-api"
include "support:cas-server-support-account-mgmt-core"
include "support:cas-server-support-account-mgmt"
include "support:cas-server-support-acme"
include "support:cas-server-support-actions-core"
include "support:cas-server-support-actions"
include "support:cas-server-support-audit-aws-firehose"
include "support:cas-server-support-audit-dynamodb"
include "support:cas-server-support-audit-jdbc"
include "support:cas-server-support-audit-mongo"
include "support:cas-server-support-audit-redis"
include "support:cas-server-support-audit-rest"
include "support:cas-server-support-aup-core"
include "support:cas-server-support-aup-jdbc"
include "support:cas-server-support-aup-ldap"
include "support:cas-server-support-aup-mongo"
include "support:cas-server-support-aup-redis"
include "support:cas-server-support-aup-rest"
include "support:cas-server-support-aup-webflow"
include "support:cas-server-support-aws"
include "support:cas-server-support-aws-cloudwatch"
include "support:cas-server-support-aws-cognito-authentication"
include "support:cas-server-support-aws-s3-service-registry"
include "support:cas-server-support-aws-ses"
include "support:cas-server-support-azuread-authentication"
include "support:cas-server-support-azure-monitor"
include "support:cas-server-support-basic"
include "support:cas-server-support-bom"
include "support:cas-server-support-bootadmin"
include "support:cas-server-support-bucket4j-core"
include "support:cas-server-support-captcha-core"
include "support:cas-server-support-captcha"
include "support:cas-server-support-cassandra-authentication"
include "support:cas-server-support-cassandra-core"
include "support:cas-server-support-cassandra-service-registry"
include "support:cas-server-support-cassandra-ticket-registry"
include "support:cas-server-support-cloud-directory-authentication"
include "support:cas-server-support-configuration-cloud-amqp"
include "support:cas-server-support-configuration-cloud-aws-s3"
include "support:cas-server-support-configuration-cloud-aws-secretsmanager"
include "support:cas-server-support-configuration-cloud-aws-ssm"
include "support:cas-server-support-configuration-cloud-azure-keyvault"
include "support:cas-server-support-configuration-cloud-dynamodb"
include "support:cas-server-support-configuration-cloud-gcp-secretsmanager"
include "support:cas-server-support-configuration-cloud-jdbc"
include "support:cas-server-support-configuration-cloud-kafka"
include "support:cas-server-support-configuration-cloud-kubernetes"
include "support:cas-server-support-configuration-cloud-mongo"
include "support:cas-server-support-configuration-cloud-rest"
include "support:cas-server-support-configuration-cloud-vault"
include "support:cas-server-support-configuration-cloud-zookeeper"
include "support:cas-server-support-configuration-metadata-repository"
include "support:cas-server-support-consent-api"
include "support:cas-server-support-consent-core"
include "support:cas-server-support-consent-dynamodb"
include "support:cas-server-support-consent-jdbc"
include "support:cas-server-support-consent-ldap"
include "support:cas-server-support-consent-mongo"
include "support:cas-server-support-consent-redis"
include "support:cas-server-support-consent-rest"
include "support:cas-server-support-consent-webflow"
include "support:cas-server-support-consul-client"
include "support:cas-server-support-cosmosdb-core"
include "support:cas-server-support-cosmosdb-service-registry"
include "support:cas-server-support-cosmosdb-ticket-registry"
include "support:cas-server-support-discovery-profile-core"
include "support:cas-server-support-discovery-profile"
include "support:cas-server-support-duo"
include "support:cas-server-support-duo-core"
include "support:cas-server-support-duo-core-mfa"
include "support:cas-server-support-dynamodb-core"
include "support:cas-server-support-dynamodb-service-registry"
include "support:cas-server-support-dynamodb-ticket-registry"
include "support:cas-server-support-elastic"
include "support:cas-server-support-electrofence"
include "support:cas-server-support-eureka-client"
include "support:cas-server-support-events-dynamodb"
include "support:cas-server-support-events-influxdb"
include "support:cas-server-support-events-jpa"
include "support:cas-server-support-events-kafka"
include "support:cas-server-support-events-memory"
include "support:cas-server-support-events-mongo"
include "support:cas-server-support-events-redis"
include "support:cas-server-support-gauth"
include "support:cas-server-support-gauth-core"
include "support:cas-server-support-gauth-core-mfa"
include "support:cas-server-support-gauth-dynamodb"
include "support:cas-server-support-gauth-jpa"
include "support:cas-server-support-gauth-ldap"
include "support:cas-server-support-gauth-mongo"
include "support:cas-server-support-gauth-redis"
include "support:cas-server-support-gcp-logging"
include "support:cas-server-support-gcp-pubsub-ticket-registry"
include "support:cas-server-support-gcp-firestore-ticket-registry"
include "support:cas-server-support-gcp-firestore-service-registry"
include "support:cas-server-support-gcp-storage-service-registry"
include "support:cas-server-support-generic"
include "support:cas-server-support-generic-remote-webflow"
include "support:cas-server-support-geolocation"
include "support:cas-server-support-geode-ticket-registry"
include "support:cas-server-support-geolocation-azure"
include "support:cas-server-support-geolocation-googlemaps"
include "support:cas-server-support-geolocation-maxmind"
include "support:cas-server-support-geolocation-ip"
include "support:cas-server-support-git-core"
include "support:cas-server-support-git-service-registry"
include "support:cas-server-support-google-analytics"
include "support:cas-server-support-grouper"
include "support:cas-server-support-grouper-core"
include "support:cas-server-support-gua"
include "support:cas-server-support-hazelcast"
include "support:cas-server-support-hazelcast-core"
include "support:cas-server-support-hazelcast-discovery-aws"
include "support:cas-server-support-hazelcast-discovery-azure"
include "support:cas-server-support-hazelcast-discovery-gcp"
include "support:cas-server-support-hazelcast-discovery-jclouds"
include "support:cas-server-support-hazelcast-discovery-kubernetes"
include "support:cas-server-support-hazelcast-discovery-zookeeper"
include "support:cas-server-support-hazelcast-monitor"
include "support:cas-server-support-hazelcast-ticket-registry"
include "support:cas-server-support-heimdall"
include "support:cas-server-support-ignite-ticket-registry"
include "support:cas-server-support-influxdb-core"
include "support:cas-server-support-interrupt-api"
include "support:cas-server-support-interrupt-core"
include "support:cas-server-support-interrupt-webflow"
include "support:cas-server-support-inwebo-mfa"
include "support:cas-server-support-javamelody"
include "support:cas-server-support-javers"
include "support:cas-server-support-jdbc"
include "support:cas-server-support-jdbc-authentication"
include "support:cas-server-support-jdbc-drivers"
include "support:cas-server-support-jdbc-monitor"
include "support:cas-server-support-amqp-ticket-registry"
include "support:cas-server-support-jmx"
include "support:cas-server-support-jpa-eclipselink"
include "support:cas-server-support-jpa-hibernate"
include "support:cas-server-support-jpa-service-registry"
include "support:cas-server-support-jpa-ticket-registry"
include "support:cas-server-support-jpa-util"
include "support:cas-server-support-json-service-registry"
include "support:cas-server-support-kafka-core"
include "support:cas-server-support-kafka-ticket-registry"
include "support:cas-server-support-ldap"
include "support:cas-server-support-ldap-core"
include "support:cas-server-support-ldap-monitor"
include "support:cas-server-support-ldap-service-registry"
include "support:cas-server-support-logback"
include "support:cas-server-support-logging-config-fluentd"
include "support:cas-server-support-logging-config-loki"
include "support:cas-server-support-logging-config-splunk"
include "support:cas-server-support-logging-config-sqs"
include "support:cas-server-support-lucene"
include "support:cas-server-support-mail-microsoft"
include "support:cas-server-support-mailgun"
include "support:cas-server-support-mailjet"
include "support:cas-server-support-memcached-aws-elasticache"
include "support:cas-server-support-memcached-core"
include "support:cas-server-support-memcached-monitor"
include "support:cas-server-support-memcached-spy"
include "support:cas-server-support-memcached-ticket-registry"
include "support:cas-server-support-metrics"
include "support:cas-server-support-mongo"
include "support:cas-server-support-mongo-core"
include "support:cas-server-support-mongo-monitor"
include "support:cas-server-support-mongo-service-registry"
include "support:cas-server-support-mongo-ticket-registry"
include "support:cas-server-support-native"
include "support:cas-server-support-notifications-apn"
include "support:cas-server-support-notifications-fcm"
include "support:cas-server-support-notifications-slack"
include "support:cas-server-support-oauth"
include "support:cas-server-support-oauth-api"
include "support:cas-server-support-oauth-core-api"
include "support:cas-server-support-oauth-services"
include "support:cas-server-support-oauth-uma"
include "support:cas-server-support-oauth-uma-core"
include "support:cas-server-support-oauth-uma-jpa"
include "support:cas-server-support-oauth-webflow"
include "support:cas-server-support-oidc"
include "support:cas-server-support-oidc-core-api"
include "support:cas-server-support-oidc-core"
include "support:cas-server-support-oidc-jpa"
include "support:cas-server-support-oidc-mongo"
include "support:cas-server-support-oidc-services"
include "support:cas-server-support-okta-authentication"
include "support:cas-server-support-openrewrite"
include "support:cas-server-support-otp-mfa"
include "support:cas-server-support-otp-mfa-core"
include "support:cas-server-support-pac4j-api"
include "support:cas-server-support-pac4j-cas"
include "support:cas-server-support-pac4j-core"
include "support:cas-server-support-pac4j-core-clients"
include "support:cas-server-support-pac4j-oidc"
include "support:cas-server-support-pac4j-saml"
include "support:cas-server-support-pac4j-webflow"
include "support:cas-server-support-palantir"
include "support:cas-server-support-passwordless-api"
include "support:cas-server-support-passwordless-authentication"
include "support:cas-server-support-passwordless-jpa"
include "support:cas-server-support-passwordless-ldap"
include "support:cas-server-support-passwordless-mongo"
include "support:cas-server-support-passwordless-webflow"
include "support:cas-server-support-permitio"
include "support:cas-server-support-person-directory-core"
include "support:cas-server-support-person-directory"
include "support:cas-server-support-pm"
include "support:cas-server-support-pm-core"
include "support:cas-server-support-pm-jdbc"
include "support:cas-server-support-pm-ldap"
include "support:cas-server-support-pm-rest"
include "support:cas-server-support-pm-webflow"
include "support:cas-server-support-qr-authentication"
include "support:cas-server-support-radius"
include "support:cas-server-support-radius-core"
include "support:cas-server-support-radius-core-mfa"
include "support:cas-server-support-radius-mfa"
include "support:cas-server-support-redis-authentication"
include "support:cas-server-support-redis-core"
include "support:cas-server-support-redis-modules"
include "support:cas-server-support-redis-service-registry"
include "support:cas-server-support-redis-ticket-registry"
include "support:cas-server-support-reports-core"
include "support:cas-server-support-reports"
include "support:cas-server-support-rest"
include "support:cas-server-support-rest-authentication"
include "support:cas-server-support-rest-core"
include "support:cas-server-support-rest-service-registry"
include "support:cas-server-support-rest-services"
include "support:cas-server-support-rest-tokens"
include "support:cas-server-support-rest-x509"
include "support:cas-server-support-saml"
include "support:cas-server-support-saml-core"
include "support:cas-server-support-saml-core-api"
include "support:cas-server-support-saml-idp"
include "support:cas-server-support-saml-idp-core"
include "support:cas-server-support-saml-idp-discovery"
include "support:cas-server-support-saml-idp-metadata"
include "support:cas-server-support-saml-idp-metadata-aws-s3"
include "support:cas-server-support-saml-idp-metadata-jpa"
include "support:cas-server-support-saml-idp-metadata-git"
include "support:cas-server-support-saml-idp-metadata-mongo"
include "support:cas-server-support-saml-idp-metadata-dynamodb"
include "support:cas-server-support-saml-idp-metadata-redis"
include "support:cas-server-support-saml-idp-metadata-rest"
include "support:cas-server-support-saml-idp-ticket"
include "support:cas-server-support-saml-idp-web"
include "support:cas-server-support-saml-mdui"
include "support:cas-server-support-saml-mdui-core"
include "support:cas-server-support-saml-sp-integrations"
include "support:cas-server-support-scim-core"
include "support:cas-server-support-scim"
include "support:cas-server-support-sendgrid"
include "support:cas-server-support-sentry"
include "support:cas-server-support-service-registry-stream"
include "support:cas-server-support-service-registry-stream-hazelcast"
include "support:cas-server-support-service-registry-stream-kafka"
include "support:cas-server-support-session-hazelcast"
include "support:cas-server-support-session-jdbc"
include "support:cas-server-support-session-mongo"
include "support:cas-server-support-session-redis"
include "support:cas-server-support-session-ticket-registry"
include "support:cas-server-support-shell-core"
include "support:cas-server-support-shell"
include "support:cas-server-support-shibboleth"
include "support:cas-server-support-simple-mfa-core"
include "support:cas-server-support-simple-mfa"
include "support:cas-server-support-sms-aws-sns"
include "support:cas-server-support-sms-clickatell"
include "support:cas-server-support-sms-smsmode"
include "support:cas-server-support-sms-nexmo"
include "support:cas-server-support-sms-textmagic"
include "support:cas-server-support-spnego"
include "support:cas-server-support-spnego-webflow"
include "support:cas-server-support-stateless-ticket-registry"
include "support:cas-server-support-surrogate-api"
include "support:cas-server-support-surrogate-core"
include "support:cas-server-support-surrogate-authentication"
include "support:cas-server-support-surrogate-authentication-jdbc"
include "support:cas-server-support-surrogate-authentication-ldap"
include "support:cas-server-support-surrogate-authentication-rest"
include "support:cas-server-support-surrogate-webflow"
include "support:cas-server-support-swagger"
include "support:cas-server-support-syncope-authentication"
include "support:cas-server-support-themes"
include "support:cas-server-support-themes-bootstrap"
include "support:cas-server-support-themes-collection"
include "support:cas-server-support-themes-core"
include "support:cas-server-support-throttle"
include "support:cas-server-support-throttle-bucket4j"
include "support:cas-server-support-throttle-core"
include "support:cas-server-support-throttle-hazelcast"
include "support:cas-server-support-throttle-jdbc"
include "support:cas-server-support-throttle-ldap"
include "support:cas-server-support-throttle-mongo"
include "support:cas-server-support-throttle-redis"
include "support:cas-server-support-thymeleaf-core"
include "support:cas-server-support-thymeleaf"
include "support:cas-server-support-token-authentication"
include "support:cas-server-support-token-core-api"
include "support:cas-server-support-token-core"
include "support:cas-server-support-token-tickets"
include "support:cas-server-support-token-webflow"
include "support:cas-server-support-tracing-jaeger"
include "support:cas-server-support-tracing-otel"
include "support:cas-server-support-tracing-zipkin"
include "support:cas-server-support-trusted"
include "support:cas-server-support-trusted-mfa"
include "support:cas-server-support-trusted-mfa-core"
include "support:cas-server-support-trusted-mfa-jdbc"
include "support:cas-server-support-trusted-mfa-mongo"
include "support:cas-server-support-trusted-mfa-redis"
include "support:cas-server-support-trusted-mfa-rest"
include "support:cas-server-support-trusted-mfa-dynamodb"
include "support:cas-server-support-trusted-webflow"
include "support:cas-server-support-twilio"
include "support:cas-server-support-twilio-mfa"
include "support:cas-server-support-validation"
include "support:cas-server-support-validation-core"
include "support:cas-server-support-webauthn"
include "support:cas-server-support-webauthn-core"
include "support:cas-server-support-webauthn-core-webflow"
include "support:cas-server-support-webauthn-dynamodb"
include "support:cas-server-support-webauthn-jpa"
include "support:cas-server-support-webauthn-ldap"
include "support:cas-server-support-webauthn-mongo"
include "support:cas-server-support-webauthn-redis"
include "support:cas-server-support-webauthn-rest"
include "support:cas-server-support-webconfig"
include "support:cas-server-support-websockets"
include "support:cas-server-support-ws-idp"
include "support:cas-server-support-ws-idp-api"
include "support:cas-server-support-ws-sts"
include "support:cas-server-support-ws-sts-api"
include "support:cas-server-support-wsfederation"
include "support:cas-server-support-wsfederation-webflow"
include "support:cas-server-support-x509"
include "support:cas-server-support-x509-core"
include "support:cas-server-support-x509-webflow"
include "support:cas-server-support-yaml-service-registry"
include "support:cas-server-support-yubikey"
include "support:cas-server-support-yubikey-core"
include "support:cas-server-support-yubikey-core-mfa"
include "support:cas-server-support-yubikey-dynamodb"
include "support:cas-server-support-yubikey-jpa"
include "support:cas-server-support-yubikey-mongo"
include "support:cas-server-support-yubikey-redis"

include "webapp:cas-server-webapp"
include "webapp:cas-server-webapp-resources"
include "webapp:cas-server-webapp-config-server"

include "webapp:cas-server-webapp-init"
include "webapp:cas-server-webapp-init-config-server"
include "webapp:cas-server-webapp-init-tomcat"
include "webapp:cas-server-webapp-starter-tomcat"
include "webapp:cas-server-webapp-native"
include "webapp:cas-server-webapp-jetty"
include "webapp:cas-server-webapp-tomcat"
include "webapp:cas-server-webapp-undertow"
