autobuild 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,12 @@
1
+ == Version 1.2.4
2
+ * git update phase now fetches the repository and branch specified by the
3
+ autobuild script. It previously was using remote tracking branches. This
4
+ will allow to detect branch changes in the autobuild specification.
5
+ * documentation support. Packages can now declare that they can generate
6
+ documentation (see Package#doc_task and CMake#with_doc). That documentation
7
+ is generated post-build and installed.
8
+ * fix build updates in the CMake package class.
9
+
1
10
  == Version 1.2.3
2
11
  * Fix git update again. FETCH_HEAD may resolve as an ID which is not the one
3
12
  to be selected for merge
@@ -36,8 +36,13 @@ begin
36
36
  end
37
37
  end
38
38
 
39
- targets = ['import']
40
- targets += ['prepare', 'build'] if Autobuild.do_build
39
+ if Autobuild.only_doc
40
+ targets = ['doc']
41
+ else
42
+ targets = ['import']
43
+ targets << 'doc' if Autobuild.do_doc
44
+ targets += ['prepare', 'build'] if Autobuild.do_build
45
+ end
41
46
  targets.each do |phase|
42
47
  packages = Autobuild.packages
43
48
  packages = Autobuild.default_packages if packages.empty?
@@ -3,6 +3,6 @@ require 'autobuild/reporting'
3
3
  require 'autobuild/package'
4
4
 
5
5
  module Autobuild
6
- VERSION = "1.2.3" unless defined? Autobuild::VERSION
6
+ VERSION = "1.2.4" unless defined? Autobuild::VERSION
7
7
  end
8
8
 
@@ -26,8 +26,9 @@ end
26
26
  module Autobuild
27
27
  class << self
28
28
  %w{ nice srcdir prefix
29
- verbose debug do_update do_build
30
- daemonize clean_log packages default_packages }.each do |name|
29
+ verbose debug do_update do_build only_doc do_doc
30
+ daemonize clean_log packages default_packages
31
+ doc_prefix }.each do |name|
31
32
  attr_accessor name
32
33
  end
33
34
 
@@ -35,11 +36,18 @@ module Autobuild
35
36
  attr_reader :programs
36
37
  # The directory in which logs are saved. Defaults to PREFIX/log.
37
38
  attr_writer :logdir
39
+
40
+ # True if we build and if the build is applied on all packages
41
+ def full_build?
42
+ do_build && !only_doc && packages.empty?
43
+ end
38
44
  end
39
45
  DEFAULT_OPTIONS = { :nice => 0,
40
46
  :srcdir => Dir.pwd, :prefix => Dir.pwd, :logdir => nil,
41
47
  :verbose => false, :debug => false, :do_build => true, :do_update => true,
42
- :daemonize => false, :packages => [], :default_packages => [] }
48
+ :daemonize => false, :packages => [], :default_packages => [],
49
+ :only_doc => false, :do_doc => true,
50
+ :doc_prefix => 'doc' }
43
51
 
44
52
  @programs = Hash.new
45
53
  DEFAULT_OPTIONS.each do |name, value|
@@ -143,8 +151,10 @@ module Autobuild
143
151
  if defined? Daemons
144
152
  opts.on("--[no-]daemon", "go into daemon mode") do |@daemonize| end
145
153
  end
146
- opts.on("--[no-]update", "update already checked-out sources") do |@do_update| end
147
- opts.on("--[no-]build", "only prepare packages, do not build them") do |@do_build| end
154
+ opts.on("--no-update", "update already checked-out sources") do |@do_update| end
155
+ opts.on("--no-build", "only prepare packages, do not build them") do |@do_build| end
156
+ opts.on("--only-doc", "only generate documentation") do |@only_doc| end
157
+ opts.on("--no-doc", "don't generate documentation") do |@doc_doc| end
148
158
 
149
159
  opts.separator ""
150
160
  opts.separator "Program output"
@@ -46,22 +46,7 @@ module Autobuild
46
46
 
47
47
  def initialize(options)
48
48
  super
49
- Autobuild.update_environment(prefix)
50
- end
51
-
52
- def depends_on(*packages)
53
- super
54
- stamps = packages.collect { |p| Package[p.to_s].installstamp }
55
- file configurestamp => stamps
56
- end
57
49
 
58
- def ensure_dependencies_installed
59
- dependencies.each do |pkg|
60
- Rake::Task[Package[pkg].installstamp].invoke
61
- end
62
- end
63
-
64
- def prepare
65
50
  file configurestamp do
66
51
  ensure_dependencies_installed
67
52
  configure
@@ -75,11 +60,29 @@ module Autobuild
75
60
  ensure_dependencies_installed
76
61
  build
77
62
  end
63
+ task "#{name}-build" => buildstamp
78
64
 
79
65
  file installstamp => buildstamp do
80
66
  install
81
67
  Autobuild.update_environment(prefix)
82
68
  end
69
+
70
+ Autobuild.update_environment(prefix)
71
+ end
72
+
73
+ def depends_on(*packages)
74
+ super
75
+ stamps = packages.collect { |p| Package[p.to_s].installstamp }
76
+ file configurestamp => stamps
77
+ end
78
+
79
+ def ensure_dependencies_installed
80
+ dependencies.each do |pkg|
81
+ Rake::Task[Package[pkg].installstamp].invoke
82
+ end
83
+ end
84
+
85
+ def prepare
83
86
  end
84
87
 
85
88
  # Configure the builddir directory before starting make
