mtbuild 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47891c77240ca894e08fc7365e6061070f2cfe04
4
- data.tar.gz: debe5f278d337539a7823630ac23a0a7bf667869
3
+ metadata.gz: 8b0c1036197b946ec76fce626e6318b9ce62c6b5
4
+ data.tar.gz: f0abf5f39b31506c0a855919937147348540f246
5
5
  SHA512:
6
- metadata.gz: b32992c59c8222a1ba40ade766e381d98b88e3eac078ee49cd7a336f0af17c02d3f7c6903eba7563c742816f708d436133ce555577116f98b4b50ccca4357b64
7
- data.tar.gz: baf679c93b1aa348a2d9cc40d1992b895bf0fa6e3a856354f0bf2a3294c5c1291170ff875fbf0658cd6a3419b7408083ae0b7fec6272cc81ba0cd9a067dec890
6
+ metadata.gz: b88fcc23e4ffc42f9abc717eec9fc2d66381fa1f98815a168a25589afa2d9d14caa7f010f3305edfccaa3689010c17673687ef6bdbb6fd1fb72a8ae774987eaf
7
+ data.tar.gz: a270534effc8dc2d446beb07b638e55eca8a1e8ef56519458aacf4f3f90224ec53a1bfb8de9bd2c53297a075f33ba9f51b30488903438f46cf2ad142907e76fc
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # MTBuild #
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/mtbuild.svg)](http://badge.fury.io/rb/mtbuild)
4
+
3
5
  MTBuild is MindTribe's Rake-based build system for building C/C++ projects.
4
6
 
5
7
  MTBuild lives here: https://github.com/MindTribe/MTBuild
@@ -149,7 +151,7 @@ Workspace
149
151
 
150
152
  #### Projects ####
151
153
 
152
- MTBuild currently defines three types of projects.
154
+ MTBuild currently defines four types of projects.
153
155
 
154
156
  ##### Application Project #####
155
157
 
@@ -163,6 +165,10 @@ A library project defines one or more configurations that contain settings for b
163
165
 
164
166
  A test application project defines one or more configurations that contain settings for building an executable application that is executed after building. This project type generates Rake tasks for compiling source files, linking them into an executable, and then running the executable. This is intended for building and running unit tests as part of the build process.
165
167
 
168
+ ##### Framework Project #####
169
+
170
+ A framework project wraps up a static library and its headers for use by applications. See the "Frameworks" section below for more information.
171
+
166
172
  #### Configurations ####
167
173
 
168
174
  A configuration containa build settings for a project. This includes source files, toolchain, dependencies, etc. By defining multiple configurations, a project can be built for different processors (ARM, x86, etc.), different platforms, or simply different settings (debug vs. release). Configurations generate the actual Rake tasks that begin doing work. They are named with a fixed convention that allows you to refer to them in other Rake tasks. The naming scheme is "Project:Configuration". For example, if you declare a project called "MyLibrary" with configuration "Debug", you could list "MyLibrary:Debug" as a dependency in any Rake task and "MyLibrary:Debug" would be built before that task.
@@ -199,12 +205,12 @@ workspace :MyWorkspace, File.dirname(__FILE__) do |w|
199
205
  end
200
206
 
201
207
  static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
208
+ lib.add_api_headers 'include'
202
209
  lib.add_configuration :Debug,
203
210
  sources: ['src/**/*.c'],
204
211
  toolchain: toolchain(:gcc,
205
212
  cflags: '-std=c99',
206
213
  )
207
- api_headers: 'include'
208
214
  end
209
215
  ```
210
216
 
@@ -223,9 +229,9 @@ workspace :MyLibrary, File.dirname(__FILE__) do |w|
223
229
  end
224
230
 
225
231
  static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
232
+ lib.add_api_headers 'include'
226
233
  lib.add_configuration :Debug,
227
- sources: ['src/**/*.c'],
228
- api_headers: 'include'
234
+ sources: ['src/**/*.c']
229
235
  end
230
236
  ```
231
237
 
@@ -235,9 +241,9 @@ Configurations can list dependencies that will be built before the configuration
235
241
 
236
242
  #### Automatic Library Dependencies ####
237
243
 
238
- MTBuild library projects allow you to specify API header locatinos for library project configurations. If you list a library project as a dependency of an application project, MTbuild will automatically include the library's API header paths when compiling the application. Additionally, it will automatically link the application with the library. This is intended to facilitate the scenario where you're building both a library and an application from a Workspace. To use the library from the application, you simply need to list the library as a dependency and MTBuild will make sure the application can use it.
244
+ MTBuild library projects allow you to specify API header locations for framework and static library project configurations. If you list a framework or a static library project as a dependency of an application project, MTbuild will automatically include the framework or library's API header paths when compiling the application. Additionally, it will automatically link the application with the framework or library. This is intended to facilitate the scenario where you're building both a library and an application from a Workspace. To use the library from the application, you simply need to list the library as a dependency and MTBuild will make sure the application can use it.
239
245
 
240
- Note that this does not work with non-MTBuild libraries. If you list a non-MTBuild Rake library task as a dependency of a MTBuild project, you will need to manually add the library's headers and library file to the project.
246
+ Note that this does not work with non-MTBuild libraries. If you list a non-MTBuild Rake library task as a dependency of a MTBuild project, you will need to manually add the library's headers and library file to the project. If you have a precompiled 3rd-party library, you might consider wrapping it in a framework project so that you can use the Automatic Library Dependencies mechanism.
241
247
 
242
248
  ###### Automatic Library Dependencies Example #####
243
249
 
@@ -258,9 +264,9 @@ This defines a library with one configuration called "Debug". The library's API
258
264
 
259
265
  ```Ruby
260
266
  static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
267
+ lib.add_api_headers 'include'
261
268
  lib.add_configuration :Debug,
262
269
  sources: ['src/**/*.c'],
263
- api_headers: 'include',
264
270
  toolchain: toolchain(:gcc)
265
271
  end
266
272
  ```
@@ -283,6 +289,10 @@ application_project :MyApp, File.dirname(__FILE__) do |app|
283
289
  end
284
290
  ```
285
291
 
292
+ #### Frameworks ####
293
+
294
+ MTBuild Frameworks contain pre-compiled objects/libraries and their headers. MTBuild Frameworks generate tasks that don't do anything; however, applications can list Framework configurations as dependencies to take advantage of Automatic Library Dependencies.
295
+
286
296
  #### Toolchains ####
287
297
 
288
298
  MTBuild Toolchains generate the individual compile, archival, and link tasks that comprise an application or library. Most of the interesting settings in a project's configuration go in the toolchain. The settings vary based upon the toolchain.
@@ -415,12 +425,14 @@ For ```configuration_block```, you supply a block that takes one parameter. When
415
425
  #### add_configuration ####
416
426
  Use ```add_configuration(configuration_name, configuration)``` inside of a static library project configuration block to add a build configuration for the library. The ```configuration_name``` parameter expects a symbol that serves as a human-readable name for the configuration. Rake tasks related to this configuration will be namespaced with this symbol. For example, the top-level Rake task for building the "Debug" configuration of "MyLibrary" would be "MyLibrary:Debug". The ```configuration``` parameter expects a hash that contains settings for the configuration.
417
427
 
418
- ##### Static Library Project configuration settings #####
419
- Static Library Project configurations use the same settings as Application Project configurations.
428
+ #### add_api_headers ####
429
+ Use ```add_api_headers(api_headers)``` inside of a static library project configuration block--before adding configurations--to set the location(s) of the library's API headers. The ```api_headers``` parameter should be one or more API header paths. For example, ```'include'``` or ```['include', 'plugins']```. Note that the API header paths should be relative to the project folder. API header paths should NOT contain one another. For example, do not do this: ```['include', 'include/things']```. You can have subfolders inside of an API header location, but you should only add the topmost folder.
420
430
 
421
- Additionally, Static Library Project configurations offer the following optional settings:
431
+ #### build_framework_package ####
432
+ Use ```build_framework_package(configuration_names)``` inside of a static library project configuration block to specify that the library should provide a framework package target. Use ```configuration_names``` to provide a list of configuration names to include in the package. For example, ```'Configuration1'``` or ```['Configuration1', 'Configuration2']```.
422
433
 
423
- * ```:api_headers``` - One or more API header paths. For example, ```'include'``` or ```['include', 'include/plugins']```. Note that the API header paths should be relative to the project folder.
434
+ ##### Static Library Project configuration settings #####
435
+ Static Library Project configurations use the same settings as Application Project configurations.
424
436
 
425
437
  ### MTBuild::TestApplicationProject ###
426
438
  Define a Test Application Project with the following DSL method:
@@ -441,6 +453,33 @@ Use ```add_configuration(configuration_name, configuration)``` inside of a test
441
453
  ##### Test Application Project configuration settings #####
442
454
  Test Application Project configurations use the same settings as Application Library Project configurations.
443
455
 
456
+ ### MTBuild::FrameworkProject ###
457
+
458
+ Define a Framework Project with the following DSL method:
459
+
460
+ ```Ruby
461
+ framework_project(framework_name, project_folder, &configuration_block)
462
+ ```
463
+
464
+ ```framework_name``` is your desired name for the framework. This should be a symbol such as ```:MyApplication```. It serves as a human-readable name for the framework. Rake tasks related to this framework will be namespaced with this symbol. For example, the top-level Rake task for building the "MyLibrary" framework with a configuration called "Debug" would be "MyLibrary:Debug".
465
+
466
+ ```project_folder``` is the location of the project. Project files should be located at or below this location. Typically, you'd simply pass ```File.dirname(__FILE__)``` to use the same folder as the project's Rakefile.
467
+
468
+ For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass an FrameworkProject object as this parameter. Inside the block, you can make FrameworkProject calls on this object to add configurations.
469
+
470
+ #### add_configuration ####
471
+ Use ```add_configuration(configuration_name, configuration)``` inside of a framework project configuration block to add a configuration for the framework. The ```configuration_name``` parameter expects a symbol that serves as a human-readable name for the configuration. Rake tasks related to this configuration will be namespaced with this symbol. For example, the top-level Rake task for building the "Debug" configuration of "MyLibrary" would be "MyLibrary:Debug". The ```configuration``` parameter expects a hash that contains settings for the configuration.
472
+
473
+ #### add_api_headers ####
474
+ Use ```add_api_headers(api_headers)``` inside of a framework project configuration block--before adding configurations--to set the location(s) of the framework's API headers. The ```api_headers``` parameter should be one or more API header paths. For example, ```'include'``` or ```['include', 'plugins']```. Note that the API header paths should be relative to the project folder. API header paths should NOT contain one another. For example, do not do this: ```['include', 'include/things']```. You can have subfolders inside of an API header location, but you should only add the topmost folder.
475
+
476
+ ##### Framework Project configuration settings #####
477
+ Framework Project configurations use the same settings as Application Project configurations.
478
+
479
+ Additionally, Framework Project configurations require the following settings:
480
+
481
+ * ```:objects``` - One or more framework object files. For example, ```'MyLibrary.a'```
482
+
444
483
  ### MTBuild::Toolchain ###
445
484
  Define a Toolchain with the following DSL method:
446
485
 
data/lib/mtbuild.rb CHANGED
@@ -4,6 +4,8 @@ require "mtbuild/application"
4
4
  require "mtbuild/application_project"
5
5
  require "mtbuild/application_task"
6
6
  require "mtbuild/dsl"
7
+ require "mtbuild/framework_project"
8
+ require "mtbuild/framework_task"
7
9
  require "mtbuild/mtbuild"
8
10
  require "mtbuild/staticlibrary_project"
9
11
  require "mtbuild/staticlibrary_task"
@@ -1,5 +1,6 @@
1
1
  module MTBuild
2
2
  require 'mtbuild/compiled_configuration'
3
+ require 'mtbuild/organized_package_task'
3
4
 
4
5
  # Use this class to create application configurations. You won't typically
5
6
  # instantiate this directly. Instead, the ApplicationProject.add_configuration
@@ -31,6 +32,15 @@ module MTBuild
31
32
  end
32
33
  end
33
34
  end
35
+
36
+ namespace @configuration_name do
37
+ OrganizedPackageTask.new("#{@project_name}-#{@configuration_name}", :noversion) do |t|
38
+ t.need_tar_gz = true
39
+ t.add_files_to_folder("", application_binaries+application_files)
40
+ end
41
+ end
42
+ Rake::Task[:"#{@project_name}:#{@configuration_name}:package"].prerequisites.insert(0, :"#{@project_name}:#{@configuration_name}")
43
+
34
44
  end
35
45
 
36
46
  end
data/lib/mtbuild/dsl.rb CHANGED
@@ -12,6 +12,11 @@ module MTBuild
12
12
  MTBuild::ApplicationProject.new(application_name, project_folder, &configuration_block)
13
13
  end
14
14
 
15
+ # Defines a FrameworkProject
16
+ def framework_project(framework_name, project_folder, &configuration_block)
17
+ MTBuild::FrameworkProject.new(framework_name, project_folder, &configuration_block)
18
+ end
19
+
15
20
  # Defines a StaticLibraryProject
16
21
  def static_library_project(library_name, project_folder, &configuration_block)
17
22
  MTBuild::StaticLibraryProject.new(library_name, project_folder, &configuration_block)
@@ -0,0 +1,36 @@
1
+ module MTBuild
2
+ require 'mtbuild/configuration'
3
+
4
+ # Use this class to create framework configurations. You won't typically
5
+ # instantiate this directly. Instead, the FrameworkProject.add_configuration
6
+ # method will create this for you.
7
+ class FrameworkConfiguration < Configuration
8
+
9
+ def initialize(project_name, project_folder, output_folder, configuration_name, configuration, api_headers)
10
+ super project_name, project_folder, output_folder, configuration_name, configuration
11
+ check_configuration(configuration)
12
+ @object_files = Utils.expand_file_list(configuration[:objects], [], @project_folder)
13
+ @api_headers = api_headers
14
+ end
15
+
16
+ # Create the actual Rake tasks that will perform the configuration's work
17
+ def configure_tasks
18
+ super
19
+ desc "Framework '#{@project_name}' with configuration '#{@configuration_name}'"
20
+ new_task = framework_task @configuration_name => @object_files do |t|
21
+ puts "found framework #{t.name}."
22
+ end
23
+ new_task.api_headers = @api_headers
24
+ new_task.library_files = @object_files
25
+ end
26
+
27
+ private
28
+
29
+ def check_configuration(configuration)
30
+ super
31
+ fail "No objects specified for #{@project_name}:#{@configuration_name}" if configuration.fetch(:objects, nil).nil?
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,33 @@
1
+ module MTBuild
2
+ require "mtbuild/framework_configuration"
3
+ require 'mtbuild/project'
4
+
5
+ # This class is used to load frameworks. A framework provides precompiled
6
+ # objects/libraries and API headers. Listing a framework as a dependency in
7
+ # an application will automatically include the framework's API headers and
8
+ # link with its objects/libraries
9
+ class FrameworkProject < Project
10
+
11
+ def initialize(project_name, project_folder, &configuration_block)
12
+ @api_headers = []
13
+ super
14
+ end
15
+
16
+ # Adds a named FrameworkConfiguration to the project.
17
+ def add_configuration(configuration_name, configuration)
18
+ super
19
+ default_configuration = Workspace.configuration_defaults.fetch(configuration_name, {})
20
+ merged_configuration = Utils.merge_configurations(default_configuration, configuration)
21
+ cfg = FrameworkConfiguration.new(@project_name, @project_folder, effective_output_folder, configuration_name, merged_configuration, @api_headers)
22
+ @configurations << cfg
23
+ return cfg
24
+ end
25
+
26
+ # Specifies API header locations
27
+ def add_api_headers(api_headers)
28
+ @api_headers += Utils.expand_folder_list(api_headers, @project_folder)
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,31 @@
1
+ module Rake
2
+
3
+ require 'rake'
4
+
5
+ # This is a top-level Rake task for loading a framework
6
+ class FrameworkTask < Task
7
+
8
+ # API header location for the framework
9
+ attr_accessor :api_headers
10
+
11
+ # The framework objects
12
+ attr_accessor :library_files
13
+
14
+ def initialize(task_name, app)
15
+ super
16
+ @api_headers = ''
17
+ @library_files = ''
18
+ end
19
+
20
+ end
21
+
22
+ module DSL
23
+
24
+ # DSL method to create a framework task.
25
+ def framework_task(*args, &block)
26
+ new_task = Rake::FrameworkTask.define_task(*args, &block)
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,145 @@
1
+ module MTBuild
2
+
3
+ require 'rake'
4
+ require 'rake/packagetask'
5
+ require 'pathname'
6
+
7
+ # Create a packaging task that will package files into distributable packages
8
+ # (e.g zip archive or tar files). The files are organized in folders inside the
9
+ # package.
10
+ #
11
+ # The OrganizedPackageTask will create the following targets:
12
+ #
13
+ # +:package+ ::
14
+ # Create all the requested package files.
15
+ #
16
+ # +:clobber_package+ ::
17
+ # Delete all the package files. This target is automatically
18
+ # added to the main clobber target.
19
+ #
20
+ # +:repackage+ ::
21
+ # Rebuild the package files from scratch, even if they are not out
22
+ # of date.
23
+ #
24
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</tt> ::
25
+ # Create a gzipped tar package (if <em>need_tar</em> is true).
26
+ #
27
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</tt> ::
28
+ # Create a gzipped tar package (if <em>need_tar_gz</em> is true).
29
+ #
30
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</tt> ::
31
+ # Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true).
32
+ #
33
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</tt> ::
34
+ # Create a zip package archive (if <em>need_zip</em> is true).
35
+ #
36
+ # Example:
37
+ #
38
+ # Rake::OrganizedPackageTask.new("MyPackage", "1.2.3") do |p|
39
+ # p.need_tar = true
40
+ # p.add_files_to_folder('bin', 'bin', '**/*')
41
+ # p.package_files.include("lib/**/*.rb")
42
+ # end
43
+ #
44
+ class OrganizedPackageTask < Rake::PackageTask
45
+
46
+ # Add files to a folder in the package
47
+ def add_files_to_folder(package_folder, included_files, excluded_files=[])
48
+ file_list = Utils.expand_file_list(included_files, excluded_files)
49
+ package_file_list = file_list.collect{ |f| File.join(package_dir_path, package_folder, File.basename(f)) }
50
+ @origin_files += file_list
51
+ @destination_files += package_file_list
52
+ end
53
+
54
+ # Add folder to a folder in the package
55
+ def add_folders_to_folder(package_folder, folders, excluded_files=[])
56
+ folders.each do |folder|
57
+ file_list = Utils.expand_file_list('/**/*', excluded_files, folder)
58
+ package_file_list = file_list.collect{ |f| File.join(package_dir_path, package_folder, get_relative_path(folder,f)) }
59
+ @origin_files += file_list
60
+ @destination_files += package_file_list
61
+ end
62
+ end
63
+
64
+ # Hide the PackageTask package_files because this class doesn't use it
65
+ private :package_files
66
+
67
+ private
68
+
69
+ def init(name, version)
70
+ super
71
+ fail "Version required (or :noversion)" if @version.nil?
72
+ @version = nil if :noversion == @version
73
+ @destination_files = []
74
+ @origin_files = []
75
+ end
76
+
77
+ def get_relative_path(parent, child)
78
+ child = Pathname.new(child)
79
+ parent = Pathname.new(parent)
80
+ return child.relative_path_from(parent).to_s
81
+ end
82
+
83
+ def define
84
+ desc "Build the package"
85
+ task :package
86
+
87
+ desc "Force a rebuild of the package files"
88
+ task :repackage => [:clobber_package, :package]
89
+
90
+ desc "Remove package products"
91
+ task :clobber_package do
92
+ rm_r package_dir rescue nil
93
+ end
94
+
95
+ task :clobber => [:clobber_package]
96
+
97
+ [
98
+ [need_tar, tgz_file, "z"],
99
+ [need_tar_gz, tar_gz_file, "z"],
100
+ [need_tar_bz2, tar_bz2_file, "j"]
101
+ ].each do |(need, file, flag)|
102
+ if need
103
+ task :package => ["#{package_dir}/#{file}"]
104
+ file "#{package_dir}/#{file}" =>
105
+ [package_dir_path] + @origin_files + @destination_files do
106
+ chdir(package_dir) do
107
+ sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}}
108
+ end
109
+ end
110
+ end
111
+ end
112
+
113
+ if need_zip
114
+ task :package => ["#{package_dir}/#{zip_file}"]
115
+ file "#{package_dir}/#{zip_file}" =>
116
+ [package_dir_path] + @origin_files + @destination_files do
117
+ chdir(package_dir) do
118
+ sh %{#{@zip_command} -r #{zip_file} #{package_name}}
119
+ end
120
+ end
121
+ end
122
+
123
+ directory package_dir_path
124
+
125
+ @destination_files.each_index do |i|
126
+ origin_file = @origin_files[i]
127
+ destination_file = @destination_files[i]
128
+
129
+ file destination_file => [origin_file, package_dir_path] do
130
+ fdir = File.dirname(destination_file)
131
+ mkdir_p(fdir) unless File.exist?(fdir)
132
+ if File.directory?(origin_file)
133
+ mkdir_p(destination_file)
134
+ else
135
+ rm_f destination_file
136
+ safe_ln(origin_file, destination_file)
137
+ end
138
+ end
139
+ end
140
+
141
+ self
142
+ end
143
+ end
144
+
145
+ end
@@ -61,10 +61,6 @@ module MTBuild
61
61
  def add_configuration(configuration_name, configuration)
62
62
  end
63
63
 
64
- def create_configuration_tasks(configuration_name, configuration)
65
- check_configuration(configuration_name, configuration)
66
- end
67
-
68
64
  include Rake::DSL
69
65
  end
70
66
 
@@ -6,12 +6,9 @@ module MTBuild
6
6
  # method will create this for you.
7
7
  class StaticLibraryConfiguration < CompiledConfiguration
8
8
 
9
- # API header location for the static library
10
- attr_reader :api_headers
11
-
12
- def initialize(project_name, project_folder, output_folder, configuration_name, configuration)
13
- super
14
- @api_headers = Utils.expand_folder_list(configuration.fetch(:api_headers, []), @project_folder)
9
+ def initialize(project_name, project_folder, output_folder, configuration_name, configuration, api_headers)
10
+ @api_headers = api_headers
11
+ super project_name, project_folder, output_folder, configuration_name, configuration
15
12
  end
16
13
 
17
14
  # Create the actual Rake tasks that will perform the configuration's work
@@ -1,21 +1,84 @@
1
1
  module MTBuild
2
2
  require "mtbuild/staticlibrary_configuration"
3
+ require 'mtbuild/organized_package_task'
3
4
  require 'mtbuild/project'
4
5
 
5
6
  # This class is used to build static libraries. A static library has
6
7
  # compilation and archival phases that produce a binary library package.
7
8
  class StaticLibraryProject < Project
8
9
 
10
+ def initialize(project_name, project_folder, &configuration_block)
11
+ @framework_configurations = []
12
+ @api_headers = []
13
+ super
14
+ if @framework_configurations.count > 0
15
+ configure_framework_tasks
16
+ end
17
+ end
18
+
9
19
  # Adds a named static library configuration to the project.
10
20
  def add_configuration(configuration_name, configuration)
11
21
  super
12
22
  default_configuration = Workspace.configuration_defaults.fetch(configuration_name, {})
13
23
  merged_configuration = Utils.merge_configurations(default_configuration, configuration)
14
- cfg = StaticLibraryConfiguration.new(@project_name, @project_folder, effective_output_folder, configuration_name, merged_configuration)
24
+ cfg = StaticLibraryConfiguration.new(@project_name, @project_folder, effective_output_folder, configuration_name, merged_configuration, @api_headers)
15
25
  @configurations << cfg
16
26
  return cfg
17
27
  end
18
28
 
29
+ # Provides a framework package target that builds a framework package with the specified configurations
30
+ def build_framework_package(configuration_names)
31
+ @framework_configurations += Utils.ensure_array(configuration_names)
32
+ end
33
+
34
+ # Specifies API header locations
35
+ def add_api_headers(api_headers)
36
+ @api_headers += Utils.expand_folder_list(api_headers, @project_folder)
37
+ end
38
+
39
+ private
40
+
41
+ def configure_framework_tasks
42
+ namespace @project_name do
43
+ framework_task = OrganizedPackageTask.new("#{@project_name}", :noversion) do |t|
44
+ t.need_tar_gz = true
45
+ t.add_folders_to_folder("Headers", @api_headers)
46
+ @framework_configurations.each do |framework_configuration|
47
+ configuration_name = "#{@project_name}:#{framework_configuration}"
48
+ configuration_task = Rake.application.lookup(configuration_name)
49
+ fail "Unable to locate configuration: #{configuration_name}" if configuration_task.nil?
50
+ fail "Configuration is not a library configuration: #{configuration_name}" unless configuration_task.respond_to? :library_files
51
+
52
+ t.add_files_to_folder("Libraries/#{framework_configuration}", configuration_task.library_files)
53
+ end
54
+ end
55
+
56
+ framework_rakefile = File.join(framework_task.package_dir_path, "Rakefile.rb")
57
+ file framework_rakefile do |f|
58
+ fdir = File.dirname(framework_rakefile)
59
+ mkdir_p(fdir) unless File.exist?(fdir)
60
+
61
+ File.open(framework_rakefile, 'w') do |f|
62
+ f.puts("framework_project :#{@project_name}, File.dirname(__FILE__) do |lib|")
63
+ f.puts(" lib.add_api_headers 'Headers'")
64
+ @framework_configurations.each do |framework_configuration|
65
+ configuration_name = "#{@project_name}:#{framework_configuration}"
66
+ configuration_task = Rake.application.lookup(configuration_name)
67
+ f.puts(" lib.add_configuration :#{framework_configuration},")
68
+ f.puts(" objects: ['Libraries/#{framework_configuration}/*']")
69
+ end
70
+ f.puts("end")
71
+ end
72
+ end
73
+
74
+ @framework_configurations.each do |framework_configuration|
75
+ Rake::Task[:"#{@project_name}:package"].prerequisites.insert(0, :"#{@project_name}:#{framework_configuration}")
76
+ Rake::Task[:"#{@project_name}:package"].prerequisites.insert(0, framework_rakefile)
77
+ end
78
+
79
+ end
80
+ end
81
+
19
82
  end
20
83
 
21
84
  end
@@ -1,4 +1,4 @@
1
1
  module MTBuild
2
2
  # The current MTBuild version.
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Ryle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-18 00:00:00.000000000 Z
11
+ date: 2014-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -107,7 +107,11 @@ files:
107
107
  - lib/mtbuild/compiled_configuration.rb
108
108
  - lib/mtbuild/configuration.rb
109
109
  - lib/mtbuild/dsl.rb
110
+ - lib/mtbuild/framework_configuration.rb
111
+ - lib/mtbuild/framework_project.rb
112
+ - lib/mtbuild/framework_task.rb
110
113
  - lib/mtbuild/mtbuild.rb
114
+ - lib/mtbuild/organized_package_task.rb
111
115
  - lib/mtbuild/project.rb
112
116
  - lib/mtbuild/staticlibrary_configuration.rb
113
117
  - lib/mtbuild/staticlibrary_project.rb
@@ -138,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
142
  requirements:
139
143
  - - '>='
140
144
  - !ruby/object:Gem::Version
141
- version: '0'
145
+ version: 1.9.1
142
146
  required_rubygems_version: !ruby/object:Gem::Requirement
143
147
  requirements:
144
148
  - - '>='