Admin/mira.py
author krauss
Sun Aug 05 23:32:04 2012 +0200 (2012-08-05)
changeset 48688 fe611991427a
parent 48687 968ecd2bca88
child 48689 ebbd70082e65
permissions -rw-r--r--
corrected session name
haftmann@41542
     1
"""
haftmann@41542
     2
    Test configuration descriptions for mira.
haftmann@41542
     3
"""
haftmann@41542
     4
haftmann@41542
     5
import os
haftmann@41542
     6
from os import path
haftmann@41542
     7
from glob import glob
haftmann@41542
     8
import subprocess
krauss@42392
     9
from datetime import datetime
haftmann@41542
    10
import re
haftmann@41542
    11
haftmann@41542
    12
import util
krauss@42392
    13
from util import Lazy
haftmann@41542
    14
krauss@42392
    15
from mira.report import Report, Report_Content
krauss@42392
    16
from mira.case import Case
krauss@42392
    17
from mira.tools import tool
krauss@42823
    18
from mira import schedule, misc
krauss@42192
    19
from mira.environment import scheduler
haftmann@46931
    20
from mira import repositories
krauss@42192
    21
haftmann@41542
    22
# build and evaluation tools
haftmann@41542
    23
krauss@42821
    24
default_usedir_options = "$ISABELLE_USEDIR_OPTIONS -d pdf -g true -i true -t true"
haftmann@41542
    25
krauss@42821
    26
def prepare_isabelle_repository(loc_isabelle, loc_contrib, loc_dependency_heaps,
krauss@42821
    27
  usedir_options=default_usedir_options, more_settings=''):
krauss@42821
    28
krauss@42821
    29
    # prepare components
haftmann@41542
    30
    loc_contrib = path.expanduser(loc_contrib)
haftmann@41542
    31
    if not path.exists(loc_contrib):
haftmann@41542
    32
        raise IOError('Bad file: %s' % loc_contrib)
haftmann@41542
    33
    subprocess.check_call(['ln', '-s', loc_contrib, '%s/contrib' % loc_isabelle])
haftmann@41542
    34
krauss@42821
    35
    # provide existing dependencies
haftmann@41542
    36
    if loc_dependency_heaps:
haftmann@41542
    37
        isabelle_path = loc_dependency_heaps + '/$ISABELLE_IDENTIFIER:$ISABELLE_OUTPUT'
haftmann@41542
    38
    else:
haftmann@41542
    39
        isabelle_path = '$ISABELLE_OUTPUT'
haftmann@41542
    40
krauss@42821
    41
    # patch settings
haftmann@41542
    42
    extra_settings = '''
haftmann@41542
    43
ISABELLE_HOME_USER="$ISABELLE_HOME/home_user"
haftmann@41542
    44
ISABELLE_OUTPUT="$ISABELLE_HOME/heaps"
haftmann@41542
    45
ISABELLE_BROWSER_INFO="$ISABELLE_HOME/browser_info"
haftmann@41542
    46
ISABELLE_PATH="%s"
haftmann@41542
    47
krauss@42821
    48
ISABELLE_USEDIR_OPTIONS="%s"
haftmann@47190
    49
krauss@42109
    50
Z3_NON_COMMERCIAL="yes"
haftmann@47190
    51
haftmann@48182
    52
source "${ISABELLE_HOME}/Admin/init_components"
haftmann@48182
    53
krauss@42113
    54
%s
krauss@42821
    55
''' % (isabelle_path, usedir_options, more_settings)
haftmann@41542
    56
haftmann@41542
    57
    writer = open(path.join(loc_isabelle, 'etc', 'settings'), 'a')
haftmann@41542
    58
    writer.write(extra_settings)
haftmann@41542
    59
    writer.close()
haftmann@41542
    60
haftmann@41542
    61
krauss@45164
    62
def isabelle_getenv(isabelle_home, var):
krauss@45164
    63
krauss@45164
    64
    _, out = env.run_process('%s/bin/isabelle' % isabelle_home, 'getenv', var)
krauss@45164
    65
    return out.split('=', 1)[1].strip()
