Skip to content

Commit 2975915

Browse files
committed
Change gradle upload from FTP to SCP. Untested, will probably explode horribly.
1 parent cf26ce2 commit 2975915

File tree

2 files changed

+38
-41
lines changed

2 files changed

+38
-41
lines changed

build.gradle

+36-38
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,27 @@ minecraft {
4646
replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
4747
}
4848

49-
//This here is for FTP
49+
//This here is for SCP
5050
repositories {
5151
mavenCentral()
5252
}
5353
configurations {
54-
ftpAntTask
54+
sshAntTask
5555
}
56-
//End of the FTP config
56+
57+
//End of the SCP config
58+
5759
dependencies {
5860
compile files(
59-
'Baubles-deobf.jar'
61+
'Baubles-deobf.jar'
6062
)
6163
compile "codechicken:CodeChickenLib:1.7.10-1.1.1.109:dev"
6264
compile "codechicken:CodeChickenCore:1.7.10-1.0.2.9:dev"
6365
compile "codechicken:NotEnoughItems:1.7.10-1.0.2.15:dev"
6466
compile "codechicken:ForgeMultipart:1.7.10-1.1.1.320:dev"
6567

66-
//and a bit more for FTP
67-
ftpAntTask module("org.apache.ant:ant-commons-net:1.7.0") {
68-
module("commons-net:commons-net:1.4.1") {
69-
dependencies("oro:oro:2.0.8@jar")
70-
}
71-
}
68+
//and a bit more for SCP
69+
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
7270
}
7371

7472
processResources {
@@ -150,50 +148,52 @@ task sort(type: Delete) {
150148
/**
151149
* This is the upload task from the build.xml
152150
*/
153-
task upload(dependsOn: 'reobf') << {
154-
ftp(action: 'mkdir', remotedir: '/files')
155-
ftp(action: 'send', remotedir: '/files') {
151+
task upload() << {
152+
scp(dir: '/files')
153+
scp(dir: '/files') {
156154
fileset(file: jar.archivePath)
157155
}
158156

159-
ftp(action: 'send', remotedir: '/files/deobf') {
157+
scp(dir: '/files/deobf') {
160158
fileset(file: deobfJar.archivePath)
161159
}
162160

163-
ftp(action: 'send', remotedir: '.') {
161+
scp {
164162
fileset(file: 'web/changelog.txt')
165163
fileset(file: 'web/versions.ini')
166164
}
167165
}
168166

167+
void scp(String dir = '', Closure antFileset = {}) {
168+
ant {
169+
taskdef(
170+
name: 'scp',
171+
classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
172+
classpath: configurations.sshAntTask.asPath)
173+
174+
String dirstr = priv.scp_dir + dir
175+
Map scpArgs = args + [
176+
verbose : 'yes',
177+
todir : dirstr,
178+
password : priv.scp_pass,
179+
]
180+
181+
delegate.scp(scpArgs) {
182+
antFileset.delegate = delegate
183+
antFileset()
184+
}
185+
}
186+
}
187+
169188
/**
170189
* This is deply_web task
171190
*/
172191
task deployWeb << {
173-
ftp(action: 'send', remotedir: '.') {
192+
scp(dir: '.') {
174193
fileset(dir: 'web') //everything from the web directory
175194
}
176195
}
177196

178-
//simple function that we can use
179-
//Got this from: http://svn.codehaus.org/gradle/website/build.gradle
180-
void ftp(Map args, Closure antFileset = {}) {
181-
ant {
182-
taskdef(name: 'ftp',
183-
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
184-
classpath: configurations.ftpAntTask.asPath)
185-
Map ftpArgs = args + [ //some default options
186-
verbose : 'yes',
187-
server : priv.host,
188-
userid : priv.user,
189-
password: priv.pass
190-
]
191-
delegate.ftp(ftpArgs) {
192-
antFileset.delegate = delegate
193-
antFileset()
194-
}
195-
}
196-
}
197197

198198
def parseConfig(File config) {
199199
config.withReader {
@@ -218,6 +218,4 @@ curse {
218218
relatedProject 'baubles': 'requiredLibrary'
219219
}
220220

221-
//change this so it only increments on upload
222-
upload.dependsOn tasks.incrementBuildNumber
223-
defaultTasks 'clean', 'build', 'sort', 'forgecraft', 'curse', 'upload' //remove clean if you want faster builds, this will stop rare inconsistancies.
221+
defaultTasks 'clean', 'build', 'sort', 'forgecraft', 'incrementBuildNumber', 'curse', 'upload'

private.properties.example

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
host=
2-
user=
3-
pass=
1+
scp_dir=
2+
scp_pass=
43
cfkey=
54
dir_forgecraft=../Build Output/Botania/

0 commit comments

Comments
 (0)