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

plugins {
	id 'java-library'
	id 'org.apache.grails.gradle.grails-plugin'
	id 'org.apache.grails.gradle.grails-gsp'
}

group = 'org.apache.grails'

ext {
	publishArtifactId = 'grails-spring-security-oauth2'
	pomTitle = 'Grails Spring Security OAuth2 Plugin'
	pomDescription = 'This plugin provides the capability to authenticate via oauth and depends on grails-spring-security.'
	pomDevelopers = [
		MatrixCrawler: 'Johannes Brunswicker',
		aitmanas: 'aitmanas',
		rvanderwerf: 'Ryan Vanderwerf',
		puneetbehl: 'Puneet Behl'
	]
}

dependencies {

	implementation platform("org.apache.grails:grails-bom:$grailsVersion")

	api project(':core-plugin'), {
		// api: GrailsUserDetailsService, SpringSecurityService
		// impl: GormUserDetailsService, GrailsUser, ReflectionUtils, @Secured(runtime), SecurityContextHolder,
		//       SpringSecurityUtils
	}
	api 'com.github.scribejava:scribejava-core:8.3.3', {
		// api: DefaultApi20, OAuth2AccessToken, OAuth20Service, Response
		// impl: OAuthRequest, ServiceBuilder, Verb
	}
	api 'org.apache.grails.bootstrap:grails-bootstrap', {
		// api: ConsoleLogger
		// impl: GrailsConsole, Model
	}
	api 'org.springframework.security:spring-security-core', {
		// api: AbstractAuthenticationToken, AuthenticationManager, GrantedAuthority
		// impl: AuthenticationException, UserDetails, UsernamePasswordAuthenticationToken
	}
	api 'org.apache.grails.views:grails-taglib', {
		// api: GrailsTagException
	}

	implementation 'commons-validator:commons-validator', {
		// impl: UrlValidator
	}
	implementation "commons-lang:commons-lang:$commonsLangVersion", {
		// impl: ExceptionUtils, StringUtils
	}
	implementation 'jline:jline', {
		// comp: ConsoleReader
	}
	implementation 'org.apache.grails.data:grails-datamapping-core', {
		// impl: @Transactional(runtime)
	}
	implementation 'org.apache.grails:grails-controllers', {
		// impl: ControllerTraitInjector
	}
	implementation 'org.apache.grails:grails-converters', {
		// impl: JSON
	}
	implementation 'org.springframework:spring-webmvc', {
		// impl: ModelAndView
	}

	runtimeOnly 'org.apache.grails:grails-services'

	compileOnly 'org.apache.grails:grails-core', { // Provided as this is a Grails plugin
		// api: GrailsApplication, GrailsApplicationCommand, GrailsAutoConfiguration, Plugin
		// impl: Holders
		// comp: @PluginSource(source)
	}
	compileOnly 'org.slf4j:slf4j-api', {
		// impl: @Slf4j(source)
	}
	compileOnly 'org.slf4j:slf4j-nop', {
		// Remove warning about missing slf4j implementation during gsp compilation
	}
	compileOnly 'org.apache.groovy:groovy' // Provided as this is a Grails plugin

	integrationTestImplementation 'org.apache.grails:grails-testing-support-web'
	integrationTestImplementation 'org.spockframework:spock-core'

	integrationTestRuntimeOnly 'net.bytebuddy:byte-buddy'
}

apply {
	from rootProject.layout.projectDirectory.file('gradle/plugin-config.gradle')
	from rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
	from rootProject.layout.projectDirectory.file('gradle/groovydoc-config.gradle')
	from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
	from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
	from rootProject.layout.projectDirectory.file('gradle/reproducible-config.gradle')
}