package buildtest
import static groovy.json.JsonOutput.*
class firstGroovy {
static common_string = '''
if (__common_cmake__)
return()
endif ()
#Generators OSX = "Xcode", Win32 = "Visual Studio 12 2013", Win64 = "Visual Studio 12 2013 Win64"
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
SET ( PREFIX_HEADER "${wdlol_DIR}/compiler_helpers/compiler_helpers.h" )
'''
static getBuildTypes()
{
def file_path = "..."
def matcher = common_string =~ /(?:\s*#\s*(Generators)\s+(.+?"[^"]+"\s*(?:,\s+.+?"[^"]+"\s*)+))|(?:\s*(CMAKE_CONFIGURATION_TYPES)\s+"(.+?(?:;.+?)*)")/
if (!matcher)
{
throw new Exception("Configuration information not found in ${file_path}")
}
def configurations = []
def generators = [:]
for (def index = 0; index < matcher.size(); index++)
{
if (matcher[index][1] == "Generators")
{
if (generators)
{
throw new Exception("Multiple generator definitions found in ${file_path}")
}
def generator_list = matcher[index][2].split(",")
generator_list.each{
def generator = it.split("=")
generators[generator[0].trim()] = generator[1].trim()
}
}
}
println prettyPrint(toJson(generators))
println "Generators ${generators.size()}"
println ("each { entry ->")
generators.each{entry -> println "$entry.key : $entry.value" }
println "each { entry, key ->"
generators.each{key, value -> println "$key : $value" }
}
static void main(def args)
{
println GroovySystem.version
getBuildTypes()
}
}
{
"OSX": "\"Xcode\"",
"Win32": "\"Visual Studio 12 2013\"",
"Win64": "\"Visual Studio 12 2013 Win64\""
}
Generators 3
each { entry ->
OSX : "Xcode"
Win32 : "Visual Studio 12 2013"
Win64 : "Visual Studio 12 2013 Win64"
each { entry, key ->
OSX : "Xcode"
Win32 : "Visual Studio 12 2013"
Win64 : "Visual Studio 12 2013 Win64"
{
"OSX": "\"Xcode\"",
"Win32": "\"Visual Studio 12 2013\"",
"Win64": "\"Visual Studio 12 2013 Win64\""
}
Generators 3
each { entry ->
OSX : "Xcode"
each { entry, key ->
OSX="Xcode" : null
As you can see, json extracts the correct keys and values out of the map, but neither version of "each" produces what I'd expext.
Any comments? Do I need to be filing a bug?
What is JIRA ID for the work to enable using "each" and other standard groovy iterators?
I would also suggest that this is not a user guide issue but a matter of proper feature specification. There need to be a clear statement of what parts of groovy we do and do not support.
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5a58ba28-09be-4fb1-b9ec-404101b2fb38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Le 15 juil. 2016 11:04 PM, "Liam Newman" <bitwi...@gmail.com> a écrit :
>
> What is JIRA ID for the work to enable using "each" and other standard groovy iterators?