plugins {
	id 'java-library'
	id 'maven-publish'
}

group = 'org.sensortech'
version = '0.1.0'

java {
	toolchain {
		languageVersion = JavaLanguageVersion.of(25)
	}

	withSourcesJar()
	withJavadocJar()
}

repositories {
	mavenLocal()
	mavenCentral()
}

test {
	useJUnitPlatform()

	// Leave disabled while :damsel migrates to JUnit 5 (same as thoughtframe-core).
	enabled = false
}

dependencies {
	// Platform
	compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
	testImplementation 'javax.servlet:javax.servlet-api:4.0.1'

	// Foundation
	api 'org.apache.commons:commons-lang3:3.7'
	api 'commons-io:commons-io:2.6'
	api 'commons-codec:commons-codec:1.9'
	api 'commons-collections:commons-collections:3.2.2'
	api 'commons-logging:commons-logging:1.2'

	// HTTP
	api 'org.apache.httpcomponents:httpclient:4.5.2'
	api 'org.apache.httpcomponents:httpcore:4.4.4'
	api 'org.apache.httpcomponents:httpmime:4.5.2'

	// Templates & Runtime Scripting
	api 'org.apache.velocity:velocity-engine-core:2.4.1'
	api 'org.apache.groovy:groovy-all:5.0.7'

	// Native
	api 'net.java.dev.jna:jna:4.1.0'
	api 'net.java.dev.jna:jna-platform:4.1.0'

	// XML / JSON
	api('org.dom4j:dom4j:2.1.3') {
		// Registers org.gjt.xpp as JAXP SAXParserFactory; breaks Jetty web.xml DOCTYPE parse
		// when that jar sorts ahead of Xerces on the Eclipse launch classpath.
		exclude group: 'pull-parser', module: 'pull-parser'
		exclude group: 'xpp3', module: 'xpp3'
	}
	api 'com.google.guava:guava:18.0'
	api 'com.googlecode.json-simple:json-simple:1.1.1'
	api 'aopalliance:aopalliance:1.0'

	// Testing
	testImplementation platform('org.junit:junit-bom:5.13.4')
	testImplementation 'org.junit.jupiter:junit-jupiter'

	testImplementation 'org.springframework:spring-core:3.2.1.RELEASE'
	testImplementation 'org.springframework:spring-beans:3.2.1.RELEASE'
	testImplementation 'org.springframework:spring-context:3.2.1.RELEASE'
	testImplementation 'org.springframework:spring-expression:3.2.1.RELEASE'
}

tasks.withType(JavaCompile).configureEach {
	options.encoding = 'UTF-8'
	options.compilerArgs += [
		'-Xlint:none',
		'-Xlint:-dep-ann'
	]
}

tasks.withType(Javadoc).configureEach {
	enabled = false
}

// plugin.xml / depends.xml live next to Java (ThoughtFrame layout); put them on the classpath.
// Keep include broad enough that src/main/resources (e.g. mimetypes.properties) is still packaged.
sourceSets {
	main {
		resources {
			srcDir 'src/main/java'
			include '**/*.xml'
			include '**/*.properties'
		}
	}
}

publishing {
	publications {
		mavenJava(MavenPublication) {
			from components.java
		}
	}
}
