Sha256: 863160fb73efe67a296c3d12dd8e3cf6da08d0118932098ad595a1999849bd70

Contents?: true

Size: 1.4 KB

Versions: 32

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require "dependabot/file_fetchers/base"

module Dependabot
  module FileFetchers
    module Java
      class Gradle < Dependabot::FileFetchers::Base
        require_relative "gradle/settings_file_parser"

        def self.required_files_in?(filenames)
          filenames.include?("build.gradle")
        end

        def self.required_files_message
          "Repo must contain a build.gradle."
        end

        private

        def fetch_files
          fetched_files = []
          fetched_files << buildfile
          fetched_files += subproject_buildfiles
          fetched_files
        end

        def buildfile
          @buildfile ||= fetch_file_from_host("build.gradle")
        end

        def subproject_buildfiles
          return [] unless settings_file

          subproject_paths =
            SettingsFileParser.
            new(settings_file: settings_file).
            subproject_paths

          subproject_paths.map do |path|
            fetch_file_from_host(File.join(path, "build.gradle"))
          rescue Dependabot::DependencyFileNotFound
            # Gradle itself doesn't worry about missing subprojects, so we don't
            nil
          end.compact
        end

        def settings_file
          @settings_file ||= fetch_file_from_host("settings.gradle")
        rescue Dependabot::DependencyFileNotFound
          nil
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
dependabot-core-0.83.2 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.83.1 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.83.0 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.82.4 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.82.3 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.82.2 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.82.1 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.82.0 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.81.1 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.81.0 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.80.1 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.80.0 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.79.4 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.79.3 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.79.2 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.79.1 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.79.0 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.78.0 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.77.2 lib/dependabot/file_fetchers/java/gradle.rb
dependabot-core-0.77.1 lib/dependabot/file_fetchers/java/gradle.rb