Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pajlada committed Jul 28, 2024
0 parents commit b4b25e3
Show file tree
Hide file tree
Showing 28 changed files with 1,150 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.{java,kt,kts}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "ci"
70 changes: 70 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build with Gradle
on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
gradle:
strategy:
matrix:
#os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
# others = slow
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3.3.2

- name: Execute Gradle build
run: ./gradlew build

- name: Build shadowJar
run: ./gradlew shadowJar

- name: Upload shadowJar
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: plugin-shadow
path: build/libs/*-*-all.jar

create-release:
needs: gradle
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')

steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: plugin-shadow
path: release-artifacts/
- name: Create release
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
with:
removeArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "release-artifacts/*"
body: |
This release should only be used if testing one of the features that have not made it to the plugin hub yet.
Note: To use this build, you must run from terminal (or command prompt): `java -ea -jar actionlogger-*-all.jar` (be sure to specify the correct version and path to the file). Also, very recent java versions may require [additional VM options](https://github.com/runelite/runelite/wiki/Building-with-IntelliJ-IDEA#jdks-16).
Latest Change:
${{ github.event.head_commit.message }}
prerelease: true
name: Nightly Release
tag: nightly-build
22 changes: 22 additions & 0 deletions .github/workflows/gradle7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build with Gradle 7.x
on: pull_request
jobs:
gradle:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11

- name: Setup hub gradle version
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.4 # https://github.com/runelite/plugin-hub/blob/master/package/gradle/wrapper/gradle-wrapper.properties

- name: Build plugin using hub gradle version
run: ./gradlew shadowJar --exclude-task test # tests are already executed by primary gradle task
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Lint

on:
push:
branches:
- master
pull_request:

concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Check formatting with Prettier
uses: actionsx/prettier@3d9f7c3fa44c9cb819e68292a328d7f4384be206
with:
# prettier CLI arguments.
args: --write .
- name: Show diff
run: git --no-pager diff --exit-code --color=never
shell: bash
33 changes: 33 additions & 0 deletions .github/workflows/update-resources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update Resources
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:

jobs:
update-resources:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Execute Resource Generator
run: ./gradlew generateResources

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: "chore: update rarity data from ${{ steps.date.outputs.date }} wiki"
commit-message: "chore: update rarity data from ${{ steps.date.outputs.date }} wiki"
branch: automated/chore/update-resources
reviewers: iProdigy
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.gradle
build
.idea/
.project
.settings/
.classpath
nbactions.xml
nb-configuration.xml
nbproject/
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore build directory
build/

# Ignore runtime resources
src/main/resources/
7 changes: 7 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
trailingComma: none
endOfLine: auto
quoteProps: preserve
overrides:
- files: "*.md"
options:
proseWrap: preserve
11 changes: 11 additions & 0 deletions .run/Run Action Logger.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Action Logger" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="actionlogger.ActionLoggerTest" />
<module name="actionlogger.test" />
<option name="PROGRAM_PARAMETERS" value="--debug --developer-mode" />
<option name="VM_PARAMETERS" value="-ea --illegal-access=warn --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
27 changes: 27 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
BSD 2-Clause License

Copyright (c) 2022, Jake Barter
All rights reserved.

Copyright (c) 2022, pajlads

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Action Logger

Action Logger logs actions your character makes to disk in a programmatically accessible format. These actions intend to make debugging quest helpers easier.

These actions include:

- Dialogues (each dialogue screen text, the options available, the last interacted npc, and the option chosen (if possible))
- Varbit changes
- Maybe player movements?
95 changes: 95 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
plugins {
java
}

repositories {
mavenLocal()
maven {
url = uri("https://repo.runelite.net")
content {
includeGroupByRegex("net\\.runelite.*")
}
}
mavenCentral()
}

dependencies {
val lombokVersion = "1.18.30" // supports JDK 21 and is verified by runelite
// old annotation processor approach due to runelite plugin hub verification restrictions
compileOnly(group = "org.projectlombok", name = "lombok", version = lombokVersion)
annotationProcessor(group = "org.projectlombok", name = "lombok", version = lombokVersion)
testCompileOnly(group = "org.projectlombok", name = "lombok", version = lombokVersion)
testAnnotationProcessor(group = "org.projectlombok", name = "lombok", version = lombokVersion)

// this version of annotations is verified by runelite
compileOnly(group = "org.jetbrains", name = "annotations", version = "23.0.0")

val runeLiteVersion = "latest.release"
compileOnly(group = "net.runelite", name = "client", version = runeLiteVersion)
testImplementation(group = "net.runelite", name = "client", version = runeLiteVersion)
testImplementation(group = "net.runelite", name = "jshell", version = runeLiteVersion)

val junitVersion = "5.5.2" // max version before junit-bom was added to pom files, due to runelite restrictions
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = junitVersion)
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-params", version = junitVersion)
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = junitVersion)
testRuntimeOnly(group = "org.junit.platform", name = "junit-platform-launcher", version = "1.5.2")

// mocking and test injection used by runelite client
testImplementation(group = "org.mockito", name = "mockito-core", version = "4.11.0") // runelite uses 3.1.0
testImplementation(group = "com.google.inject.extensions", name = "guice-testlib", version = "4.1.0") {
exclude(group = "com.google.inject", module = "guice") // already provided by runelite client
}
}

group = "actionlogger"
version = "0.1.0"

tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
val version = JavaVersion.VERSION_11.toString()
sourceCompatibility = version
targetCompatibility = version
}

tasks.test {
useJUnitPlatform {
excludeTags("generator")
}
}

tasks.register(name = "generateResources", type = Test::class) {
useJUnitPlatform {
includeTags("generator")
}
}

tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}

tasks.register(name = "shadowJar", type = Jar::class) {
dependsOn(configurations.testRuntimeClasspath)
manifest {
attributes(mapOf("Main-Class" to "actionlogger.ActionLoggerTest"))
}

duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(sourceSets.main.get().output)
from(sourceSets.test.get().output)
from({
configurations.testRuntimeClasspath.get().map {
if (it.isDirectory) it else zipTree(it)
}
})
exclude("META-INF/INDEX.LIST")
exclude("META-INF/*.SF")
exclude("META-INF/*.DSA")
exclude("META-INF/*.RSA")
exclude("**/module-info.class")

group = BasePlugin.BUILD_GROUP
archiveClassifier.set("shadow")
archiveFileName.set(rootProject.name + "-" + project.version + "-all.jar")
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
8 changes: 8 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit b4b25e3

Please sign in to comment.