rubygems/rubygems — pull request #539 by donv (2013-04-15 23:35:39+00:00)
Title: Add 'dalvik' as a recognized RubyGems platform

Ruboto (JRuby on Android - http://ruboto.org/ ) is using RubyGems. We are currently limiting gems to the Ruby, and 'java' platforms, but developers have started developing gems that are specific to Android. The Java-like environment on Android is the DalvikVM which offers much the same environment as Java, so 'java' gems can be used.

I propose to add 'dalvik' as a recognised RubyGems platform to allow developers to release gems that will not be installed on non-Android platforms. This allows versions of gems that are Android specific while having parallel releases that offer pure-Ruby, CEXT, or Java based versions of the gem.

Android has a simple integer concept of API level which should be used to limit the availability of a gem. A platform of 'dalvik' should be valid for all Ruboto apps, while for example a platform of 'dalvik15' should only be valid for API level 15 or higher which corresponds to Android 4.0.3 or later.

This pull request seems to do the trick, although I cannot say I have read the complete RubyGems source. It has allowed me to create a gem that only installs when platform is set to 'universal-dalvik' or 'universal-dalvik-' where the integer is equal or higher than the API level set in the gem platform.

Currently we are overriding Gem.platforms during gem installation to specify that only Ruby, 'java', and 'dalvik' gems should be installed, but we aim to use the "bundle install --platform" feature outlined here: https://github.com/carlhuda/bundler/pull/1164