bibliothecary 8.2.6 → 8.3.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf83ce2eee3ff72c5c46565c445c66fd9ed78d0a57986feb80437a43f2c948f3
|
4
|
+
data.tar.gz: 4177c6b7a5b270c4f07128f88b16308e30b2f3f75e50b3367bc1c379576f349a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a3883e9ef9b6713b4f2607283f939c2e0c6523eeefbaac30471d23dafc67506d1a56e032bc7e02f1f7a60d8e10eebe58930325a6df8689d2d66978988cb6bd6
|
7
|
+
data.tar.gz: 1cd8c5e10724a994155a1585f60453c36161b17774c0a1838e48a47d711728df0ee40de88c18780328c715e8af4cbd09c69684a0f5e989e715a05489f14d5803
|
@@ -5,7 +5,6 @@ module Bibliothecary
|
|
5
5
|
attr_accessor :carthage_parser_host
|
6
6
|
attr_accessor :clojars_parser_host
|
7
7
|
attr_accessor :mix_parser_host
|
8
|
-
attr_accessor :gradle_parser_host
|
9
8
|
attr_accessor :yarn_parser_host
|
10
9
|
attr_accessor :conda_parser_host
|
11
10
|
attr_accessor :swift_parser_host
|
@@ -17,7 +16,6 @@ module Bibliothecary
|
|
17
16
|
@carthage_parser_host = 'https://carthage.libraries.io'
|
18
17
|
@clojars_parser_host = 'https://clojars.libraries.io'
|
19
18
|
@mix_parser_host = 'https://mix.libraries.io'
|
20
|
-
@gradle_parser_host = 'https://gradle-parser.libraries.io'
|
21
19
|
@yarn_parser_host = 'https://yarn-parser.libraries.io'
|
22
20
|
@conda_parser_host = 'https://conda-parser.libraries.io'
|
23
21
|
@swift_parser_host = 'http://swift.libraries.io'
|
@@ -13,16 +13,18 @@ module Bibliothecary
|
|
13
13
|
GRADLE_DEP_REGEX = /(\+---|\\---){1}/
|
14
14
|
|
15
15
|
# Builtin methods: https://docs.gradle.org/current/userguide/java_plugin.html#tab:configurations
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
# Deprecated methods: https://docs.gradle.org/current/userguide/upgrading_version_6.html#sec:configuration_removal
|
17
|
+
GRADLE_DEPENDENCY_METHODS = %w(api compile compileClasspath compileOnly compileOnlyApi implementation runtime runtimeClasspath runtimeOnly testCompile testCompileOnly testImplementation testRuntime testRuntimeOnly)
|
18
|
+
|
19
|
+
# Intentionally overly-simplified regexes to scrape deps from build.gradle (Groovy) and build.gradle.kts (Kotlin) files.
|
20
|
+
# To be truly useful bibliothecary would need full Groovy / Kotlin parsers that speaks Gradle,
|
21
|
+
# because the Groovy and Kotlin DSLs have many dynamic ways of declaring dependencies.
|
22
|
+
GRADLE_VERSION_REGEX = /[\w.-]+/ # e.g. '1.2.3'
|
23
|
+
GRADLE_VAR_INTERPOLATION_REGEX = /\$\w+/ # e.g. '$myVersion'
|
24
|
+
GRADLE_CODE_INTERPOLATION_REGEX = /\$\{.*\}/ # e.g. '${my-project-settings["version"]}'
|
25
|
+
GRADLE_GAV_REGEX = /([\w.-]+)\:([\w.-]+)(?:\:(#{GRADLE_VERSION_REGEX}|#{GRADLE_VAR_INTERPOLATION_REGEX}|#{GRADLE_CODE_INTERPOLATION_REGEX}))?/ # e.g. "group:artifactId:1.2.3"
|
26
|
+
GRADLE_GROOVY_SIMPLE_REGEX = /(#{GRADLE_DEPENDENCY_METHODS.join('|')})\s*\(?\s*['"]#{GRADLE_GAV_REGEX}['"]/m
|
27
|
+
GRADLE_KOTLIN_SIMPLE_REGEX = /(#{GRADLE_DEPENDENCY_METHODS.join('|')})\s*\(\s*"#{GRADLE_GAV_REGEX}"/m
|
26
28
|
|
27
29
|
MAVEN_PROPERTY_REGEX = /\$\{(.+?)\}/
|
28
30
|
MAX_DEPTH = 5
|
@@ -233,24 +235,21 @@ module Bibliothecary
|
|
233
235
|
end
|
234
236
|
|
235
237
|
def self.parse_gradle(file_contents, options: {})
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
json['dependencies'].map do |dependency|
|
241
|
-
name = gradle_dependency_name(dependency["group"], dependency["name"])
|
242
|
-
next unless name =~ /[\w-]+\.[\w_-]+(\.[\w-])?\:[\w-]/
|
238
|
+
file_contents
|
239
|
+
.scan(GRADLE_GROOVY_SIMPLE_REGEX) # match 'implementation "group:artifactId:version"'
|
240
|
+
.reject { |(_type, group, artifactId, _version)| group.nil? || artifactId.nil? } # remove any matches with missing group/artifactId
|
241
|
+
.map { |(type, group, artifactId, version)|
|
243
242
|
{
|
244
|
-
name:
|
245
|
-
requirement:
|
246
|
-
type:
|
243
|
+
name: [group, artifactId].join(":"),
|
244
|
+
requirement: version || "*",
|
245
|
+
type: type
|
247
246
|
}
|
248
|
-
|
247
|
+
}
|
249
248
|
end
|
250
249
|
|
251
250
|
def self.parse_gradle_kts(file_contents, options: {})
|
252
251
|
file_contents
|
253
|
-
.scan(
|
252
|
+
.scan(GRADLE_KOTLIN_SIMPLE_REGEX) # match 'implementation("group:artifactId:version")'
|
254
253
|
.reject { |(_type, group, artifactId, _version)| group.nil? || artifactId.nil? } # remove any matches with missing group/artifactId
|
255
254
|
.map { |(type, group, artifactId, version)|
|
256
255
|
{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibliothecary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.2
|
4
|
+
version: 8.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tomlrb
|