Home | History | Annotate | Download | only in util
      1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # This target generates a "last_change.h" header file in the generated files
      6 # directory that contains a define of the last revision of the source tree
      7 # of the form:
      8 #  #define LAST_CHANGE "123456"
      9 #
     10 # The version is a string rather than an integer for extra flexibility (for
     11 # example, we may require git hashes in the future).
     12 #
     13 # All you need to do is depend on this target, and then from your source code:
     14 #  #include "build/util/last_change.h"
     15 action("last_change") {
     16   script = "lastchange.py"
     17 
     18   # Rerun the script any time this file changes.
     19   source_prereqs = [ "//build/util/LASTCHANGE" ]
     20 
     21   output_header = "$target_gen_dir/last_change.h"
     22   outputs = [ output_header ]
     23 
     24   build_relative_src = rebase_path("//", root_build_dir)
     25   build_relative_outputs = rebase_path(output_header, root_build_dir)
     26 
     27   args = [
     28     "--source-dir=$build_relative_src",
     29     "--header=$build_relative_outputs",
     30     "--version-macro=LAST_CHANGE",
     31   ]
     32 }
     33 
     34 action("webkit_version") {
     35   script = "version.py"
     36 
     37   lastchange_file = "LASTCHANGE.blink"
     38   # TODO(brettw) move from content to this directory.
     39   template_file = "//content/webkit_version.h.in"
     40   source_prereqs = [ lastchange_file, template_file ]
     41 
     42   output_file = "$root_gen_dir/webkit_version.h"
     43   outputs = [ output_file ]
     44 
     45   args = [
     46     "-f", rebase_path(lastchange_file, root_build_dir),
     47     rebase_path(template_file, root_build_dir),
     48     rebase_path(output_file, root_build_dir),
     49   ]
     50 }
     51