@@ -35,7 +35,7 @@ module Autobuild
35
35
  end
36
36
 
37
37
  # Fetch and merge if the merge leads to a fast-forward
38
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch')
38
+ Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch', repository, branch)
39
39
  if !File.readable?( File.join('.git', 'FETCH_HEAD') )
40
40
  return
41
41
  end
@@ -63,6 +63,9 @@ module Autobuild
63
63
 
64
64
  # Call the config block (if any)
65
65
  yield(self) if block_given?
66
+
67
+ @doc_dir ||= 'doc'
68
+ @doc_target_dir ||= name
66
69
 
67
70
  # Declare the installation stampfile
68
71
  file installstamp do
@@ -88,6 +91,9 @@ module Autobuild
88
91
  Rake::Task["#{name}-import"].invoke
89
92
  Rake::Task["#{name}-prepare"].invoke
90
93
  Rake::Task["#{name}-build"].invoke
94
+ if has_doc? && !Autobuild.no_doc
95
+ Rake::Task["#{name}-doc"].invoke
96
+ end
91
97
  end
92
98
  task :default => name
93
99
  end
@@ -95,6 +101,69 @@ module Autobuild
95
101
  def import; @importer.import(self) if @importer end
96
102
  def prepare; end
97
103
 
104
+ # Directory in which the documentation target will have generated the
105
+ # documentation (if any). The interpretation of relative directories
106
+ # is package-specific. The default implementation interpret them
107
+ # as relative to the source directory, but packages like CMake will
108
+ # interpret them as relative to their build directories.
109
+ attr_accessor :doc_dir
110
+
111
+ # Directory in which the documentation target should install the
112
+ # documentation. If it is relative, it is interpreted as relative to
113
+ # the prefix directory.
114
+ attr_accessor :doc_target_dir
115
+
116
+ # Defines a documentation generation task. The documentation is first
117
+ # generated by the given block, and then installed. The local attribute
118
+ # #doc_dir defines where the documentation is generated by the
119
+ # package's build system, and the #doc_target_dir and
120
+ # Autobuild.doc_prefix attributes define where it should be installed.
121
+ #
122
+ # The block is invoked in the package's source directory
123
+ #
124
+ # In general, specific package types define a meaningful #with_doc
125
+ # method which calls this method internally.
126
+ def doc_task
127
+ task "#{name}-doc" => "#{name}-build" do
128
+ @installed_doc = false
129
+ catch(:doc_disabled) do
130
+ Dir.chdir(srcdir) do
131
+ yield if block_given?
132
+ end
133
+
134
+ unless @installed_doc
135
+ install_doc
136
+ end
137
+ end
138
+ end
139
+
140
+ task :doc => "#{name}-doc"
141
+ end
142
+
143
+ def install_doc(relative_to = srcdir)
144
+ full_doc_prefix = File.expand_path(Autobuild.doc_prefix, Autobuild.prefix)
145
+ doc_target_dir = File.expand_path(self.doc_target_dir, full_doc_prefix)
146
+ doc_dir = File.expand_path(self.doc_dir, relative_to)
147
+ FileUtils.rm_rf doc_target_dir
148
+ FileUtils.mkdir_p File.dirname(doc_target_dir)
149
+ FileUtils.cp_r doc_dir, doc_target_dir
150
+
151
+ @installed_doc = true
152
+ end
153
+
154
+ # Can be called in the doc_task implementation to announce that the
155
+ # documentation is to be disabled for that package. This is mainly used
156
+ # when a runtime check is necessary to know if a package has
157
+ # documentation or not.
158
+ def doc_disabled
159
+ throw :doc_disabled
160
+ end
161
+
162
+ # True if a documentation task is defined for this package
163
+ def has_doc?
164
+ !!Rake.application.lookup("#{name}-doc")
165
+ end
166
+
98
167
  def post_install(*args, &block)
99
168
  if args.empty?
100
169
  @post_install = block
@@ -130,7 +199,6 @@ module Autobuild
130
199
  task "#{p}-import" => "#{name}-import"
131
200
  task "#{p}-prepare" => "#{name}-prepare"
132
201
  task "#{p}-build" => "#{name}-build"
133
- task "#{p}-install" => "#{name}-install"
134
202
  @provides << p
135
203
  end
136
204
  end
@@ -31,6 +31,20 @@ module Autobuild
31
31
  @defines[name] = value
32
32
  end
33
33
 
34
+ def install_doc
35
+ super(builddir)
36
+ end
37
+
38
+ # Declare that the given target can be used to generate documentation
39
+ def with_doc(target = 'doc')
40
+ doc_task do
41
+ Dir.chdir(builddir) do
42
+ Subprocess.run(name, 'doc', Autobuild.tool(:make), target)
43
+ yield if block_given?
44
+ end
45
+ end
46
+ end
47
+
34
48
  def prepare
35
49
  super
36
50
 
@@ -68,7 +82,7 @@ module Autobuild
68
82
  command << srcdir
69
83
 
70
84
  Subprocess.run(name, 'configure', *command)
71
- touch_stamp configurestamp
85
+ super
72
86
  end
73
87
  end
74
88
 
@@ -88,7 +102,7 @@ module Autobuild
88
102
  Dir.chdir(builddir) do
89
103
  Subprocess.run(name, 'install', Autobuild.tool(:make), 'install')
90
104
  end
91
- touch_stamp(installstamp)
105
+ super
92
106
  end
93
107
  end
94
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-09 00:00:00 +02:00
12
+ date: 2008-10-14 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency