2017-05-31 419 views
0

我沒有得到使用SCons更新項目的自動構建版本。首先,我在源文件中更改了一些內容,scons告訴我:如何在源文件更改時更新scons版本

scons: done reading SConscript files. 
scons: Building targets ... 
scons: `.' is up to date. 
scons: done building targets. 

如何更新自動構建?

UPDATE 20170601:

萊德爾@ PC-LAP127:〜/資源/埃菲爾鐵塔/ PF_HP-MT $ scons的--tree =修剪項目= pf_hp.ecf

+-. 
    +-.sconf_temp 
    +-SConstruct 
    +-build 
    | +-build/F_code-unix.tar 
    | | +-pf_hp.ecf 
    | | +-project.py 
    | | +-/home/leder/Source/Eiffel/library/Eiffel-Loop/precomp/linux-x86-64/console-application.ecf 
    | | +-/home/leder/Source/Eiffel/library/Eiffel-Loop/precomp/console-application.ecf 
    | +-build/linux-x86-64 
    | +-build/linux-x86-64/package 
    |  +-build/linux-x86-64/package/bin 
    |  +-build/linux-x86-64/package/bin/pf_hp 
    |   +-[build/F_code-unix.tar] 
    +-config.log 
    +-pf_hp.ecf 
    +-project.py 

萊德爾@ PC-LAP127 :〜/ Source/Eiffel/PF_HP-mt $ tree -L 2。

. 
├── build 
│   ├── F_code-unix.tar 
│   ├── linux-x86-64 
│   └── version.txt 
├── config.log 
├── EIFGENs 
│   └── classic 
├── git_push.sh 
├── input.txt 
├── LICENSE.gpl 
├── LIESMICH.txt 
├── pf_hp.ecf 
├── pf_hp.ecf.old 
├── pf_hp.pecf 
├── project.py 
├── project.pyc 
├── README.txt 
├── SConstruct 
├── source 
│   ├── application_root.e 
│   ├── build_info.e 
│   ├── folding 
│   ├── notes 
│   ├── sub-applications 
│   └── testing 
└── test.sh 

9 directories, 17 files 

萊德爾@ PC-LAP127:〜/資源/埃菲爾鐵塔/ PF_HP-MT $少SConstruct

import eiffel_loop.eiffel.SConstruct 
SConstruct (END) 

UPDATE_20170601,eiffel_loop.eiffel.SConstruct.py:

# author: "Finnian Reilly" 
# copyright: "Copyright (c) 2001-2012 Finnian Reilly" 
# contact: "finnian at eiffel hyphen loop dot com" 
# license: "MIT license (See: en.wikipedia.org/wiki/MIT_License)" 
# date: "3 June 2010" 
# revision: "0.2" 

import os, sys 

from os import path 

from eiffel_loop.eiffel import project 
from eiffel_loop.scons import eiffel 

from eiffel_loop.eiffel.ecf import EIFFEL_CONFIG_FILE 
from eiffel_loop.eiffel.ecf import FREEZE_BUILD 
from eiffel_loop.eiffel.ecf import C_CODE_TAR_BUILD 
from eiffel_loop.eiffel.ecf import FINALIZED_BUILD 

from SCons.Script import * 

# SCRIPT START 
arguments = Variables() 
arguments.Add (EnumVariable('cpu', 'Set target cpu for compiler', 'x64', allowed_values=('x64', 'x86'))) 

arguments.Add (
    EnumVariable('action', 'Set build action', 'finalize', 
     allowed_values=(
      Split ("freeze finalize finalize_and_test finalize_and_install install_resources make_installers") 
     ) 
    ) 
) 
arguments.Add (BoolVariable ('compile_eiffel', 'Compile Eiffel source (no implies C compile only)', 'yes')) 
arguments.Add (BoolVariable ('install', 'Set to \'yes\' to install finalized release', 'no')) 
arguments.Add (PathVariable ('project', 'Path to Eiffel configuration file', 'default.ecf')) 

#arguments.Add (
# ListVariable (
#  'MSC_options', 'Visual Studio setenv.cmd options', '', Split ("/Debug /Release /x86 /x64 /ia64 /vista /xp /2003 /2008 /win7") 
# ) 
#) 

env = Environment (variables = arguments) 

Help (arguments.GenerateHelpText (env) + '\nproject: Set to name of Eiffel project configuration file (*.ecf)\n') 

if env.GetOption ('help'): 
    None 

else: 
    is_windows_platform = sys.platform == 'win32' 
    project_py = project.read_project_py() 

# MSC_options = env.get ('MSC_options').data 
# if MSC_options: 
#  project_py.MSC_options = MSC_options 
#  print 'MSC_options:', project_py.MSC_options 

    ecf_path = env.get ('project') 
    action = env.get ('action') 
    compile_eiffel = env.get ('compile_eiffel') 

    project_py.set_build_environment (env.get ('cpu')) 

    env.Append (ENV = os.environ, ISE_PLATFORM = os.environ ['ISE_PLATFORM']) 
    if 'ISE_C_COMPILER' in os.environ: 
     env.Append (ISE_C_COMPILER = os.environ ['ISE_C_COMPILER']) 

    config = EIFFEL_CONFIG_FILE (ecf_path) 

    project_files = [ecf_path, 'project.py'] 

    if action == 'install_resources': 
     build = FREEZE_BUILD (config, project_py) 
     build.post_compilation() 
    else: 
     if action in ['finalize', 'make_installers']: 
      tar_build = C_CODE_TAR_BUILD (config, project_py) 
      build = FINALIZED_BUILD (config, project_py) 

      if compile_eiffel: 
       env.Append (EIFFEL_BUILD = tar_build) 
       env.Append (BUILDERS = {'eiffel_compile' : Builder (action = eiffel.compile_eiffel)}) 
       f_code = env.eiffel_compile (tar_build.target(), project_files) 
      else: 
       f_code = None 

     else: 
      build = FREEZE_BUILD (config, project_py) 
      f_code = None 

     env.Append (C_BUILD = build) 
     env.Append (BUILDERS = {'c_compile' : Builder (action = eiffel.compile_C_code)}) 

     if f_code: 
      executable = env.c_compile (build.target(), tar_build.target()) 
     else: 
      executable = env.c_compile (build.target(), project_files) 

     if build.precompile_path: 
      env.Append (BUILDERS = {'precomp_copier' : Builder (action = eiffel.copy_precompile)}) 
      precompile_name = path.basename (build.precompile_path) 
      precompile_dir = path.dirname (path.dirname (build.precompile_path)) 
      precomp_ecf = env.precomp_copier (build.precompile_path, path.join (precompile_dir, precompile_name)) 
      if f_code: 
       Depends (tar_build.target(), build.precompile_path) 
      else: 
       Depends (executable, build.precompile_path) 

     eiffel.check_C_libraries (env, build) 
     if len (build.SConscripts) > 0: 
      print "\nDepends on External libraries:" 
      for script in build.SConscripts: 
       print "\t" + script 

     SConscript (build.SConscripts, exports='env') 

     # only make library a dependency if it doesn't exist or object files are being cleaned out 
     lib_dependencies = [] 
     for lib in build.scons_buildable_libs: 
      if env.GetOption ('clean') or not path.exists (lib): 
       if not lib in lib_dependencies: 
        lib_dependencies.append (lib) 

     Depends (executable, lib_dependencies) 

     productions = [executable, precomp_ecf] 
     if f_code: 
      productions.append (tar_build.target()) 

     env.NoClean (productions) 
+0

有沒有辦法告訴SCons有關所有源代碼和配置文件?我猜,它沒有看到哪些文件被改變。另一種方法是每次運行EiffelStudio編譯器,它足夠聰明,可以在工作臺模式下進行增量重新編譯,但可能不適合構建最終化的應用程序。 –

+0

是的,這是解決方案:EiffelStudio編譯器'ec'檢測到變化! – Leder

+0

好。我添加了一個答案,以便您可以將問題標記爲已解決。 –

回答

1

如果SCons不知道或看到哪些文件已被更改,替代方法是運行EiffelStudio編譯器每次。它在工作臺模式下執行快速增量重新編譯,所以不會因等待重新編譯而受到懲罰。

注意。如果您不使用圖形環境,則可以使用稍微更小一點的編譯器(而不是常規的ec)版本編譯項目。但這是以與IDE不兼容爲代價的(例如,在完全非交互式編譯設置中)。

相關問題