mtbuild 0.1.4 → 0.1.5

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: b0d05d02b66836b1bccc0714228bb5b8ddd3f75b
4
- data.tar.gz: 9003247800a677e9c85c3edf17a7aa8c27cc9520
3
+ metadata.gz: 187145809f7658bc92518be6863f4bdb610f9e62
4
+ data.tar.gz: 748518274ed38a3d00de5c1912ee7e225a1e3255
5
5
  SHA512:
6
- metadata.gz: 465655463b2538271833decc1684553d0170f86fea3301383c23fa766262cdd38a119aa6860ba9020300d0085c8e069aecbd6953d16ee830b9b6e9cba45d2105
7
- data.tar.gz: 63c20bcf635b5978a934bc2f01f6fedff1214cdc706a8d75f446d6ae08cd303780240a59c373c6860a1012c768cb3310c8791ddc0e1db6df1351d109d3858dc3
6
+ metadata.gz: 5c3d17fad767c18324de6c7920774f960d4e8ce03a75514f7f56e9129168963b911cbb41ccc7d6c2ebd76313bfdacef9d9cc4c1ab17aa36b0050f375fca16ed3
7
+ data.tar.gz: d8c2fda21efca90b2db2c35c85fdd8958e7c949ee1b6d6d47444d9dbe73639b2f4911c879dc321eaf9d618bdb2f25bf29ba3de0e93226831c47e2f0678dad22f
data/CHANGES.md CHANGED
@@ -1,13 +1,23 @@
1
1
  # Release Notes #
2
2
 
3
3
 
4
+ ## MTBuild 0.1.5 ##
5
+
6
+ ### Changes ###
7
+
8
+ * Projects no longer need to explicitly specify each desired configuration.
9
+ Instead, they can provide a default configuration which is used as a base
10
+ to automatically create specific configurations from defaults set in the
11
+ parent workspace.
12
+
13
+
4
14
  ## MTBuild 0.1.4 ##
5
15
 
6
16
  ### Changes ###
7
17
 
8
- * Made minor changes to examples to fix style.
9
- * Removed "versioners" because the concept was stupid.
10
- * Added example of using environment variables.
18
+ * Made minor changes to examples to fix style.
19
+ * Removed "versioners" because the concept was stupid.
20
+ * Added example of using environment variables.
11
21
 
12
22
 
13
23
  ## MTBuild 0.1.3 ##
@@ -15,12 +25,12 @@
15
25
  ### Changes ###
16
26
 
17
27
  * Changed 'default' task to 'all' task to be more compatible with 'make'
18
- conventions.
28
+ conventions.
19
29
  * Fixed bug where source files couldn't be excluded with 'excludes'
20
30
  configuration property.
21
31
  * Renamed the 'excludes' property to 'source_excludes' and documented it.