krauss@45164
    66
krauss@45164
    67
haftmann@41542
    68
def extract_isabelle_run_timing(logdata):
haftmann@41542
    69
haftmann@41542
    70
    def to_secs(h, m, s):
haftmann@41542
    71
        return (int(h) * 60 + int(m)) * 60 + int(s)
haftmann@41542
    72
    pat = r'Finished (\S+) \((\d+):(\d+):(\d+) elapsed time, (\d+):(\d+):(\d+) cpu time'
krauss@42186
    73
    pat2 = r'Timing (\S+) \((\d+) threads, (\d+\.\d+)s elapsed time, (\d+\.\d+)s cpu time, (\d+\.\d+)s GC time, factor (\d+\.\d+)\)'
haftmann@41542
    74
    t = dict((name, {'elapsed': to_secs(eh,em,es), 'cpu': to_secs(ch,cm,cs)})
haftmann@41542
    75
             for name, eh, em, es, ch, cm, cs in re.findall(pat, logdata))
krauss@42186
    76
    for name, threads, elapsed, cpu, gc, factor in re.findall(pat2, logdata):
haftmann@41542
    77
haftmann@41542
    78
        if name not in t:
haftmann@41542
    79
            t[name] = {}
haftmann@41542
    80
haftmann@41542
    81
        t[name]['threads'] = int(threads)
haftmann@41542
    82
        t[name]['elapsed_inner'] = elapsed
haftmann@41542
    83
        t[name]['cpu_inner'] = cpu
haftmann@41542
    84
        t[name]['gc'] = gc
krauss@42186
    85
        t[name]['factor'] = factor
haftmann@41542
    86
haftmann@41542
    87
    return t
haftmann@41542
    88
haftmann@41542
    89
haftmann@41542
    90
def extract_isabelle_run_summary(logdata):
haftmann@41542
    91
krauss@41894
    92
    re_error = re.compile(r'^(?:make: )?\*\*\* (.*)$', re.MULTILINE)
haftmann@41542
    93
    summary = '\n'.join(re_error.findall(logdata))
haftmann@41542
    94
    if summary == '':
haftmann@41542
    95
        summary = 'ok'
haftmann@41542
    96
haftmann@41542
    97
    return summary
haftmann@41542
    98
haftmann@41542
    99
krauss@45164
   100
def extract_image_size(isabelle_home):
krauss@45164
   101
    
krauss@45164
   102
    isabelle_output = isabelle_getenv(isabelle_home, 'ISABELLE_OUTPUT')
krauss@45164
   103
    return dict((p, path.getsize(path.join(isabelle_output, p))) for p in os.listdir(isabelle_output) if p != "log")
krauss@45164
   104
krauss@45164
   105
def extract_report_data(isabelle_home, logdata):
krauss@45164
   106
krauss@45164
   107
    return {
krauss@45164
   108
        'timing': extract_isabelle_run_timing(logdata),
krauss@45164
   109
        'image_size': extract_image_size(isabelle_home) }
krauss@45164
   110
krauss@45164
   111
krauss@42392
   112
@tool
krauss@42392
   113
def import_isatest_log(env, conf, logfile):
krauss@42392
   114
krauss@42392
   115
    """Imports isatest log file as a report."""
krauss@42392
   116
krauss@42392
   117
    def the_match(pat, text, name):
krauss@42392
   118
        match = re.search(pat, text)
krauss@42392
   119
        if not match: raise Exception('No match found for ' + name)
krauss@42392
   120
        return match.groups()
krauss@42392
   121
krauss@42392
   122
    def parse_date(d):
krauss@42392
   123
        return datetime.strptime(d, '%a %b %d %H:%M:%S %Z %Y')
krauss@42392
   124
krauss@42392
   125
    log = util.readfile(logfile)
krauss@42392
   126
krauss@42392
   127
    (begin_date, host) = the_match(r'-+ starting test -+ ([^-]*) -+ (\S*)', log, 'start tag')
krauss@42392
   128
    (isabelle_version,) = the_match(r'Isabelle version: ([a-f0-9]{12})', log, 'Isabelle version')
