// publish build scans from CI builds
plugins {
    id "com.gradle.develocity" version "3.19.2"
    id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.1'
}


def isCI = System.getenv('CI') != null

develocity {
    server = "https://develocity-staging.eclipse.org"
    allowUntrustedServer = false // ensure a trusted certificate is configured
    buildScan {
        publishing.onlyIf { it.isAuthenticated() }
        obfuscation {
            username { name -> isCI ? 'ci' : 'local' }
            ipAddresses { addresses -> addresses.collect { address -> "0.0.0.0" } }
            externalProcessName { processName -> "non-build-process" }
            hostname { host -> isCI ? 'ci' : 'local' }
        }
        uploadInBackground = !isCI
    }
}

rootProject.name = 'buildship'

include ':org.gradle.toolingapi'
include ':org.eclipse.buildship.compat'
include ':org.eclipse.buildship.core'
include ':org.eclipse.buildship.ui'
include ':org.eclipse.buildship.feature'
include ':org.eclipse.buildship.site'
include ':org.eclipse.buildship.branding'
include ':org.eclipse.buildship.core.test'
include ':org.eclipse.buildship.ui.test'
if (properties['latest'] == 'true') {
    include ':org.eclipse.buildship.gradleprop.provider'
    include ':org.eclipse.buildship.gradleprop.ls'
    include ':org.eclipse.buildship.gradleprop.feature'
    include ':org.eclipse.buildship.kotlindsl.provider'
    include ':org.eclipse.buildship.kotlindsl.feature'
    include ':org.eclipse.buildship.dcl.feature'
    include ':org.eclipse.buildship.dcl.provider'
    include ':org.eclipse.buildship.gradleprop.test'
}

include ':org.eclipse.buildship.oomph'
include ':org.eclipse.buildship.oomph.edit'
include ':org.eclipse.buildship.oomph.feature'
include ':org.eclipse.buildship.oomph.test'

buildCache {
    local {
        enabled = !isCI
    }

    remote(develocity.buildCache) {
        enabled = true
        push = isCI
    }

}
