-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
71 lines (61 loc) · 1.29 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
import groovy.io.FileType
task clean(type: Delete) {
delete 'build'
}
task buildR {
inputs.file('src/print/**/*.R')
inputs.file("data/")
outputs.file('build/latex')
doLast {
new File('src/print/').eachFileRecurse(FileType.FILES) {
file ->
if (file.name.endsWith('.R')) {
exec {
workingDir "$projectDir"
commandLine 'R', '-f', file.absolutePath
}
}
}
}
}
task copyLatex(type: Sync) {
from 'src/print/'
into 'build/latex/src'
include '**/*.tex'
}
task buildLatex(type: Exec) {
dependsOn copyLatex
dependsOn buildR
inputs.file('../src/lektion1.tex')
outputs.file("$buildDir/latex/output")
workingDir "$buildDir/latex/output"
commandLine 'pdflatex', '../src/lektion1.tex'
doFirst {
new File("$buildDir/latex/output").mkdirs();
}
}
task buildWeb(type: Exec) {
inputs.file("src/web/")
inputs.file("data/")
outputs.file("build/web")
workingDir "src/web/"
commandLine 'npm', 'run', 'build'
doFirst {
exec {
workingDir "src/web"
commandLine 'npm', 'install'
}
}
}
task dist(type: Sync) {
from "$buildDir/latex/output"
into "$buildDir/dist"
include "**/*.pdf"
doLast {
new File("$buildDir/dist").mkdirs();
}
}
task build {
dependsOn buildLatex
dependsOn buildWeb
}