krauss@42392
   129
    (success, end_date) = the_match(r'-+ test (successful|FAILED) -+ ([^-]*) -', log, 'end tag')
krauss@42392
   130
    summary = extract_isabelle_run_summary(log)
krauss@42392
   131
    data = {'timing': extract_isabelle_run_timing(log)}
krauss@42392
   132
    atts = {'log': Lazy.simple(log)}
krauss@42392
   133
krauss@42392
   134
    content = Report_Content(summary, host, parse_date(begin_date),
krauss@42392
   135
      parse_date(end_date), Lazy.simple(data), atts)
krauss@42392
   136
    revision = ('Isabelle', env.repositories.get('Isabelle')[isabelle_version].hex())
krauss@42392
   137
    case = Case(conf, [revision])
krauss@42392
   138
krauss@42392
   139
    env.report_db.put(case, (success == 'successful'), content)
krauss@42392
   140
krauss@42392
   141
krauss@48686
   142
def isabelle_build(env, case, paths, dep_paths, playground, *cmdargs, **kwargs):
haftmann@41542
   143
krauss@48686
   144
    more_settings=kwargs.get('more_settings', '')
haftmann@41542
   145
krauss@42114
   146
    isabelle_home = paths[0]
haftmann@41542
   147
krauss@48686
   148
    # copy over build results from dependencies
krauss@48686
   149
    heap_dir = path.join(isabelle_home, 'heaps')
krauss@48686
   150
    classes_dir = path.join(heap_dir, 'classes')
krauss@48686
   151
    os.makedirs(classes_dir)
krauss@42115
   152
krauss@48686
   153
    for dep_path in dep_paths:
krauss@48686
   154
        subprocess.check_call(['cp', '-a'] + glob(dep_path + '/*') + [heap_dir])
krauss@45164
   155
krauss@48686
   156
    subprocess.check_call(['ln', '-s', classes_dir, path.join(isabelle_home, 'lib', 'classes')])
krauss@48686
   157
    jars = glob(path.join(classes_dir, 'ext', '*.jar'))
krauss@48686
   158
    if jars:
krauss@48686
   159
        subprocess.check_call(['touch'] + jars)
krauss@42115
   160
krauss@48686
   161
    # misc preparations
krauss@48686
   162
    if 'lxbroy10' in misc.hostnames():  # special settings for lxbroy10
krauss@42823
   163
        more_settings += '''
krauss@42823
   164
ML_PLATFORM="x86_64-linux"
krauss@45157
   165
ML_HOME="/home/polyml/polyml-5.4.1/x86_64-linux"
krauss@42823
   166
ML_SYSTEM="polyml-5.4.1"
wenzelm@46200
   167
ML_OPTIONS="-H 4000 --gcthreads 4"
bulwahn@43334
   168
bulwahn@43334
   169
ISABELLE_GHC="/usr/bin/ghc"
krauss@42823
   170
'''
krauss@42823
   171
krauss@48686
   172
    prepare_isabelle_repository(isabelle_home, env.settings.contrib, None,
krauss@48686
   173
      usedir_options="", more_settings=more_settings)
krauss@42114
   174
    os.chdir(isabelle_home)
haftmann@41542
   175
krauss@48686
   176
    # invoke build tool
krauss@48686
   177
    (return_code, log) = env.run_process('%s/bin/isabelle' % isabelle_home, 'build', '-s', '-v', *cmdargs)
haftmann@41542
   178
krauss@48686
   179
    # collect report
krauss@48686
   180
    return (return_code == 0, extract_isabelle_run_summary(log),
krauss@48686
   181
      extract_report_data(isabelle_home, log), {'log': log}, heap_dir)
haftmann@41542
   182
haftmann@41542
   183
krauss@43689
   184
krauss@43689
   185
# Isabelle configurations
krauss@43689
   186
krauss@43689
   187
@configuration(repos = [Isabelle], deps = [])
krauss@43689
   188
def Pure(*args):
krauss@48686
   189
    """Pure Image"""
