Preparing the mod for builds
This commit is contained in:
parent
aa0b3fd423
commit
cc6f6b8949
4 changed files with 210 additions and 7 deletions
207
build.gradle
Normal file
207
build.gradle
Normal file
|
@ -0,0 +1,207 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = "ForgeFS"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
deployJars
|
||||
}
|
||||
|
||||
apply plugin: "maven"
|
||||
apply plugin: "fml"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
flatDir {
|
||||
name "fileRepo"
|
||||
dirs "repo"
|
||||
}
|
||||
}
|
||||
|
||||
// define the properties file
|
||||
ext.configFile = file "build.properties"
|
||||
|
||||
configFile.withReader {
|
||||
// read config. it shall from now on be referenced as simply config or as project.config
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
project.ext.config = new ConfigSlurper().parse prop
|
||||
}
|
||||
|
||||
group = "biomesoplenty"
|
||||
version = config.mod_version
|
||||
archivesBaseName = "BiomesOPlenty"
|
||||
|
||||
minecraft {
|
||||
version = config.minecraft_version + "-" + config.forge_version // grab latest forge
|
||||
assetDir = "run/assets"
|
||||
|
||||
replaceIn "BiomesOPlenty.java"
|
||||
replace "1.42.666.42.1", config.forge_version
|
||||
}
|
||||
|
||||
// add some stuff to the version
|
||||
version = "${config.minecraft_version}-${config.mod_version}.${System.getenv().BUILD_NUMBER}"
|
||||
|
||||
jenkins {
|
||||
job = 'BiomesOPlenty'
|
||||
}
|
||||
|
||||
processResources {
|
||||
// replace stuff in the files we want.
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include '**/*.info'
|
||||
include '**/*.properties'
|
||||
|
||||
// replaces
|
||||
expand ([
|
||||
'modid': project.archivesBaseName,
|
||||
'mod_version': project.config.mod_version,
|
||||
'minecraft_version': project.config.minecraft_version,
|
||||
'build_number': project.config.build_number,
|
||||
'worldcore_version': project.config.worldcore_version
|
||||
])
|
||||
}
|
||||
|
||||
// copy everything else, thats we didnt do before
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude '**/*.info'
|
||||
exclude '**/*.properties'
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePlugin': 'biomesoplenty.asm.BOPLoadingPlugin'
|
||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
||||
}
|
||||
classifier = 'universal'
|
||||
}
|
||||
|
||||
import net.minecraftforge.gradle.tasks.dev.ChangelogTask
|
||||
import net.minecraftforge.gradle.common.Constants
|
||||
import net.minecraftforge.gradle.delayed.*
|
||||
|
||||
task createChangelog(type: ChangelogTask) {
|
||||
def jobName = "${System.getenv().JOB_NAME}"
|
||||
def buildNumber = "${System.getenv().BUILD_NUMBER}"
|
||||
|
||||
setServerRoot(new DelayedString(project, 'http://ci.jenkins.minecraftforge.net/'))
|
||||
setJobName(new DelayedString(project, jobName.toString()));
|
||||
setAuthName(new DelayedString(project, 'console_script'));
|
||||
setAuthPassword(new DelayedString(project, 'dc6d48ca20a474beeac280a9a16a926e'));
|
||||
setTargetBuild({buildNumber.toString()});
|
||||
setOutput(new DelayedFile(project, 'build/distributions/' + project.getName() + '-' + project.version + '-changelog.txt'));
|
||||
}
|
||||
|
||||
tasks.build.dependsOn('createChangelog')
|
||||
|
||||
task sourceJar(type: Jar) {
|
||||
from sourceSets.main.allJava
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
task apiZip(type: Zip) {
|
||||
from(sourceSets.main.java)
|
||||
{
|
||||
include "biomesoplenty/api/*"
|
||||
}
|
||||
classifier = 'api'
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
classifier = 'deobf'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourceJar
|
||||
archives deobfJar
|
||||
archives apiZip
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
add getProject().repositories.mavenLocal()
|
||||
}
|
||||
repositories.mavenDeployer {
|
||||
configuration = configurations.deployJars
|
||||
|
||||
if (project.hasProperty("filesmaven")) {
|
||||
logger.info('Publishing to files server')
|
||||
repository(url: project.filesmaven.url) {
|
||||
authentication(userName: project.filesmaven.username, privateKey: project.filesmaven.key)
|
||||
}
|
||||
} else {
|
||||
logger.info('Publishing to repo folder')
|
||||
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
|
||||
}
|
||||
|
||||
pom {
|
||||
groupId = project.group
|
||||
version = project.version
|
||||
artifactId = project.archivesBaseName
|
||||
}
|
||||
pom.project {
|
||||
name project.archivesBaseName
|
||||
packaging 'jar'
|
||||
description 'Biomes O Plenty'
|
||||
url 'https://github.com/Glitchfiend/BiomesOPlenty'
|
||||
|
||||
scm {
|
||||
url 'https://github.com/Glitchfiend/BiomesOPlenty'
|
||||
connection 'scm:git:git://github.com/Glitchfiend/BiomesOPlenty.git'
|
||||
developerConnection 'scm:git:git@github.com:Glitchfiend/BiomesOPlenty.git'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system 'github'
|
||||
url 'https://github.com/Glitchfiend/BiomesOPlenty/issues'
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported'
|
||||
url 'http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_US'
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'Adubbz'
|
||||
name 'Adubbz'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'Amnet'
|
||||
name 'Amnet'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'Forstride'
|
||||
name 'Forstride'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
developer {
|
||||
id 'ted80'
|
||||
name 'ted80'
|
||||
roles { role 'developer' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
build.properties
Normal file
3
build.properties
Normal file
|
@ -0,0 +1,3 @@
|
|||
minecraft_version=1.8
|
||||
forge_version=7.10.93.1001-1.8
|
||||
mod_version=3.0.0
|
|
@ -11,7 +11,4 @@ package biomesoplenty.common.util;
|
|||
public class ReflectionHelper
|
||||
{
|
||||
//Various fields used in Reflection. These should be checked with every update.
|
||||
|
||||
//Item
|
||||
public static String[] BLOCK_TO_ITEM = new String[] { "BLOCK_TO_ITEM", "field_179220_a" };
|
||||
}
|
||||
|
|
|
@ -34,10 +34,6 @@ public class RegistryUtil
|
|||
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, Object... itemCtorArgs)
|
||||
{
|
||||
block = GameRegistry.registerBlock(block, itemclass, name, itemCtorArgs);
|
||||
Item associatedItem = GameRegistry.findItem(BiomesOPlenty.MOD_ID, name);
|
||||
|
||||
Map blockToItem = ObfuscationReflectionHelper.getPrivateValue(Item.class, null, ReflectionHelper.BLOCK_TO_ITEM);
|
||||
blockToItem.put(block, associatedItem);
|
||||
|
||||
Iterator iterator = block.getBlockState().getValidStates().iterator();
|
||||
|
||||
|
|
Loading…
Reference in a new issue