Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New layout #79

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pipeline {
}
post {
success {
archiveArtifacts artifacts: 'archives/*.jar, files.txt, build/version.properties', followSymlinks: false
javadoc javadocDir: 'build/docs/javadoc', keepAll: true
archiveArtifacts artifacts: 'archives/*.jar, files.txt, core/build/version.properties', followSymlinks: false
javadoc javadocDir: 'core/build/docs/javadoc', keepAll: true
}
}
}
Expand Down
146 changes: 18 additions & 128 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
import org.gradle.internal.os.OperatingSystem

plugins {
java
`java-library`
id("com.github.johnrengelman.shadow") version "7.1.2"
id("org.kakara.versionfile") version "1.0.0"
`maven-publish`
signing
}

val lwjglVersion = "3.2.3"
val jomlVersion = "1.9.25"

// LWJGL Native Versions
var lwjglNatives = when (OperatingSystem.current()) {
OperatingSystem.LINUX -> System.getProperty("os.arch").let {
if (it.startsWith("arm") || it.startsWith("aarch64"))
"natives-linux-${if (it.contains("64") || it.startsWith("armv8")) "arm64" else "arm32"}"
else
"natives-linux"
}
OperatingSystem.WINDOWS -> if (System.getProperty("os.arch")
.contains("64")
) "natives-windows" else "natives-windows-x86"
OperatingSystem.MAC_OS -> "natives-macos"
else -> throw Error("Unrecognized or unsupported Operating system. Please set \"lwjglNatives\" manually")
}

if (hasProperty("native")) {
lwjglNatives = properties.get("native").toString()
id("maven-publish")
}

group = "org.kakara"
val artifactName = "engine"
var build = "0"
Expand All @@ -46,110 +17,29 @@ if (hasProperty("buildNumber")) {
version = org.kakara.engine.Version.getEngineVersion("", branch);
}

java {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
maven("https://repo.ryandw11.com/repository/maven-releases")
jcenter()
}
subprojects {

publishing {
publications {

create<MavenPublication>("mavenJava") {
artifact(tasks["shadowJar"])

artifactId = artifactName
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(artifactName)
}
}
}
repositories {
maven {

val releasesRepoUrl = uri("https://repo.kingtux.me/storages/maven/kakara")
val snapshotsRepoUrl = uri("https://repo.kingtux.me/storages/maven/kakara")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials(PasswordCredentials::class)

}
mavenLocal()
maven("https://repo.maven.apache.org/maven2")
maven("https://repo.kingtux.me/storages/maven/kakara")
}
}

tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
tasks.register<Javadoc>("aggregatedJavadocs") {
setDestinationDir(file("$buildDir/docs/javadoc"))
title = "$project.name $version API"
options.withGroovyBuilder {
"author"(true)
"addStringOption"("Xdoclint:none", "-quiet")
"addStringOption"("sourcepath", "")
}
}

tasks {
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
if (project.hasProperty("is-build")) {
//Used by Jenkins
archiveFileName.set("${project.name}-${project.version}-${project.property("native")}.jar")
subprojects.forEach { proj ->
proj.tasks.filterIsInstance<Javadoc>().forEach {
source += it.source
classpath += it.classpath
excludes += it.excludes
includes += it.includes
}
archiveClassifier.set("");
dependsOn(project.tasks.getByName("vftask"));
}
"jar"{
dependsOn(project.tasks.getByName("vftask"));
}
}

versionFileConfig {
isCompileIntoJar = true;
jarDirectory = "engine"
}
dependencies {
// Regular Depends
implementation(group = "me.ryandw11", name = "Octree", version = "1.0")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-io:commons-io:2.11.0")
implementation("org.jetbrains:annotations:23.0.0")
implementation("com.github.nifty-gui:nifty:1.4.3")
implementation("org.l33tlabs.twl:pngdecoder:1.0")
implementation("io.imgui.java:binding:1.77-0.17.2")
implementation("io.imgui.java:lwjgl3:1.77-0.17.2")
implementation("org.slf4j:slf4j-api:1.8.0-beta4")
testRuntimeOnly("org.slf4j:slf4j-simple:1.8.0-beta4")
implementation("org.joml", "joml", jomlVersion)

//LWJGL
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))

