canoe 0.3.2.3 → 0.3.2.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 +4 -4
- data/lib/config_reader.rb +9 -3
- data/lib/util.rb +1 -1
- data/lib/workspace/build.rb +8 -4
- data/lib/workspace/make.rb +1 -1
- data/lib/workspace/test.rb +10 -6
- data/lib/workspace/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 18aa4cddd71a6a2b06ea69ea320de7e75b5a9155685d5f4918b5047faf9a83af
|
|
4
|
+
data.tar.gz: 488a487b6b2cb872fed7b81e604756c7676e279a3b750e720f3c219aa1f29210
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0e5a956513c53ecee63750c6d13b2ff5ebba51716e72e6631aed667962d5df5e0ea3eee064ba0435a6d3f37ebf3cc2d6128bc5fce0145d6952500ef39eac0e4
|
|
7
|
+
data.tar.gz: 1cf7cd8b486bb92f32c646fa0eebebf94288a97c00362e6af749814c352305a2b3903e4df2ffde3689365d90020522eb681e5e07d9ed486b3a0871a49edb16e7
|
data/lib/config_reader.rb
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
require 'json'
|
|
2
|
+
require_relative 'util'
|
|
2
3
|
|
|
3
4
|
##
|
|
4
5
|
# class ConfigReader
|
|
5
6
|
# Just read a json file
|
|
6
7
|
class ConfigReader
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
include Canoe::Err
|
|
9
|
+
def initialize(file)
|
|
10
|
+
@config_file = file
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def extract_flags
|
|
14
|
+
abort_on_err("config file #{@config_file} does not exsit") unless File.exist? @config_file
|
|
15
|
+
JSON.parse(File.read(@config_file))
|
|
10
16
|
end
|
|
11
17
|
end
|
data/lib/util.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Canoe
|
|
|
25
25
|
module WorkSpaceUtil
|
|
26
26
|
def current_workspace
|
|
27
27
|
abort_on_err 'not in a canoe workspace' unless File.exist? '.canoe'
|
|
28
|
-
config = ConfigReader.
|
|
28
|
+
config = ConfigReader.new('config.json').extract_flags
|
|
29
29
|
|
|
30
30
|
src_sfx = config['source-suffix'] || 'cpp'
|
|
31
31
|
hdr_sfx = config['header-suffix'] || 'hpp'
|
data/lib/workspace/build.rb
CHANGED
|
@@ -18,6 +18,10 @@ module Canoe
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def hdr_of_src(file)
|
|
22
|
+
file.gsub(".#{@source_suffix}", ".#{@header_suffix}")
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
# args are commandline parameters passed to `canoe build`,
|
|
22
26
|
# could be 'all', 'test', 'target', 'base' or empty
|
|
23
27
|
def build(arg = 'target')
|
|
@@ -43,14 +47,14 @@ module Canoe
|
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
def build_compiler_from_config
|
|
46
|
-
flags = ConfigReader.
|
|
47
|
-
compiler_name = flags[
|
|
50
|
+
flags = ConfigReader.new('config.json').extract_flags
|
|
51
|
+
compiler_name = flags['compiler'] ? flags['compiler'] : 'clang++'
|
|
48
52
|
|
|
49
53
|
abort_on_err "compiler #{compiler_name} not found" unless system "which #{compiler_name} > /dev/null"
|
|
50
|
-
compiler_flags = [
|
|
54
|
+
compiler_flags = ['-Isrc/components']
|
|
51
55
|
linker_flags = []
|
|
52
56
|
|
|
53
|
-
c_flags, l_flags = flags[
|
|
57
|
+
c_flags, l_flags = flags['flags']['compile'], flags['flags']['link']
|
|
54
58
|
build_flags(compiler_flags, c_flags)
|
|
55
59
|
build_flags(linker_flags, l_flags)
|
|
56
60
|
|
data/lib/workspace/make.rb
CHANGED
data/lib/workspace/test.rb
CHANGED
|
@@ -50,15 +50,19 @@ module Canoe
|
|
|
50
50
|
rebuild ||= !File.exist?(bin)
|
|
51
51
|
|
|
52
52
|
file = "#{@tests_short}/test_#{name}.#{@source_suffix}"
|
|
53
|
+
rebuild ||= File.mtime(bin) < File.mtime(file)
|
|
53
54
|
|
|
54
55
|
deps = fetch_all_deps
|
|
55
|
-
extract_one_file(file, deps).
|
|
56
|
-
rebuild ||= File.mtime(bin) < File.mtime(f)
|
|
56
|
+
extract_one_file(file, deps).each do |f|
|
|
57
|
+
rebuild ||= File.mtime(bin) < File.mtime(f) || File.mtime(bin) < File.mtime(hdr_of_src(f))
|
|
57
58
|
end
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if rebuild
|
|
61
|
+
build_compiler_from_config
|
|
62
|
+
issue_command bin if build_one_test(file, deps)
|
|
63
|
+
else
|
|
64
|
+
issue_command bin
|
|
65
|
+
end
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
def fetch_all_test_files
|
|
@@ -84,7 +88,7 @@ module Canoe
|
|
|
84
88
|
def compile_one_test(test_file, deps)
|
|
85
89
|
extract_one_file(test_file, deps).each do |f|
|
|
86
90
|
o = file_to_obj(f)
|
|
87
|
-
next if File.exist?(o) && File.mtime(o) > File.mtime(f)
|
|
91
|
+
next if File.exist?(o) && File.mtime(o) > File.mtime(f) && File.mtime(o) > File.mtime(hdr_of_src(f))
|
|
88
92
|
|
|
89
93
|
compile(f, o)
|
|
90
94
|
end
|
data/lib/workspace/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: canoe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.2.
|
|
4
|
+
version: 0.3.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- XIONG Ziwei
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-06-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |+
|
|
14
14
|
Canoe offers project management and building facilities to C/C++ projects.
|