-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
125 lines (108 loc) · 3.25 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
plugins {
id 'java'
id 'maven-publish'
id 'com.enonic.defaults' version '2.1.5'
id 'com.enonic.xp.base' version '3.5.2'
id "com.github.node-gradle.node" version "7.1.0"
}
repositories {
mavenLocal()
mavenCentral()
xp.enonicRepo()
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = sourceCompatibility
dependencies {
compileOnly "com.enonic.xp:core-api:${xpVersion}"
compileOnly "com.enonic.xp:portal-api:${xpVersion}"
compileOnly "com.enonic.xp:script-api:${xpVersion}"
implementation "com.enonic.xp:lib-context:${xpVersion}"
implementation "com.enonic.xp:lib-io:${xpVersion}"
implementation "com.enonic.xp:lib-portal:${xpVersion}"
implementation "com.enonic.xp:lib-schema:${xpVersion}"
implementation "com.enonic.xp:lib-task:${xpVersion}"
implementation 'com.enonic.lib:lib-cache:2.2.1'
implementation 'com.enonic.lib:lib-static:2.0.0'
implementation 'org.attoparser:attoparser:2.0.7.RELEASE'
implementation 'org.apache.commons:commons-pool2:2.12.1'
testImplementation "com.enonic.xp:testing:${xpVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.11.4"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.4"
testImplementation 'org.mockito:mockito-core:5.15.2'
}
node {
download = true
version = '22.11.0'
}
processResources {
exclude '**/.gitkeep'
exclude '**/*.es6'
exclude '**/*.ts'
}
tasks.withType( Copy ) {
includeEmptyDirs = false
}
tasks.register('npmCheck', NpmTask) {
dependsOn npmInstall
args = [
'run',
'check:types'
]
environment = [
'FORCE_COLOR': 'true',
]
}
// check.dependsOn npmCheck
def BUILD_ENV = "production"
if ( project.hasProperty( "dev" ) || project.hasProperty( "development" ) )
{
BUILD_ENV = "development"
}
tasks.register('npmBuild', NpmTask) {
args = [
'run',
'build',
]
environment = [
'FORCE_COLOR': 'true',
'LOG_LEVEL_FROM_GRADLE': gradle.startParameter.logLevel.toString(),
'NODE_ENV': project.hasProperty('dev') || project.hasProperty('development') ? 'development' : 'production'
]
inputs.dir 'src/main/resources'
outputs.dir 'build/resources/main'
outputs.upToDateWhen { false }
}
tasks.register('publishToNpm', NpmTask ) {
onlyIf { !version.endsWith( '-SNAPSHOT' ) }
args = ['publish']
dependsOn npmBuild
workingDir = file('build/types')
}
publish.dependsOn publishToNpm
compileTestJava.dependsOn npmBuild
jar.dependsOn npmBuild
javadoc.dependsOn npmBuild
if ( BUILD_ENV == 'development' )
{
task nsiInstall( type: NpmTask ) {
println "BUILD_ENV is set to '" + BUILD_ENV + "':\nOVERRIDING VANILLA npmInstall IN FAVOR OF node-safe-install (nsi)."
// Because nsi retains 'npm link' symlinks!
args = ['run', 'install:nsi']
}
npmInstall.enabled = false
npmInstall.dependsOn nsiInstall
nsiInstall.inputs.files( "package.json", "package-lock.json" )
nsiInstall.outputs.dir( "node_modules" )
nsiInstall.outputs.file file( "package-lock.json" )
}
else
{
npmInstall.inputs.files( "package.json", "package-lock.json" )
// npmInstall.outputs.dir("node_modules")
npmInstall.outputs.file file( "package-lock.json" )
npmBuild.dependsOn( npmInstall )
}
test {
useJUnitPlatform {
}
}