|
1 | 1 | env.project = "tcl-regex-java"
|
2 | 2 |
|
3 |
| -properties([ |
4 |
| - parameters([ |
| 3 | +def properties = [ |
| 4 | + buildParams: [ |
5 | 5 | booleanParam(
|
6 | 6 | name: 'release',
|
7 | 7 | defaultValue: false,
|
8 | 8 | description: 'Release the project'
|
9 |
| - ), |
| 9 | + ), |
10 | 10 | string(
|
11 | 11 | name: 'version',
|
12 | 12 | defaultValue: '',
|
13 | 13 | description: 'Version to release, or empty to use the default next version'
|
14 |
| - ) |
15 |
| - ]) |
16 |
| -]) |
| 14 | + ), |
| 15 | + string( |
| 16 | + name: 'buildJdk', |
| 17 | + defaultValue: 'openjdk-21', |
| 18 | + description: 'The JDK to use for building', |
| 19 | + ), |
| 20 | + string( |
| 21 | + name: 'testJdks', |
| 22 | + defaultValue: 'openjdk-11 openjdk-17', |
| 23 | + description: 'The JDKs to use for tests, separated by spaces', |
| 24 | + ), |
| 25 | + ], |
| 26 | +] |
17 | 27 |
|
18 | 28 | standardProperties(properties)
|
19 | 29 |
|
20 |
| -def options = [ |
21 |
| - mavenOptionsExtra: [jdk: 'openjdk-17'], |
| 30 | +def afterBuildClosures = [] |
| 31 | + |
| 32 | +def buildOptions = [ |
| 33 | + mavenOptionsExtra: [jdk: params.buildJdk], |
| 34 | + afterBuild: { afterBuildClosures.each { it() } }, |
22 | 35 | ]
|
23 | 36 |
|
24 |
| -options.afterBuild = { |
25 |
| - withMaven([jdk: params.testJdk]) { |
26 |
| - withSonarQubeEnv() { |
27 |
| - sh "mvn -D sonar.login=${env.SONAR_AUTH_TOKEN} sonar:sonar -D sonar.host.url=${env.SONAR_HOST_URL}" |
| 37 | + |
| 38 | +afterBuildClosures += { |
| 39 | + stage('sonar-report') { |
| 40 | + withMaven() { |
| 41 | + withSonarQubeEnv() { |
| 42 | + sh "mvn -D sonar.login=${env.SONAR_AUTH_TOKEN} sonar:sonar -D sonar.host.url=${env.SONAR_HOST_URL}" |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +if (params.testJdks) { |
| 49 | + afterBuildClosures += { |
| 50 | + params.testJdks.split(' ').each { testJdk -> |
| 51 | + stage("Tests in ${testJdk}") { |
| 52 | + withMaven([ |
| 53 | + jdk: testJdk, |
| 54 | + ]) { |
| 55 | + sh 'mvn -B -e -D enforcer.skip -D maven.javadoc.skip verify' |
| 56 | + } |
| 57 | + } |
28 | 58 | }
|
29 | 59 | }
|
30 | 60 | }
|
31 | 61 |
|
32 |
| -options.buildArgs = ' ' |
| 62 | +buildOptions.buildArgs = ' ' |
33 | 63 |
|
34 |
| -standardBuildSteps(options) |
| 64 | +standardBuildSteps(buildOptions) |
0 commit comments