Skip to content

Commit

Permalink
1.14 port
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Aug 4, 2019
1 parent 6ce588a commit 26473e6
Show file tree
Hide file tree
Showing 10 changed files with 212 additions and 263 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Thumbs.db
/out
/.idea
/atlassian-ide-plugin.xml
*.iml

## Private Stuffs
/private.properties
Expand Down
224 changes: 83 additions & 141 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,57 +1,77 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}

repositories {
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
}
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

ext.configFile = file('build.properties')

ext.config = parseConfig(configFile)
//ext.priv = parseConfig(file('private.properties'))

version = "${config.version}-${config.build_number}"
group = "vazkii.neat" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
group = "vazkii.${config.mod_id}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

minecraft {
version = "${config.mc_version}-${config.forge_version}"
runDir = "eclipse/assets"
mappings = config.mc_mappings

//This, does the token replacement.
//Though, I reccomend this to be replaced with a token such as @VERSION@
replace 'GRADLE:BUILD', config.build_number
replace 'GRADLE:VERSION', config.version
}
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.

mappings channel: "${config.mapping_channel}", version: "${config.mapping_version}"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
source sourceSets.main
}
}
}

repositories {
mavenCentral()
server {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

mods {
examplemod {
source sourceSets.main
}
}
}
}
}

dependencies {

minecraft "net.minecraftforge:forge:${config.mc_version}-${config.forge_version}"
}

processResources {
Expand All @@ -69,20 +89,7 @@ processResources {
}
}

/**
* These, go outside of the processResources {}* Though, this was added with the NEI intergation commit (8bf4680)
*/
task deobfJar(type: Jar) {
from(sourceSets.main.output)
archiveName = "${baseName} ${version}-deobf.${extension}"
}

artifacts {
archives deobfJar
}
/**
* Increments the buildnumber in your config file, and saves it
*/
task incrementBuildNumber {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
Expand All @@ -93,90 +100,24 @@ task incrementBuildNumber {
//file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
}

// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
into file("${config.dir_output}/wtf")
}

// Seriously, I'm desperate to make this work
task wtfGradle1(type: Delete) {
dependsOn "wtfGradle2"
delete "${config.dir_output}/wtf/${deobfJar.archiveName}"
}

task output(type: Copy) {
dependsOn "wtfGradle1"
from(jar.destinationDir)
into file(config.dir_output)
}

task outputDeobf(type: Copy) {
dependsOn "output"
from(config.dir_output) {
include deobfJar.archiveName
}
into file("${config.dir_output}/deobf")
}

/*task forgecraft(type: Copy) {
dependsOn "outputDeobf"
from "${config.dir_output}/wtf"
into file(config.dir_forgecraft)
}*/

task sort(type: Delete) {
dependsOn /*"forgecraft"*/ "outputDeobf"
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
}

/**
* This is the upload task from the build.xml
*/
/*task upload(dependsOn: 'reobf') << {
ftp(action: 'mkdir', remotedir: '/files')
ftp(action: 'send', remotedir: '/files') {
fileset(file: jar.archivePath)
}
ftp(action: 'send', remotedir: '/files/deobf') {
fileset(file: deobfJar.archivePath)
}
ftp(action: 'send', remotedir: '.') {
fileset(file: 'web/changelog.txt')
fileset(file: 'web/versions.ini')
}
}*/

/**
* This is deply_web task
*/
task deployWeb << {
ftp(action: 'send', remotedir: '.') {
fileset(dir: 'web') //everything from the web directory
}
}

//simple function that we can use
//Got this from: http://svn.codehaus.org/gradle/website/build.gradle
/*void ftp(Map args, Closure antFileset = {}) {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
Map ftpArgs = args + [ //some default options
verbose : 'yes',
server : priv.host,
userid : priv.user,
password: priv.pass
]
delegate.ftp(ftpArgs) {
antFileset.delegate = delegate
antFileset()
import java.util.regex.Pattern
task sortArtifacts(type: Copy) {
from jar.destinationDir
into config.dir_output
//Put each jar with a classifier in a subfolder with the classifier as its name
eachFile {
//This matcher is used to get the classifier of the jar
def matcher = Pattern.compile(Pattern.quote("$config.mod_name-$version") + "-(?<classifier>\\w+).jar").matcher(it.name)
//Only change the destination for full matches, i.e jars with classifiers
if (matcher.matches())
{
def classifier = matcher.group('classifier')
/* Set the relative path to change the destination, since
* Gradle doesn't seem to like the absolute path being set*/
it.relativePath = it.relativePath.parent.append(false, classifier, it.name)
}
}
}*/
}

def parseConfig(File config) {
config.withReader {
Expand All @@ -189,17 +130,18 @@ def parseConfig(File config) {
jar {
//rename the default output, for some better... sanity with scipts
archiveName = "${baseName} ${version}.${extension}"

manifest {
attributes([
"Specification-Title": "${config.mod_id}",
"Specification-Vendor": "vazkii",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": "${config.mod_id}",
"Implementation-Version": "${version}",
"Implementation-Vendor" :"vazkii",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

/*curse {
apiKey = priv.cfkey
projectId = "225643"
changelog = """
See http://vazkii.us/mod/Botania/changelog.php#${version}
"""
releaseType = "release"
}*/

//change this so it only increments on upload
//upload.dependsOn tasks.incrementBuildNumber
defaultTasks 'clean', 'build', 'sort', 'incrementBuildNumber'/*, 'forgecraft', 'curse', 'upload'*/ //remove clean if you want faster builds, this will stop rare inconsistancies.
defaultTasks 'clean', 'build', 'sort', 'incrementBuildNumber'
16 changes: 8 additions & 8 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#
#Tue Jul 31 00:30:38 BST 2018
#Sun Aug 04 02:48:00 BST 2019
mod_name=Neat
forge_version=14.23.2.2613
dir_repo=./
dir_forgecraft=D\:/Seafile/incoming/ForgeCraft2/mods
mc_mappings=snapshot_20171003
version=1.4
forge_version=28.0.40
mapping_version=20190719-1.14.3
mapping_channel=snapshot
mod_id=neat
version=1.5
dir_output=../Build Output/Neat/
build_number=18
mc_version=1.12.2
mc_version=1.14.4
build_number=44
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Oct 27 18:34:11 EDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
Loading

0 comments on commit 26473e6

Please sign in to comment.