- job:
    name: android-clang-toolchain
    project-type: freestyle
    defaults: global
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            everyone-flat:
                - job-build
                - job-cancel
        - build-discarder:
            days-to-keep: 60
            num-to-keep: 60
    disabled: true
    node: docker-xenial-aosp
    display-name: 'DELETE ME'
    wrappers:
        - timestamps
        - timeout:
            timeout: 500
    builders:
        - shell:
            !include-raw: android-clang-toolchain/builders.sh
        - linaro-publish-token
        - shell: |
            #!/bin/bash

            # Publish
            test -d ${HOME}/bin || mkdir ${HOME}/bin
            wget -q https://git.linaro.org/ci/publishing-api.git/blob_plain/HEAD:/linaro-cp.py -O ${HOME}/bin/linaro-cp.py
            PUB_DEST=/android/${JOB_NAME}/${BUILD_NUMBER}
            time python3 ${HOME}/bin/linaro-cp.py \
              --api_version 3 \
              --manifest \
              --link-latest \
              --split-job-owner \
              ${HOME}/srv/aosp/${JOB_NAME}/llvm/build/ \
              ${PUB_DEST} \
              --include "^(clang-.*.tar.xz)$"

              cat << EOF > ${WORKSPACE}/android-master-clang_parameters
              CLANG_TOOLCHAIN_URL=http://snapshots.linaro.org/android/android-clang-toolchain/${BUILD_NUMBER}/clang-dev-linux-x86.tar.xz
              EOF
        - trigger-builds:
            - project: 'android-master-clang'
              property-file: android-master-clang_parameters
              block: false
    publishers:
        - email-ext:
            recipients: 'bernhard.rosenkranzer@linaro.org,vishal.bhoj@linaro.org,daniel.diaz@linaro.org'
            content-type: text
            body: |
                Build URL: ${PROJECT_URL}${BUILD_NUMBER}/
                Full log: ${PROJECT_URL}${BUILD_NUMBER}/consoleText
                Parsed warnings/errors: ${PROJECT_URL}${BUILD_NUMBER}/parsed_console

                Errors:
                ${BUILD_LOG_REGEX, regex=".*ERROR:.* ", linesBefore=0, linesAfter=0, showTruncatedLines=false}
        - logparser:
            parse-rules: '/var/jenkins_home/userContent/android.parse'
            unstable-on-warning: false
            fail-on-error: false
        - fingerprint:
            files: 'build/fingerprints/*'