krauss@48686
   190
    return isabelle_build(*(args + ("-b", "Pure")))
krauss@43689
   191
haftmann@41542
   192
@configuration(repos = [Isabelle], deps = [(Pure, [0])])
haftmann@41542
   193
def HOL(*args):
krauss@48686
   194
    """HOL Image"""
krauss@48686
   195
    return isabelle_build(*(args + ("-b", "HOL")))
haftmann@41542
   196
haftmann@46934
   197
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@46934
   198
def HOL_Library(*args):
krauss@48686
   199
    """HOL Library"""
krauss@48686
   200
    return isabelle_build(*(args + ("-b", "HOL-Library")))
krauss@48686
   201
krauss@48686
   202
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
krauss@48688
   203
def HOLCF(*args):
krauss@48686
   204
    """HOLCF"""
krauss@48688
   205
    return isabelle_build(*(args + ("-b", "HOLCF")))
haftmann@46934
   206
haftmann@46934
   207
@configuration(repos = [Isabelle], deps = [(Pure, [0])])
haftmann@46934
   208
def ZF(*args):
krauss@48686
   209
    """HOLCF"""
krauss@48686
   210
    return isabelle_build(*(args + ("-b", "ZF")))
haftmann@46934
   211
haftmann@46934
   212
bulwahn@47895
   213
settings64='''
bulwahn@47895
   214
ML_PLATFORM=x86_64-linux
bulwahn@47895
   215
ML_HOME="/home/polyml/polyml-5.4.1/x86_64-linux"
bulwahn@47895
   216
ML_SYSTEM="polyml-5.4.1"
bulwahn@47895
   217
'''
bulwahn@47895
   218
bulwahn@47897
   219
@configuration(repos = [Isabelle], deps = [])
haftmann@41542
   220
def AFP_images(*args):
krauss@43689
   221
    """Isabelle images needed for the AFP (64 bit)"""
krauss@48688
   222
    return isabelle_build(*(args + ("-b", "-j", "2", "Pure", "HOL", "HOLCF", "HOL-Word")), more_settings=settings64)
haftmann@41542
   223
krauss@42822
   224
@configuration(repos = [Isabelle], deps = [])
haftmann@41542
   225
def Isabelle_makeall(*args):
krauss@48686
   226
    """Build all sessions"""
krauss@48686
   227
    return isabelle_build(*(args + ("-j", "6", "-o", "threads=4", "-a")), more_settings=settings64)
haftmann@46934
   228
haftmann@46931
   229
haftmann@41542
   230
# Mutabelle configurations
haftmann@41542
   231
haftmann@41542
   232
def invoke_mutabelle(theory, env, case, paths, dep_paths, playground):
haftmann@41542
   233
haftmann@41542
   234
    """Mutant testing for counterexample generators in Isabelle"""
haftmann@41542
   235
haftmann@41542
   236
    (loc_isabelle,) = paths
haftmann@41542
   237
    (dep_isabelle,) = dep_paths
bulwahn@43152
   238
    more_settings = '''
bulwahn@43153
   239
ISABELLE_GHC="/usr/bin/ghc"
bulwahn@43152
   240
'''
bulwahn@43152
   241
    prepare_isabelle_repository(loc_isabelle, env.settings.contrib, dep_isabelle,
bulwahn@43152
   242
      more_settings = more_settings)
haftmann@41542
   243
    os.chdir(loc_isabelle)
haftmann@41542
   244
    
haftmann@41542
   245
    (return_code, log) = env.run_process('bin/isabelle',
haftmann@41542
   246
      'mutabelle', '-O', playground, theory)
haftmann@41542
   247
    
haftmann@41542
   248
    try:
haftmann@41542
   249
        mutabelle_log = util.readfile(path.join(playground, 'log'))
haftmann@41542
   250
    except IOError:
haftmann@41542
   251
        mutabelle_log = ''
haftmann@41542
   252
krauss@42472
   253
    mutabelle_data = dict(
krauss@42472
   254
        (tool, {'counterexample': c, 'no_counterexample': n, 'timeout': t, 'error': e})
krauss@42472
   255
        for tool, c, n, t, e in re.findall(r'(\S+)\s+: C: (\d+) N: (\d+) T: (\d+) E: (\d+)', log))