implementation("org.lwjgl", "lwjgl")
implementation("org.lwjgl", "lwjgl-assimp")
implementation("org.lwjgl", "lwjgl-glfw")
implementation("org.lwjgl", "lwjgl-nanovg")
implementation("org.lwjgl", "lwjgl-openal")
implementation("org.lwjgl", "lwjgl-opengl")
implementation("org.lwjgl", "lwjgl-par")
implementation("org.lwjgl", "lwjgl-stb")
if (!lwjglNatives.equals("build", true)) {
runtimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-assimp", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-nanovg", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-openal", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-par", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives)
implementation("io.imgui.java:$lwjglNatives:1.77-0.17.2")
}
}
}
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
rm -Rv archives
mkdir archives
./gradlew clean shadowJar -PbuildNumber=${BUILD_NUMBER} -Pnative=natives-linux -Pis-build=true -Pbranch=${GIT_BRANCH}
cp build/libs/*.jar archives/
cp core/build/libs/*.jar archives/

./gradlew clean shadowJar javadoc -PbuildNumber=${BUILD_NUMBER} -Pnative=natives-windows -Pis-build=true -Pbranch=${GIT_BRANCH}
cp build/libs/*.jar archives/
cp core/build/libs/*.jar archives/

ls archives/ > files.txt
160 changes: 160 additions & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
import org.gradle.internal.os.OperatingSystem

plugins {
java
`java-library`
id("com.github.johnrengelman.shadow") version "7.1.2"
id("org.kakara.versionfile") version "1.0.0"
`maven-publish`
signing
}

val lwjglVersion = "3.2.3"
val jomlVersion = "1.9.25"

// LWJGL Native Versions
var lwjglNatives = when (OperatingSystem.current()) {
OperatingSystem.LINUX -> System.getProperty("os.arch").let {
if (it.startsWith("arm") || it.startsWith("aarch64"))
"natives-linux-${if (it.contains("64") || it.startsWith("armv8")) "arm64" else "arm32"}"
else
"natives-linux"
}
OperatingSystem.WINDOWS -> if (System.getProperty("os.arch")
.contains("64")
) "natives-windows" else "natives-windows-x86"
OperatingSystem.MAC_OS -> "natives-macos"
else -> throw Error("Unrecognized or unsupported Operating system. Please set \"lwjglNatives\" manually")
}

if (hasProperty("native")) {
lwjglNatives = properties.get("native").toString()
}

group = "org.kakara"
val artifactName = "engine"
var build = "0"
var branch = ""

if (hasProperty("branch")) {
branch = properties.get("branch").toString()
}

if (hasProperty("buildNumber")) {
version = org.kakara.engine.Version.getEngineVersion(properties.get("buildNumber").toString(), branch);
} else {
version = org.kakara.engine.Version.getEngineVersion("", branch);
}

java {
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}

repositories {
mavenCentral()
maven("https://repo.ryandw11.com/repository/maven-releases")
jcenter()
}

publishing {
publications {

create<MavenPublication>("mavenJava") {
artifact(tasks["shadowJar"])

artifactId = artifactName
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
pom {
name.set(artifactName)
}
}
}
repositories {
maven {

val releasesRepoUrl = uri("https://repo.kingtux.me/storages/maven/kakara")
val snapshotsRepoUrl = uri("https://repo.kingtux.me/storages/maven/kakara")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials(PasswordCredentials::class)

}
mavenLocal()
}
}

tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}

tasks {
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
if (project.hasProperty("is-build")) {
//Used by Jenkins
archiveFileName.set("${project.name}-${project.version}-${project.property("native")}.jar")
}
archiveClassifier.set("");
dependsOn(project.tasks.getByName("vftask"));
}
"jar"{
dependsOn(project.tasks.getByName("vftask"));
}
}

versionFileConfig {
isCompileIntoJar = true;
jarDirectory = "engine"
}
dependencies {
// Regular Depends
implementation(group = "me.ryandw11", name = "Octree", version = "1.0")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("commons-io:commons-io:2.11.0")
implementation("org.jetbrains:annotations:23.0.0")
implementation("com.github.nifty-gui:nifty:1.4.3")
implementation("org.l33tlabs.twl:pngdecoder:1.0")
implementation("io.imgui.java:binding:1.77-0.17.2")
implementation("io.imgui.java:lwjgl3:1.77-0.17.2")
implementation("org.slf4j:slf4j-api:1.8.0-beta4")
testRuntimeOnly("org.slf4j:slf4j-simple:1.8.0-beta4")
implementation("org.joml", "joml", jomlVersion)

//LWJGL
implementation(platform("org.lwjgl:lwjgl-bom:$lwjglVersion"))

implementation("org.lwjgl", "lwjgl")
implementation("org.lwjgl", "lwjgl-assimp")
implementation("org.lwjgl", "lwjgl-glfw")
implementation("org.lwjgl", "lwjgl-nanovg")
implementation("org.lwjgl", "lwjgl-openal")
implementation("org.lwjgl", "lwjgl-opengl")
implementation("org.lwjgl", "lwjgl-par")
implementation("org.lwjgl", "lwjgl-stb")
if (lwjglNatives.equals("natives-windows", true)) {
implementation(project(":windows"))
} else if (lwjglNatives.equals("natives-linux", true)) {
implementation(project(":linux"))
}
if (!lwjglNatives.equals("build", true)) {
runtimeOnly("org.lwjgl", "lwjgl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-assimp", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-nanovg", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-openal", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-par", classifier = lwjglNatives)
runtimeOnly("org.lwjgl", "lwjgl-stb", classifier = lwjglNatives)
implementation("io.imgui.java:$lwjglNatives:1.77-0.17.2")
}
}
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
Loading