Skip to content

Commit

Permalink
update gradle, kotlin, refactor core dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubydesic committed Sep 3, 2023
1 parent 5599242 commit 7d84b43
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 21 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "vs-core"]
path = vs-core
url = https://github.com/ValkyrienSkies/vs-core
51 changes: 43 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ buildscript {

plugins {
// Needed for Forge+Fabric
id "architectury-plugin" version "3.4.143"
id "dev.architectury.loom" version "1.0.306" apply false
id "architectury-plugin" version "3.4.146"
id "dev.architectury.loom" version "1.3.355" apply false
id 'io.github.juuxel.loom-quiltflower' version '1.8.0' apply false
// Kotlin
id "org.jetbrains.kotlin.jvm" version "1.7.10" apply false
id "org.jetbrains.kotlin.jvm" version "1.9.10" apply false
// Kotlin linter
id "org.jlleitschuh.gradle.ktlint" version "10.3.0"

Expand Down Expand Up @@ -42,9 +42,29 @@ dependencyLocking {
lockAllConfigurations()
}

// Determine the version of vs-core
String vsCoreGitRevision = "git rev-parse HEAD".execute(null, gradle.includedBuild("vs-core").projectDir).text.trim()
ext.vs_core_version = "1.1.0+" + vsCoreGitRevision.substring(0, 10)
tasks.register("updateVsCore") {
File versionFile = null
File gradleProperties = file("gradle.properties")

try {
def vsCoreBuild = gradle.includedBuild("vs-core")
versionFile = new File(vsCoreBuild.projectDir, "api-game/build/version.txt")

inputs.file(versionFile)
outputs.file(gradleProperties)
dependsOn(vsCoreBuild.task(":api-game:writeVersion"))
} catch (UnknownDomainObjectException ignore) {}

onlyIf {
versionFile != null
}

doLast {
def vsCoreVersion = versionFile.text
def newGradleProperties = gradleProperties.text.replaceFirst("(?m)^vs_core_version=.*", "vs_core_version=" + vsCoreVersion)
gradleProperties.write(newGradleProperties)
}
}

subprojects {
apply plugin: "dev.architectury.loom"
Expand All @@ -54,7 +74,22 @@ subprojects {
apply plugin: "org.jetbrains.kotlin.jvm"
apply plugin: "io.github.juuxel.loom-quiltflower"

configurations.each { it.resolutionStrategy.useGlobalDependencySubstitutionRules.set(false) }

repositories {
try {
def vsCoreBuild = gradle.includedBuild("vs-core")
mavenLocal {
content {
includeGroup("org.valkyrienskies.core")
}
}

[':impl', ':api', ':api-game'].each {
compileJava.dependsOn(vsCoreBuild.task("${it}:publishToMavenLocal"))
}
} catch (UnknownDomainObjectException ignore) {}

mavenCentral()
maven {
name = "Valkyrien Skies Internal"
Expand Down Expand Up @@ -125,9 +160,9 @@ subprojects {
tasks.withType(Checkstyle) {
reports {
// Do not output html reports
html.enabled = false
html.required.set(false)
// Output xml reports
xml.enabled = true
xml.required.set(true)
}
}

Expand Down
2 changes: 2 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

dependencies {
annotationProcessor(implementation("com.github.LlamaLad7:MixinExtras:0.1.1"))

Expand Down Expand Up @@ -26,6 +27,7 @@ dependencies {
modCompileOnly("com.simibubi.create:create-fabric-${minecraft_version}:${create_fabric_version}")
{ exclude group: 'com.github.AlphaMode', module: 'fakeconfigtoml' }
modCompileOnly("com.jozufozu.flywheel:flywheel-fabric-${minecraft_version}:0.6.8-33")
modCompileOnly("io.github.fabricators_of_create:Porting-Lib:${port_lib_version}+${minecraft_version}")
}

architectury {
Expand Down
9 changes: 5 additions & 4 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
}

// Depend on the fabric kotlin mod
include(modImplementation("net.fabricmc:fabric-language-kotlin:1.8.5+kotlin.1.7.20"))
include(modImplementation("net.fabricmc:fabric-language-kotlin:1.10.10+kotlin.1.9.10"))
include(modImplementation("me.shedaniel.cloth:cloth-config-fabric:6.3.81"))

modImplementation("curse.maven:sodium-394468:3669187")
Expand Down Expand Up @@ -103,7 +103,7 @@ processResources {

shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
archiveClassifier.set "dev-shadow"
duplicatesStrategy DuplicatesStrategy.EXCLUDE // Ignore duplicate valkyrienskies-common.accesswidener files
dependencies {
exclude(dependency("org.jetbrains.kotlin:.*:.*")) // Don't shade kotlin!
Expand All @@ -115,16 +115,17 @@ shadowJar {
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
archiveClassifier.set null
duplicatesStrategy DuplicatesStrategy.EXCLUDE // Ignore duplicate valkyrienskies-common.accesswidener files
}

jar {
classifier "dev"
archiveClassifier.set "dev"
duplicatesStrategy DuplicatesStrategy.EXCLUDE // Ignore duplicate valkyrienskies-common.accesswidener files
}

sourcesJar {
dependsOn "copyAccessWidener"
duplicatesStrategy DuplicatesStrategy.EXCLUDE // Ignore duplicate valkyrienskies-common.accesswidener files
def commonSources = project(":common").sourcesJar
dependsOn commonSources
Expand Down
6 changes: 3 additions & 3 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,21 @@ shadowJar {
exclude "net/optifine/**"

configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
archiveClassifier.set "dev-shadow"
}

remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
archiveClassifier.set null
}

compileKotlin {
kotlinOptions.jvmTarget = '17'
}

jar {
classifier "dev"
archiveClassifier.set "dev"
}

sourcesJar {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fabric_loader_version=0.14.10
fabric_api_version=0.59.0+1.18.2
forge_version=1.18.2-40.1.69
create_fabric_version=0.5.0.i-934+1.18.2
vs_core_version=1.1.0+22a5fcd037
# Prevent kotlin from autoincluding stdlib as a dependency, which breaks
# gradle's composite builds (includeBuild) for some reason. We'll add it manually
kotlin.stdlib.default.dependency=false
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 7 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ dependencyResolutionManagement {
include("common")
include("fabric")
include("forge")
includeBuild("vs-core")

try {
def core = file("../vs-core")
if (core.isDirectory()) {
includeBuild(core)
}
} catch (SecurityException ignore) {}

rootProject.name = "valkyrienskies"
1 change: 0 additions & 1 deletion vs-core
Submodule vs-core deleted from 1a7b58

0 comments on commit 7d84b43

Please sign in to comment.