/* * Geekdroid is a utility library for development on the Android * Platform. * * Copyright (C) 2017-2020 by Frederic-Charles Barthelery. * * This file is part of Geekdroid. * * Geekdroid is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Geekdroid is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Geekdroid. If not, see . */ package com.geekorum.build import com.hierynomus.gradle.license.LicenseBasePlugin import com.hierynomus.gradle.license.tasks.LicenseCheck import com.hierynomus.gradle.license.tasks.LicenseFormat import nl.javadude.gradle.plugins.license.LicenseExtension import nl.javadude.gradle.plugins.license.LicensePlugin import org.gradle.api.Project import org.gradle.api.Task import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.invoke import org.gradle.kotlin.dsl.named internal fun Project.configureSourceLicenseChecker(): Unit { apply() configure { header = file("$rootDir/config/license/header.txt") // ignore failures for now until we set the final license ignoreFailures = true excludes(listOf("**/*.webp", "**/*.png")) } tasks { val checkKotlinFilesLicenseTask = register("checkKotlinFilesLicense", LicenseCheck::class.java) { source = fileTree("src").apply { include("**/*.kt") } } val formatKotlinFilesLicenseTask = register("formatKotlinFilesLicense", LicenseFormat::class.java) { source = fileTree("src").apply { include("**/*.kt") } } named(LicenseBasePlugin.getLICENSE_TASK_BASE_NAME()) { dependsOn(checkKotlinFilesLicenseTask) } named(LicenseBasePlugin.getFORMAT_TASK_BASE_NAME()) { dependsOn(formatKotlinFilesLicenseTask) } } }