Sha256: 6145998f150ec7ecb844b8ae365668d2b4523da0d729c7c237426be791e7f6e9

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

require "xmlsimple"

module LicenseFinder
  class Gradle < PackageManager
    def current_packages
      `#{LicenseFinder.config.gradle_command} downloadLicenses`

      xml = license_report.read

      options = {
        'GroupTags' => { 'dependencies' => 'dependency' }
      }
      XmlSimple.xml_in(xml, options).fetch('dependency', []).map do |dep|
        dep["license"].reject! { |l| l["name"] == "No license found" }
        GradlePackage.new(dep, logger: logger)
      end
    end

    private

    def license_report
      Pathname.new('build/reports/license/dependency-license.xml')
    end

    def package_path
      Pathname.new('build.gradle')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
license_finder-1.2 lib/license_finder/package_managers/gradle.rb
license_finder-1.2-java lib/license_finder/package_managers/gradle.rb