Add scm-ui assets to scm-webapp war file

This commit is contained in:
Sebastian Sdorra
2020-12-21 16:19:56 +01:00
committed by René Pfeuffer
parent 4fd136fea2
commit 6430c811e2
3 changed files with 84 additions and 9 deletions

View File

@@ -4,7 +4,7 @@
* Copyright (c) 2020-present Cloudogu GmbH and Contributors * Copyright (c) 2020-present Cloudogu GmbH and Contributors
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the 'Software'), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
@@ -13,7 +13,7 @@
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
@@ -30,31 +30,100 @@ node {
download = true download = true
version = '14.15.1' version = '14.15.1'
yarnVersion = '1.22.5' yarnVersion = '1.22.5'
nodeModulesDir = file("${project.rootProject.projectDir}") nodeModulesDir = file('${project.rootProject.projectDir}')
} }
// TODO define inputs and outputs // TODO define inputs and outputs
task typecheck(type: YarnTask) { task typecheck(type: YarnTask) {
args = ['run', 'typecheck'] args = ['run', 'typecheck']
inputs.files(fileTree(project.projectDir) {
include 'ui-*/src/**'
include 'ui-*/**/*.js'
include 'ui-*/**/*.jsx'
include 'ui-*/**/*.ts'
include 'ui-*/**/*.tsx'
})
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.file("build/tmp/typecheck/marker")
dependsOn('yarn_install') dependsOn('yarn_install')
doLast {
File directory = new File(project.buildDir, 'tmp/typecheck')
directory.mkdirs()
File marker = new File(directory, "marker")
marker.createNewFile()
}
} }
task test(type: YarnTask) { task test(type: YarnTask) {
args = ['run', 'test'] args = ['run', 'test']
inputs.files(fileTree(project.projectDir) {
include 'ui-*/src/**'
include 'ui-*/**/*.js'
include 'ui-*/**/*.jsx'
include 'ui-*/**/*.ts'
include 'ui-*/**/*.tsx'
})
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.dir('build/jest-reports')
dependsOn('yarn_install') dependsOn('yarn_install')
} }
task check {
task check(type: YarnTask) {
dependsOn('typecheck', 'test') dependsOn('typecheck', 'test')
} }
task build(type: YarnTask) { yarn_install {
inputs.files(fileTree(project.projectDir) {
include 'ui-*/package.json'
})
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.file(new File(project.rootProject.projectDir, 'package.json'))
inputs.file(new File(project.rootProject.projectDir, 'yarn.lock'))
outputs.dir(new File(project.rootProject.projectDir, 'node_modules'))
}
task build {
dependsOn 'check', 'bundle'
}
task bundle(type: YarnTask) {
args = ['run', 'build'] args = ['run', 'build']
inputs.files(fileTree(project.projectDir) {
include 'ui-*/src/**'
include 'ui-*/**/*.js'
include 'ui-*/**/*.jsx'
include 'ui-*/**/*.ts'
include 'ui-*/**/*.tsx'
include 'ui-*/**/*.css'
include 'ui-*/**/*.sass'
include 'ui-*/**/*.scss'
exclude '**/*.test.ts'
exclude '**/*.test.tsx'
})
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.dir('build/assets')
dependsOn('yarn_install') dependsOn('yarn_install')
} }
configurations {
assets {
canBeConsumed = true
canBeResolved = true
}
}
artifacts {
assets(project.layout.buildDirectory) {
builtBy(build)
}
}
// TODO
task deploy(type: YarnTask) { task deploy(type: YarnTask) {
args = ['run', 'deploy', project.version] args = ['run', 'deploy', project.version]
dependsOn('yarn_install') dependsOn('yarn_install')

View File

@@ -114,7 +114,7 @@ module.exports = [
extensions: [".ts", ".tsx", ".js", ".jsx", ".css", ".scss", ".json"] extensions: [".ts", ".tsx", ".js", ".jsx", ".css", ".scss", ".json"]
}, },
output: { output: {
path: path.join(root, "target", "assets"), path: path.join(root, "build", "assets"),
filename: "[name].bundle.js", filename: "[name].bundle.js",
chunkFilename: "[name].bundle.js" chunkFilename: "[name].bundle.js"
}, },
@@ -190,7 +190,7 @@ module.exports = [
minimizer: [new OptimizeCSSAssetsPlugin({})] minimizer: [new OptimizeCSSAssetsPlugin({})]
}, },
output: { output: {
path: path.join(root, "target", "assets"), path: path.join(root, "build", "assets"),
filename: "ui-styles.bundle.js" filename: "ui-styles.bundle.js"
} }
}, },
@@ -200,7 +200,7 @@ module.exports = [
polyfills: "./ui-polyfill/src/index.js" polyfills: "./ui-polyfill/src/index.js"
}, },
output: { output: {
path: path.resolve(root, "target", "assets"), path: path.resolve(root, "build", "assets"),
filename: "[name].bundle.js" filename: "[name].bundle.js"
} }
} }

View File

@@ -28,12 +28,17 @@ plugins {
id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.1.6' id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.1.6'
} }
configurations {
assets
}
dependencies { dependencies {
implementation platform(project(':')) implementation platform(project(':'))
corePlugin project(path: ':scm-plugins:scm-git-plugin', configuration: 'smp') corePlugin project(path: ':scm-plugins:scm-git-plugin', configuration: 'smp')
corePlugin project(path: ':scm-plugins:scm-hg-plugin', configuration: 'smp') corePlugin project(path: ':scm-plugins:scm-hg-plugin', configuration: 'smp')
corePlugin project(path: ':scm-plugins:scm-svn-plugin', configuration: 'smp') corePlugin project(path: ':scm-plugins:scm-svn-plugin', configuration: 'smp')
assets project(path: ':scm-ui', configuration: 'assets')
implementation project(':scm-core') implementation project(':scm-core')
implementation project(':scm-dao-xml') implementation project(':scm-dao-xml')
@@ -136,6 +141,7 @@ dependencies {
war { war {
from 'build/war' from 'build/war'
from project.configurations.assets
dependsOn 'copy-core-plugins' dependsOn 'copy-core-plugins'
} }
/** /**