reggae 0.0.1
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 +7 -0
- data/bin/reggae_json_build.rb +6 -0
- data/lib/reggae.rb +188 -0
- metadata +89 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 293aca1dd714ce9306b1e5e91b105d2b1f8af14b
|
|
4
|
+
data.tar.gz: 55d34485b5e8819936850cf8c7cf1ba8ead2ee61
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 66a56aa8bf2d750de046749736846c198be1e6f2ea8fa142cdc61722f58e0e471d2f18fc6bbd8364bf2fee50342d64c5150a50307bb4ea4d5b574392dd82d2eb
|
|
7
|
+
data.tar.gz: 3ae0004152253603e766dba520f499ac2e9049aff0f87a97d605f0185507e852b56357bc62659d640817f9ae07c37d08eb62932effd6a066b789ca28b034a8da
|
data/lib/reggae.rb
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
# Find the build object
|
|
4
|
+
module BuildFinder
|
|
5
|
+
def self.get_build
|
|
6
|
+
builds = []
|
|
7
|
+
ObjectSpace.each_object(Build) { |x| builds << x }
|
|
8
|
+
if builds.length != 1
|
|
9
|
+
fail "Only one Build object may exist, found #{builds.length}"
|
|
10
|
+
end
|
|
11
|
+
builds[0]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Aggregates top-level targets
|
|
16
|
+
class Build
|
|
17
|
+
def initialize(tgt)
|
|
18
|
+
@targets = arrayify(tgt)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_json
|
|
22
|
+
jsonify.to_json
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def jsonify
|
|
26
|
+
@targets.map { |t| t.jsonify }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# A build target
|
|
31
|
+
class Target
|
|
32
|
+
attr_reader :outputs, :command, :dependencies, :implicits
|
|
33
|
+
|
|
34
|
+
def initialize(outputs, command = '', dependencies = [], implicits = [])
|
|
35
|
+
@outputs = arrayify(outputs)
|
|
36
|
+
@command = jsonifiable(command, ShellCommand)
|
|
37
|
+
@dependencies = dependify(dependencies, FixedDependencies)
|
|
38
|
+
@implicits = dependify(implicits, FixedDependencies)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def to_json
|
|
42
|
+
jsonify.to_json
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def jsonify
|
|
46
|
+
{ type: 'fixed',
|
|
47
|
+
command: @command.jsonify,
|
|
48
|
+
outputs: @outputs,
|
|
49
|
+
dependencies: @dependencies.jsonify,
|
|
50
|
+
implicits: @implicits.jsonify
|
|
51
|
+
}
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# A shell command
|
|
56
|
+
class ShellCommand
|
|
57
|
+
def initialize(cmd = '')
|
|
58
|
+
@cmd = cmd
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def jsonify
|
|
62
|
+
@cmd == '' ? {} : { type: 'shell', cmd: @cmd }
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
private def arrayify(arg)
|
|
67
|
+
arg.class == Array ? arg : [arg]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private def jsonifiable(arg, klass)
|
|
71
|
+
(arg.respond_to? :jsonify) ? arg : klass.new(arg)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private def dependify(arg, klass)
|
|
75
|
+
(arg.is_a? Dependencies) ? arg : klass.new(arg)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Equivalent to link in the D version
|
|
79
|
+
class LinkCommand
|
|
80
|
+
def initialize(flags)
|
|
81
|
+
@flags = flags
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def jsonify
|
|
85
|
+
{ type: 'link', flags: @flags }
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def link(exe_name:, flags: '', dependencies: [], implicits: [])
|
|
90
|
+
Target.new([exe_name], LinkCommand.new(flags), dependencies, implicits)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def object_files(src_dirs: [], exclude_dirs: [],
|
|
94
|
+
src_files: [], exclude_files: [],
|
|
95
|
+
flags: '',
|
|
96
|
+
includes: [], string_imports: [])
|
|
97
|
+
DynamicDependencies.new('objectFiles',
|
|
98
|
+
{ src_dirs: src_dirs,
|
|
99
|
+
exclude_dirs: exclude_dirs,
|
|
100
|
+
src_files: src_files,
|
|
101
|
+
exclude_files: exclude_files,
|
|
102
|
+
flags: flags,
|
|
103
|
+
includes: includes,
|
|
104
|
+
string_imports: string_imports })
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class Dependencies
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# A 'compile-time' known list of dependencies
|
|
111
|
+
class FixedDependencies < Dependencies
|
|
112
|
+
def initialize(deps)
|
|
113
|
+
@deps = arrayify(deps)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def jsonify
|
|
117
|
+
{ type: 'fixed', targets: @deps.map { |t| t.jsonify } }
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# a rule to create a static library
|
|
122
|
+
def static_library(name,
|
|
123
|
+
src_dirs: [],
|
|
124
|
+
exclude_dirs: [],
|
|
125
|
+
src_files: [],
|
|
126
|
+
exclude_files: [],
|
|
127
|
+
flags: '',
|
|
128
|
+
includes: [],
|
|
129
|
+
string_imports: [])
|
|
130
|
+
DynamicDependencies.new('staticLibrary',
|
|
131
|
+
{ name: name,
|
|
132
|
+
src_dirs: src_dirs,
|
|
133
|
+
exclude_dirs: exclude_dirs,
|
|
134
|
+
src_files: src_files,
|
|
135
|
+
exclude_files: exclude_files,
|
|
136
|
+
flags: flags,
|
|
137
|
+
includes: includes,
|
|
138
|
+
string_imports: string_imports })
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def scriptlike(src_name:,
|
|
142
|
+
exe_name:,
|
|
143
|
+
flags: '',
|
|
144
|
+
includes: [],
|
|
145
|
+
string_imports: [],
|
|
146
|
+
link_with: [])
|
|
147
|
+
|
|
148
|
+
Dynamic.new('scriptlike',
|
|
149
|
+
{ src_name: src_name,
|
|
150
|
+
exe_name: exe_name,
|
|
151
|
+
flags: flags,
|
|
152
|
+
includes: includes,
|
|
153
|
+
string_imports: string_imports,
|
|
154
|
+
link_with: dependify(link_with, FixedDependencies) })
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# A run-time determined list of dependencies
|
|
158
|
+
class DynamicDependencies < Dependencies
|
|
159
|
+
def initialize(func_name, args)
|
|
160
|
+
@func_name = func_name
|
|
161
|
+
@args = args
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def jsonify
|
|
165
|
+
base = { type: 'dynamic', func: @func_name }
|
|
166
|
+
base.merge(@args)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# dynamic target
|
|
171
|
+
class Dynamic
|
|
172
|
+
def initialize(func_name, args)
|
|
173
|
+
@func_name = func_name
|
|
174
|
+
@args = args
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def jsonify
|
|
178
|
+
hash = { type: 'dynamic', func: @func_name }
|
|
179
|
+
@args.each do |k, v|
|
|
180
|
+
if v.respond_to? :jsonify
|
|
181
|
+
hash[k] = v.jsonify
|
|
182
|
+
else
|
|
183
|
+
hash[k] = v
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
hash
|
|
187
|
+
end
|
|
188
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: reggae
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Atila Neves
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.7'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.7'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description:
|
|
56
|
+
email:
|
|
57
|
+
- atila.neves@cisco.com
|
|
58
|
+
executables:
|
|
59
|
+
- reggae_json_build.rb
|
|
60
|
+
extensions: []
|
|
61
|
+
extra_rdoc_files: []
|
|
62
|
+
files:
|
|
63
|
+
- bin/reggae_json_build.rb
|
|
64
|
+
- lib/reggae.rb
|
|
65
|
+
homepage: https://github.com/atilaneves/reggae-ruby
|
|
66
|
+
licenses:
|
|
67
|
+
- BSD
|
|
68
|
+
metadata: {}
|
|
69
|
+
post_install_message:
|
|
70
|
+
rdoc_options: []
|
|
71
|
+
require_paths:
|
|
72
|
+
- lib
|
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
|
+
requirements:
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: '0'
|
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
requirements: []
|
|
84
|
+
rubyforge_project:
|
|
85
|
+
rubygems_version: 2.4.5.1
|
|
86
|
+
signing_key:
|
|
87
|
+
specification_version: 4
|
|
88
|
+
summary: Ruby front-end to the reggae meta-build system
|
|
89
|
+
test_files: []
|