mtbuild 0.1.3 → 0.1.4

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: a217788ed422994acb0e8b158ddb179f84298f9f
4
- data.tar.gz: 5c385e802f9c2fd223f993a93b0009cfb7d984ce
3
+ metadata.gz: b0d05d02b66836b1bccc0714228bb5b8ddd3f75b
4
+ data.tar.gz: 9003247800a677e9c85c3edf17a7aa8c27cc9520
5
5
  SHA512:
6
- metadata.gz: 0e02b69f8cf243376deaf87e298b5855adbbc0885003ee3e6a9a73adcf5124c011aa4efd4b013db361fcbb092ccd1ba1e68362829f83f0af7cdc7a8f40352df6
7
- data.tar.gz: f8f2ff9949627b0216253280b44ccfa7ed9625f5f22e7a921678c09a1c9fb86616902eae46f34f0f33fd03428fc879cdd74ec0c8cf260cf30ad1b9832bcee481
6
+ metadata.gz: 465655463b2538271833decc1684553d0170f86fea3301383c23fa766262cdd38a119aa6860ba9020300d0085c8e069aecbd6953d16ee830b9b6e9cba45d2105
7
+ data.tar.gz: 63c20bcf635b5978a934bc2f01f6fedff1214cdc706a8d75f446d6ae08cd303780240a59c373c6860a1012c768cb3310c8791ddc0e1db6df1351d109d3858dc3
data/CHANGES.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Release Notes #
2
2
 
3
3
 
4
+ ## MTBuild 0.1.4 ##
5
+
6
+ ### Changes ###
7
+
8
+ * Made minor changes to examples to fix style.
9
+ * Removed "versioners" because the concept was stupid.
10
+ * Added example of using environment variables.
11
+
12
+
4
13
  ## MTBuild 0.1.3 ##
5
14
 
6
15
  ### Changes ###
data/README.md CHANGED
@@ -321,28 +321,6 @@ MTBuild Frameworks contain pre-compiled objects/libraries and their headers. MTB
321
321
 
322
322
  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.
323
323
 
324
- #### Versioners ####
325
-
326
- MTBuild Versioners update version information inside a source or header file. Versioner tasks are typically invoked on their own with a separate invocation of MTBuild. Versioners are an optional convenience intended for Continuous Integration servers. They're not strictly related to the build process; however, because it's common for CI servers to stamp version information into a file when building, it is convenient to be able to describe the files that need updating along with the rest of the project inside the mtbuildfile.
327
-
328
- For example, the following project is configure to use the Mindtribe Standard Version versioner:
329
-
330
- ```Ruby
331
- application_project :MyApp, File.dirname(__FILE__) do |app|
332
- app.add_configuration :Debug,
333
- sources: ['main.c'],
334
- toolchain: toolchain(:gcc),
335
- versioner: versioner(:mt_std_version,
336
- files: 'src/version.h'
337
- )
338
- end
339
- ```
340
-
341
- The following updates the project's "version.h" header. The parameters to this particular versioner are detailed in a later section.
342
-
343
- ```Shell
344
- mtbuild MyApp:Debug:Version[1,0,0,465,"1.0.0 (465)","f1e471b49a4bedc9cf5c6aabf88cde478e482a69"]
345
- ```
346
324
 
347
325
  #### DSL ####
348
326
 
@@ -467,8 +445,6 @@ Application Project configurations offer the following optional settings:
467
445
 
468
446
  * ```:tests``` - The Rake task names of one or more unit test applications. For example, ```'MyLibraryTest:Test'``` or ```['MyLibraryTest1:Test', 'MyLibraryTest2:Test']```
469
447
 
470
- * ```:versioner``` - A versioner hash constructed with the ```versioner``` DSL method (detailed in a later section).
471
-
472
448
  * ```:pre_build``` - A callable object (typically a ```lambda```) that will be invoked before the build of this configuration begins.
473
449
 
474
450
  * ```:post_build``` - A callable object (typically a ```lambda```) that will be invoked after the build of this configuration completes.
@@ -606,45 +582,3 @@ Define an arm-none-eabi-gcc toolchain by passing ```:arm_none_eabi_gcc``` as the
606
582
 
607
583
  ##### ToolchainArmNoneEabiGcc settings #####
608
584
  The ToolchainArmNoneEabiGcc toolchain uses the same settings as the ToolchainGcc toolchain.
