Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GRADLE build Performance #1357

Open
wants to merge 1 commit into
base: 1.12.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
324 changes: 166 additions & 158 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,158 +1,166 @@
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "com.wynprice.cursemaven:CurseMaven:2.1.1"
}
}

plugins {
id "org.sonarqube" version "2.6.2"
id "maven-publish"
id "com.wynprice.cursemaven" version "2.1.1"
id "de.fuerstenau.buildconfig" version "1.1.8"
}

// We apply the 'forge' plugin, so ForgeGradle can do it's stuff.
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'idea'

repositories {
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name "LatvianModder Ivy"
url = "https://maven.latmod.com/"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
}

minecraft{
version = minecraft_version + "-" + forge_version
mappings = mcp_mappings
runDir = "run"
replaceIn "automation/AncientWarfareAutomation.java"
replaceIn "core/AncientWarfareCore.java"
replaceIn "npc/AncientWarfareNPC.java"
replaceIn "structure/AncientWarfareStructure.java"
replaceIn "vehicle/AncientWarfareVehicles.java"
replace "@VERSION@", "${project.minecraft.version}-${project.major}.${project.minor}.${project.patch}." + getBuildNumber() + getStable()
replace "0.000.000.001", "$forge_version"
}
version = minecraft.version + "-" + project.major +"."+ project.minor +"."+ project.patch +"."+ getBuildNumber() + getStable()
group = "shadowmage"
archivesBaseName = "ancientwarfare"

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
deobfCompile "cofh:RedstoneFlux:${rf_version}:universal"
deobfCompile "mezz.jei:jei_${minecraft_version}:${jei_version}"
deobfCompile "codechicken:CodeChickenLib:${ccl_version}:deobf"
deobfCompile "com.feed_the_beast.mods:FTBLib:${ftblib_version}"
compile "curse.maven:ElectroblobsWizardry:${eb_cf_fileid}"
compile "curse.maven:infinitylib:${infinitylib_cf_fileid}"
compile "curse.maven:agricraft:${agricraft_cf_fileid}"
}

buildConfig {
appName = project.name // sets value of NAME field
version = project.version // sets value of VERSION field,

clsName = 'BuildConfig' // sets the name of the BuildConfig class
packageName = 'net.shadowmage.ancientwarfare' // sets the package of the BuildConfig class,
charset = 'UTF-8' // sets charset of the generated class,

buildConfigField 'boolean', 'UNSTABLE', {isUnstable()}
}

processResources{
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}

jar {
manifest {
attributes 'FMLAT': 'ancientwarfare_at.cfg'
}
}

static def getBuildNumber() {
if (System.getenv("GITHUB_RUN_NUMBER") != null) {
return Integer.valueOf(Integer.parseInt(System.getenv("GITHUB_RUN_NUMBER")) + 830).toString()
}
return ""
}

def getStable() {
if (isUnstable()) {
return "unstable"
}
return ""
}

def isUnstable() {
return (System.getenv("GITHUB_REF") == null || System.getenv("GITHUB_REF").endsWith("-dev"));
}

task minifyStructureTemplates(type: MinifyStructuresTask) {
templateFolder = "$projectDir/src/main/resources/assets/ancientwarfare/template/"
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/P3pp3rF1y/AncientWarfare2")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GPR_USER")
password = project.findProperty("gpr.key") ?: System.getenv("GPR_API_KEY")
}
}
}
publications {
gpr(MavenPublication) {
artifactId 'ancientwarfare2'

from components.java
}
}
}

sonarqube {
properties {
property "sonar.projectName", "Ancient Warfare 2"
property "sonar.projectKey", "ancientwarfare"
}
}
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "com.wynprice.cursemaven:CurseMaven:2.1.1"
}
}

plugins {
id "org.sonarqube" version "2.6.2"
id "maven-publish"
id "com.wynprice.cursemaven" version "2.1.1"
id "de.fuerstenau.buildconfig" version "1.1.8"
}

// We apply the 'forge' plugin, so ForgeGradle can do it's stuff.
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'idea'

repositories {
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name "LatvianModder Ivy"
url = "https://maven.latmod.com/"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
}

minecraft{
version = minecraft_version + "-" + forge_version
mappings = mcp_mappings
runDir = "run"
replaceIn "automation/AncientWarfareAutomation.java"
replaceIn "core/AncientWarfareCore.java"
replaceIn "npc/AncientWarfareNPC.java"
replaceIn "structure/AncientWarfareStructure.java"
replaceIn "vehicle/AncientWarfareVehicles.java"
replace "@VERSION@", "${project.minecraft.version}-${project.major}.${project.minor}.${project.patch}." + getBuildNumber() + getStable()
replace "0.000.000.001", "$forge_version"
}
version = minecraft.version + "-" + project.major +"."+ project.minor +"."+ project.patch +"."+ getBuildNumber() + getStable()
group = "shadowmage"
archivesBaseName = "ancientwarfare"

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
deobfCompile "cofh:RedstoneFlux:${rf_version}:universal"
deobfCompile "mezz.jei:jei_${minecraft_version}:${jei_version}"
deobfCompile "codechicken:CodeChickenLib:${ccl_version}:deobf"
deobfCompile "com.feed_the_beast.mods:FTBLib:${ftblib_version}"
compile "curse.maven:ElectroblobsWizardry:${eb_cf_fileid}"
compile "curse.maven:infinitylib:${infinitylib_cf_fileid}"
compile "curse.maven:agricraft:${agricraft_cf_fileid}"
}

buildConfig {
appName = project.name // sets value of NAME field
version = project.version // sets value of VERSION field,

clsName = 'BuildConfig' // sets the name of the BuildConfig class
packageName = 'net.shadowmage.ancientwarfare' // sets the package of the BuildConfig class,
charset = 'UTF-8' // sets charset of the generated class,

buildConfigField 'boolean', 'UNSTABLE', {isUnstable()}
}

processResources{
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'

// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}

// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}

jar {
manifest {
attributes 'FMLAT': 'ancientwarfare_at.cfg'
}
}

static def getBuildNumber() {
if (System.getenv("GITHUB_RUN_NUMBER") != null) {
return Integer.valueOf(Integer.parseInt(System.getenv("GITHUB_RUN_NUMBER")) + 830).toString()
}
return ""
}

def getStable() {
if (isUnstable()) {
return "unstable"
}
return ""
}

def isUnstable() {
return (System.getenv("GITHUB_REF") == null || System.getenv("GITHUB_REF").endsWith("-dev"));
}

task minifyStructureTemplates(type: MinifyStructuresTask) {
templateFolder = "$projectDir/src/main/resources/assets/ancientwarfare/template/"
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/P3pp3rF1y/AncientWarfare2")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GPR_USER")
password = project.findProperty("gpr.key") ?: System.getenv("GPR_API_KEY")
}
}
}
publications {
gpr(MavenPublication) {
artifactId 'ancientwarfare2'

from components.java
}
}
}

sonarqube {
properties {
property "sonar.projectName", "Ancient Warfare 2"
property "sonar.projectKey", "ancientwarfare"
}
}

allprojects {
tasks.withType(JavaCompile).configureEach {
options.fork = true
options.incremental = true
}

}