-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
111 lines (104 loc) · 4.38 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
import org.labkey.gradle.util.BuildUtils
/***********************************************************************************************************************
* wnprc-modules "main" build file
*
* This file is the "main" build definition for the wnprc-modules folders that lie under it, with the caveat that this
* file itself is expected to be a subproject of the main _LabKey_ build. As such, the folder structure is assumed to
* be as follows:
*
* [labkey root]
* -> externalModules
* -> wnprc-modules (this folder)
* -> docker
* -> gradle
* -> java2ts
* -> [module]
* -> [module]
* ...
*
* To include all the subprojects (including docker and java2ts, which get some special treatment later), add the
* following to the top-level (LabKey root) settings.gradle file or to a "module set" in [labkey root]/gradle/settings:
*
* include 'externalModules:wnprc-modules'
* file('externalModules/wnprc-modules').listFiles().findAll { d ->
* d.isDirectory() && (new File(d.getAbsolutePath(), 'build.gradle')).exists()
* }.each { d ->
* include "externalModules:wnprc-modules:${d.getName()}"
* }
*
* In case it is not immediately obvious, that code will add every subfolder containing a build.gradle file as a
* subproject to the gradle build under the ":externalModules:wnprc-modules" project.
*
* Each module subproject (i.e., not docker or java2ts) will get a few module-specific tasks, largely modelled off the
* LabKey gradle plugin:
*
* - cleanModule
* - copyModuleResources
* - createModuleXml
* - createModule
* - deployModule
* - undeployModule
*
* The subprojects will also selectively gain some Java- and/or JavaScript-related, depending on the files that exist
* within the folder. These tasks are defined in the files in the ./gradle directory and are generally applied in the
* following way:
*
* - api: Added to modules with a ./api-src directory. Applies the "java-base" plugin and creates a source set
* called "api".
* - java: Added to modules with a ./src/java directory. Applies the "java" plugin and configured it.
* - javascript: Selectively adds tasks based on ./webpack.config.[jt]s, ./tsconfig.json, and/or ./src/less/**.
* - jsp: Added to modules with a ./src/java directory. Configures source sets for JSP compilation.
*
* The "main" wnprc-modules build also has some tasks to manage all the modules:
*
* - cleanModules
* - createModules
* - deployModules
* - undeployModules
*
**********************************************************************************************************************/
// using this to manage our node_modules and package.json in the base directory rather than module by module
// using this to ignore the node_modules and other "base" folders in IntelliJ IDEA
apply plugin: 'idea'
idea.module {
excludeDirs += file('node_modules')
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
}
def wnprcDir = project.projectDir
def modules = [
project('ApiKey'),
project('DBUtils'),
project('DeviceProxy'),
project('GoogleDrive'),
project('primateid'),
project('wnprc_billing'),
project('wnprc_billingpublic'),
project('WNPRC_Purchasing'),
project('WebUtils'),
project('WNPRC_Compliance'),
project('WNPRC_EHR')]
configure(modules) {
// tell IntelliJ to ignore any build directories
apply plugin: 'idea'
idea.module { excludeDirs += file('build') }
apply plugin: 'java'
if (file("${project.projectDir}/src").exists()) {
apply plugin: 'org.labkey.build.module'
apply from: "${wnprcDir}/gradle/java.gradle"
} else {
apply plugin: 'org.labkey.build.fileModule'
}
}
task ("cleanModules", group: "Build", dependsOn: modules.collect { "${it.path}:cleanModule" },
description: "Cleans/unstages all child modules")
task ("createModules", group: "Build", dependsOn: modules.collect { "${it.path}:module" },
description: "Builds and jars the .module file for each subproject")
task ("deployModules", group: "Deploy", dependsOn: modules.collect { "${it.path}:deployModule" },
description: "Deploys all child modules")
task ("undeployModules", group: "Deploy", dependsOn: modules.collect { "${it.path}:undeployModule" },
description: "Undeploys all child modules")