コード例 #1
0
def Main():
  utils.ConfigureJava()
  # Parse the options.
  parser = BuildOptions()
  (options, args) = parser.parse_args()
  if not ProcessOptions(options, args):
    parser.print_help()
    return 1
  # Determine which targets to build. By default we build the "all" target.
  if len(args) == 0:
    targets = ['all']
  else:
    targets = args

  # Build all targets for each requested configuration.
  for target in targets:
    for target_os in options.os:
      for mode in options.mode:
        for arch in options.arch:
          cross_build = utils.IsCrossBuild(target_os, arch)
          if target in ['create_sdk'] and cross_build:
            if BuildCrossSdk(options, target_os, mode, arch) != 0:
              return 1
          else:
            if BuildOneConfig(options, target, target_os,
                              mode, arch, cross_build) != 0:
              return 1

  return 0
コード例 #2
0
def Main():
    utils.ConfigureJava()
    # Parse the options.
    parser = BuildOptions()
    (options, args) = parser.parse_args()
    if not ProcessOptions(options, args):
        parser.print_help()
        return 1
    # Determine which targets to build. By default we build the "all" target.
    if len(args) == 0:
        if HOST_OS == 'macos':
            targets = ['All']
        else:
            targets = ['samples']
    else:
        targets = args

    filter_xcodebuild_output = False
    # Remember path
    old_path = os.environ['PATH']
    # Build all targets for each requested configuration.
    for target in targets:
        for target_os in options.os:
            for mode in options.mode:
                for arch in options.arch:
                    os.environ['DART_BUILD_MODE'] = mode
                    build_config = utils.GetBuildConf(mode, arch)
                    if HOST_OS == 'macos':
                        filter_xcodebuild_output = True
                        project_file = 'dart.xcodeproj'
                        if os.path.exists('dart-%s.gyp' %
                                          CurrentDirectoryBaseName()):
                            project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName(
                            )
                        args = [
                            'xcodebuild', '-project', project_file, '-target',
                            target, '-configuration', build_config,
                            'SYMROOT=%s' % os.path.abspath('xcodebuild')
                        ]
                    elif HOST_OS == 'win32':
                        project_file = 'dart.sln'
                        if os.path.exists('dart-%s.gyp' %
                                          CurrentDirectoryBaseName()):
                            project_file = 'dart-%s.sln' % CurrentDirectoryBaseName(
                            )
                        if target == 'all':
                            args = [
                                options.devenv + os.sep + options.executable,
                                '/build', build_config, project_file
                            ]
                        else:
                            args = [
                                options.devenv + os.sep + options.executable,
                                '/build', build_config, '/project', target,
                                project_file
                            ]
                    else:
                        make = 'make'
                        if HOST_OS == 'freebsd':
                            make = 'gmake'
                            # work around lack of flock
                            os.environ['LINK'] = '$(CXX)'
                        args = [
                            make,
                            '-j',
                            options.j,
                            'BUILDTYPE=' + build_config,
                        ]
                        if target_os != HOST_OS:
                            args += [
                                'builddir_name=' +
                                utils.GetBuildDir(HOST_OS, target_os)
                            ]
                        if options.verbose:
                            args += ['V=1']

                        args += [target]

                    if target_os != HOST_OS:
                        SetCrossCompilationEnvironment(HOST_OS, target_os,
                                                       arch, old_path)
                    else:
                        gypDefinesList = ['target_arch=%s' % arch]
                        os.environ['GYP_DEFINES'] = ' '.join(gypDefinesList)

                    RunhooksIfNeeded(HOST_OS, mode, arch, target_os)

                    toolchainprefix = None
                    if target_os == 'android':
                        if arch == 'ia32':
                            toolchainprefix = ('%s/i686-linux-android' %
                                               os.environ['ANDROID_TOOLCHAIN'])

                        if arch == 'arm':
                            toolchainprefix = ('%s/arm-linux-androideabi' %
                                               os.environ['ANDROID_TOOLCHAIN'])

                        sysroot = os.environ[
                            'ANDROID_NDK_ROOT'] + "/platforms/android-19/arch-arm"
                        args.append("CFLAGS=--sysroot=" + sysroot)
                        args.append(
                            "CXXFLAGS=-Ithird_party/dart/third_party/android_tools/ndk/sources/cxx-stl/stlport/stlport/ --sysroot="
                            + sysroot)
                        args.append("LDFLAGS=--sysroot=" + sysroot)

                    toolsOverride = SetTools(arch, toolchainprefix)
                    if toolsOverride:
                        printToolOverrides = target_os != 'android'
                        for k, v in toolsOverride.iteritems():
                            args.append(k + "=" + v)
                            if printToolOverrides:
                                print k + " = " + v
                        if not os.path.isfile(toolsOverride['CC.target']):
                            if arch == 'arm':
                                print arm_cc_error
                            else:
                                print "Couldn't find compiler: %s" % toolsOverride[
                                    'CC.target']
                            return 1

                    process = None
                    if filter_xcodebuild_output:
                        process = subprocess.Popen(
                            args,
                            stdin=None,
                            bufsize=1,  # Line buffered.
                            stdout=subprocess.PIPE,
                            stderr=subprocess.STDOUT)
                        FilterEmptyXcodebuildSections(process)
                    else:
                        process = subprocess.Popen(args, stdin=None)
                    process.wait()
                    if process.returncode != 0:
                        print "BUILD FAILED"
                        return 1

    return 0
