Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1199 improve build system #1210

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
build/
dist/
out/
tsup/
.xp/
**/*.js
**/*.d.ts
Expand Down
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
module.exports = {
extends: '@enonic/eslint-config',
parserOptions: {
project: './tsconfig.json',
project: [
'./src/main/resources/tsconfig.json',
'./src/main/resources/_static/tsconfig.json'
],
tsconfigRootDir: __dirname,
},
'rules': {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.enonic
.DS_Store
build/
temp/
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.18.1
3 changes: 1 addition & 2 deletions .swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"loose": true
},
"exclude": [
".*\\.d\\.ts$",
"/lib/"
".*\\.d\\.ts$"
],
"module": {
"type": "commonjs",
Expand Down
44 changes: 33 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'maven-publish'
id 'com.enonic.defaults' version '2.1.2'
id 'com.enonic.xp.app' version '3.4.0'
id "com.github.node-gradle.node" version '7.0.0'
id 'com.github.node-gradle.node' version '7.0.1'
}

def xpVersion=version
Expand Down Expand Up @@ -36,9 +36,12 @@ dependencies {
include "com.enonic.xp:lib-portal:${xpVersion}"
include "com.enonic.xp:lib-auth:${xpVersion}"
include "com.enonic.xp:lib-i18n:${xpVersion}"
include "com.enonic.xp:lib-io:${xpVersion}"
include "com.enonic.lib:lib-admin-ui:${libAdminUiVersion}"
devResources "com.enonic.lib:lib-admin-ui:${libAdminUiVersion}"
include "com.enonic.lib:lib-mustache:2.1.0"
include 'com.enonic.lib:lib-router:3.1.0'
include 'com.enonic.lib:lib-static:1.0.3'

testImplementation "org.mockito:mockito-core:4.8.0"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.1"
Expand All @@ -47,31 +50,50 @@ dependencies {
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.1"
}

tasks.register('npmCheck', NpmTask) {
dependsOn( 'npmInstall' )
args = [
'run',
'check:types'
]
environment = [
'FORCE_COLOR': 'true',
]
}

tasks.register('lint', NpmTask ) {
group "verification"
dependsOn( 'npmInstall' )
args = ['run', 'lint']
outputs.upToDateWhen { false }
}

check.dependsOn lint
check.configure {
dependsOn( 'lint', 'npmCheck' )
}

tasks.register('webpack', NpmTask) {
dependsOn( 'npmInstall' )
environment = ['NODE_ENV': nodeEnvironment()]
tasks.register( 'npmBuild', NpmTask) {
dependsOn npmInstall
description = 'Build UI resources (ts, css, etc).'
environment = [
'FORCE_COLOR': 'true',
'LOG_LEVEL_FROM_GRADLE': gradle.startParameter.logLevel.toString(),
'NODE_ENV': nodeEnvironment()
]
args = ['run', 'build']
inputs.dir '.xp/dev'
inputs.dir 'src/main'
inputs.file 'webpack.config.js'
outputs.dir "$buildDir/build/resources/main/assets"
inputs.dir 'src/main/resources'
inputs.file 'tsup.config.ts'
outputs.dir "$buildDir/build/resources/main"
}

jar {
processResources {
exclude 'assets/styles/**/*.less'
exclude 'assets/styles/**/*.js'
exclude '**/*.d.ts'
exclude '**/*.ts'
}

jar {
def whitelist = [
/.*bundle\.js$/,
/.*\/widgets\/.*\.js$/,
Expand All @@ -89,7 +111,7 @@ jar {

outputs.dir "${buildDir}/resources/main"

dependsOn( 'webpack', 'test', 'javadoc' )
dependsOn( 'npmBuild', 'test', 'javadoc' )
}

test {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Project settings
#
version=7.14.0-SNAPSHOT
libAdminUiVersion=4.9.0-SNAPSHOT
libAdminUiVersion=4.9.0-3266-SNAPSHOT
systemProp.org.gradle.internal.http.connectionTimeout=120000
systemProp.org.gradle.internal.http.socketTimeout=120000
2 changes: 1 addition & 1 deletion gradle/node.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.github.node-gradle.node'

node {
version = '18.17.1'
version = '18.18.1'
download = true
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Loading