-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
- 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
There are no files selected for viewing
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
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() | ||
) |
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" |
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") | ||
} | ||
|
||
} |