-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
83 lines (70 loc) · 2.28 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '25.0.1'
defaultConfig {
applicationId 'org.zeroturnaround.jf.android.calculator'
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName '1.0'
}
}
task gatherHwProps {
doLast {
// gather the props from the console
def input = new BufferedReader(System.in.newReader('UTF-8'))
println ''
println 'Your full name (e.g. John Smith): '
project.ext.fullName = input.readLine().trim()
println 'Your Student Book Number (matrikli number, e.g. B12345): '
project.ext.bookNo = input.readLine().trim()
println 'Homework number: '
project.ext.hwNo = input.readLine().trim()
println 'Comment: '
project.ext.comment = input.readLine().trim()
// write them out to build/homework.properties
Properties props = new Properties()
props.put('full-name', project.ext.fullName)
props.put('sbn', project.ext.bookNo)
props.put('homework-number', project.ext.hwNo) // hardcoded 14
props.put('comment', project.ext.comment)
// make sure buildDir exists and then write our props
buildDir.mkdirs()
project.file("${buildDir}/homework.properties").withWriter('UTF-8') { out ->
props.store(out, 'Homework 14')
}
}
}
task deploy(type: Zip) {
dependsOn gatherHwProps
doFirst {
archiveName "jf-homework-${project.ext.bookNo}-${project.ext.hwNo}.zip"
}
doLast {
println "Built zip ${archivePath.absolutePath}"
}
destinationDir project.buildDir
from(projectDir) {
// ignore everything that is in .gitignore
exclude 'build/'
exclude '.idea/'
exclude '.gradle/'
exclude '**/*.iml'
exclude '**/*.swp'
exclude 'local.properties'
// ignore the wrapper dir as it has a jar in it and could block emails...
exclude 'gradle/'
// ignore the gifs, they take quite a lot of space
exclude '**/*.gif'
}
from(file("${buildDir}/homework.properties"))
}