609
-
610
-
611
- ### MTBuild::Versioner ###
612
- Define a Versioner with the following DSL method:
613
-
614
- ```Ruby
615
- def versioner(versioner_name, versioner_configuration={})
616
- ```
617
-
618
- ```versioner_name``` is the name of a valid MTBuild versioner. See following sections for valid versioner names.
619
-
620
- ```versioner_configuration``` expects a hash that contains settings for the versioner.
621
-
622
- ### MTBuild::VersionerMTStdVersion ###
623
- Define a Mindtribe Standard Version versioner by passing ```:mt_std_version``` as the ```versioner_name``` when invoking the ```versioner()``` method.
624
-
625
- ##### VersionerMTStdVersion settings #####
626
- The VersionerMTStdVersion versioner requires the following settings:
627
-
628
- * ```:files``` - One or more version files to be updated. For example, ```'version.h'``` or ```['src/version.h', 'test/version.h']```.
629
-
630
- ##### VersionerMTStdVersion invocation #####
631
-
632
- Mindtribe Standard Version parameters should be specified when invoking MTBuild to run a VersionerMTStdVersion versioner task. These parameters, in order, are:
633
-
634
- * ```major``` - The build's major version number
635
-
636
- * ```minor``` - The build's minor version number
637
-
638
- * ```revision``` - The build's revision number
639
-
640
- * ```build``` - The build's build number
641
-
642
- * ```version_string``` - The build's version as a complete string
643
-
644
- * ```git_SHA``` - The build's git SHA as a string
645
-
646
- For example:
647
-
648
- ```Shell
649
- mtbuild MyApp:Debug:Version[1,0,0,465,"1.0.0 (465)","f1e471b49a4bedc9cf5c6aabf88cde478e482a69"]
650
- ```
@@ -1,6 +1,6 @@
1
1
  module MTBuild
2
2
  # The current MTBuild version.
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
 
6
6
  require 'rake'
@@ -1,7 +1,5 @@
1
1
  module MTBuild
2
2
 
3
- require 'mtbuild/versioner'
4
-
5
3
  # This is the base class for all configuration types.
6
4
  class Configuration
7
5
 
@@ -29,15 +27,10 @@ module MTBuild
29
27
  @post_build = configuration.fetch(:post_build, nil)
30
28
 
31
29
  @pre_build.call if @pre_build.respond_to? :call
32
-
33
- @versioner = nil
34
- @versioner_config = configuration.fetch(:versioner, nil)
35
- @versioner = Versioner.create_versioner(@parent_project.project_name, @project_folder, @output_folder, @configuration_name, @versioner_config) unless @versioner_config.nil?
36
30
  end
37
31
 
38
32
  # Create the actual Rake tasks that will perform the configuration's work
39
33
  def configure_tasks
40
- @versioner.create_version_tasks unless @versioner.nil?
41
34
  end
42
35
 
43
36
  private
@@ -34,13 +34,6 @@ module MTBuild
34
34
  return toolchain_configuration
35
35
  end
36
36
 
37
- # Defines a Versioner
38
- def versioner(versioner_name, versioner_configuration={})
39
- fail "error: the version file configuration is expected to be a hash." unless versioner_configuration.is_a? Hash
40
- versioner_configuration[:name] = versioner_name
41
- return versioner_configuration
42
- end
43
-
44
37
  # Declare an MT file task.
45
38
  #
46
39
  # Example:
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.3
4
+ version: 0.1.4
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-14 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -128,8 +128,6 @@ files:
128
128
  - lib/mtbuild/toolchains/gcc.rb
129
129
  - lib/mtbuild/utils.rb
130
130
  - lib/mtbuild/version.rb
131
- - lib/mtbuild/versioner.rb
132
- - lib/mtbuild/versioners/mt_std_version.rb
133
131
  - lib/mtbuild/workspace.rb
134
132
  - lib/mtbuild.rb
135
133
  - CHANGES.md
