-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
78 lines (65 loc) · 1.68 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
plugins {
id 'java'
id 'maven-publish'
id "com.github.node-gradle.node" version '3.4.0'
id 'com.enonic.xp.base' version '3.1.0'
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
dependencies {
compile "com.enonic.xp:portal-api:${xpVersion}"
}
repositories {
mavenCentral()
xp.enonicRepo()
maven { url 'https://jitpack.io' }
}
node {
download = true
version = '16.13.1'
}
task npmInstallForce(type: NpmTask) {
description = 'Update all project node dependencies'
args = ['install', '--force']
}
task cleanNode(type: org.gradle.api.tasks.Delete) {
delete 'node_modules'
}
task serverWebpack(type: NodeTask, dependsOn: npmInstall) {
environment = ['NODE_ENV': nodeEnvironment()]
// args = [ '--config', 'webpack.server.config.babel.js', '--color']
args = ['--config', 'webpack.server.config.js', '--color']
description = 'Build server JS.'
inputs.dir 'src/main'
outputs.dir "${buildDir}/resources/main"
script = file('node_modules/webpack-cli/bin/cli.js')
}
processResources {
include '**/*'
exclude '**/.gitkeep'
exclude '**/tsconfig.*.json'
exclude '**/*.es'
exclude '**/*.es6'
exclude '**/*.ts'
includeEmptyDirs false
}
jar {
exclude 'assets/styles/**/*.js'
dependsOn += serverWebpack
}
jar.outputs.dir "${buildDir}/resources/main"
def nodeEnvironment() {
def environments = [prod: 'production', dev: 'development']
def nodeEnv = environments[hasProperty('env') ? env : 'prod']
return nodeEnv != null ? nodeEnv : 'production'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId group
artifactId projectName
version version
}
}
}