Skip to content

Commit

Permalink
Fix incremental build of sonar web
Browse files Browse the repository at this point in the history
  • Loading branch information
drautureau-sonarsource authored Mar 14, 2018
1 parent acabda0 commit b7497de
Show file tree
Hide file tree
Showing 39 changed files with 41 additions and 41 deletions.
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# The following should be moved in related sub-directories
server/sonar-web/src/main/webapp/stylesheets/sonar-colorizer.css
server/sonar-web/src/main/webapp/deploy/plugins
server/sonar-web/src/main/webapp/deploy/bootstrap
server/sonar-web/src/main/webapp/deploy/maven/org
server/sonar-web/src/main/webapp/WEB-INF/log/
server/sonar-web/src/main/webapp/deploy/*.jar
server/sonar-web/src/main/webapp/deploy/jdbc-driver.txt

# ---- Gradle
build/
.gradle/
Expand Down
7 changes: 0 additions & 7 deletions server/sonar-web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ yarn-error.log
#webpack
.awcache/

# build
build/
src/main/webapp/js/
src/main/webapp/css/
src/main/webapp/index.html
src/main/webapp/WEB-INF/lib/*.jar

# tests
src/test/json/**/*.png
lcov.info
Expand Down
41 changes: 34 additions & 7 deletions server/sonar-web/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,44 @@ sonarqube {
}

apply plugin: 'com.moowork.node'
apply plugin: 'war'

configurations {
branding
}
dependencies {
branding 'com.sonarsource:sonarsource-branding:1.3.0.307@war'
}

def webappDir = "${buildDir}/webapp"
def brandingDir = "${buildDir}/branding"

task unzipBranding(type: Copy) {
into projectDir
from { zipTree(configurations.branding.singleFile) }
into brandingDir
}
task copyBrandingSrc(type: Copy, dependsOn: unzipBranding) {
into projectDir
from file(brandingDir)
include '**/*.js'
includeEmptyDirs = false
}
task copyBrandingWebapp(type: Copy, dependsOn: unzipBranding) {
into "${projectDir}/public"
from file("${brandingDir}/src/main/webapp")
include '**/*.svg'
includeEmptyDirs = false
}
task copyBrandingFile(type: Copy, dependsOn: unzipBranding) {
into "${projectDir}/public"
from file(brandingDir)
include '**/branding'
includeEmptyDirs = false
}
task copyBranding() {
dependsOn copyBrandingSrc
dependsOn copyBrandingWebapp
dependsOn copyBrandingFile
}

node {
version = '8.5.0'
Expand All @@ -32,13 +55,17 @@ node {
}

yarn_run {
if (release) { dependsOn unzipBranding }
if (release) { dependsOn copyBranding }
inputs.dir('config')
inputs.dir('public')
inputs.dir('scripts')
inputs.dir('src/main/js')
inputs.dir('src')
inputs.file('.babelrc')
inputs.file('build.gradle')
outputs.dir('src/main/webapp')
inputs.file('package.json')
inputs.file('tsconfig.json')
inputs.file('yarn.lock')
outputs.dir(webappDir)

args = ['build']
}

war.dependsOn yarn_run
8 changes: 4 additions & 4 deletions server/sonar-web/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ const nodePaths = (process.env.NODE_PATH || '')

// config after eject: we're in ./config/
module.exports = {
appBuild: resolveApp('src/main/webapp'),
appBuild: resolveApp('build/webapp'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src/main/js'),
jsBuild: resolveApp('src/main/webapp/js'),
cssBuild: resolveApp('src/main/webapp/css'),
htmlBuild: resolveApp('src/main/webapp/index.html'),
jsBuild: resolveApp('build/webapp/js'),
cssBuild: resolveApp('build/webapp/css'),
htmlBuild: resolveApp('build/webapp/index.html'),
appNodeModules: resolveApp('node_modules'),
ownNodeModules: resolveApp('node_modules'),
nodePaths
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
10 changes: 2 additions & 8 deletions server/sonar-web/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ function clean() {
// if you're in it, you don't end up in Trash
console.log(chalk.cyan.bold('Cleaning output directories and files...'));

console.log(paths.jsBuild + '/*');
rimrafSync(paths.jsBuild + '/*');

console.log(paths.cssBuild + '/*');
rimrafSync(paths.cssBuild + '/*');

console.log(paths.htmlBuild);
rimrafSync(paths.htmlBuild);
console.log(paths.appBuild + '/*');
rimrafSync(paths.appBuild + '/*');

console.log();
}
Expand Down
7 changes: 1 addition & 6 deletions sonar-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ configurations {
jsw
scanner
server
webapp
jdbc_mssql {
transitive = false
}
Expand Down Expand Up @@ -40,7 +39,6 @@ dependencies {
jsw 'tanukisoft:wrapper:3.2.3'
scanner project(path: ':sonar-scanner-engine-shaded', configuration: 'shadow')
server project(':server:sonar-server')
webapp project(path: ':server:sonar-web', configuration: 'archives')

jdbc_h2 'com.h2database:h2'
jdbc_mssql 'com.microsoft.sqlserver:mssql-jdbc'
Expand Down Expand Up @@ -103,11 +101,8 @@ task zip(type: Zip) {
into("${archiveDir}/lib/common/") {
from configurations.ce + configurations.server + configurations.compile
}
dependsOn configurations.webapp
into("${archiveDir}/web/") {
from {
configurations.webapp.files.collect { zipTree(it) }
}
from tasks.getByPath(':server:sonar-web:yarn_run').outputs
}
into("${archiveDir}/lib/jdbc/mssql/") {
from configurations.jdbc_mssql
Expand Down

0 comments on commit b7497de

Please sign in to comment.