@@ -1,54 +0,0 @@
1
- module MTBuild
2
-
3
- # This is the base class for all versioner types.
4
- class Versioner
5
-
6
- def initialize(project_name, project_folder, output_folder, configuration_name, configuration)
7
- @project_name = project_name
8
- @project_folder = project_folder
9
- @output_folder = output_folder
10
- @configuration_name = configuration_name
11
-
12
- check_configuration(configuration)
13
-
14
- @versioner_name = configuration[:name]
15
- end
16
-
17
- # Create the actual Rake tasks that will perform the versioner's work
18
- def create_version_tasks
19
- fail "Versioner didn't provide create_version_tasks"
20
- end
21
-
22
- private
23
-
24
- def check_configuration(configuration)
25
- fail "error. No name specified for versioner in #{@project_name}:#{@configuration_name}" if configuration.fetch(:name, nil).nil?
26
- end
27
-
28
- @registered_versioners = {}
29
-
30
- def self.register_versioner(versioner_name, versioner_class)
31
- @registered_versioners[versioner_name] = versioner_class;
32
- end
33
-
34
- def self.create_versioner(project_name, project_folder, output_folder, configuration_name, versioner_configuration)
35
- versioner_name = versioner_configuration.fetch(:name, nil)
36
- fail "error: versioner name not specified for #{project_name}:#{configuration_name}." if versioner_name.nil?
37
-
38
- versioner_class = @registered_versioners.fetch(versioner_name, nil)
39
- if !versioner_class
40
- versioner = File.join('mtbuild', 'versioners', versioner_name.to_s)
41
- begin
42
- require versioner
43
- rescue LoadError
44
- end
45
- end
46
- versioner_class = @registered_versioners.fetch(versioner_name, nil)
47
- fail "error: version file #{versioner_name} could not be found." if versioner_class.nil?
48
- return Object::const_get(versioner_class).new(project_name, project_folder, output_folder, configuration_name, versioner_configuration)
49
- end
50
-
51
- include Rake::DSL
52
- end
53
-
54
- end
@@ -1,72 +0,0 @@
1
- module MTBuild
2
- require 'mtbuild/versioner'
3
-
4
- Versioner.register_versioner(:mt_std_version, 'MTBuild::VersionerMTStdVersion')
5
-
6
- # This Versioner subclass can update files that follow the standard MindTribe version format.
7
- class VersionerMTStdVersion < Versioner
8
-
9
- def initialize(project_name, project_folder, output_folder, configuration_name, configuration)
10
- super
11
- @version_files = Utils.expand_file_list(configuration.fetch(:files, []), [], @project_folder)
12
- end
13
-
14
- # Create the actual Rake tasks that will perform the versioner's work
15
- def create_version_tasks
16
- namespace @configuration_name do
17
- desc "Update version for '#{@project_name}' with configuration '#{@configuration_name}'"
18
- @version_files.each do |file|
19
- version_task = task :Version, [:major, :minor, :revision, :build, :version_string, :git_SHA] => file do |t, args|
20
- args.with_defaults(:major => '', :minor => '', :revision => '', :build => '', :version_string => '', :git_SHA => '')
21
- update_version(file, args.major, args.minor, args.revision, args.build, args.version_string, args.git_SHA)
22
- puts "updated version in '#{file}'"
23
- end
24
- end
25
- end
26
- end
27
-
28
- private
29
-
30
- def check_configuration(configuration)
31
- super
32
- fail "No version files specified for #{@project_name}:#{@configuration_name}" if configuration.fetch(:files, nil).nil?
33
- end
34
-
35
- # This method searches through a file for version definitions of roughly the following format:
36
- #
37
- # #define xxxMAJOR 0
38
- # #define xxxMINOR 0
39
- # #define xxxREVISION 0
40
- # #define xxxBUILD 0
41
- # #define xxxVERSIONSTRING "0"
42
- # #define xxxGITSHA "0000000000000000000000000000000000000000"
43
- #
44
- # The "xxx" can include almost any valid C/C++ identifier text as needed for the particular application. The spacing
45
- # between the identifier and the defined value is flexible. The order of the definitions is not important and
46
- # definitions can be repeated or omitted. For more detail on the exact search criteria, review the regular expressions
47
- # below.
48
- #
49
- # When one or more of the above lines is found, the defined value is replaced by the respective value passed into this
50
- # method.
51
- def update_version(file_name, major=nil, minor=nil, revision=nil, build=nil, version_string=nil, git_SHA=nil)
52
- matching_list = []
53
-
54
- matching_list << [/(\s*#define\s.+?MAJOR\s*)(\S+?)(\s*.*$)/, "\\1#{major}\\3"] unless major.empty?
55
- matching_list << [/(\s*#define\s.+?MINOR\s*)(.+?)(\s*$)/, "\\1#{minor}\\3"] unless minor.empty?
56
- matching_list << [/(\s*#define\s.+?REVISION\s*)(.+?)(\s*$)/, "\\1#{revision}\\3"] unless revision.empty?
57
- matching_list << [/(\s*#define\s.+?BUILD\s*)(.+?)(\s*$)/, "\\1#{build}\\3"] unless build.empty?
58
- matching_list << [/(\s*#define\s.+?VERSIONSTRING\s*\")(.+?)(\"\s*$)/, "\\1#{version_string}\\3"] unless version_string.empty?
59
- matching_list << [/(\s*#define\s.+?GITSHA\s*\")(.+?)(\"\s*$)/, "\\1#{git_SHA}\\3"] unless git_SHA.empty?
60
-
61
- fail "Nothing to do. Please specify at least one version component to update." if matching_list.empty?
62
-
63
- file_contents = File.read(file_name)
64
- matching_list.each do |matching_expression, replacement_text|
65
- file_contents = file_contents.gsub(matching_expression, replacement_text)
66
- end
67
- File.open(file_name, "w") {|file| file.puts file_contents}
68
- end
69
-
70
- end
71
-
72
- end