Skip to content

Commit 63ade42

Browse files
committed
Version 4.0.0:
- 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`
1 parent 57bb69f commit 63ade42

File tree

73 files changed

+903
-401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+903
-401
lines changed

.idea/.name

-1
This file was deleted.

.idea/compiler.xml

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/Overwatcheat.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/kotlinc.xml

+5-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/Overwatcheat.main.iml

+41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/Overwatcheat.test.iml

+45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/gradle-build/gradle-build.test.iml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules/overwatcheat.main.iml

-38
This file was deleted.

.idea/modules/overwatcheat.test.iml

-45
This file was deleted.

build.gradle

-116
This file was deleted.

build.gradle.kts

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import org.jetbrains.kotlin.incremental.deleteRecursivelyOrThrow
2+
3+
plugins {
4+
id("overwatcheat-kotlin-project")
5+
6+
application
7+
8+
id("com.github.johnrengelman.shadow") version "7.1.2"
9+
}
10+
11+
group = "org.jire.overwatcheat"
12+
version = "4.0.0"
13+
14+
dependencies {
15+
implementation(libs.fastutil)
16+
implementation(libs.javacv.platform)
17+
implementation(libs.vis.ui)
18+
19+
implementation(libs.jna)
20+
implementation(libs.jna.platform)
21+
22+
implementation(libs.gdx)
23+
implementation(libs.gdx.platform)
24+
25+
implementation(libs.gdx.box2d)
26+
implementation(libs.gdx.box2d.platform)
27+
28+
implementation(libs.gdx.freetype)
29+
implementation(libs.gdx.freetype.platform)
30+
31+
implementation(libs.gdx.backend.lwjgl3)
32+
}
33+
34+
application {
35+
applicationName = "Overwatcheat"
36+
mainClass.set("org.jire.overwatcheat.Main")
37+
}
38+
39+
tasks {
40+
configureShadowJar()
41+
configureOverwatcheat()
42+
}
43+
44+
fun TaskContainerScope.configureShadowJar() {
45+
shadowJar {
46+
archiveBaseName.set("Overwatcheat")
47+
archiveClassifier.set("")
48+
archiveVersion.set("")
49+
50+
isZip64 = true
51+
}
52+
named<Zip>("distZip").configure {
53+
enabled
54+
}
55+
named<Tar>("distTar").configure {
56+
enabled = false
57+
}
58+
}
59+
60+
fun TaskContainerScope.configureOverwatcheat() {
61+
register("overwatcheat") {
62+
doLast {
63+
val version = version
64+
val name = "Overwatcheat $version"
65+
66+
val buildDir = file("build/")
67+
68+
val dir = buildDir.resolve(name)
69+
if (dir.exists()) dir.deleteRecursivelyOrThrow()
70+
dir.mkdirs()
71+
72+
val jarName = "${name}.jar"
73+
val jar = dir.resolve(jarName)
74+
val allJar = buildDir.resolve("libs/Overwatcheat-${version}.jar")
75+
allJar.copyTo(jar, true)
76+
77+
dir.writeStartBat(name, jarName)
78+
79+
fun File.copyFromRoot(path: String) = file(path).copyTo(resolve(path), true)
80+
81+
dir.copyFromRoot("overwatcheat.cfg")
82+
dir.copyFromRoot("LICENSE.txt")
83+
dir.copyFromRoot("README.md")
84+
}
85+
}
86+
}
87+
88+
fun File.writeStartBat(name: String, jarName: String) =
89+
resolve("Start ${name}.bat").writeText(
90+
"""@echo off
91+
cd /d "%~dp0"
92+
title $name
93+
java -jar "$jarName"
94+
pause""".trimIndent()
95+
)

gradle-build/build.gradle.kts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
plugins {
2+
base
3+
}
4+
5+
group = "org.jire.overwatcheat.gradle_build"
6+
version = "0.1.0"
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
group = "org.jire.overwatcheat.gradle_build"
6+
version = "0.1.0"
7+
8+
val kotlinVersion = "1.7.20"
9+
10+
dependencies {
11+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
12+
}
13+
14+
gradlePlugin {
15+
plugins {
16+
register("overwatcheat-kotlin-project") {
17+
id = name
18+
implementationClass = "org.jire.overwatcheat.gradle_build.projects.KotlinProjectPlugin"
19+
}
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* Free, open-source undetected color cheat for Overwatch!
3+
* Copyright (C) 2017 Thomas G. Nappo
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
package org.jire.overwatcheat.gradle_build.projects
20+
21+
import org.gradle.api.JavaVersion
22+
import org.gradle.api.Plugin
23+
import org.gradle.api.Project
24+
import org.gradle.api.plugins.JavaPlugin
25+
import org.gradle.api.plugins.JavaPluginExtension
26+
import org.gradle.api.tasks.compile.JavaCompile
27+
import org.gradle.kotlin.dsl.configure
28+
import org.gradle.kotlin.dsl.dependencies
29+
import org.gradle.kotlin.dsl.withType
30+
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
31+
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
32+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
33+
34+
class KotlinProjectPlugin : Plugin<Project> {
35+
36+
private fun configureCompileJava(project: Project) {
37+
project.run {
38+
plugins.withType<JavaPlugin>().configureEach {
39+
configure<JavaPluginExtension> {
40+
sourceCompatibility = JavaVersion.VERSION_17
41+
targetCompatibility = JavaVersion.VERSION_17
42+
}
43+
}
44+
45+
tasks.withType<JavaCompile>().configureEach {
46+
options.encoding = "UTF-8"
47+
options.release.set(17)
48+
}
49+
}
50+
}
51+
52+
override fun apply(target: Project) {
53+
target.run {
54+
plugins.apply("org.jetbrains.kotlin.jvm")
55+
56+
configureCompileJava(target)
57+
58+
tasks.withType<KotlinCompile>().configureEach {
59+
kotlinOptions {
60+
jvmTarget = "17"
61+
}
62+
}
63+
64+
val kotlinPluginVersion = getKotlinPluginVersion()
65+
66+
plugins.withType<KotlinPluginWrapper>().configureEach {
67+
dependencies {
68+
configurations.named("api").configure {
69+
for (module in kotlinModules) {
70+
invoke("org.jetbrains.kotlin:kotlin-$module") {
71+
version {
72+
strictly(kotlinPluginVersion)
73+
}
74+
}
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}
81+
82+
private companion object {
83+
val kotlinModules = listOf("stdlib", "stdlib-common", "stdlib-jdk7", "stdlib-jdk8")
84+
}
85+
86+
}

0 commit comments

Comments
 (0)