flgen 0.19.0 → 0.21.0
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 +4 -4
- data/README.md +2 -0
- data/lib/flgen/context.rb +18 -4
- data/lib/flgen/file_list.rb +9 -4
- data/lib/flgen/predefined_macros.yaml +12 -0
- data/lib/flgen/version.rb +1 -1
- data/lib/flgen.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe67e7c60ca35355577e56501c46a5745fec3209091ae08adec482291480bfc2
|
4
|
+
data.tar.gz: b1b22bab5e3221f0b065d56cd280f6511430f7180954242e0adfc5e1d5199cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a736ba945d947a72ddeccf2c1f09f0f75ed27aa9ec79fc59c81518619bd004094a96dd6911185f861371abeb8c25abc3ebe3b7fae4a1695b40c221e08b47b6c3
|
7
|
+
data.tar.gz: b4666bb3afdd53adf29f6a8f6c63d02e660e9c0558b9a5681bf2e33196360eeead5ca6d54a863918915fb3facd4bc57999c6b89c9bdb87d7d3a787c18d5eb4a7
|
data/README.md
CHANGED
@@ -47,6 +47,8 @@ FLGen prives APIs listed below to describe your filelists.
|
|
47
47
|
* Define a text macro.
|
48
48
|
* `macro?(name)`/`macro_defined?(name)`
|
49
49
|
* Return `true` if the given macro is defined.
|
50
|
+
* `macro(name)`
|
51
|
+
* Return the value of the given macro.
|
50
52
|
* `env?(name)`
|
51
53
|
* Return `true` if the givne environment variable is defined.
|
52
54
|
* `env(name)`
|
data/lib/flgen/context.rb
CHANGED
@@ -4,6 +4,7 @@ module FLGen
|
|
4
4
|
class Context
|
5
5
|
def initialize(options)
|
6
6
|
@options = options
|
7
|
+
define_predefined_macros
|
7
8
|
end
|
8
9
|
|
9
10
|
attr_reader :options
|
@@ -35,11 +36,11 @@ module FLGen
|
|
35
36
|
else
|
36
37
|
[macro, value]
|
37
38
|
end
|
38
|
-
add_macro_definition(k
|
39
|
+
add_macro_definition(k, v, false)
|
39
40
|
end
|
40
41
|
|
41
42
|
def macros
|
42
|
-
@macros ||=
|
43
|
+
@macros ||= {}
|
43
44
|
end
|
44
45
|
|
45
46
|
def add_include_directory(directory)
|
@@ -95,8 +96,21 @@ module FLGen
|
|
95
96
|
arguments.none? { |arg| arg.type == :library_file && arg.path == file }
|
96
97
|
end
|
97
98
|
|
98
|
-
def
|
99
|
-
|
99
|
+
def define_predefined_macros
|
100
|
+
return unless options[:tool]
|
101
|
+
|
102
|
+
list_name = File.join(__dir__, 'predefined_macros.yaml')
|
103
|
+
list = YAML.safe_load_file(list_name, filename: list_name, symbolize_names: true)
|
104
|
+
list[options[:tool]]&.each { |macro| add_macro_definition(macro, nil, true) }
|
105
|
+
end
|
106
|
+
|
107
|
+
def add_macro_definition(macro, value, predefined)
|
108
|
+
name = macro.to_sym
|
109
|
+
macros[name] = value || true
|
110
|
+
add_macro_argument(name, value) unless predefined
|
111
|
+
end
|
112
|
+
|
113
|
+
def add_macro_argument(name, value)
|
100
114
|
arguments
|
101
115
|
.delete_if { |argument| argument.type == :define && argument.name == name }
|
102
116
|
add_compile_argument(Arguments::Define.new(name, value))
|
data/lib/flgen/file_list.rb
CHANGED
@@ -31,11 +31,12 @@ module FLGen
|
|
31
31
|
|
32
32
|
def find_files(patterns, from: nil, &block)
|
33
33
|
glob_files(patterns, from, __callee__, caller_location)
|
34
|
-
.then { |e|
|
34
|
+
.then { |e| block_given? && (return e.each(&block)) || e.to_a }
|
35
35
|
end
|
36
36
|
|
37
37
|
def find_file(patterns, from: nil)
|
38
|
-
glob_files(patterns, from, __callee__, caller_location)
|
38
|
+
glob_files(patterns, from, __callee__, caller_location)
|
39
|
+
.first&.then { |f| block_given? && (return yield f) || f }
|
39
40
|
end
|
40
41
|
|
41
42
|
def file?(path, from: :current)
|
@@ -49,11 +50,15 @@ module FLGen
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def macro?(macro)
|
52
|
-
@context.macros.
|
53
|
+
@context.macros.key?(macro.to_sym)
|
53
54
|
end
|
54
55
|
|
55
56
|
alias_method :macro_defined?, :macro?
|
56
57
|
|
58
|
+
def macro(name)
|
59
|
+
@context.macros[name.to_sym]
|
60
|
+
end
|
61
|
+
|
57
62
|
def env?(name)
|
58
63
|
ENV.key?(name.to_s)
|
59
64
|
end
|
@@ -117,7 +122,7 @@ module FLGen
|
|
117
122
|
return
|
118
123
|
end
|
119
124
|
|
120
|
-
@context.__send__("add_#{method_name}"
|
125
|
+
@context.__send__("add_#{method_name}", extracted_path)
|
121
126
|
end
|
122
127
|
|
123
128
|
def raise_no_entry_error(path, location, raise_error)
|
data/lib/flgen/version.rb
CHANGED
data/lib/flgen.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Filelist generator
|
14
14
|
email:
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/flgen/file_list_formatter.rb
|
31
31
|
- lib/flgen/file_list_xsim_formatter.rb
|
32
32
|
- lib/flgen/formatter.rb
|
33
|
+
- lib/flgen/predefined_macros.yaml
|
33
34
|
- lib/flgen/source_file.rb
|
34
35
|
- lib/flgen/version.rb
|
35
36
|
- lib/flgen/vivado_tcl_formatter.rb
|
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
65
|
- !ruby/object:Gem::Version
|
65
66
|
version: '0'
|
66
67
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
68
|
+
rubygems_version: 3.5.9
|
68
69
|
signing_key:
|
69
70
|
specification_version: 4
|
70
71
|
summary: Filelist generator
|