krauss@42472
   256
haftmann@41542
   257
    return (return_code == 0 and mutabelle_log != '', extract_isabelle_run_summary(log),
krauss@42472
   258
      {'mutabelle_results': {theory: mutabelle_data}},
haftmann@41652
   259
      {'log': log, 'mutabelle_log': mutabelle_log}, None)
haftmann@41542
   260
krauss@42948
   261
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   262
def Mutabelle_Relation(*args):
haftmann@41542
   263
    """Mutabelle regression suite on Relation theory"""
haftmann@41542
   264
    return invoke_mutabelle('Relation', *args)
haftmann@41542
   265
krauss@42948
   266
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   267
def Mutabelle_List(*args):
haftmann@41542
   268
    """Mutabelle regression suite on List theory"""
haftmann@41542
   269
    return invoke_mutabelle('List', *args)
haftmann@41542
   270
krauss@42948
   271
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   272
def Mutabelle_Set(*args):
haftmann@41542
   273
    """Mutabelle regression suite on Set theory"""
haftmann@41542
   274
    return invoke_mutabelle('Set', *args)
haftmann@41542
   275
krauss@42948
   276
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   277
def Mutabelle_Map(*args):
haftmann@41542
   278
    """Mutabelle regression suite on Map theory"""
haftmann@41542
   279
    return invoke_mutabelle('Map', *args)
haftmann@41542
   280
krauss@42948
   281
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   282
def Mutabelle_Divides(*args):
haftmann@41542
   283
    """Mutabelle regression suite on Divides theory"""
haftmann@41542
   284
    return invoke_mutabelle('Divides', *args)
haftmann@41542
   285
krauss@42948
   286
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   287
def Mutabelle_MacLaurin(*args):
haftmann@41542
   288
    """Mutabelle regression suite on MacLaurin theory"""
haftmann@41542
   289
    return invoke_mutabelle('MacLaurin', *args)
haftmann@41542
   290
krauss@42948
   291
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
haftmann@41542
   292
def Mutabelle_Fun(*args):
haftmann@41542
   293
    """Mutabelle regression suite on Fun theory"""
haftmann@41542
   294
    return invoke_mutabelle('Fun', *args)
krauss@42040
   295
krauss@42393
   296
mutabelle_confs = 'Mutabelle_Relation Mutabelle_List Mutabelle_Set Mutabelle_Map Mutabelle_Divides Mutabelle_MacLaurin Mutabelle_Fun'.split(' ')
krauss@42393
   297
krauss@42393
   298
@scheduler()
krauss@42393
   299
def mutabelle_scheduler(env):
krauss@42393
   300
    """Scheduler for Mutabelle."""
krauss@42393
   301
    return schedule.age_scheduler(env, 'Isabelle', mutabelle_confs)
krauss@42040
   302
bulwahn@47896
   303
krauss@42040
   304
# Judgement Day configurations
krauss@42040
   305
krauss@42095
   306
judgement_day_provers = ('e', 'spass', 'vampire', 'z3', 'cvc3', 'yices')
krauss@42040
   307
krauss@42040
   308
def judgement_day(base_path, theory, opts, env, case, paths, dep_paths, playground):
krauss@42040
   309
    """Judgement Day regression suite"""
krauss@42040
   310
krauss@42040
   311
    isa = paths[0]
krauss@42040
   312
    dep_path = dep_paths[0]
krauss@42040
   313
krauss@42040
   314
    os.chdir(path.join(playground, '..', base_path)) # Mirabelle requires specific cwd
krauss@42040
   315
    prepare_isabelle_repository(isa, env.settings.contrib, dep_path)
krauss@42040
   316
krauss@42040
   317
    output = {}
krauss@42040
   318
    success_rates = {}
krauss@42040
   319
    some_success = False
krauss@42040
   320
krauss@42040
   321
    for atp in judgement_day_provers:
krauss@42040
   322
