apply plugin: 'java'
apply plugin: 'eclipse'

tasks.withType(JavaCompile) {
	options.encoding = 'UTF-8'
}

eclipse {
	classpath {
		downloadJavadoc = true
		downloadSources = true
	}
}

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaLanguageVersion.of(21)

repositories {
	mavenCentral()
	maven {
		name = "Speiger Maven"
		url = "https://maven.speiger.com/repository/main"
	}
	maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}

task srcJar(type: Jar) {
	from sourceSets.main.allSource
	archiveClassifier = 'sources'
	from {
		configurations.runtimeClasspath.collect { 
			it.isDirectory() ? it : zipTree(it)
		}
	}
	duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

artifacts {
	archives srcJar
}

jar {
	manifest {
		attributes "Main-Class": 'speiger.src.coreengine.NewInputTest'
	}
	from {
		configurations.runtimeClasspath.collect { 
			it.isDirectory() ? it : zipTree(it)
		}
	}
	exclude('**/*.LIST')
	exclude('**/module-info.class')
	duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

dependencies {
	//LWJGL 3
	implementation platform("org.lwjgl:lwjgl-bom:$lwjglVersion")
	
	implementation "org.lwjgl:lwjgl"
	implementation "org.lwjgl:lwjgl-glfw"
	implementation "org.lwjgl:lwjgl-jemalloc"
	implementation "org.lwjgl:lwjgl-openal"
	implementation "org.lwjgl:lwjgl-opengl"
	implementation "org.lwjgl:lwjgl-stb"
	implementation "org.lwjgl:lwjgl-nfd"
	implementation "org.lwjgl:lwjgl-freetype"
	implementation "org.lwjgl:lwjgl-harfbuzz"
	implementation "org.lwjgl:lwjgl-nanovg"
	implementation "org.lwjgl:lwjgl::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-glfw::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-jemalloc::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-openal::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-opengl::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-stb::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-nfd::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-freetype::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-harfbuzz::$lwjglNatives"
	implementation "org.lwjgl:lwjgl-nanovg::$lwjglNatives"
	
	
	
	//Gson
	implementation 'com.google.code.gson:gson:2.8.6'
	
	//Primitive Collections
	implementation 'de.speiger:Primitive-Collections:0.9.0'
}