Sha256: a28e3a57a386fae6711c02ca6eacd59314b0a5d282a5a790320daec9c94b9824

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

module Buildr
  # Provides the shade method.
  module Shade
    class << self
      def shade(input_jar, output_jar, relocations = {})

        shaded_jar = (input_jar.to_s + '-shaded')
        a = Buildr.artifact('org.realityforge.shade:shade-cli:jar:all:2.0.0')
        a.invoke

        args = []
        args << Java::Commands.path_to_bin('java')
        args << '-jar'
        args << a.to_s
        args << '--input'
        args << input_jar.to_s
        args << '--output'
        args << shaded_jar.to_s
        relocations.each_pair do |k, v|
          args << "-r#{k}=#{v}"
        end

        sh args.join(' ')
        FileUtils.mv shaded_jar, output_jar.to_s
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
realityforge-buildr-1.5.22 addon/buildr/shade.rb
realityforge-buildr-1.5.21 addon/buildr/shade.rb