Skip to content

Commit

Permalink
It exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Vazkii committed Mar 17, 2016
1 parent 6a892d4 commit 595b63a
Show file tree
Hide file tree
Showing 11 changed files with 494 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .gitignore
@@ -0,0 +1,61 @@
## Windows
Thumbs.db

## gradle
/.gradle
/build

## ForgeGradle
/run

## eclipse
/.settings
/.metadata
/.classpath
/.project
/eclipse
/bin

## intellij
/out
/.idea
/atlassian-ide-plugin.xml
/*.ipr
/*.iws
/*.iml

## Private Stuffs
/private.properties

## Jars
*.jar
!/gradle/wrapper/gradle-wrapper.jar
!GardenOfGlass.jar

### OSX (adds a lot of garbage)###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

2 changes: 2 additions & 0 deletions build.bat
@@ -0,0 +1,2 @@
sh gradlew
pause
209 changes: 209 additions & 0 deletions build.gradle
@@ -0,0 +1,209 @@
buildscript {
repositories {
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.1-SNAPSHOT'
classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT'
}
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.matthewprenger.cursegradle'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

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

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

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

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

mappings = "stable_22"
replace 'GRADLE:BUILD', config.build_number
replace 'GRADLE:VERSION', config.version

replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
makeObfSourceJar = false
}

//This here is for SCP
repositories {
mavenCentral()
}
configurations {
sshAntTask
}

//End of the SCP config

dependencies {
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
}

jar {
exclude "**/*.bat"
exclude "**/*.psd"
}

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', '**/psd/**'
}
}

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 {
config.toProperties().store(it, "")
}

file('web/versions.ini').append("\n${version}=${minecraft.version}")
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(priv.dir_forgecraft)
}

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

def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
}

/**
* This is the upload task from the build.xml
*/
task upload() << {
scp('/files') {
fileset(file: jar.archivePath)
}

scp('/files/deobf') {
fileset(file: deobfJar.archivePath)
}

scp('/') {
fileset(file: 'web/changelog.txt')
fileset(file: 'web/versions.ini')
}
}

/**
* This is deply_web task
*/
task deployWeb << {
scp('/') {
fileset(dir: 'web') //everything from the web directory
}
}

def scp(String dir, Closure antFileset = {}) {
ant {
taskdef(
name: 'scp',
classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
classpath: configurations.sshAntTask.asPath)

String dirstr = priv.scp_dir + dir
Map scpArgs = [
todir : dirstr,
password : priv.scp_pass,
sftp: true,
trust: 'yes'
]

delegate.scp(scpArgs) {
antFileset.delegate = delegate
antFileset()
}
}
}


curseforge {
apiKey = priv.cfkey
project {
id = "241665"
changelog = """
See http://quark.vazkii.us/changelog.php#${version}
"""
releaseType = "alpha" // TODO change to release sometime
}
}


//defaultTasks 'clean', 'build', 'sort', 'forgecraft', 'incrementBuildNumber', 'curseforge', 'upload'
defaultTasks 'clean', 'build', 'sort', 'incrementBuildNumber'
9 changes: 9 additions & 0 deletions build.properties
@@ -0,0 +1,9 @@
#
#Mon Mar 14 15:24:59 GMT 2016
version=alpha
dir_output=../Build Output/Quark/
dir_repo=./
forge_version=11.15.1.1722
mc_version=1.9
build_number=1
mod_name=Quark
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
#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

0 comments on commit 595b63a

Please sign in to comment.