/* * Copyright (c) 2019 Owain van Brakel * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import org.ajoberstar.grgit.Grgit buildscript { repositories { gradlePluginPortal() maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master") } dependencies { classpath(Plugins.grgitPlugin) classpath(Plugins.versionsPlugin) classpath(Plugins.injectorPlugin) } } plugins { id(Plugins.testLogger.first) version Plugins.testLogger.second apply false id(Plugins.versions.first) version Plugins.versions.second id(Plugins.latestVersion.first) version Plugins.latestVersion.second id(Plugins.grgit.first) version Plugins.grgit.second checkstyle application } val grgit = Grgit.open(mapOf("dir" to rootProject.projectDir.absolutePath)) val localGitCommit = grgit.head().id val localGitCommitShort = grgit.head().getAbbreviatedId(7) fun isNonStable(version: String): Boolean { return listOf("ALPHA", "BETA", "RC").any { version.toUpperCase().contains(it) } } allprojects { group = "com.openosrs" version = ProjectVersions.rlVersion } subprojects { repositories { //mavenLocal() jcenter() maven(url = "https://mvnrepository.com/artifact") maven(url = "https://repo.runelite.net") maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master") maven(url = "https://jitpack.io") } apply() apply() apply(plugin = Plugins.testLogger.first) project.extra["gitCommit"] = localGitCommit project.extra["gitCommitShort"] = localGitCommitShort project.extra["rootPath"] = rootDir.toString().replace("\\", "/") if (this.name != "runescape-client") { apply(plugin = "checkstyle") checkstyle { maxWarnings = 0 toolVersion = "8.25" isShowViolations = true isIgnoreFailures = false } } configure { repositories { maven { name = "runelite" url = uri("https://maven.pkg.github.com/open-osrs/runelite") credentials { username = System.getProperty("gpr_user") password = System.getProperty("gpr_key") } } } publications { register("gpr", MavenPublication::class) { from(components["java"]) } } } tasks { java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } withType { options.encoding = "UTF-8" } withType { isPreserveFileTimestamps = false isReproducibleFileOrder = true dirMode = 493 fileMode = 420 } withType { group = "verification" exclude("**/ScriptVarType.java") exclude("**/LayoutSolver.java") } } } application { mainClassName = "net.runelite.client.RuneLite" } tasks { named("run") { group = "openosrs" classpath = project(":runelite-client").sourceSets.main.get().runtimeClasspath } named("dependencyUpdates") { checkForGradleUpdate = false resolutionStrategy { componentSelection { all { if (candidate.displayName.contains("fernflower") || isNonStable(candidate.version)) { reject("Non stable") } } } } } }