krauss@42040
   323
        log_dir = path.join(playground, 'mirabelle_log_' + atp)
krauss@42040
   324
        os.makedirs(log_dir)
krauss@42040
   325
krauss@42040
   326
        cmd = ('%s/bin/isabelle mirabelle -q -O %s sledgehammer[prover=%s,%s] %s.thy'
krauss@42040
   327
               % (isa, log_dir, atp, opts, theory))
krauss@42040
   328
krauss@42040
   329
        os.system(cmd)
krauss@42040
   330
        output[atp] = util.readfile(path.join(log_dir, theory + '.log'))
krauss@42040
   331
krauss@42040
   332
        percentages = list(re.findall(r'Success rate: (\d+)%', output[atp]))
krauss@42040
   333
        if len(percentages) == 2:
krauss@42040
   334
            success_rates[atp] = {
krauss@42040
   335
                'sledgehammer': int(percentages[0]),
krauss@42040
   336
                'metis': int(percentages[1])}
krauss@42040
   337
            if success_rates[atp]['sledgehammer'] > 0:
krauss@42040
   338
                some_success = True
krauss@42040
   339
        else:
krauss@42040
   340
            success_rates[atp] = {}
krauss@42040
   341
krauss@42040
   342
krauss@42040
   343
    data = {'success_rates': success_rates}
krauss@42040
   344
    raw_attachments = dict((atp + "_output", output[atp]) for atp in judgement_day_provers)
krauss@42040
   345
    # FIXME: summary?
krauss@42040
   346
    return (some_success, '', data, raw_attachments, None)
krauss@42040
   347
krauss@42040
   348
krauss@42948
   349
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
krauss@42040
   350
def JD_NS(*args):
krauss@42040
   351
    """Judgement Day regression suite NS"""
krauss@42040
   352
    return judgement_day('Isabelle/src/HOL/Auth', 'NS_Shared', 'prover_timeout=10', *args)
krauss@42040
   353
krauss@42948
   354
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
krauss@42040
   355
def JD_FTA(*args):
krauss@42040
   356
    """Judgement Day regression suite FTA"""
krauss@42040
   357
    return judgement_day('Isabelle/src/HOL/Library', 'Fundamental_Theorem_Algebra', 'prover_timeout=10', *args)
krauss@42040
   358
krauss@42948
   359
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
krauss@42040
   360
def JD_Hoare(*args):
krauss@42040
   361
    """Judgement Day regression suite Hoare"""
krauss@42058
   362
    return judgement_day('Isabelle/src/HOL/IMPP', 'Hoare', 'prover_timeout=10', *args)
krauss@42040
   363
krauss@42948
   364
@configuration(repos = [Isabelle], deps = [(HOL, [0])])
krauss@42040
   365
def JD_SN(*args):
krauss@42040
   366
    """Judgement Day regression suite SN"""
krauss@42058
   367
    return judgement_day('Isabelle/src/HOL/Proofs/Lambda', 'StrongNorm', 'prover_timeout=10', *args)
krauss@42040
   368
krauss@42116
   369
krauss@42192
   370
JD_confs = 'JD_NS JD_FTA JD_Hoare JD_SN JD_Arrow JD_FFT JD_Jinja JD_QE JD_S2S'.split(' ')
krauss@42192
   371
krauss@42192
   372
@scheduler()
krauss@42197
   373
def judgement_day_scheduler(env):
krauss@42192
   374
    """Scheduler for Judgement Day."""
krauss@42192
   375
    return schedule.age_scheduler(env, 'Isabelle', JD_confs)
krauss@42192
   376
krauss@42192
   377
krauss@42116
   378
# SML/NJ
krauss@42116
   379
krauss@42116
   380
smlnj_settings = '''
krauss@42116
   381
ML_SYSTEM=smlnj
wenzelm@48443
   382
ML_HOME="/home/smlnj/110.74/bin"
wenzelm@48443
   383
ML_OPTIONS="@SMLdebug=/dev/null @SMLalloc=1024"
krauss@42116
   384
ML_PLATFORM=$(eval $("$ML_HOME/.arch-n-opsys" 2>/dev/null); echo "$HEAP_SUFFIX")
krauss@42116
   385
'''
krauss@42116
   386
