-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
133 lines (118 loc) · 4.04 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
plugins {
id 'com.enonic.xp.app' version '3.5.2'
id "com.github.node-gradle.node" version "7.1.0"
}
repositories {
mavenLocal()
mavenCentral()
xp.enonicRepo('dev')
}
node {
download = true
version = '18.18.0'
}
app {
name = "${appName}"
displayName = "${appDisplayName}"
vendorName = "${vendorName}"
vendorUrl = "${vendorUrl}"
systemVersion = "${xpVersion}"
}
dependencies {
implementation "com.enonic.xp:core-api:${xpVersion}"
implementation "com.enonic.xp:portal-api:${xpVersion}"
include "com.enonic.xp:lib-content:${xpVersion}"
include "com.enonic.xp:lib-portal:${xpVersion}"
//include "com.enonic.xp:lib-auth:${xpVersion}"
//include "com.enonic.xp:lib-context:${xpVersion}"
//include "com.enonic.xp:lib-i18n:${xpVersion}"
//include "com.enonic.xp:lib-io:${xpVersion}"
//include "com.enonic.xp:lib-mail:${xpVersion}"
//include "com.enonic.xp:lib-repo:${xpVersion}"
//include "com.enonic.xp:lib-websocket:${xpVersion}"
include 'com.enonic.lib:lib-guillotine:5.5.0'
// include 'com.enonic.lib:lib-guillotine:6.2.1'
include 'com.enonic.lib:lib-react4xp:5.1.1'
// include 'com.enonic.lib:lib-react4xp:5.1.1-SNAPSHOT'
include 'com.enonic.lib:lib-thymeleaf:2.1.1'
}
sourceSets {
main {
resources {
['.gitkeep','*.es6','*.jsx','*.scss','*.tsx'].each { ext ->
exclude "**/$ext"
}
}
}
}
processResources {
// Files that are simply copied by gradle: png svg xml
exclude '**/.gitkeep'
exclude '**/*.jsx' // handled by @enonic/react4xp gradle files
exclude '**/*.sass' // handled by @enonic/react4xp gradle files
exclude '**/*.scss' // handled by @enonic/react4xp gradle files
exclude '**/*.tsx' // handled by @enonic/react4xp gradle files
exclude '**/*.ts' // handled by tsup
}
tasks.withType(Copy) {
includeEmptyDirs = false
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// This task takes care of XP non-react (and therefore non-react4xp) ts files
// under src/main/resources. This is independent of react4xp, so you can replace
// this with your own build steps if you want.
// IMPORTANT:
// This task only handles .ts files under src/main/resources.
// If you use your own logic to compile non-react XP files
// (i.e. replace this task or add more to it),
// you should usually make it ignore .tsx and .jsx files,
// to ensure that those are handled only by the react4xp build
// (node_modules/@enonic/react4xp/react4xp.gradle, aka. react4xpGradlePath)
// and not compiled twice.
tasks.register('buildXpResources', NpmTask) {
dependsOn( npmInstall )
args = ['run', 'build:xp:resources']
group 'enonic xp'
description 'tsup transpile Enonic XP TypeScript source files (important: ignoring TSX/JSX components since they are left to react4xp)'
outputs.dir 'build/resources/main'
// This is just so gradle is able to do incremental builds:
inputs.files fileTree(dir: 'src/main/resources', exclude: [
'**/.gitkeep',
'**/*.cjs',
'**/*.es',
'**/*.jsx',
'**/*.html',
'**/*.png',
'**/*.sass',
'**/*.scss',
'**/*.svg',
'**/*.tsx',
'**/*.xml'
])
}
tasks.register('react4xp', NpmTask) {
dependsOn( npmInstall )
args = [
'run', 'build:react4xp'
]
description 'Compile react4xp resources'
environment = [
'R4X_APP_NAME': "${appName}",
'R4X_BUILD_LOG_LEVEL': gradle.startParameter.logLevel.toString(),
'R4X_DIR_PATH_ABSOLUTE_PROJECT': project.projectDir.toString(),
'NODE_ENV': project.hasProperty('dev') || project.hasProperty('development') ? 'development' : 'production'
]
group 'react4xp'
inputs.dir 'node_modules/@enonic/react4xp'
inputs.dir 'src/main/resources'
outputs.dir 'build/resources/main'
}
tasks.register('dev', Exec) {
dependsOn( deploy )
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'gradlew.bat', 'deploy', '-t'
} else {
commandLine './gradlew', 'deploy', '-t'
}
}
jar.dependsOn ( 'buildXpResources', 'react4xp' )