Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default gradle configuration #631

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions lib/licensed/sources/gradle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
module Licensed
module Sources
class Gradle < Source
DEFAULT_CONFIGURATIONS = ["runtimeOnly", "runtimeClasspath"].freeze
DEFAULT_CONFIGURATIONS = ["runtimeClasspath"].freeze
GRADLE_LICENSES_PATH = ".gradle-licenses".freeze
GRADLE_LICENSES_CSV_NAME = "licenses.csv".freeze
class Dependency < Licensed::Dependency
Expand Down Expand Up @@ -150,17 +150,12 @@ def run(command)
private

def create_init_script(configurations)
# we need to create extensions in the event that the user hasn't configured custom configurations
# to avoid hitting errors where core Gradle configurations are set with canBeResolved=false
configuration_map = configurations.map { |c| [c, "licensed#{c}"] }.to_h
configuration_dsl = configuration_map.map { |orig, custom| "#{custom}.extendsFrom(#{orig})" }

f = Tempfile.new(["init", ".gradle"])
f.write(
<<~EOF
import com.github.jk1.license.render.CsvReportRenderer
import com.github.jk1.license.filter.LicenseBundleNormalizer
final configs = #{configuration_map.values.inspect}
final configs = #{configurations.inspect}

initscript {
repositories {
Expand All @@ -174,10 +169,6 @@ def create_init_script(configurations)
}

allprojects {
configurations {
#{configuration_dsl.join("\n") }
}

apply plugin: com.github.jk1.license.LicenseReportPlugin
licenseReport {
outputDir = "$rootDir/#{GRADLE_LICENSES_PATH}"
Expand Down