krauss@48686
   387
@configuration(repos = [Isabelle], deps = [(Pure, [0])])
krauss@42116
   388
def SML_HOL(*args):
krauss@42116
   389
    """HOL image built with SML/NJ"""
krauss@48686
   390
    return isabelle_build(*(args + ("-b", "HOL")), more_settings=smlnj_settings)
krauss@42116
   391
krauss@42116
   392
@configuration(repos = [Isabelle], deps = [])
krauss@42116
   393
def SML_makeall(*args):
krauss@48686
   394
    """SML/NJ build of all possible sessions"""
krauss@48686
   395
    return isabelle_build(*(args + ("-j", "3", "-a")), more_settings=smlnj_settings)
krauss@48686
   396
krauss@48686
   397
krauss@48686
   398
# Legacy Isabelle configurations
krauss@48686
   399
krauss@48686
   400
# distribution and documentation Build
krauss@48686
   401
krauss@48686
   402
@configuration(repos = [Isabelle], deps = [])
krauss@48686
   403
def Distribution(env, case, paths, dep_paths, playground):
krauss@48686
   404
    """Build of distribution"""
krauss@48686
   405
    ## FIXME This is rudimentary; study Admin/CHECKLIST to complete this configuration accordingly
krauss@48686
   406
    isabelle_home = paths[0]
krauss@48686
   407
    (return_code, log) = env.run_process(path.join(isabelle_home, 'Admin', 'Release', 'makedist'),
krauss@48686
   408
      REPOS = repositories.get(Isabelle).local_path, DISTPREFIX = os.getcwd())
krauss@48686
   409
    return (return_code == 0, '', ## FIXME might add summary here
krauss@48686
   410
      {}, {'log': log}, None) ## FIXME might add proper result here
krauss@48686
   411
krauss@48686
   412
krauss@48686
   413
def isabelle_dependency_only(env, case, paths, dep_paths, playground):
krauss@43894
   414
krauss@48686
   415
    isabelle_home = paths[0]
krauss@48686
   416
    result = path.join(isabelle_home, 'heaps')
krauss@48686
   417
    os.makedirs(result)
krauss@48686
   418
    for dep_path in dep_paths:
krauss@48686
   419
        subprocess.check_call(['cp', '-R'] + glob(dep_path + '/*') + [result])
krauss@48686
   420
krauss@48686
   421
    return (True, 'ok', {}, {}, result)
krauss@48686
   422
krauss@48686
   423
krauss@48686
   424
@configuration(repos = [Isabelle], deps = [
krauss@48686
   425
    (HOL, [0]),
krauss@48686
   426
    (HOL_HOLCF, [0]),
krauss@48686
   427
    (ZF, [0]),
krauss@48686
   428
    (HOL_Library, [0])
krauss@48686
   429
  ])
krauss@48686
   430
def Documentation_images(*args):
krauss@48686
   431
    """Isabelle images needed to build the documentation"""
krauss@48686
   432
    return isabelle_dependency_only(*args)
krauss@48686
   433
krauss@48686
   434
@configuration(repos = [Isabelle], deps = [(Documentation_images, [0])])
krauss@48686
   435
def Documentation(env, case, paths, dep_paths, playground):
krauss@48686
   436
    """Build of documentation"""
krauss@48686
   437
    isabelle_home = paths[0]
krauss@48686
   438
    dep_path = dep_paths[0]
krauss@48686
   439
    prepare_isabelle_repository(isabelle_home, env.settings.contrib, dep_path,
krauss@48686
   440
      usedir_options = default_usedir_options)
krauss@48686
   441
    (return_code, log) = env.run_process(path.join(isabelle_home, 'Admin', 'build', 'doc-src'))
krauss@48686
   442
    return (return_code == 0, extract_isabelle_run_summary(log),
krauss@48686
   443
      extract_report_data(isabelle_home, log), {'log': log}, None)
krauss@48686
   444
krauss@48686
   445