Skip to content

Commit

Permalink
Fix: Copy the API Viewer resources into the built plugin
Browse files Browse the repository at this point in the history
As mentioned in JENKINS-66988, we currently are not producing the API
Viewer in the built plugin.

This is due to [0], in which the JPI plugin ignores any processing of
the WAR that we do separately.

As an intermediate solution, we can make sure that we copy the files
into the `src/main/webapp` directory, so it is present for the plugin.

This requires that we then exclude the files from Git, as we want them
to only be generated, but we need to make sure that `config.json` is
still included.

Finally, we make sure that the `jpi` task depends on the copying of
files, for standalone building of the plugin, and the `copyApiViewer`
depends on the build process for the `api-viewer` project.

[0]: jenkinsci/gradle-jpi-plugin#193
  • Loading branch information
jamietanna committed Oct 27, 2021
1 parent 48bad8f commit 6b3e9f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ generated
.bundle

node_modules

!job-dsl-plugin/src/main/webapp/api-viewer/config.json
job-dsl-plugin/src/main/webapp/api-viewer
21 changes: 13 additions & 8 deletions job-dsl-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ buildscript {

plugins {
id 'org.jenkins-ci.jpi' version '0.43.0'
id 'war'
}

java {
Expand Down Expand Up @@ -91,16 +90,22 @@ test {
systemProperty 'jenkins.test.noSpaceInTmpDirs', 'true'
}

war {
into('api-viewer') {
from(project(':job-dsl-api-viewer').projectDir) {
include 'index.html'
include 'build/dist/**'
}
task copyApiViewer {
copy {
from(project(':job-dsl-api-viewer').projectDir)
include 'index.html'
into 'src/main/webapp/api-viewer'
}
copy {
from(project(':job-dsl-api-viewer').buildDir)
include 'dist/**'
into 'src/main/webapp/api-viewer/build'
}
dependsOn tasks.getByPath(':job-dsl-api-viewer:build')
}

copyApiViewer.dependsOn ':job-dsl-api-viewer:build'
jpi.dependsOn 'copyApiViewer'

dependencies {
annotationProcessor 'net.java.sezpoz:sezpoz:1.13'
annotationProcessor 'org.jenkins-ci:annotation-indexer:1.12'
Expand Down

0 comments on commit 6b3e9f1

Please sign in to comment.