Skip to content

Commit

Permalink
[JENKINS-50692] [INFRA-1571] #3394: JEP-305 Incrementals in core
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed May 3, 2018
1 parent 3465da4 commit 3fb17fb
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
target
.flattened-pom.xml
work

# IntelliJ project files
Expand Down
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
@@ -0,0 +1,7 @@
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>io.jenkins.tools</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.0-alpha-3</version>
</extension>
</extensions>
1 change: 1 addition & 0 deletions .mvn/maven.config
@@ -0,0 +1 @@
-Pmight-produce-incrementals
31 changes: 13 additions & 18 deletions Jenkinsfile
Expand Up @@ -30,6 +30,9 @@ for(i = 0; i < buildTypes.size(); i++) {
checkout scm
}

def changelistF = "${pwd tmp: true}/changelist"
def m2repo = "${pwd tmp: true}/m2repo"

// Now run the actual build.
stage("${buildType} Build / Test") {
timeout(time: 180, unit: 'MINUTES') {
Expand All @@ -39,7 +42,7 @@ for(i = 0; i < buildTypes.size(); i++) {
"MAVEN_OPTS=-Xmx1536m -Xms512m"]) {
// Actually run Maven!
// -Dmaven.repo.local=… tells Maven to create a subdir in the temporary directory for the local Maven repository
def mvnCmd = "mvn -Pdebug -U javadoc:javadoc clean install ${runTests ? '-Dmaven.test.failure.ignore' : '-DskipTests'} -V -B -Dmaven.repo.local=${pwd tmp: true}/m2repo -s settings-azure.xml -e"
def mvnCmd = "mvn -Pdebug -U -Dset.changelist help:evaluate -Dexpression=changelist -Doutput=$changelistF clean install ${runTests ? '-Dmaven.test.failure.ignore' : '-DskipTests'} -V -B -Dmaven.repo.local=$m2repo -s settings-azure.xml -e"
if(isUnix()) {
sh mvnCmd
sh 'test `git status --short | tee /dev/stderr | wc --bytes` -eq 0'
Expand All @@ -52,14 +55,17 @@ for(i = 0; i < buildTypes.size(); i++) {

// Once we've built, archive the artifacts and the test results.
stage("${buildType} Publishing") {
def files = findFiles(glob: '**/target/*.jar, **/target/*.war, **/target/*.hpi')
renameFiles(files, buildType.toLowerCase())

archiveArtifacts artifacts: '**/target/*.jar, **/target/*.war, **/target/*.hpi',
fingerprint: true
if (runTests) {
junit healthScaleFactor: 20.0, testResults: '*/target/surefire-reports/*.xml'
}
if (buildType == 'Linux') {
def changelist = readFile(changelistF)
dir(m2repo) {
archiveArtifacts artifacts: "**/*$changelist/*$changelist*",
excludes: '**/*.lastUpdated,**/jenkins-test/',
fingerprint: true
}
}
}
}
}
Expand Down Expand Up @@ -91,6 +97,7 @@ builds.ath = {

builds.failFast = failFast
parallel builds
infra.maybePublishIncrementals()

// This method sets up the Maven and JDK tools, puts them in the environment along
// with whatever other arbitrary environment variables we passed in, and runs the
Expand All @@ -115,15 +122,3 @@ void withMavenEnv(List envVars = [], def body) {
body.call()
}
}

void renameFiles(def files, String prefix) {
for(i = 0; i < files.length; i++) {
def newPath = files[i].path.replace(files[i].name, "${prefix}-${files[i].name}")
def rename = "${files[i].path} ${newPath}"
if(isUnix()) {
sh "mv ${rename}"
} else {
bat "move ${rename}"
}
}
}
2 changes: 1 addition & 1 deletion cli/pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-parent</artifactId>
<version>2.120-SNAPSHOT</version>
<version>${revision}${changelist}</version>
</parent>

<artifactId>cli</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Expand Up @@ -29,7 +29,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-parent</artifactId>
<version>2.120-SNAPSHOT</version>
<version>${revision}${changelist}</version>
</parent>

<artifactId>jenkins-core</artifactId>
Expand Down
15 changes: 7 additions & 8 deletions pom.xml
Expand Up @@ -28,13 +28,13 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci</groupId>
<artifactId>jenkins</artifactId>
<version>1.41</version>
<version>1.43</version>
<relativePath />
</parent>

<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-parent</artifactId>
<version>2.120-SNAPSHOT</version>
<version>${revision}${changelist}</version>
<packaging>pom</packaging>

<name>Jenkins main module</name>
Expand All @@ -59,7 +59,7 @@ THE SOFTWARE.
<connection>scm:git:git://github.com/jenkinsci/jenkins.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/jenkins.git</developerConnection>
<url>https://github.com/jenkinsci/jenkins</url>
<tag>HEAD</tag>
<tag>${scmTag}</tag>
</scm>

<distributionManagement>
Expand All @@ -75,6 +75,9 @@ THE SOFTWARE.
</issueManagement>

<properties>
<revision>2.120</revision>
<changelist>-SNAPSHOT</changelist>

<!-- *.html files are in UTF-8, and *.properties are in iso-8859-1, so this configuration is actually incorrect,
but this suppresses a warning from Maven, and as long as we don't do filtering we should be OK. -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -505,10 +508,6 @@ THE SOFTWARE.
<artifactId>maven-makepkgs-plugin</artifactId>
<version>0.6.2</version>
</plugin>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
Expand Down Expand Up @@ -566,7 +565,7 @@ THE SOFTWARE.
<artifactId>maven-release-plugin</artifactId>
<configuration>
<!-- enable release profile during the release, create IPS package, and sign bits. -->
<prepareVerifyArgs>-P release,sign</prepareVerifyArgs>
<arguments>-P release,sign</arguments>
<!-- work around for a bug in javadoc plugin that causes the release to fail. see MRELEASE-271 -->
<preparationGoals>clean install</preparationGoals>
<goals>-DskipTests -Danimal.sniffer.skip=false javadoc:javadoc deploy javadoc:aggregate</goals>
Expand Down
2 changes: 1 addition & 1 deletion test/pom.xml
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-parent</artifactId>
<version>2.120-SNAPSHOT</version>
<version>${revision}${changelist}</version>
</parent>

<artifactId>jenkins-test</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion war/pom.xml
Expand Up @@ -28,7 +28,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-parent</artifactId>
<version>2.120-SNAPSHOT</version>
<version>${revision}${changelist}</version>
</parent>

<artifactId>jenkins-war</artifactId>
Expand Down

0 comments on commit 3fb17fb

Please sign in to comment.