Grawlingson: CORE Update entire compile process using !30 clean up CLI work

* Adds patcher and core openrsc client the IdleRSC project

 * app = idlersc app files
 * client = openrsc client
 * patcher = idlersc patcher

"* Fix CLI due to input causing the program to crash on startup.
* Fix transitive dependency spitting out an error on [startup](https://www.slf4j.org/codes.html#StaticLoggerBinder).
* Fix `.editorconfig` causing IDE formatting to clash with spotless' preferred formatting.
* Fix typo in debugger button. (This isn't 100% fixed, I'll investigate later.)
* Fix infinite looping bug when the cache creation window is exited.
* Add more documentation.
* Add `patcher` and `client` subprojects.
* Add `run` task to gradle for development/debugging purposes. This can be invoked via IDE or command line using the gradle wrapper. Bonus - args can be passed via the gradle --args option. For example, `./gradlew run --args='--auto-login --username username --password password --init-cache coleslaw'`
* Move main project to `app` subproject due to shared dependencies.
* ~~Bump JDK required to 11.~~ Keeping minimum required JDK at 8.
* Add convenience scripts to update code shared from `core` repository.
* Played musical chairs with level 3 chickens. Spoiler: I lost, every time."
This commit is contained in:
Kaila_Btw committed 2024-01-03 21:45:51 -05:00
1 parent cc92de0dcd
commit fd49f71b00
630 files changed
+61834 -121

No files matched your search

+4 -5
View File
@@ -13,7 +13,7 @@ stages:
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- apt-get update --quiet --assume-yes
- apt-get install --quiet --assume-yes git
- apt-get install --quiet --assume-yes git make
# git rev-list --count does not work correctly with the default settings.
variables:
@@ -37,7 +37,7 @@ cache:
format:
stage: format
script:
- ./gradlew --build-cache --parallel spotlessCheck
- make check-format
# Explicitly state to gradle wrapper that we want the cache to be enabled,
# build a release zip, then upload the zip artifact to Gitlab CI for end-users
@@ -45,7 +45,7 @@ format:
build:
stage: build
script:
- ./gradlew --build-cache --parallel release
- make release
artifacts:
paths:
- ./*.zip
@@ -54,8 +54,7 @@ build:
pages:
stage: pages
script:
- ./gradlew --build-cache --parallel javadoc
- cp -r build/docs/javadoc public
- make build-javadoc
artifacts:
paths:
- public
+1
View File
@@ -0,0 +1 @@
Menus:1
+57
View File
@@ -0,0 +1,57 @@
# Terminal Colours
RED?=$(shell tput setaf 1)
GREEN?=$(shell tput setaf 2)
YELLOW?=$(shell tput setaf 3)
BLUE?=$(shell tput setaf 4)
BOLD?=$(shell tput bold)
RST?=$(shell tput sgr0)
##@ Build
.PHONY: build
build: ## Build the project
@./gradlew build
.PHONY: release
release: ## Create a release archive
@./gradlew release
.PHONY: clean
clean: ## Clean everything up
@./gradlew clean
##@ Maintenance
.PHONY: check-cache
check-cache: ## Check cache contents and update if necessary
@scripts/check-cache.sh
.PHONY: check-client
check-client: ## Check client contents and update if necessary
@scripts/check-client.sh
.PHONY: update-core
update-core: ## Update core repository
@scripts/get-core-repository.sh
##@ Utility/CI
.DEFAULT_GOAL = help
.PHONY: run
run: ## Compile & run the project
@./gradlew run
.PHONY: build-javadoc
build-javadoc: ## Build API documentation
@./gradlew app:javadoc
@cp -r app/build/docs/javadoc public
.PHONY: check-format
check-format: ## Check if source code is properly formatted
@./gradlew spotlessCheck
.PHONY: format
format: ## Format source code
@./gradlew spotlessApply
.PHONY: help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n $(YELLOW)make$(RST) $(BLUE)command$(RST)\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " $(BLUE)%-15s$(RST) %s\n", $$1, $$2 } /^##@/ { printf "\n$(BOLD)%s$(RST)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
+107
View File
@@ -0,0 +1,107 @@
plugins {
// Facilitates Java compilation
id 'java'
// For formatting source-code
alias(libs.plugins.spotless)
// Ensure jars are reproducible
id 'reproducible-archives'
// Bundle all dependencies (a.k.a. create a fat jar)
id 'bundle-dependencies'
// Use metadata from git
id 'git-metadata'
// Enable additional compiler warnings
id 'compiler-warnings'
}
// Tasks not related to build are split out into their own gradle scripts
// in order to keep build.gradle as compact as possible.
apply from: "$project.rootDir/spotless.gradle"
// Where dependencies are fetched from
repositories {
mavenCentral()
maven { url "https://maven.scijava.org/content/repositories/public/" }
maven { url 'https://jitpack.io' }
}
dependencies {
// Ensure gradle is aware of the patched client dependency
implementation files(new File(project(':patcher').getBuildDir(), 'libs/patched_client.jar'))
// Used to find/populate scripts
implementation libs.reflections
// Dependency of reflections spits out an error when it is not included in the jar.
// https://www.slf4j.org/codes.html#StaticLoggerBinder
implementation libs.slf4j.nop
// Used to parse/validate CLI arguments
implementation libs.commons.cli
implementation project(path: ':client')
}
tasks.named('compileJava') {
// Create resources before compileJava runs
dependsOn ':createClientCache', ':copyMapData', ':buildPatchedClient'
// Run spotlessApply after successful compilation rather than before, so
// that any developer errors can be dealt with prior to formatting
finalizedBy spotlessApply
}
tasks.named('jar') {
manifest {
attributes(
// Define entry point for application
'Main-Class': 'bot.Main',
// Embed version/build information in application
'Build-Commit-Hash': "${gitCommitHash()}",
'Build-Commit-Date': "${gitCommitDate()}",
'Build-Commit-Count': "${gitCommitCount()}",
'Build-Jdk' : "${System.properties['java.version']}",
)
}
// FTBFS: Set duplicate handling strategy for module-info.class.
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
tasks.register('copyJar') {
// Final JAR
group 'build'
description 'copy app.jar to main dir'
inputs.file "${project(':app').getBuildDir()}/libs/app.jar"
outputs.file "Idlersc.jar"
doLast {
copy {
from("${project(':app').getBuildDir()}/libs") {
rename 'app.jar', "${rootProject.name}.jar"
}
into '../'
}
}
//File appJar = new File(project(':app').getBuildDir(), "libs/${project(':app').getName()}.jar")
// from("${project(':app').getBuildDir()}/libs/app.jar")
// into "."
}
tasks.named('testClasses') {
finalizedBy('copyJar')
}
// Add additional files to clean task
tasks.named('clean') {
delete 'src/main/resources'
}
// Create resources before processResources runs
tasks.named('processResources') {
dependsOn ':createClientCache', ':copyMapData', ':buildPatchedClient'
}
// FTBFS: spotlessMisc complains when there is no dependency on copyMapData
tasks.named('spotlessMisc') {
dependsOn ':copyMapData'
}
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.
Loaded 100 of 630 files, more files were not shown because too many files have changed in this diff. Show more