コード例 #3
0
def Main():
    utils.ConfigureJava()
    # Parse the options.
    parser = BuildOptions()
    (options, args) = parser.parse_args()
    if not ProcessOptions(options):
        parser.print_help()
        return 1
    # Determine which targets to build. By default we build the "all" target.
    if len(args) == 0:
        if HOST_OS == 'macos':
            target = 'All'
        else:
            target = 'all'
    else:
        target = args[0]
    # Build the targets for each requested configuration.
    for mode in options.mode:
        for arch in options.arch:
            build_config = utils.GetBuildConf(mode, arch)
            if HOST_OS == 'macos':
                project_file = 'dart.xcodeproj'
                if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
                    project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName(
                    )
                args = [
                    'xcodebuild', '-project', project_file, '-target', target,
                    '-parallelizeTargets', '-configuration', build_config,
                    'SYMROOT=%s' % os.path.abspath('xcodebuild')
                ]
            elif HOST_OS == 'win32':
                project_file = 'dart.sln'
                if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
                    project_file = 'dart-%s.sln' % CurrentDirectoryBaseName()
                if target == 'all':
                    args = [
                        options.devenv + os.sep + 'devenv.com', '/build',
                        build_config, project_file
                    ]
                else:
                    args = [
                        options.devenv + os.sep + 'devenv.com', '/build',
                        build_config, '/project', target, project_file
                    ]
            else:
                make = 'make'
                if HOST_OS == 'freebsd':
                    make = 'gmake'
                    # work around lack of flock
                    os.environ['LINK'] = '$(CXX)'
                args = [
                    make,
                    '-j',
                    options.j,
                    'BUILDTYPE=' + build_config,
                ]
                if options.verbose:
                    args += ['V=1']

                args += [target]

            toolsOverride = setTools(arch)
            if toolsOverride:
                for k, v in toolsOverride.iteritems():
                    args.append(k + "=" + v)
                    print k + " = " + v

            print ' '.join(args)
            process = subprocess.Popen(args)
            process.wait()
            if process.returncode != 0:
                print "BUILD FAILED"
                return 1

    return 0
