-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
97 lines (78 loc) · 3.01 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
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.node-gradle:gradle-node-plugin:2.2.3"
classpath "com.moowork.gradle:gradle-node-plugin:1.3.1"
}
}
import org.apache.tools.ant.filters.ReplaceTokens
import java.util.regex.*
import java.net.InetAddress
// Check if plugin is already loaded (i.e. when run at enlistment level)
def gradleNodePluginId = 'com.github.node-gradle.node'
final hasGradleNodePlugin = project.getPlugins().hasPlugin(gradleNodePluginId);
def mooworkNodePluginId = 'com.moowork.node'
final hasMooworkNodePlugin = project.getPlugins().hasPlugin(mooworkNodePluginId);
// If plugins are not already loaded (i.e. run at LKMods level), then
// load from classpaths using legacy plugin application
// Can use following to download node for consistency environments
// gradleNodePlugin must be applied in plugins to work
// node {
// /* gradle-node-plugin configuration
// https://github.com/srs/gradle-node-plugin/blob/master/docs/node.md
// Task name pattern:
// ./gradlew npm_<command> Executes an NPM command.
// */
// version = "${nodeVersion}"
// npmVersion = "${npmVersion}"
// // If true, it will download node using above parameters.
// // If false, it will try to use globally installed node.
// download = false
// }
apply plugin: gradleNodePluginId
apply plugin: mooworkNodePluginId
// Allow for local and server builds using flexible basePath
ext.labKeyModulesDir = System.getenv('GRADLE_LKMODS_DIR')
ext.deployDir = System.getenv('GRADLE_DEPLOY_DIR')
ext.externalModulesDir = System.getenv('GRADLE_EXTERNAL_MODULES_DIR')
// GRADLE_BUILD_TYPE should be set to 'dev','prod', or 'local'
ext.buildType = System.getenv('GRADLE_BUILD_TYPE')
if (ext.buildType == 'dev'){
buildType = "Development"
}else if(ext.buildType == 'prod'){
buildType = "Production"
}else if(ext.buildType == 'local'){
buildType = "Local"}
else{
throw new GradleException("Unknown build type: ${ext.buildType}")
}
if (deployDir == null)
throw new GradleException("deploy directory ${deployDir} does not exist.")
if (externalModulesDir == null){
mkdir externalModulesDir
}
// Build Parameters for module.xml
ext.buildUser = System.getProperty('user.name')
ext.buildOS = System.getProperty('os.name')
ext.reactModules = ['DataFinder', 'ResourcesPage', 'AboutPage', 'DataAccess', 'extraWebapp', 'AnalyteExplorer']
subprojects {
if (!hasGradleNodePlugin &&
!hasMooworkNodePlugin &&
reactModules.contains(project.name)) {
apply plugin: gradleNodePluginId
apply plugin: mooworkNodePluginId
}
apply plugin: 'java' // for ant token replacement
task deploy {
doLast{ task ->
println "$task.project.name - deploying to $externalModulesDir"
}
}
}
// Each module has individual build files for speed and ease of deployment
// in */LabKeyModules - gradle :<ModuleName>:deploy