Skip to content

Commit

Permalink
Merge branch 'beta' into dragon-calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
CalMWolfs authored Oct 20, 2024
2 parents c4af2bd + 8ce3e9d commit 504917c
Show file tree
Hide file tree
Showing 409 changed files with 6,217 additions and 3,565 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/process_detekt_sarif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ read -r -d '' jq_command <<'EOF'
",title=" + (.ruleId) +
",col=" + (.l.region.startColumn|tostring) +
",endColumn=" + (.l.region.endColumn|tostring) +
"::" + (.message.text)
"::" + (.message)
)
EOF

Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ jobs:
with:
name: "Test Results"
path: versions/1.8.9/build/reports/tests/test/
#detekt:
# name: Run detekt
# runs-on: ubuntu-latest
detekt:
name: Run detekt
runs-on: ubuntu-latest

# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - uses: ./.github/actions/setup-normal-workspace
# # detektMain is a LOT slower than detekt, but it does type analysis
# - name: Run detekt main (w/typing analysis)
# run: |
# ./gradlew detektMain --stacktrace
# - name: Annotate detekt failures
# if: ${{ !cancelled() }}
# run: |
# chmod +x .github/scripts/process_detekt_sarif.sh
# ./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/main.sarif
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ./.github/actions/setup-normal-workspace
# detektMain is a LOT slower than detekt, but it does type analysis
- name: Run detekt main (w/typing analysis)
run: |
./gradlew detektMain --stacktrace
- name: Annotate detekt failures
if: ${{ !cancelled() }}
run: |
chmod +x .github/scripts/process_detekt_sarif.sh
./.github/scripts/process_detekt_sarif.sh versions/1.8.9/build/reports/detekt/main.sarif

preprocess:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: "PR Changelog Verification"

on:
pull_request_target:
types: [ opened, edited ]
types: [ opened, edited, ready_for_review ]

jobs:
verify-changelog:
if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id
if: github.event.pull_request.state == 'open' && '511310721' == github.repository_id && github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 2 additions & 0 deletions .idea/dictionaries/default_user.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ out [their guide](https://github.com/NotEnoughUpdates/NotEnoughUpdates/blob/mast

If you are not very familiar with git, you might want to try this out: https://learngitbranching.js.org/.

_An explanation how to use intellij and branches will follow here soon._
Proposed changes are better off being in their own branch, you can do this by doing the following from within IntelliJ with the SkyHanni project already open.
- Click the beta dropdown at the top of IntelliJ
- Click new branch
- Give the branch a name relating to the changes you plan to make

_A more in depth explanation how to use intellij and branches will follow here soon._

Please use a prefix for the name of the PR (E.g. Feature, Improvement, Fix, Backend, ...).

Expand Down
23 changes: 20 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import net.fabricmc.loom.task.RunGameTask
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import skyhannibuildsystem.ChangelogVerification
import skyhannibuildsystem.DownloadBackupRepo

plugins {
idea
Expand Down Expand Up @@ -96,6 +97,12 @@ val headlessLwjgl by configurations.creating {
isTransitive = false
isVisible = false
}

val includeBackupRepo by tasks.registering(DownloadBackupRepo::class) {
this.outputDirectory.set(layout.buildDirectory.dir("downloadedRepo"))
this.branch = "main"
}

tasks.runClient {
this.javaLauncher.set(
javaToolchains.launcherFor {
Expand Down Expand Up @@ -145,14 +152,18 @@ dependencies {
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT")
annotationProcessor("com.google.code.gson:gson:2.10.1")
annotationProcessor("com.google.guava:guava:17.0")
} else if (target == ProjectTarget.MODERN) {
modCompileOnly("net.fabricmc:fabric-loader:0.16.7")
modCompileOnly("net.fabricmc.fabric-api:fabric-api:0.102.0+1.21")
}

implementation(kotlin("stdlib-jdk8"))
shadowImpl("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") {
exclude(group = "org.jetbrains.kotlin")
}

modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
if (target.isForge) modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.2.1")
else modRuntimeOnly("me.djtheredstoner:DevAuth-fabric:1.2.1")

modCompileOnly("com.github.hannibal002:notenoughupdates:4957f0b:all") {
exclude(module = "unspecified")
Expand Down Expand Up @@ -213,6 +224,7 @@ kotlin {

// Tasks:
tasks.processResources {
from(includeBackupRepo)
inputs.property("version", version)
filesMatching(listOf("mcmod.info", "fabric.mod.json")) {
expand("version" to version)
Expand Down Expand Up @@ -243,6 +255,10 @@ if (target == ProjectTarget.MAIN) {
}
}

tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget.set(JvmTarget.fromTarget(target.minecraftVersion.formattedJavaLanguageVersion))
}

if (target.parent == ProjectTarget.MAIN) {
val mainRes = project(ProjectTarget.MAIN.projectPath).tasks.getAt("processResources")
tasks.named("processResources") {
Expand Down Expand Up @@ -323,7 +339,8 @@ if (!MultiVersionStage.activeState.shouldCompile(target)) {

preprocess {
vars.put("MC", target.minecraftVersion.versionNumber)
vars.put("FORGE", if (target.forgeDep != null) 1 else 0)
vars.put("FORGE", if (target.isForge) 1 else 0)
vars.put("FABRIC", if (target.isFabric) 1 else 0)
vars.put("JAVA", target.minecraftVersion.javaVersion)
patternAnnotation.set("at.hannibal2.skyhanni.utils.compat.Pattern")
}
Expand Down Expand Up @@ -367,7 +384,7 @@ detekt {

tasks.withType<Detekt>().configureEach {
onlyIf {
false // TODO: Remove onlyIf when we're ready to enforce
target == ProjectTarget.MAIN
}

reports {
Expand Down
34 changes: 34 additions & 0 deletions buildSrc/src/main/kotlin/skyhannibuildsystem/DownloadBackupRepo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package skyhannibuildsystem

import org.gradle.api.DefaultTask
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import java.net.URL

// Code taken from NotEnoughUpdates
abstract class DownloadBackupRepo : DefaultTask() {

@get:OutputDirectory
abstract val outputDirectory: DirectoryProperty

@get:Input
abstract var branch: String

@get:Internal
val repoFile get() = outputDirectory.get().asFile.resolve("assets/skyhanni/repo.zip")

@TaskAction
fun downloadRepo() {
val downloadUrl = URL("https://github.com/hannibal002/SkyHanni-Repo/archive/refs/heads/$branch.zip")
val file = repoFile
file.parentFile.mkdirs()
file.outputStream().use { out ->
downloadUrl.openStream().use { inp ->
inp.copyTo(out)
}
}
}
}
Loading

0 comments on commit 504917c

Please sign in to comment.