コード例 #4
0
def Main():
    """Main loop."""
    script_start_time = time.time()
    utils.ConfigureJava()
    parser = BuildOptions()
    (options, args) = parser.parse_args()
    if not ProcessOptions(options):
        parser.print_help()
        return 1

    client = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
    repositories = []
    for component in os.listdir(client) + ['.']:
        test_path = os.path.join(client, component, 'tests')
        if os.path.exists(test_path) and os.path.isdir(test_path):
            suites = GetSuites(test_path)
            repositories += [
                TestRepository(os.path.join(test_path, name))
                for name in suites
            ]
    repositories += [TestRepository(a) for a in options.suite]

    root = LiteralTestSuite(repositories)
    if args:
        paths = []
        for arg in args:
            path = _SplitPath(arg)
            paths.append(path)
    else:
        paths = [_SplitPath(t) for t in BUILT_IN_TESTS]

    # Check for --valgrind option. If enabled, we overwrite the special
    # command flag with a command that uses the tools/valgrind.py script.
    if options.valgrind:
        run_valgrind = os.path.join(client, 'runtime', 'tools', 'valgrind.py')
        options.special_command = 'python -u ' + run_valgrind + ' @'

    context = Context(client, options.verbose, options.os, options.timeout,
                      GetSpecialCommandProcessor(options.special_command),
                      options.suppress_dialogs, options.executable,
                      options.flags, options.keep_temporary_files,
                      options.batch, options.checked)

    # Get status for tests
    sections = []
    defs = {}
    root.GetTestStatus(context, sections, defs)
    config = Configuration(sections, defs)

    # List the tests
    all_cases = []
    all_unused = []
    globally_unused_rules = None
    for path in paths:
        for mode in options.mode:
            for arch in options.arch:
                for component in options.component:
                    env = {
                        'mode': mode,
                        'system': utils.GuessOS(),
                        'arch': arch,
                        'component': component,
                        'checked': options.checked,
                        'unchecked': not options.checked,
                    }
                    test_list = root.ListTests([], path, context, mode, arch,
                                               component)
                    (cases, unused_rules,
                     unused_outcomes) = config.ClassifyTests(test_list, env)
                    if globally_unused_rules is None:
                        globally_unused_rules = set(unused_rules)
                    else:
                        globally_unused_rules = (
                            globally_unused_rules.intersection(unused_rules))
                    all_cases += cases
                    all_unused.append(unused_rules)

    if options.report:
        PrintReport(all_cases)

    if options.list:
        PrintTests(all_cases)
        return 0

    result = None

    def DoSkip(case):
        return testing.SKIP in case.outcomes or testing.SLOW in case.outcomes

    cases_to_run = [c for c in all_cases if not DoSkip(c)]
    # Creating test cases may generate temporary files. Make sure
    # Skipped tests clean up these files.
    for c in all_cases:
        if DoSkip(c): c.case.Cleanup()

    if cases_to_run:
        try:
            start = time.time()
            if RunTestCases(cases_to_run, options.progress, options.tasks,
                            context, script_start_time):
                result = 0
            else:
                result = 1
            duration = time.time() - start
        except KeyboardInterrupt:
            print 'Exiting on KeyboardInterrupt'
            return 1
    else:
        print 'No tests to run.'
        return 0

    if options.time:
        print
        print '--- Total time: %s ---' % FormatTime(duration)
        timed_tests = [
            t.case for t in cases_to_run if not t.case.duration is None
        ]
        timed_tests.sort(lambda a, b: a.CompareTime(b))
        index = 1
        for entry in timed_tests[:20]:
            t = FormatTime(entry.duration)
            print '%4i (%s) %s' % (index, t, entry.GetLabel())
            index += 1

    return result
コード例 #5
0
def Main():
    utils.ConfigureJava()
    # Parse the options.
    parser = BuildOptions()
    (options, args) = parser.parse_args()
    if not ProcessOptions(options, args):
        parser.print_help()
        return 1
    # Determine which targets to build. By default we build the "all" target.
    if len(args) == 0:
        if HOST_OS == 'macos':
            targets = ['All']
        else:
            targets = ['all']
    else:
        targets = args

    filter_xcodebuild_output = False
    # Build all targets for each requested configuration.
    for target in targets:
        for target_os in options.os:
            for mode in options.mode:
                for arch in options.arch:
                    start_time = time.time()
                    os.environ['DART_BUILD_MODE'] = mode
                    build_config = utils.GetBuildConf(mode, arch, target_os)
                    if HOST_OS == 'macos':
                        filter_xcodebuild_output = True
                        project_file = 'dart.xcodeproj'
                        if os.path.exists('dart-%s.gyp' %
                                          CurrentDirectoryBaseName()):
                            project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName(
                            )
                        args = [
                            'xcodebuild', '-project', project_file, '-target',
                            target, '-configuration', build_config,
                            'SYMROOT=%s' % os.path.abspath('xcodebuild')
                        ]
                    elif HOST_OS == 'win32':
                        project_file = 'dart.sln'
                        if os.path.exists('dart-%s.gyp' %
                                          CurrentDirectoryBaseName()):
                            project_file = 'dart-%s.sln' % CurrentDirectoryBaseName(
                            )
                        if target == 'all':
                            args = [
                                options.devenv + os.sep + options.executable,
                                '/build', build_config, project_file
                            ]
                        else:
                            args = [
                                options.devenv + os.sep + options.executable,
                                '/build', build_config, '/project', target,
                                project_file
                            ]
                    else:
                        make = 'make'
                        if HOST_OS == 'freebsd':
                            make = 'gmake'
                            # work around lack of flock
                            os.environ['LINK'] = '$(CXX)'
                        args = [
                            make,
                            '-j',
                            options.j,
                            'BUILDTYPE=' + build_config,
                        ]
                        if target_os != HOST_OS:
                            args += [
                                'builddir_name=' +
                                utils.GetBuildDir(HOST_OS, target_os)
                            ]
                        if options.verbose:
                            args += ['V=1']

                        args += [target]

                    toolchainprefix = options.toolchain
                    toolsOverride = SetTools(arch, target_os, toolchainprefix)
                    if toolsOverride:
                        for k, v in toolsOverride.iteritems():
                            args.append(k + "=" + v)
                            if options.verbose:
                                print k + " = " + v
                        if not os.path.isfile(toolsOverride['CC.target']):
                            if arch == 'arm':
                                print arm_cc_error
                            else:
                                print "Couldn't find compiler: %s" % toolsOverride[
                                    'CC.target']
                            return 1

                    print ' '.join(args)
                    process = None
                    if filter_xcodebuild_output:
                        process = subprocess.Popen(
                            args,
                            stdin=None,
                            bufsize=1,  # Line buffered.
                            stdout=subprocess.PIPE,
                            stderr=subprocess.STDOUT)
                        FilterEmptyXcodebuildSections(process)
                    else:
                        process = subprocess.Popen(args, stdin=None)
                    process.wait()
                    if process.returncode != 0:
                        NotifyBuildDone(build_config,
                                        success=False,
                                        start=start_time)
                        return 1
                    else:
                        NotifyBuildDone(build_config,
                                        success=True,
                                        start=start_time)

    return 0
