mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Merge pull request #355 from cazzar/master
Full and proper gradlization
This commit is contained in:
commit
5f1df8a774
1180 files changed
+137
-132
No files matched your search
+133
-22
@@ -24,46 +24,157 @@ repositories {
|
||||
|
||||
apply plugin: 'forge'
|
||||
|
||||
version = "1.0"
|
||||
group= "vazkii.botania" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = "modid"
|
||||
ext.configFile = file('build.properties')
|
||||
|
||||
ext.config = parseConfig(configFile)
|
||||
ext.ftp = parseConfig(file('ftp.properties'))
|
||||
|
||||
version = "${config.version}-${config.build_number}"
|
||||
group = "vazkii.botania" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = config.mod_name
|
||||
|
||||
minecraft {
|
||||
version = "1.7.10-10.13.1.1217"
|
||||
version = "${config.mc_version}-${config.forge_version}"
|
||||
assetDir = "eclipse/assets"
|
||||
|
||||
//This, does the token replacement.
|
||||
//Though, I reccomend this to be replaced with a token such as @VERSION@
|
||||
replace 'ANT:BUILD', config.build_number
|
||||
replace 'ANT:VERSION', config.version
|
||||
|
||||
replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
|
||||
}
|
||||
|
||||
//This here is for FTP
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
configurations {
|
||||
ftpAntTask
|
||||
}
|
||||
//End of the FTP config
|
||||
dependencies {
|
||||
compile files (
|
||||
'Baubles-deobf.jar'
|
||||
compile files(
|
||||
'Baubles-deobf.jar'
|
||||
)
|
||||
compile "codechicken:CodeChickenLib:1.7.10-1.1.1.95:dev"
|
||||
compile "codechicken:CodeChickenCore:1.7.10-1.0.2.9:dev"
|
||||
compile "codechicken:NotEnoughItems:1.7.10-1.0.2.15:dev"
|
||||
|
||||
//and a bit more for FTP
|
||||
ftpAntTask module("org.apache.ant:ant-commons-net:1.7.0") {
|
||||
module("commons-net:commons-net:1.4.1") {
|
||||
dependencies("oro:oro:2.0.8@jar")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
processResources
|
||||
{
|
||||
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
|
||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
||||
}
|
||||
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
exclude 'mcmod.info', '**/psd/**'
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
from(sourceSets.main.output)
|
||||
classifier = 'deobf'
|
||||
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives deobfJar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* These, go outside of the processResources {}* Though, this was added with the NEI intergation commit (8bf4680)
|
||||
*/
|
||||
task deobfJar(type: Jar) {
|
||||
from(sourceSets.main.output)
|
||||
classifier = 'deobf'
|
||||
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives deobfJar
|
||||
}
|
||||
/**
|
||||
* Increments the buildnumber in your config file, and saves it
|
||||
*/
|
||||
task incrementBuildNumber(dependsOn: 'reobf') << {
|
||||
config.build_number = (config.build_number.toString().toInteger()) + 1
|
||||
configFile.withWriter {
|
||||
config.toProperties().store(it, "")
|
||||
}
|
||||
|
||||
file('web/versions.ini').append("\n${version}=${minecraft.version}")
|
||||
file("${config.dir.repo}/version/${minecraft.version}.txt").write("${version}")
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy over to ForgeCraft
|
||||
*/
|
||||
task forgecraft(type: Copy) {
|
||||
dependsOn "build"
|
||||
from jar.archivePath
|
||||
into config.dir.forgecraft
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: '.') {
|
||||
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 : ftp.host,
|
||||
userid : ftp.user,
|
||||
password: ftp.pass
|
||||
]
|
||||
delegate.ftp(ftpArgs) {
|
||||
antFileset.delegate = delegate
|
||||
antFileset()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def parseConfig(File config) {
|
||||
config.withReader {
|
||||
def prop = new Properties()
|
||||
prop.load(it)
|
||||
return (new ConfigSlurper().parse(prop))
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
//rename the default output, for some better... sanity with scipts
|
||||
archiveName = "${baseName} ${version}.${extension}"
|
||||
}
|
||||
|
||||
//change this so it only increments on upload
|
||||
upload.dependsOn tasks.incrementBuildNumber
|
||||
defaultTasks 'clean', 'build', 'forgecraft', 'upload' //remove clean if you want faster builds, this will stop rare inconsistancies.
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
#Tue, 04 Nov 2014 15:09:06 +0000
|
||||
version=r1.2
|
||||
build_number=133
|
||||
mc_version=1.7.2
|
||||
mc_version=1.7.10
|
||||
forge_version=10.13.1.1217
|
||||
mod_name=Botania
|
||||
dir.repo=./
|
||||
dir.gradle=../MCP17
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Botania" default="build">
|
||||
|
||||
<property file="build.properties" prefix="build"/>
|
||||
<property file="ftp.properties" prefix="ftp"/>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir.gradle}\build\classes\main" />
|
||||
<delete dir="${build.dir.gradle}\src\main\java\vazkii" />
|
||||
<delete file="${build.dir.gradle}\src\main\java\mcmod.info" />
|
||||
|
||||
<delete dir="${build.dir.gradle}\src\api\java\thaumcraft" />
|
||||
|
||||
<delete dir ="${build.dir.temp}" />
|
||||
</target>
|
||||
|
||||
<target name="increment_build_number">
|
||||
<propertyfile file="build.properties">
|
||||
<entry key="build_number" type="int" operation="+" default="1"/>
|
||||
</propertyfile>
|
||||
<concat destfile="${build.dir.repo}\web\versions.ini" append="true" fixlastline="true">${line.separator}${build.version}-${build.build_number}=${build.mc_version}</concat>
|
||||
<echo file="${build.dir.repo}\version\${build.mc_version}.txt">${build.version}-${build.build_number}</echo>
|
||||
</target>
|
||||
|
||||
<target name="prep">
|
||||
<mkdir dir="${build.dir.temp}" />
|
||||
|
||||
<copy todir="${build.dir.temp}">
|
||||
<fileset dir="${build.dir.repo}\resources\" />
|
||||
</copy>
|
||||
|
||||
<copy todir="${build.dir.gradle}\src\main\java">
|
||||
<fileset dir="${build.dir.repo}\MODSRC\" />
|
||||
</copy>
|
||||
|
||||
<copy todir="${build.dir.gradle}\src\api\java">
|
||||
<fileset dir="${build.dir.repo}\apis\" />
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="replace_tokens">
|
||||
<replace dir="${build.dir.temp}" token="ANT:VERSION" value="${build.version}" />
|
||||
<replace dir="${build.dir.temp}" token="ANT:BUILD" value="${build.build_number}" />
|
||||
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:VERSION" value="${build.version}" />
|
||||
<replace dir="${build.dir.gradle}\src\main\java" token="ANT:BUILD" value="${build.build_number}" />
|
||||
</target>
|
||||
|
||||
<target name="gradle_build">
|
||||
<copy todir="${build.dir.gradle}" overwrite="true">
|
||||
<fileset file="${build.dir.repo}\build.gradle"/>
|
||||
</copy>
|
||||
|
||||
<exec dir="${build.dir.gradle}" executable="cmd" osfamily="windows">
|
||||
<arg line="/c gradle build" />
|
||||
</exec>
|
||||
|
||||
<exec dir="${build.dir.gradle}" executable="gradle" osfamily="unix">
|
||||
<arg value="build" />
|
||||
</exec>
|
||||
|
||||
<move file="${build.dir.gradle}\build\libs\modid-1.0.jar" tofile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" />
|
||||
</target>
|
||||
|
||||
<target name="inject_assets">
|
||||
<jar update="true" destfile="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar">
|
||||
<fileset dir="${build.dir.temp}" excludes="**/psd/**" />
|
||||
</jar>
|
||||
<delete dir ="${build.dir.temp}" />
|
||||
</target>
|
||||
|
||||
<target name="forgecraft">
|
||||
<delete>
|
||||
<fileset dir="${build.dir.forgecraft}" includes="**/${build.mod_name}*" />
|
||||
</delete>
|
||||
<copy file="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" todir="${build.dir.forgecraft}" />
|
||||
</target>
|
||||
|
||||
<target name="upload">
|
||||
<ftp action="mkdir" server="${ftp.host}" remotedir="/files" userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes" />
|
||||
<ftp action="send" server="${ftp.host}" remotedir="/files" userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes">
|
||||
<fileset file="${build.dir.output}\${build.mod_name}\${build.mod_name} ${build.version}-${build.build_number}.jar" />
|
||||
</ftp>
|
||||
<ftp action="send" server="${ftp.host}" remotedir="." userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes">
|
||||
<fileset file="${build.dir.repo}web/changelog.txt" />
|
||||
<fileset file="${build.dir.repo}web/versions.ini" />
|
||||
</ftp>
|
||||
</target>
|
||||
|
||||
<target name="deploy_website">
|
||||
<ftp action="send" server="${ftp.host}" remotedir="." userid="${ftp.user}" password="${ftp.pass}" verbose="yes" depends="yes">
|
||||
<fileset dir="${build.dir.repo}web" />
|
||||
</ftp>
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
<antcall target="clean" />
|
||||
<antcall target="prep" />
|
||||
<antcall target="replace_tokens" />
|
||||
<antcall target="gradle_build" />
|
||||
<antcall target="inject_assets" />
|
||||
<antcall target="increment_build_number" />
|
||||
<antcall target="clean" />
|
||||
<antcall target="forgecraft" />
|
||||
<antcall target="upload" />
|
||||
</target>
|
||||
</project>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 1180 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user