diff options
author | miozune <miozune@gmail.com> | 2023-09-23 15:45:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-23 15:45:01 +0900 |
commit | ed6a15a45c82b833029970a46172b1dc4056c2c2 (patch) | |
tree | e4e15411e2c86d51fd0862a1ab33aeb7967f41b5 /build.gradle | |
parent | 0b64da21122c2671e943131ce60e5b45d2759a2e (diff) | |
download | GT5-Unofficial-ed6a15a45c82b833029970a46172b1dc4056c2c2.tar.gz GT5-Unofficial-ed6a15a45c82b833029970a46172b1dc4056c2c2.tar.bz2 GT5-Unofficial-ed6a15a45c82b833029970a46172b1dc4056c2c2.zip |
Cleanup noXXXYYY methods (#77)
* updateBuildScript
* Update dependencies
* Cleanup noXXXYYY methods
* Fix wildcard import
Diffstat (limited to 'build.gradle')
-rw-r--r-- | build.gradle | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/build.gradle b/build.gradle index b894d64772..7ff83a31bc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1692122114 +//version: 1695409603 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -89,6 +89,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output') def projectJavaVersion = JavaLanguageVersion.of(8) boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false +boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false + +final String CHECKSTYLE_CONFIG = """ +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> +<module name="Checker"> + <module name="TreeWalker"> + <!-- Use CHECKSTYLE:OFF and CHECKSTYLE:ON comments to suppress checkstyle lints in a block --> + <module name="SuppressionCommentFilter"/> + <module name="AvoidStarImport"> + <!-- Allow static wildcard imports for cases like Opcodes and LWJGL classes, these don't get created accidentally by the IDE --> + <property name="allowStaticMemberImports" value="true"/> + </module> + </module> +</module> +""" checkPropertyExists("modName") checkPropertyExists("modId") @@ -140,6 +157,17 @@ if (!disableSpotless) { apply from: Blowdryer.file('spotless.gradle') } +if (!disableCheckstyle) { + apply plugin: 'checkstyle' + tasks.named("checkstylePatchedMc") { enabled = false } + tasks.named("checkstyleMcLauncher") { enabled = false } + tasks.named("checkstyleIdeVirtualMain") { enabled = false } + tasks.named("checkstyleInjectedTags") { enabled = false } + checkstyle { + config = resources.text.fromString(CHECKSTYLE_CONFIG) + } +} + String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" @@ -600,15 +628,10 @@ repositories { } maven { name = "ic2" - url = "https://maven.ic2.player.to/" - metadataSources { - mavenPom() - artifact() + url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/") + content { + includeGroup "net.industrial-craft" } - } - maven { - name = "ic2-mirror" - url = "https://maven2.ic2.player.to/" metadataSources { mavenPom() artifact() @@ -1576,6 +1599,25 @@ def getSecondaryArtifacts() { return secondaryArtifacts } +def getURL(String main, String fallback) { + return pingURL(main, 10000) ? main : fallback +} + +// credit: https://stackoverflow.com/a/3584332 +def pingURL(String url, int timeout) { + url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates. + try { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection() + connection.setConnectTimeout(timeout) + connection.setReadTimeout(timeout) + connection.setRequestMethod("HEAD") + int responseCode = connection.getResponseCode() + return 200 <= responseCode && responseCode <= 399 + } catch (IOException ignored) { + return false + } +} + // For easier scripting of things that require variables defined earlier in the buildscript if (file('addon.late.gradle.kts').exists()) { apply from: 'addon.late.gradle.kts' |