コード例 #6
0
ファイル: build.py プロジェクト: joskid/bleeding_edge
def Main():
  utils.ConfigureJava()
  # Parse the options.
  parser = BuildOptions()
  (options, args) = parser.parse_args()
  if not ProcessOptions(options, args):
    parser.print_help()
    return 1
  # Determine which targets to build. By default we build the "all" target.
  if len(args) == 0:
    if HOST_OS == 'macos':
      target = 'All'
    else:
      target = 'all'
  else:
    target = args[0]

  # Remember path
  old_path = os.environ['PATH']
  # Build the targets for each requested configuration.
  for target_os in options.os:
    for mode in options.mode:
      for arch in options.arch:
        build_config = utils.GetBuildConf(mode, arch)
        if HOST_OS == 'macos':
          project_file = 'dart.xcodeproj'
          if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
            project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName()
          args = ['xcodebuild',
                  '-project',
                  project_file,
                  '-target',
                  target,
                  '-parallelizeTargets',
                  '-configuration',
                  build_config,
                  'SYMROOT=%s' % os.path.abspath('xcodebuild')
                  ]
        elif HOST_OS == 'win32':
          project_file = 'dart.sln'
          if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
            project_file = 'dart-%s.sln' % CurrentDirectoryBaseName()
          if target == 'all':
            args = [options.devenv + os.sep + 'devenv.com',
                    '/build',
                    build_config,
                    project_file
                   ]
          else:
            args = [options.devenv + os.sep + 'devenv.com',
                    '/build',
                    build_config,
                    '/project',
                    target,
                    project_file
                   ]
        else:
          make = 'make'
          if HOST_OS == 'freebsd':
            make = 'gmake'
            # work around lack of flock
            os.environ['LINK'] = '$(CXX)'
          args = [make,
                  '-j',
                  options.j,
                  'BUILDTYPE=' + build_config,
                  ]
          if target_os != HOST_OS:
            args += ['builddir_name=' + utils.GetBuildDir(HOST_OS, target_os)]
          if options.verbose:
            args += ['V=1']

          args += [target]

        if target_os != HOST_OS:
          SetCrossCompilationEnvironment(
              HOST_OS, target_os, arch, old_path)

        RunhooksIfNeeded(HOST_OS, mode, arch, target_os)

        toolchainprefix = None
        if target_os == 'android':
          toolchainprefix = ('%s/i686-linux-android'
                              % os.environ['ANDROID_TOOLCHAIN'])
        toolsOverride = SetTools(arch, toolchainprefix)
        if toolsOverride:
          printToolOverrides = target_os != 'android'
          for k, v in toolsOverride.iteritems():
            args.append(  k + "=" + v)
            if printToolOverrides:
              print k + " = " + v

        print ' '.join(args)
        process = subprocess.Popen(args)
        process.wait()
        if process.returncode != 0:
          print "BUILD FAILED"
          return 1

  return 0