extconf_compile_commands_json 0.0.3 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8d7c642bd054f8d9fc2be995d871882d4289466841fd24485fcb599949b774d
4
- data.tar.gz: 389552e5907835a6ac8b7cccf77cd4d2d43efad407c871df691ca36080ca5f25
3
+ metadata.gz: 3c739766b7103843b06349b2c4b2009c3f03575f263310b726ecdd1f43be2656
4
+ data.tar.gz: 8df257ed2d7c2941c3673b8734e34413fd9a49f8f2302519792f885c543fe49c
5
5
  SHA512:
6
- metadata.gz: 36ca9d74b65d2b3e357b322fbd79ec3c01a4a27087d42d1b37acee48f067c6735f86558e6a4fb99d626b7ffcb7af6a2b9af46bc889f7a1e842150e89f8876515
7
- data.tar.gz: c90b79690b11e0e357f191b9bfeb840c3894bb152b707baa86ed8576efabdd45bf999fb771055a0c580b21dd6a9a235fddffdea1e1bb6b35694d753ca3b1cc03
6
+ metadata.gz: 68280f4d6d5e84cfc6e7444918ac7a0579a97806e9e318473cefc8daa0822cbbd42a04eb17e49508b4d95453c3ea2021445559376f962fbc36e730e12cb16dd9
7
+ data.tar.gz: 83b390d94c7ee493a32decad39745c42c23efc5a4ce31abc49bde6906ad32210b77cc636819fc041c5c7fbabf51bb5d4e4d3fc2a46a9cdc9d3b2a6d0aff1b923
@@ -11,14 +11,16 @@ require "mkmf"
11
11
  # needing to muck about with $LOAD_PATH or Bundler.
12
12
  require_relative "../extconf_compile_commands_json"
13
13
 
14
- module ExtconfCompileCommandsJson
15
- module AutoloadPatch
16
- def create_makefile(*args)
17
- super
18
- ExtconfCompileCommandsJson.generate!
19
- ExtconfCompileCommandsJson.symlink!
20
- end
14
+ # We have to patch MakeMakefile directly, rather than prepending to it, because
15
+ # requiring mkmf includes it into the toplevel main object straight away. So prepending
16
+ # here would be too late.
17
+
18
+ module MakeMakefile
19
+ alias_method :__extconfcc_orig_create_makefile, :create_makefile
20
+ def create_makefile(*args)
21
+ r = __extconfcc_orig_create_makefile(*args)
22
+ ExtconfCompileCommandsJson.generate!
23
+ ExtconfCompileCommandsJson.symlink!
24
+ r
21
25
  end
22
26
  end
23
-
24
- MakeMakefile.prepend ExtconfCompileCommandsJson::AutoloadPatch
@@ -7,15 +7,10 @@ require "fileutils"
7
7
 
8
8
  module ExtconfCompileCommandsJson
9
9
  def self.generate!
10
- mkmf_cflags = []
11
10
  # Start by expanding what's in our magic variables
12
- [$INCFLAGS, $CPPFLAGS, $CFLAGS, $COUTFLAGS].each do |v|
13
- next unless v
14
- mkmf_cflags.concat Shellwords.split(v)
15
- end
16
- # expand that with the contents of the ruby options
17
- mkmf_cflags.map! do |flag|
18
- flag
11
+ mkmf_cflags = [$INCFLAGS, $CPPFLAGS, $CFLAGS, $COUTFLAGS].map { |flag|
12
+ # expand that with the contents of the ruby options
13
+ (flag || "")
19
14
  .gsub("$(arch_hdrdir)", $arch_hdrdir || "")
20
15
  .gsub("$(hdrdir)", $hdrdir || "")
21
16
  .gsub("$(srcdir)", $srcdir || "")
@@ -27,8 +22,12 @@ module ExtconfCompileCommandsJson
27
22
  .gsub("$(debugflags)", RbConfig::CONFIG["debugflags"] || "")
28
23
  .gsub("$(warnflags)", RbConfig::CONFIG["warnflags"] || "")
29
24
  .gsub("$(empty)", "")
30
- end
31
- mkmf_cflags.reject! { |f| f.empty? }
25
+ }.flat_map { |flags|
26
+ # Need to shellwords expand them (_after_ doing the $() subst's)
27
+ Shellwords.split(flags)
28
+ }.reject { |flag|
29
+ flag.empty?
30
+ }
32
31
  # This makes sure that #include "extconf.h" works
33
32
  mkmf_cflags = ["-iquote#{File.realpath(Dir.pwd)}"] + mkmf_cflags
34
33
  compile_commands = $srcs.map do |src|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extconf_compile_commands_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - KJ Tsanaktsidis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-05 00:00:00.000000000 Z
11
+ date: 2022-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard