Skip to content

Commit

Permalink
Version 4.0.0:
Browse files Browse the repository at this point in the history
- Kotlin upgraded to `1.7.20`
- Gradle upgraded to `7.5.1`
- Kotlin-Script for Gradle, rather than Groovy
- Separated Gradle build into `gradle-build` composite build
- All dependencies upgraded to latest versions
- Base package changed from `com.overwatcheat` to `org.jire.overwatcheat`
- Main file renamed from `Overwatcheat` to `Main`
  • Loading branch information
Jire committed Oct 17, 2022
1 parent 57bb69f commit 63ade42
Show file tree
Hide file tree
Showing 73 changed files with 903 additions and 401 deletions.
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

4 changes: 3 additions & 1 deletion .idea/compiler.xml

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

2 changes: 1 addition & 1 deletion .idea/copyright/Overwatcheat.xml

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

7 changes: 5 additions & 2 deletions .idea/kotlinc.xml

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

5 changes: 4 additions & 1 deletion .idea/misc.xml

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

41 changes: 41 additions & 0 deletions .idea/modules/Overwatcheat.main.iml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions .idea/modules/Overwatcheat.test.iml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .idea/modules/gradle-build/gradle-build.test.iml

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

38 changes: 0 additions & 38 deletions .idea/modules/overwatcheat.main.iml

This file was deleted.

45 changes: 0 additions & 45 deletions .idea/modules/overwatcheat.test.iml

This file was deleted.

116 changes: 0 additions & 116 deletions build.gradle

This file was deleted.

95 changes: 95 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import org.jetbrains.kotlin.incremental.deleteRecursivelyOrThrow

plugins {
id("overwatcheat-kotlin-project")

application

id("com.github.johnrengelman.shadow") version "7.1.2"
}

group = "org.jire.overwatcheat"
version = "4.0.0"

dependencies {
implementation(libs.fastutil)
implementation(libs.javacv.platform)
implementation(libs.vis.ui)

implementation(libs.jna)
implementation(libs.jna.platform)

implementation(libs.gdx)
implementation(libs.gdx.platform)

implementation(libs.gdx.box2d)
implementation(libs.gdx.box2d.platform)

implementation(libs.gdx.freetype)
implementation(libs.gdx.freetype.platform)

implementation(libs.gdx.backend.lwjgl3)
}

application {
applicationName = "Overwatcheat"
mainClass.set("org.jire.overwatcheat.Main")
}

tasks {
configureShadowJar()
configureOverwatcheat()
}

fun TaskContainerScope.configureShadowJar() {
shadowJar {
archiveBaseName.set("Overwatcheat")
archiveClassifier.set("")
archiveVersion.set("")

isZip64 = true
}
named<Zip>("distZip").configure {
enabled
}
named<Tar>("distTar").configure {
enabled = false
}
}

fun TaskContainerScope.configureOverwatcheat() {
register("overwatcheat") {
doLast {
val version = version
val name = "Overwatcheat $version"

val buildDir = file("build/")

val dir = buildDir.resolve(name)
if (dir.exists()) dir.deleteRecursivelyOrThrow()
dir.mkdirs()

val jarName = "${name}.jar"
val jar = dir.resolve(jarName)
val allJar = buildDir.resolve("libs/Overwatcheat-${version}.jar")
allJar.copyTo(jar, true)

dir.writeStartBat(name, jarName)

fun File.copyFromRoot(path: String) = file(path).copyTo(resolve(path), true)

dir.copyFromRoot("overwatcheat.cfg")
dir.copyFromRoot("LICENSE.txt")
dir.copyFromRoot("README.md")
}
}
}

fun File.writeStartBat(name: String, jarName: String) =
resolve("Start ${name}.bat").writeText(
"""@echo off
cd /d "%~dp0"
title $name
java -jar "$jarName"
pause""".trimIndent()
)
6 changes: 6 additions & 0 deletions gradle-build/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
plugins {
base
}

group = "org.jire.overwatcheat.gradle_build"
version = "0.1.0"
21 changes: 21 additions & 0 deletions gradle-build/projects/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
`kotlin-dsl`
}

group = "org.jire.overwatcheat.gradle_build"
version = "0.1.0"

val kotlinVersion = "1.7.20"

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}

gradlePlugin {
plugins {
register("overwatcheat-kotlin-project") {
id = name
implementationClass = "org.jire.overwatcheat.gradle_build.projects.KotlinProjectPlugin"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Free, open-source undetected color cheat for Overwatch!
* Copyright (C) 2017 Thomas G. Nappo
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.jire.overwatcheat.gradle_build.projects

import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

class KotlinProjectPlugin : Plugin<Project> {

private fun configureCompileJava(project: Project) {
project.run {
plugins.withType<JavaPlugin>().configureEach {
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release.set(17)
}
}
}

override fun apply(target: Project) {
target.run {
plugins.apply("org.jetbrains.kotlin.jvm")

configureCompileJava(target)

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
}
}

val kotlinPluginVersion = getKotlinPluginVersion()

plugins.withType<KotlinPluginWrapper>().configureEach {
dependencies {
configurations.named("api").configure {
for (module in kotlinModules) {
invoke("org.jetbrains.kotlin:kotlin-$module") {
version {
strictly(kotlinPluginVersion)
}
}
}
}
}
}
}
}

private companion object {
val kotlinModules = listOf("stdlib", "stdlib-common", "stdlib-jdk7", "stdlib-jdk8")
}

}
Loading

0 comments on commit 63ade42

Please sign in to comment.