-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use DefaultsPlugin to set up gradle build. Use travis-ci. Correct sty…
…le issues which cause spotless check to fail.
- Loading branch information
Showing
18 changed files
with
96 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# More details on how to configure the Travis build | ||
# https://docs.travis-ci.com/user/customizing-the-build/ | ||
|
||
# Speed up build with travis caches | ||
cache: | ||
directories: | ||
- $HOME/.gradle/caches/ | ||
- $HOME/.gradle/wrapper/ | ||
|
||
language: java | ||
|
||
jdk: | ||
- oraclejdk8 | ||
|
||
#Skipping install step to avoid having Travis run arbitrary './gradlew assemble' task | ||
# https://docs.travis-ci.com/user/customizing-the-build/#Skipping-the-Installation-Step | ||
install: | ||
- true | ||
|
||
#Don't build tags | ||
branches: | ||
except: | ||
- /^v\d/ | ||
|
||
#Build and perform release (if needed) | ||
script: | ||
- ./gradlew build -s && ./gradlew ciPerformRelease | ||
|
||
after_success: | ||
#Generates coverage report: | ||
- ./gradlew --stacktrace jacocoTestReport && cp build/reports/jacoco/test/jacocoTestReport.xml jacoco.xml || echo "Code coverage failed" | ||
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,36 @@ | ||
buildscript { | ||
repositories { | ||
mavenLocal() | ||
jcenter() | ||
maven { | ||
name = "forge" | ||
url = "http://files.minecraftforge.net/maven" | ||
} | ||
maven { | ||
name = "nallar" | ||
url = "https://repo.nallar.me/" | ||
} | ||
} | ||
if (System.getenv("GRADLE_NO_CACHE_CHANGING") != null) { | ||
configurations.all { | ||
resolutionStrategy.cacheChangingModulesFor 1, 'seconds' | ||
resolutionStrategy.cacheDynamicVersionsFor 1, 'seconds' | ||
} | ||
maven { url "https://repo.nallar.me/" } | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
maven { url "http://files.minecraftforge.net/maven" } | ||
} | ||
dependencies { | ||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' | ||
classpath 'org.minimallycorrect.libloader:LibLoaderGradle:0.1-SNAPSHOT' | ||
classpath 'org.minimallycorrect.gradle:DefaultsPlugin:0.0.9' | ||
} | ||
} | ||
plugins { | ||
id "com.matthewprenger.cursegradle" version "1.0.9" | ||
} | ||
apply plugin: 'org.minimallycorrect.gradle.DefaultsPlugin' | ||
apply plugin: 'org.minimallycorrect.libloader.LibLoaderGradle' | ||
apply plugin: 'net.minecraftforge.gradle.forge' | ||
apply plugin: 'idea' | ||
|
||
ext.mcVersion = "1.12" | ||
ext.runMcVersion = "1.12" | ||
ext.forgeVersion = "14.21.0.2340" | ||
ext.forgeMappings = "snapshot_20170617" | ||
group = "org.minimallycorrect.tickprofiler" // http://maven.apache.org/guides/mini/guide-naming-conventions.html | ||
archivesBaseName = "TickProfiler" | ||
|
||
def calculateVersion() { | ||
def ver = project.runMcVersion | ||
if (System.env.BUILD_NUMBER != null) | ||
return ver + "-jenkins." + System.env.BUILD_NUMBER | ||
if (project.hasProperty("release")) | ||
return ver + '-' + project.release | ||
return ver + "-dev" | ||
} | ||
|
||
version = calculateVersion() | ||
group = "org.minimallycorrect.tickprofiler" | ||
|
||
repositories { | ||
jcenter() | ||
maven { url = 'https://repo.nallar.me/' } | ||
} | ||
|
||
if (System.getenv("GRADLE_NO_CACHE_CHANGING") != null) { | ||
configurations.all { | ||
resolutionStrategy.cacheChangingModulesFor 1, 'seconds' | ||
resolutionStrategy.cacheDynamicVersionsFor 1, 'seconds' | ||
} | ||
} | ||
minimallyCorrectDefaults { | ||
minecraft = 1.12 | ||
fmlCorePlugin = "org.minimallycorrect.tickprofiler.minecraft.CoreMod" | ||
fmlCorePluginContainsFmlMod = true | ||
curseforgeProject = 270330 | ||
labels = ['minecraft-mod', 'profiler', 'minecraft', 'java', 'performance'] | ||
description = "Profile your minecraft server: Find which entities and tile entities are making your server slow" | ||
} () | ||
|
||
dependencies { | ||
libLoader "com.eclipsesource.minimal-json:minimal-json:0.9.4" | ||
libLoader "org.minimallycorrect.modpatcher:ModPatcher:$mcVersion-SNAPSHOT" | ||
compileOnly 'org.projectlombok:lombok:1.16.16' | ||
testCompileOnly 'org.projectlombok:lombok:1.16.16' | ||
libLoader "org.minimallycorrect.modpatcher:ModPatcher:${project.minecraft.version}-SNAPSHOT" | ||
testCompile 'junit:junit:4.12' | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
sourceCompatibility = 8 | ||
targetCompatibility = 8 | ||
options.with { | ||
encoding = 'UTF-8' | ||
compilerArgs << "-Xlint:all" << '-Xlint:-path' << '-Xlint:-processing' << '-Xlint:-rawtypes' << '-Xlint:-serial' | ||
} | ||
} | ||
|
||
minecraft { | ||
version = "${project.mcVersion}-${project.forgeVersion}" | ||
runDir = "run" | ||
mappings = project.forgeMappings | ||
|
||
replace "@MOD_VERSION@", project.version | ||
replace "@MC_VERSION@", runMcVersion | ||
} | ||
|
||
processResources { | ||
// this will ensure that this task is redone when the versions change. | ||
inputs.property "version", project.version | ||
inputs.property "mcversion", project.minecraft.version | ||
|
||
filesMatching("mcmod.info") { | ||
expand 'version': project.version, 'mcversion': runMcVersion | ||
} | ||
filesMatching("modpatcher.version") { | ||
expand 'version': project.version | ||
} | ||
} | ||
|
||
jar { | ||
manifest.mainAttributes("FMLCorePlugin": "org.minimallycorrect.tickprofiler.minecraft.CoreMod", "FMLCorePluginContainsFMLMod": "YasPlease") | ||
} | ||
|
||
wrapper { | ||
gradleVersion = "3.5" | ||
def jvmOpts = "-Xmx2G" | ||
inputs.property("jvmOpts", jvmOpts) | ||
doLast { | ||
def optsEnvVar = "DEFAULT_JVM_OPTS" | ||
scriptFile.write scriptFile.text.replace("$optsEnvVar=\"\"", "$optsEnvVar=\"$jvmOpts\"") | ||
batchScript.write batchScript.text.replace("set $optsEnvVar=", "set $optsEnvVar=$jvmOpts") | ||
} | ||
} | ||
|
||
if (System.getenv("CURSEFORGE_API_KEY") != null) { | ||
curseforge { | ||
apiKey = System.getenv("CURSEFORGE_API_KEY") // This should really be in a gradle.properties file | ||
project { | ||
id = "270330" | ||
changelog = "git rev-parse --short HEAD".execute().text.trim() + ":" + "git log -1 --pretty=%B".execute().text.trim() | ||
releaseType = "beta" | ||
addArtifact sourceJar | ||
} | ||
} | ||
project.tasks.getByName("curseforge").dependsOn.add(sourceJar) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Auto-generated by https://github.com/MinimallyCorrect/DefaultsPlugin | ||
|
||
minimallyCorrectDefaultsShipkit {} () |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#Fri May 12 22:30:15 BST 2017 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.