licensed 4.0.0 → 4.0.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: 4c0f6c78059b52e669e7febd8a0a146c7d2bc1d2ff9c7a4e962941470a13845c
4
- data.tar.gz: 14c6ff763c08e1317b430704fe8ec4552373f9ab24df80838f114fdb4d1fe906
3
+ metadata.gz: f4589c212dd085a4f62711a077b50ec04ee1ca398a1c4b39e29644caebd4795e
4
+ data.tar.gz: e2366f102dec2839fa56e3050ceedcba249ecc9fb8012a2cf5074356918a20f4
5
5
  SHA512:
6
- metadata.gz: 7c7af4fe377c93becf816adab3b549452dba206aaf03080f18c42f944991f3572e4822ba768c6cc0ef1f320a81b9643738313097637f6da548b5285180a89ae2
7
- data.tar.gz: be4466294a92d6cdb807fb6ace47b2ff0231430b118e60c7059dbfed92379a4e827e75f9df276e916c034f8f9a7226a95ef621239f1dbd0baecb942a30427a1a
6
+ metadata.gz: c40137a979df559cb8b3adeaf4645c453102b96b7b177fcf391276eb0b93154e10be855325021c231ea1ebd27fca55d43d858ba77b73051a07f1f783d122eeba
7
+ data.tar.gz: 856405d0edbd8dc18d29705004e361a3307fb52efbea60372d17adb941f0a8ebccc977548bae136b16e3956607354b1ab8a3a646fef44344d942e44b83be23f7
data/CHANGELOG.md CHANGED
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 4.0.2
10
+
11
+ ### Fixed
12
+
13
+ - The path to a gradlew executable can be configured when enumerating gradle dependencies (:tada: @LouisBoudreau https://github.com/github/licensed/pull/610)
14
+
15
+ ## 4.0.1
16
+
17
+ ### Fixed
18
+
19
+ - Running gradle tests will no longer fail when gradle is not available (https://github.com/github/licensed/pull/606)
20
+
9
21
  ## 4.0.0
10
22
 
11
23
  ### Added
@@ -677,4 +689,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
677
689
 
678
690
  Initial release :tada:
679
691
 
680
- [Unreleased]: https://github.com/github/licensed/compare/4.0.0...HEAD
692
+ [Unreleased]: https://github.com/github/licensed/compare/4.0.2...HEAD
@@ -14,6 +14,7 @@ gradle:
14
14
  - runtime
15
15
  - runtimeClassPath
16
16
  ```
17
+
17
18
  ### Multi-build projects
18
19
 
19
20
  To run `licensed` for specific projects in a [multi-build project](https://docs.gradle.org/current/userguide/multi_project_builds.html) you must specify the [apps](../configuration/application_source.md) configuration key.
@@ -21,4 +22,13 @@ To run `licensed` for specific projects in a [multi-build project](https://docs.
21
22
  ```yml
22
23
  apps:
23
24
  - source_path: ./path/to/subproject
24
- ```
25
+ ```
26
+
27
+ ### Gradlew
28
+
29
+ The `gradle.gradlew` property is used to determine where the `gradlew` executable is. The default location the [configuration root](../configuration/configuration_root.md).
30
+
31
+ ```yml
32
+ gradle:
33
+ gradlew: path/from/root/to/gradle/gradlew
34
+ ```
@@ -42,7 +42,7 @@ module Licensed
42
42
  end
43
43
 
44
44
  def enabled?
45
- gradle_runner.enabled? && File.exist?(config.pwd.join("build.gradle"))
45
+ !executable.to_s.empty? && File.exist?(config.pwd.join("build.gradle"))
46
46
  end
47
47
 
48
48
  def enumerate_dependencies
@@ -62,8 +62,18 @@ module Licensed
62
62
 
63
63
  private
64
64
 
65
+ def executable
66
+ return @executable if defined?(@executable)
67
+
68
+ @executable = begin
69
+ return gradlew if File.executable?(gradlew)
70
+
71
+ "gradle" if Licensed::Shell.tool_available?("gradle")
72
+ end
73
+ end
74
+
65
75
  def gradle_runner
66
- @gradle_runner ||= Runner.new(config.pwd, configurations)
76
+ @gradle_runner ||= Runner.new(config.pwd, configurations, executable)
67
77
  end
68
78
 
69
79
  # Returns the configurations to include in license generation.
@@ -78,6 +88,14 @@ module Licensed
78
88
  end
79
89
  end
80
90
 
91
+ # Returns the path to the Gradle wrapper.
92
+ def gradlew
93
+ @gradlew ||= begin
94
+ gradlew = config.dig("gradle", "gradlew")
95
+ config.root.join(gradlew || "gradlew").to_s
96
+ end
97
+ end
98
+
81
99
  # Returns a key to uniquely identify a name and version in the obtained CSV content
82
100
  def csv_key(name:, version:)
83
101
  "#{name}-#{version}"
@@ -116,8 +134,9 @@ module Licensed
116
134
  # The Gradle::Runner class is a wrapper which provides
117
135
  # an interface to run gradle commands with the init script initialized
118
136
  class Runner
119
- def initialize(root_path, configurations)
137
+ def initialize(root_path, configurations, executable)
120
138
  @root_path = root_path
139
+ @executable = executable
121
140
  @init_script = create_init_script(root_path, configurations)
122
141
  end
123
142
 
@@ -126,28 +145,13 @@ module Licensed
126
145
  # The configuration cache is an incubating feature that can be activated manually.
127
146
  # The gradle plugin for licenses does not support it so we prevent it to run for gradle version supporting it.
128
147
  args << "--no-configuration-cache" if gradle_version >= "6.6"
129
- Licensed::Shell.execute(executable, "-q", "--init-script", @init_script.path, *args)
130
- end
131
-
132
- def enabled?
133
- !executable.to_s.empty?
148
+ Licensed::Shell.execute(@executable, "-q", "--init-script", @init_script.path, *args)
134
149
  end
135
150
 
136
151
  private
137
152
 
138
153
  def gradle_version
139
- @gradle_version ||= Licensed::Shell.execute(executable, "--version").scan(/Gradle [\d+]\.[\d+]/).last.split(" ").last
140
- end
141
-
142
- def executable
143
- return @executable if defined?(@executable)
144
-
145
- @executable = begin
146
- gradlew = File.join(@root_path, "gradlew")
147
- return gradlew if File.executable?(gradlew)
148
-
149
- "gradle" if Licensed::Shell.tool_available?("gradle")
150
- end
154
+ @gradle_version ||= Licensed::Shell.execute(@executable, "--version").scan(/Gradle [\d+]\.[\d+]/).last.split(" ").last
151
155
  end
152
156
 
153
157
  def create_init_script(path, configurations)
@@ -202,7 +206,7 @@ module Licensed
202
206
  # Prefixes the gradle command with the project name for multi-build projects.
203
207
  def format_command(command, source_path)
204
208
  Dir.chdir(source_path) do
205
- path = Licensed::Shell.execute(executable, "properties", "-Dorg.gradle.logging.level=quiet").scan(/path:.*/).last.split(" ").last
209
+ path = Licensed::Shell.execute(@executable, "properties", "-Dorg.gradle.logging.level=quiet").scan(/path:.*/).last.split(" ").last
206
210
  path == ":" ? command : "#{path}:#{command}"
207
211
  end
208
212
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "4.0.0".freeze
3
+ VERSION = "4.0.2".freeze
4
4
 
5
5
  def self.previous_major_versions
6
6
  major_version = Gem::Version.new(Licensed::VERSION).segments.first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensed
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee