-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
116 lines (106 loc) · 4.03 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import org.labkey.gradle.task.InstallRPackage
import org.labkey.gradle.util.GroupNames
import org.labkey.gradle.util.BuildUtils
buildscript {
repositories {
mavenCentral {
content {
excludeGroupByRegex "org\\.labkey.*"
}
}
maven {
url "${artifactory_contextUrl}/plugins-release-no-proxy"
mavenContent {
releasesOnly()
}
content {
includeGroup "org.labkey.build"
includeGroup "org.labkey.versioning"
}
}
if (gradlePluginsVersion.contains("SNAPSHOT"))
{
mavenLocal()
maven {
url "${artifactory_contextUrl}/plugins-snapshot-local"
mavenContent {
snapshotsOnly()
}
content {
includeGroup "org.labkey.build"
includeGroup "org.labkey.versioning"
}
}
}
}
dependencies {
classpath "org.labkey.build:gradlePlugins:${gradlePluginsVersion}"
}
configurations.configureEach {
// Check for updates every build for SNAPSHOT dependencies
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}
File buildOutputFile = project.layout.buildDirectory.file("commands.out").get().getAsFile()
String rLibsUserPath = InstallRPackage.getRLibsUserPath(project)
String rExe = InstallRPackage.getRPath()
project.tasks.register("check") {
Task task ->
group GroupNames.VERIFICATION
description "Run validation checks on the Rlabkey package"
task.outputs.dir project.layout.buildDirectory.file("Rlabkey.Rcheck")
task.outputs.dir project.file("Rlabkey/src-i386")
task.outputs.dir project.file("Rlabkey/src-x64")
task.outputs.files project.fileTree(dir: "Rlabkey/src", includes: ["*.o", "*.dll"])
task.doLast {
File[] existingFiles = BuildUtils.getBuildDir(project).listFiles(new FilenameFilter() {
@Override
boolean accept(File dir, String name) {
return name.endsWith(".tar.gz");
}
})
if (existingFiles.length > 0) {
project.ant.exec(
executable: rExe,
output: buildOutputFile,
append: true,
dir: BuildUtils.getBuildDir(project),
logError: true
)
{
arg(line: "CMD check --no-examples --as-cran ${existingFiles[0]}")
}
}
}
task.dependsOn build
}
project.tasks.register("build") {
Task task ->
task.group GroupNames.BUILD
task.description "Build the Rlabkey package that can be installed and tested in R. Builds binary package on windows, source only on unix"
task.inputs.files project.fileTree(dir: "Rlabkey", excludes: ["src-i386", "src-x64"]).files
task.outputs.dir project.layout.buildDirectory
task.doFirst(
{
BuildUtils.getBuildDir(project).mkdirs()
project.ant.exec(
executable: rExe,
dir: BuildUtils.getBuildDir(project),
output: buildOutputFile,
append: true,
logError: true
)
{
arg(line: "CMD build ${project.projectDir}/Rlabkey")
if (rLibsUserPath != null)
env(key: "R_LIBS_USER", value: rLibsUserPath)
}
}
)
}
project.tasks.register("clean", Delete) {
group GroupNames.BUILD
description "Deletes all non-versioned files generated during the build process"
delete project.tasks.check
delete project.tasks.build
}