Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
The enclosed config.xml file will instruct Jenkins to check out and build llvm + clang, archiving the resulting clang binary.
The configuration will build daily and will retain builds for 5 days.
To add it to your Jenkins install, just copy the config.xml file to e.g.:
jobs/Clang/config.xml
Then "reload configuration" in Jenkins, or stop and start Jenkins to reload it implicitly.
Depending on your use case, you may want to alter the configuration so it builds a debug version of clang. For more information about building clang and the options for controlling optimization, see here:
http://clang.llvm.org/get_started.html#build
The archived clang will have its execute bit set (this is required due to a bug in Jenkins, which will hopefully be fixed at somepoint. See: https://issues.jenkins-ci.org/browse/JENKINS-9741). Also, a file will be created
${JENKINS_HOME}/StableClangPath.txt
which can be injected into the build environment of another job. It sets the property STABLE_CLANG_PATH to the full path of the just archived clang executable, which in turn can be used to run scan-build with the latest clang as part of a job.
Enjoy!
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<logRotator class="hudson.tasks.LogRotator">
<daysToKeep>5</daysToKeep>
<numToKeep>-1</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</logRotator>
<keepDependencies>false</keepDependencies>
<properties/>
<scm class="hudson.scm.SubversionSCM" plugin="subversion@1.45">
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>http://llvm.org/svn/llvm-project/llvm/trunk</remote>
<local>llvm</local>
<depthOption>infinity</depthOption>
<ignoreExternalsOption>false</ignoreExternalsOption>
</hudson.scm.SubversionSCM_-ModuleLocation>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>http://llvm.org/svn/llvm-project/cfe/trunk</remote>
<local>llvm/tools/clang</local>
<depthOption>infinity</depthOption>
<ignoreExternalsOption>false</ignoreExternalsOption>
</hudson.scm.SubversionSCM_-ModuleLocation>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>http://llvm.org/svn/llvm-project/clang-tools-extra/trunk</remote>
<local>llvm/tools/clang/tools/extra</local>
<depthOption>infinity</depthOption>
<ignoreExternalsOption>false</ignoreExternalsOption>
</hudson.scm.SubversionSCM_-ModuleLocation>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>http://llvm.org/svn/llvm-project/compiler-rt/trunk</remote>
<local>llvm/projects/compiler-rt</local>
<depthOption>infinity</depthOption>
<ignoreExternalsOption>false</ignoreExternalsOption>
</hudson.scm.SubversionSCM_-ModuleLocation>
</locations>
<excludedRegions></excludedRegions>
<includedRegions></includedRegions>
<excludedUsers></excludedUsers>
<excludedRevprop></excludedRevprop>
<excludedCommitMessages></excludedCommitMessages>
<workspaceUpdater class="hudson.scm.subversion.UpdateUpdater"/>
<ignoreDirPropChanges>false</ignoreDirPropChanges>
<filterChangelog>false</filterChangelog>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers class="vector">
<hudson.triggers.TimerTrigger>
<spec>@daily</spec>
</hudson.triggers.TimerTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command># Don&apos;t do the whole configuration dance unless we are building for the first time
if [ ! -d ./build ]; then
mkdir -p build
cd build
../llvm/configure --enable-optimized
else
cd build
fi
make -j4</command>
</hudson.tasks.Shell>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
<artifacts>build/Release+Asserts/bin/clang</artifacts>
<latestOnly>false</latestOnly>
</hudson.tasks.ArtifactArchiver>
<hudson.plugins.postbuildtask.PostbuildTask plugin="postbuild-task@1.8">
<tasks>
<hudson.plugins.postbuildtask.TaskProperties>
<logTexts>
<hudson.plugins.postbuildtask.LogProperties>
<logText></logText>
<operator>AND</operator>
</hudson.plugins.postbuildtask.LogProperties>
</logTexts>
<EscalateStatus>false</EscalateStatus>
<RunIfJobSuccessful>true</RunIfJobSuccessful>
<script>chmod +x ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/archive/build/Release+Asserts/bin/clang&#xd;
echo &quot;STABLE_CLANG_PATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/archive/build/Release+Asserts/bin/clang&quot; &gt; ${JENKINS_HOME}/StableClangPath.txt</script>
</hudson.plugins.postbuildtask.TaskProperties>
</tasks>
</hudson.plugins.postbuildtask.PostbuildTask>
</publishers>
<buildWrappers/>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment