/*
 * Nextcloud - Android Client
 *
 * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2024 Alper Ozturk <alper_ozturk@proton.me>
 * SPDX-FileCopyrightText: 2023 Tobias Kaminsky <tobias@kaminsky.me>
 * SPDX-FileCopyrightText: 2022 Álvaro Brey Vilas <alvaro@alvarobrey.com>
 * SPDX-FileCopyrightText: 2016 Andy Scherzinger <info@andy-scherzinger.de>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
buildscript {
    ext {
        androidLibraryVersion ="0c886d61f6"
        androidPluginVersion = '8.3.2'
        androidxMediaVersion = '1.3.1'
        androidxTestVersion = "1.5.0"
        appCompatVersion = '1.6.1'
        checkerVersion = "3.21.2"
        daggerVersion = "2.51.1"
        documentScannerVersion = "1.1.1"
        espressoVersion = "3.5.1"
        fidoVersion = "4.1.0-patch2"
        jacoco_version = '0.8.12'
        kotlin_version = '1.9.23'
        markwonVersion = "4.6.2"
        mockitoVersion = "4.11.0"
        mockitoKotlinVersion = "4.1.0"
        mockkVersion = "1.13.10"
        prismVersion = "2.0.0"
        roomVersion = "2.6.1"
        workRuntime = "2.9.0"

        ciBuild = System.getenv("CI") == "true"
        shotTest = System.getenv("SHOT_TEST") == "true"
    }
}

subprojects {
    buildscript {
        repositories {
            gradlePluginPortal()
            google()
            mavenCentral()
        }
    }
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

tasks.register('clean', Delete) {
    delete rootProject.buildDir
}

tasks.register('installGitHooks', Copy) {
    def sourceFolder = "${rootProject.projectDir}/scripts/hooks"
    def destFolder = "${rootProject.projectDir}/.git/hooks"

    description = "Install git hooks"

    from(sourceFolder) {
        include '*'
    }
    into destFolder

    eachFile { file ->
        println "${sourceFolder}/${file.relativeSourcePath} -> ${destFolder}/${file.path}"
    }
}