22
32
  (Source file exclusion was previously undocumented--probably because it
23
- didn't work.)
33
+ didn't work.)
24
34
 
25
35
 
26
36
  ## MTBuild 0.1.2 ##
@@ -29,7 +39,7 @@
29
39
 
30
40
  * Fixed issue where executables and libraries are generated with colons in
31
41
  their names due to workspace prefix.
32
- * Added pre-build and post-build project tasks.
42
+ * Added pre-build and post-build project tasks.
33
43
 
34
44
 
35
45
  ## MTBuild 0.1.1 ##
data/README.md CHANGED
@@ -352,7 +352,7 @@ The optional, named parameter, ```pull_default_tasks``` determines whether the p
352
352
 
353
353
  The optional, named parameter ```pull_configurations``` specifies a list of configurations to pull up from the child workspace. Pulling up configurations makes them available to other projects included by the parent workspace.
354
354
 
355
- The optional, named parameter ```push_configurations``` specifies a list of configurations to push down to the child workspace. Pushing down configurations allows you to add to a child workspace's configuration settings. Note that pushing a configuration down to a child cannot be used to create a new configuration for that child. It only lets you add configuration settings to child configurations that already exist. MTBuild ignores pushed configurations that do not exist in the child workspace's projects. Pushing down a configuration is intended to allow a parent workspace to override or add to a child's build settings. This should be used rarely and with caution since it's generally assumed that projects in a child workspace have been tested with the settings provided by that workspace.
355
+ The optional, named parameter ```push_configurations``` specifies a list of configurations to push down to the child workspace. Pushing down configurations allows you to add to a child workspace's configuration settings or, if the child has a default configuration set via ```set_default_configuration()```, you can auto-generate a new configuration.
356
356
 
357
357
  #### add_default_tasks ####
358
358
  Use ```add_default_tasks(default_tasks)``` inside of a workspace configuration block to add tasks that run when you invoke MTBuild with no arguments. The ```default_tasks``` parameter expects one or more (in an array) project task names. The project tasks should be qualified relative to the current workspace. For example, if a workspace includes a project called ```MyApp```, which has a configuration called ```Debug```, you can add this by referring to it as ```MyApp:Debug```. If no default tasks are specified, then invoking MTBuild with no arguments will effectively do nothing.
@@ -412,6 +412,9 @@ This is a base class for projects. You won't typically use it directly, but it p
412
412
  #### task_for_configuration ####
413
413
  Use ```task_for_configuration(config_name)``` to get the fully qualified task name for the project configuration called ```config_name```. This is useful for getting fully qualified task names to register as default tasks using ```MTBuild::Workspace.add_default_tasks```
414
414
 
415
+ #### tasks_for_all_configurations ####
416
+ Use ```tasks_for_all_configurations``` to get a list of the fully qualified task names for all of the project's configurations. This is useful for getting fully qualified task names to register as default tasks using ```MTBuild::Workspace.add_default_tasks```
417
+
415
418
 
416
419
  ### MTBuild::ApplicationProject ###
417
420
 
@@ -427,6 +430,11 @@ application_project(application_name, project_folder, &configuration_block)
427
430
 
428
431
  For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass an ApplicationProject object as this parameter. Inside the block, you can make ApplicationProject calls on this object to add configurations.
429
432
 
433
+ #### set_default_configuration ####
434
+ Use ```set_default_configuration(configuration)``` inside of an application project configuration block to add a default build configuration for the application. The ```configuration``` parameter expects a hash that contains settings for the configuration. Default project configurations allow you to specify a base set of toolchain settings, source files, dependencies, etc. for a project. Any project configurations that are explicitly added with ```add_configuration()``` will be merged with the project default.
435
+
436
+ You can also use ```set_default_configuration()``` in a project along with ```set_configuration_defaults()``` in the parent workspace to auto-generate project configurations without needing to explicitly add each configuration to a project with ```add_configuration()```. If a project contains a default configuration, then any configurations added with ```set_configuration_defaults()``` in a parent workspace will be auto-generated for the project by merging the workspace configuration with the default configuration. Note that you can use all three mechanisms together: ```set_default_configuration()```, ```set_configuration_defaults()```, and ```add_configuration()```. When you do so, the configuration results from the merging of all three tiers of settings.
437
+
430
438
  #### add_configuration ####
431
439
  Use ```add_configuration(configuration_name, configuration)``` inside of an application project configuration block to add a build configuration for the application. 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 "MyApplication" would be "MyApplication:Debug". The ```configuration``` parameter expects a hash that contains settings for the configuration.
432
440
 
@@ -437,7 +445,7 @@ Application Project configurations require the following settings:
437
445
 
438
446
  Application Project configurations offer the following optional settings:
439
447
 
440
- * ```:dependencies``` - The Rake task names of one or more dependencies. For example, ```'MyLibrary:Debug'``` or ```['MyLibrary1:Debug', 'MyLibrary2:Debug']```
448
+ * ```:dependencies``` - The Rake task names of one or more dependencies. For example, ```'MyLibrary:Debug'``` or ```['MyLibrary1:Debug', 'MyLibrary2:Debug']```. You can use the special character '.' to specify the current configuration. For example, ```'MyLibrary:.'``` would expand to ```'MyLibrary:Debug'``` if listed as a dependency in a configuration called 'Debug'.
441
449
 
442
450
  * ```:sources``` - Source files to build in this configuration. Specified as one or more source file names or source file glob patterns. For example, ```'main.c'``` or ```['main.c', 'startup.c']``` or ```['src/main.c', 'src/*.cpp']```. Note that the source file paths should be relative to the project folder.
443
451
 
@@ -1,6 +1,6 @@
1
1
  module MTBuild
2
2
  # The current MTBuild version.
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
 
6
6
  require 'rake'
@@ -6,15 +6,11 @@ module MTBuild
6
6
  # and link phases that produce a binary executable.
7
7
  class ApplicationProject < Project
8
8
 
9
- # Adds a named ApplicationConfiguration to the project.
10
- def add_configuration(configuration_name, configuration)
11
- super
12
- default_configuration = {}
13
- default_configuration = @parent_workspace.configuration_defaults.fetch(configuration_name, {}) unless @parent_workspace.nil?
14
- merged_configuration = Utils.merge_configurations(default_configuration, configuration)
15
- cfg = ApplicationConfiguration.new(self, effective_output_folder, configuration_name, merged_configuration)
16
- @configurations << cfg
17
- cfg
9
+ private
10
+
11
+ # Create an application configuration
12
+ def create_configuration(configuration_name, configuration)
13
+ ApplicationConfiguration.new(self, effective_output_folder, configuration_name, configuration)
18
14
  end
19
15
 
20
16
  end
@@ -17,7 +17,7 @@ module MTBuild
17
17
 
18
18
  def initialize(parent_project, output_folder, configuration_name, configuration)
19
19
  super
20
- @dependencies = namespace_tasks(configuration.fetch(:dependencies, []))
20
+ @dependencies = expand_configuration_wildcards(namespace_tasks(configuration.fetch(:dependencies, [])))
21
21
  @dependencies |= configuration.fetch(:rake_dependencies, [])
22
22
  @default_toolchain_config = configuration[:toolchain]
23
23
  @default_toolchain = Toolchain.create_toolchain(self, @default_toolchain_config)
@@ -43,6 +43,10 @@ module MTBuild
43
43
  return task_list
44
44
  end
45
45
 
46
+ def expand_configuration_wildcards(task_list)
47
+ return task_list.collect {|task| task.sub(':.', ":#{@configuration_name}") }
48
+ end
49
+
46
50
  include Rake::DSL
47
51
  end
48
52
 
@@ -13,22 +13,18 @@ module MTBuild
13
13
  super
14
14
  end
15
15
 
16
- # Adds a named FrameworkConfiguration to the project.
17
- def add_configuration(configuration_name, configuration)
18
- super
19
- default_configuration = {}
20
- default_configuration = @parent_workspace.configuration_defaults.fetch(configuration_name, {}) unless @parent_workspace.nil?
21
- merged_configuration = Utils.merge_configurations(default_configuration, configuration)
22
- cfg = FrameworkConfiguration.new(self, effective_output_folder, configuration_name, merged_configuration, @api_headers)
23
- @configurations << cfg
24
- return cfg
25
- end
26
-
27
16
  # Specifies API header locations
28
17
  def add_api_headers(api_headers)
29
18
  @api_headers += Utils.expand_folder_list(api_headers, @project_folder)
30
19
  end
31
20
 
21
+ private
22
+
23
+ # Create a framework configuration
24
+ def create_configuration(configuration_name, configuration)
25
+ FrameworkConfiguration.new(self, effective_output_folder, configuration_name, configuration, @api_headers)
26
+ end
27
+
32
28
  end
33
29
 
34
30
  end
@@ -24,7 +24,8 @@ module MTBuild
24
24
  # If supplied, the configuration_block will be passed the
25
25
  # newly-constructed Project object.
26
26
  def initialize(project_name, project_folder, &configuration_block)
27
- @configurations = []
27
+ @default_configuration = nil
28
+ @configurations = {}
28
29
  @project_folder = File.expand_path(project_folder)
29
30
  @output_folder = File.expand_path(File.join(@project_folder, MTBuild.default_output_folder))
30
31
  @project_name, @parent_workspace = MTBuild::BuildRegistry.enter_project(project_name, self)
@@ -32,8 +33,10 @@ module MTBuild
32
33
 
33
34
  configuration_block.call(self) if configuration_block
34
35
 
36
+ generate_implicit_workspace_configurations
37
+
35
38
  namespace @project_name do
36
- @configurations.each do |configuration|
39
+ @configurations.each_value do |configuration|
37
40
  configuration.configure_tasks
38
41
  end
39
42
 
@@ -48,6 +51,11 @@ module MTBuild
48
51
  "#{@project_name}:#{config_name}"
49
52
  end
50
53
 
54
+ # Get the list of fully-qualified task names for all configurations
55
+ def tasks_for_all_configurations
56
+ @configurations.keys.collect{ |name| "#{@project_name}:#{name}"}
57
+ end
58
+
51
59
  # Set the project's output folder.
52
60
  def set_output_folder(output_folder)
53
61
  @output_folder = File.expand_path(File.join(@project_folder, output_folder))
@@ -70,9 +78,37 @@ module MTBuild
70
78
  end
71
79
  end
72
80
 
81
+ def add_configuration(configuration_name, configuration)
82
+ merged_configuration = {}
83
+ unless @default_configuration.nil?
84
+ merged_configuration = @default_configuration
85
+ end
86
+ unless @parent_workspace.nil?
87
+ configuration_defaults = @parent_workspace.configuration_defaults.fetch(configuration_name, {})
88
+ merged_configuration = Utils.merge_configurations(configuration_defaults, merged_configuration)
89
+ end
90
+ merged_configuration = Utils.merge_configurations(merged_configuration, configuration)
91
+ cfg = create_configuration(configuration_name, merged_configuration)
92
+ @configurations[configuration_name] = cfg
93
+ cfg
94
+ end
95
+
96
+ def set_default_configuration(configuration)
97
+ @default_configuration = configuration
98
+ end
99
+
73
100
  private
74
101
 
75
- def add_configuration(configuration_name, configuration)
102
+ def create_configuration(configuration_name, configuration)
103
+ nil
104
+ end
105
+
106
+ def generate_implicit_workspace_configurations
107
+ if not @default_configuration.nil? and not @parent_workspace.nil?
108
+ @parent_workspace.configuration_defaults.each do |configuration_name, configuration|
109
+ add_configuration(configuration_name, configuration) unless @configurations.has_key? configuration_name
110
+ end
111
+ end
76
112
  end
77
113
 
78
114
  include Rake::DSL
@@ -16,17 +16,6 @@ module MTBuild
16
16
  end
17
17
  end
18
18
 
19
- # Adds a named static library configuration to the project.
20
- def add_configuration(configuration_name, configuration)
21
- super
22
- default_configuration = {}
23
- default_configuration = @parent_workspace.configuration_defaults.fetch(configuration_name, {}) unless @parent_workspace.nil?
24
- merged_configuration = Utils.merge_configurations(default_configuration, configuration)
25
- cfg = StaticLibraryConfiguration.new(self, effective_output_folder, configuration_name, merged_configuration, @api_headers)
26
- @configurations << cfg
27
- return cfg
28
- end
29
-
30
19
  # Provides a framework package target that builds a framework package with the specified configurations
31
20
  def build_framework_package(configuration_names)
32
21
  @framework_configurations += Utils.ensure_array(configuration_names)
@@ -39,6 +28,11 @@ module MTBuild
39
28
 
40
29
  private
41
30
 
31
+ # Create a static library configuration
32
+ def create_configuration(configuration_name, configuration)
33
+ StaticLibraryConfiguration.new(self, effective_output_folder, configuration_name, configuration, @api_headers)
34
+ end
35
+
42
36
  def configure_framework_tasks
43
37
  namespace @project_name do
44
38
  framework_task = OrganizedPackageTask.new("#{@project_name}", :noversion) do |t|
@@ -7,17 +7,14 @@ module MTBuild
7
7
  # executable is invoked after building successfully.
8
8
  class TestApplicationProject < Project
9
9
 
10
- # Adds a named test application configuration to the project.
11
- def add_configuration(configuration_name, configuration)
12
- super
13
- default_configuration = {}
14
- default_configuration = @parent_workspace.configuration_defaults.fetch(configuration_name, {}) unless @parent_workspace.nil?
15
- merged_configuration = Utils.merge_configurations(default_configuration, configuration)
16
- cfg = TestApplicationConfiguration.new(self, effective_output_folder, configuration_name, merged_configuration)
17
- @configurations << cfg
18
- return cfg
10
+ private
11
+
12
+ # Create a test application configuration
13
+ def create_configuration(configuration_name, configuration)
14
+ TestApplicationConfiguration.new(self, effective_output_folder, configuration_name, configuration)
19
15
  end
20
16
 
17
+
21
18
  end
22
19
 
23
20
  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.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Ryle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2015-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake