#!/usr/bin/env groovy
import java.lang.StringBuilder
import hudson.matrix.MatrixProject
import org.jenkinsci.plugins.envinject.EnvInjectJobProperty
import org.jenkinsci.plugins.envinject.EnvInjectJobPropertyInfo
def jenkinsInstance = jenkins.model.Jenkins.getInstance()
def developmentView = jenkinsInstance.getView("myView")
developmentView.getItems().each { project ->
StringBuilder builder = new StringBuilder()
builder.append("NO_CPPCHECK=true")
builder.append("\n")
builder.append("NO_INSTALL=true")
final def propertiesContent = builder.toString()
def info = new EnvInjectJobPropertyInfo(null, propertiesContent, null, null, null, false)
def property = new EnvInjectJobProperty()
property.setOn(true)
property.setKeepJenkinsSystemVariables(true)
property.setKeepBuildVariables(true)
property.setInfo(info)
project.addProperty(property)
project.save()
}