/*
 * This base configuration file is inherited by all projects, i.e. the root project and sub-projects.
 * Configuration common to all of them should be added here.
 */

// --------------- Plugins ---------------

apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'

group = 'org.dyvil'

// --------------- Dependencies ---------------

repositories {
	mavenLocal()
	mavenCentral()
	jcenter()
}

// --------------- Publishing ---------------

java {
	withSourcesJar()
	withJavadocJar()
}

signing {
	sign publishing.publications
}

publishing {
	publications {
		create('mavenJava', MavenPublication) {
			from(components.java)
			pom {
				name = project.name
				url = 'https://github.com/Dyvil/Dyvil'
				inceptionYear = '2014'

				scm {
					url = 'https://github.com/Dyvil/Dyvil'
				}

				licenses {
					license {
						name = 'MIT License'
						url = 'https://www.opensource.org/licenses/mit-license.php'
					}
				}

				developers {
					developer {
						id = 'Clashsoft'
						name = 'Adrian Kunz'
					}
				}
			}
		}
	}
}

afterEvaluate {
	publishing.publications.mavenJava.pom.description.set(project.description)
}

// --------------- Tasks ---------------

tasks.register('version') {
	it.doLast {
		println version
	}
}

// --------------- Java Compilation ---------------

tasks.withType(JavaCompile) {
	options.compilerArgs.addAll(
		'-parameters',          // generates parameter attributes and names
		'-XDignore.symbol.file' // disables "proprietary API" warnings
	)
	options.fork = true
}

// --------------- Jar ---------------

tasks.withType(Jar) {
	preserveFileTimestamps = false

	from(rootProject.rootDir) {
		include 'LICENSE.md'
		include 'thirdparty/*LICENSE*'
	}
}
