Skip to content

Commit

Permalink
Merge branch 'hannibal002:beta' into feature/tentacles
Browse files Browse the repository at this point in the history
  • Loading branch information
j10a1n15 authored Oct 19, 2024
2 parents ccb48e0 + 13ed9b5 commit 7c032db
Show file tree
Hide file tree
Showing 402 changed files with 6,064 additions and 3,991 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
34 changes: 18 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,30 @@ 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:
runs-on: ubuntu-latest
name: "Build multi version"
env:
SKIP_DETEKT: "true"
steps:
- name: Checkout code
uses: actions/checkout@v4
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
1 change: 1 addition & 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: 7 additions & 0 deletions .live-plugins/module/plugin.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ val forgeEvent = "SubscribeEvent"
val handleEvent = "HandleEvent"
val skyHanniModule = "SkyHanniModule"

val skyhanniPath = "at.hannibal2.skyhanni"
val patternGroup = "at.hannibal2.skyhanni.utils.repopatterns.RepoPatternGroup"
val pattern = "java.util.regex.Pattern"

Expand All @@ -36,12 +37,17 @@ fun isRepoPattern(property: KtProperty): Boolean {
return false
}

fun isFromSkyhanni(declaration: KtNamedDeclaration): Boolean {
return declaration.fqName?.asString()?.startsWith(skyhanniPath) ?: false
}

class ModuleInspectionKotlin : AbstractKotlinInspection() {
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {

val visitor = object : KtVisitorVoid() {

override fun visitClass(klass: KtClass) {
if (!isFromSkyhanni(klass)) return
val hasAnnotation = klass.annotationEntries.any { it.shortName?.asString() == skyHanniModule }

if (hasAnnotation) {
Expand All @@ -54,6 +60,7 @@ class ModuleInspectionKotlin : AbstractKotlinInspection() {
}

override fun visitObjectDeclaration(declaration: KtObjectDeclaration) {
if (!isFromSkyhanni(declaration)) return
val hasAnnotation = declaration.annotationEntries.any { it.shortName?.asString() == skyHanniModule }
if (hasAnnotation) return

Expand Down
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
10 changes: 9 additions & 1 deletion 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 @@ -213,6 +220,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 @@ -367,7 +375,7 @@ detekt {

tasks.withType<Detekt>().configureEach {
onlyIf {
false // TODO: Remove onlyIf when we're ready to enforce
System.getenv("SKIP_DETEKT") != "true"
}

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 7c032db

Please sign in to comment.