├── docs ├── docinfo.html ├── .awestruct_ignore ├── plugins │ ├── jar.adoc │ ├── war.adoc │ └── storm.adoc ├── jar.adoc ├── war.adoc ├── base.adoc ├── core.adoc ├── images │ ├── jruby-gradle.png │ ├── print-script-output.png │ └── self-executing-jar-output.png ├── news.html.haml ├── _ext │ └── pipeline.rb ├── docs.adoc ├── storm.adoc ├── _config │ └── site.yml ├── cookbook.adoc ├── community.adoc ├── stylesheets │ └── jrubygradle.css ├── examples │ ├── building-wars.gradle │ ├── rspec.gradle │ ├── executable-jar.gradle │ └── basic-topology.gradle ├── news │ ├── 2015-08-16-introduction-at-jrubyconfeu.adoc │ ├── 2015-09-10-jruby-gradle-1.0.4.adoc │ └── 2015-08-04-jrubygradle-one-point-oh.adoc ├── download.adoc ├── _layouts │ └── base.html.haml ├── errors │ ├── jrubyexec-version-conflict.adoc │ └── jar-deprecated-jrubyversion.adoc ├── build.gradle └── index.adoc ├── CNAME ├── war-plugin ├── src │ ├── gradleTest │ │ └── .gitkeep │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ └── com.github.jruby-gradle.war.properties │ │ └── groovy │ │ │ └── com │ │ │ └── github │ │ │ └── jrubygradle │ │ │ └── war │ │ │ └── JRubyWarPlugin.groovy │ └── test │ │ └── groovy │ │ └── com │ │ └── github │ │ └── jrubygradle │ │ └── war │ │ ├── JRubyWarPluginSpec.groovy │ │ └── JRubyWarSpec.groovy ├── build.gradle └── LICENSE ├── base-plugin └── src │ ├── gradleTest │ ├── run-ruby-binscript │ ├── run-simple-ruby-script │ ├── run-script-with-jruby-args │ └── jrubyExec │ │ ├── scripts │ │ └── requiresGem.rb │ │ └── build.gradle │ ├── integTest │ ├── mavenrepo │ │ └── rubygems │ │ │ ├── rack │ │ │ ├── 1.5.3 │ │ │ │ ├── rack-1.5.3.gem │ │ │ │ └── rack-1.5.3.pom │ │ │ └── maven-metadata.xml │ │ │ ├── sinatra │ │ │ ├── 1.4.5 │ │ │ │ ├── sinatra-1.4.5.gem │ │ │ │ └── sinatra-1.4.5.pom │ │ │ └── maven-metadata.xml │ │ │ ├── rack-protection │ │ │ ├── 1.5.3 │ │ │ │ └── rack-protection-1.5.3.gem │ │ │ └── maven-metadata.xml │ │ │ ├── jar-dependencies │ │ │ ├── 0.1.15 │ │ │ │ ├── jar-dependencies-0.1.15.gem │ │ │ │ └── jar-dependencies-0.1.15.pom │ │ │ ├── 0.1.16.pre │ │ │ │ ├── jar-dependencies-0.1.16.pre.gem │ │ │ │ └── jar-dependencies-0.1.16.pre.pom │ │ │ └── maven-metadata.xml │ │ │ └── lookout-rack-utils │ │ │ ├── 3.1.0.12 │ │ │ └── lookout-rack-utils-3.1.0.12.gem │ │ │ └── maven-metadata.xml │ ├── resources │ │ ├── scripts │ │ │ ├── helloWorld.rb │ │ │ ├── helloName.rb │ │ │ ├── envVars.rb │ │ │ ├── require-a-gem.rb │ │ │ └── requiresGem.rb │ │ └── logback-test.xml │ └── groovy │ │ └── com │ │ └── github │ │ └── jrubygradle │ │ ├── testhelper │ │ └── VersionFinder.groovy │ │ ├── JRubyPrepareJarsIntegrationSpec.groovy │ │ └── JRubyGenerateGradleRbIntegrationSpec.groovy │ ├── main │ ├── resources │ │ └── META-INF │ │ │ └── gradle-plugins │ │ │ ├── rubystub.template │ │ │ └── com.github.jruby-gradle.base.properties │ └── groovy │ │ └── com │ │ └── github │ │ └── jrubygradle │ │ ├── UninitialisedParameterException.groovy │ │ ├── internal │ │ └── JRubyPrepareUtils.groovy │ │ ├── JRubyPrepare.groovy │ │ └── JRubyPlugin.groovy │ └── test │ ├── resources │ ├── helloWorld.rb │ └── logback-test.xml │ └── groovy │ └── com │ └── github │ └── jrubygradle │ ├── JRubyPluginSpec.groovy │ └── JRubyPluginExtensionSpec.groovy ├── jar-plugin ├── src │ ├── gradleTest │ │ └── self-executing-jar │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ └── com.github.jruby-gradle.jar.properties │ │ └── groovy │ │ │ └── com │ │ │ └── github │ │ │ └── jrubygradle │ │ │ └── jar │ │ │ └── JRubyJarPlugin.groovy │ ├── test │ │ └── resources │ │ │ └── logback-test.xml │ └── integTest │ │ └── groovy │ │ └── com │ │ └── github │ │ └── jrubygradle │ │ └── jar │ │ ├── JRubyJarIntegrationSpec.groovy │ │ └── helpers │ │ └── IntegrationSpecification.groovy ├── LICENSE ├── README.adoc ├── CHANGELOG.md ├── build.gradle └── gradle │ └── integration-test.gradle ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── license.gradle ├── license.txt └── integration-tests.gradle ├── .gitignore ├── examples ├── run-ruby-binscript │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── build.gradle │ └── gradlew.bat ├── self-executing-jar │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── entrypoint.rb │ ├── build.gradle │ └── gradlew.bat ├── run-simple-ruby-script │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── print-script.rb │ ├── build.gradle │ └── gradlew.bat └── run-script-with-jruby-args │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── print-script.rb │ ├── build.gradle │ └── gradlew.bat ├── settings.gradle ├── .sdkmanrc ├── gradle.properties ├── changelog.rb ├── core-plugin ├── build.gradle ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ ├── jruby-gradle │ │ │ │ └── com.jrubygradle.core-plugin.version.properties │ │ │ │ └── gradle-plugins │ │ │ │ └── com.github.jruby-gradle.core.properties │ │ └── groovy │ │ │ └── com │ │ │ └── github │ │ │ └── jrubygradle │ │ │ ├── api │ │ │ ├── core │ │ │ │ ├── JRubyAwareTask.java │ │ │ │ ├── ApiException.groovy │ │ │ │ ├── GemRepositoryConfiguration.groovy │ │ │ │ ├── IvyXmlProxyServer.java │ │ │ │ ├── JRubyCorePlugin.groovy │ │ │ │ └── RubyGemQueryRestApi.java │ │ │ └── gems │ │ │ │ ├── JarDependency.java │ │ │ │ ├── GemInstallException.groovy │ │ │ │ ├── GemVersionException.groovy │ │ │ │ ├── GemDependency.java │ │ │ │ ├── GemOverwriteAction.groovy │ │ │ │ └── GemGroups.groovy │ │ │ └── internal │ │ │ ├── gems │ │ │ ├── DefaultJarDependency.groovy │ │ │ ├── DefaultGemDependency.groovy │ │ │ └── DefaultGemInfo.groovy │ │ │ └── core │ │ │ ├── PluginMetadata.groovy │ │ │ ├── Transform.groovy │ │ │ └── IvyUtils.groovy │ └── test │ │ └── groovy │ │ └── com │ │ └── github │ │ └── jrubygradle │ │ ├── api │ │ └── core │ │ │ ├── RepositoryHandlerExtensionSpec.groovy │ │ │ └── IvyXmlProxyServerSpec.groovy │ │ └── internal │ │ └── gems │ │ └── GemToIvySpec.groovy └── README.adoc ├── LICENSE.md ├── Jenkinsfile ├── HACKING.adoc ├── README.adoc ├── CODE_OF_CONDUCT.adoc ├── gradlew.bat └── CODE_OF_CONDUCT.md /docs/docinfo.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | jruby-gradle.org 2 | -------------------------------------------------------------------------------- /war-plugin/src/gradleTest/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/.awestruct_ignore: -------------------------------------------------------------------------------- 1 | build 2 | *.gradle 3 | -------------------------------------------------------------------------------- /docs/plugins/jar.adoc: -------------------------------------------------------------------------------- 1 | = The Jar Plugin 2 | 3 | // vim: ft=asciidoc 4 | -------------------------------------------------------------------------------- /docs/plugins/war.adoc: -------------------------------------------------------------------------------- 1 | = The War Plugin 2 | 3 | 4 | // vim: ft=asciidoc 5 | -------------------------------------------------------------------------------- /base-plugin/src/gradleTest/run-ruby-binscript: -------------------------------------------------------------------------------- 1 | ../../../examples/run-ruby-binscript -------------------------------------------------------------------------------- /jar-plugin/src/gradleTest/self-executing-jar: -------------------------------------------------------------------------------- 1 | ../../../examples/self-executing-jar -------------------------------------------------------------------------------- /base-plugin/src/gradleTest/run-simple-ruby-script: -------------------------------------------------------------------------------- 1 | ../../../examples/run-simple-ruby-script -------------------------------------------------------------------------------- /base-plugin/src/gradleTest/run-script-with-jruby-args: -------------------------------------------------------------------------------- 1 | ../../../examples/run-script-with-jruby-args -------------------------------------------------------------------------------- /docs/jar.adoc: -------------------------------------------------------------------------------- 1 | = Jar plugin 2 | :page-layout: base 3 | :toc: right 4 | 5 | include::./../jar-plugin/README.adoc[] 6 | -------------------------------------------------------------------------------- /docs/war.adoc: -------------------------------------------------------------------------------- 1 | = War plugin 2 | :page-layout: base 3 | :toc: right 4 | 5 | include::./../war-plugin/README.adoc[] 6 | -------------------------------------------------------------------------------- /docs/base.adoc: -------------------------------------------------------------------------------- 1 | = Base plugin 2 | :page-layout: base 3 | :toc: right 4 | 5 | include::./../base-plugin/README.adoc[] 6 | -------------------------------------------------------------------------------- /docs/core.adoc: -------------------------------------------------------------------------------- 1 | = Core plugin 2 | :page-layout: base 3 | :toc: right 4 | 5 | include::./../core-plugin/README.adoc[] 6 | -------------------------------------------------------------------------------- /docs/images/jruby-gradle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/docs/images/jruby-gradle.png -------------------------------------------------------------------------------- /docs/images/print-script-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/docs/images/print-script-output.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | *.sw* 3 | .ruby-* 4 | .gradle/ 5 | *.iml 6 | *.ipr 7 | *.iws 8 | .idea 9 | .awestruct/ 10 | out/ 11 | .testconfig 12 | -------------------------------------------------------------------------------- /docs/images/self-executing-jar-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/docs/images/self-executing-jar-output.png -------------------------------------------------------------------------------- /examples/run-ruby-binscript/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/examples/run-ruby-binscript/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/self-executing-jar/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/examples/self-executing-jar/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/run-simple-ruby-script/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/examples/run-simple-ruby-script/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/rack/1.5.3/rack-1.5.3.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/base-plugin/src/integTest/mavenrepo/rubygems/rack/1.5.3/rack-1.5.3.gem -------------------------------------------------------------------------------- /examples/run-script-with-jruby-args/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/examples/run-script-with-jruby-args/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/sinatra/1.4.5/sinatra-1.4.5.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/base-plugin/src/integTest/mavenrepo/rubygems/sinatra/1.4.5/sinatra-1.4.5.gem -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | ['base','war','jar', 'core'].each { mod -> 2 | def fName = "jruby-gradle-${mod}-plugin" 3 | 4 | include fName 5 | project(":${fName}").projectDir = file("${mod}-plugin") 6 | } 7 | 8 | include 'docs' 9 | 10 | -------------------------------------------------------------------------------- /.sdkmanrc: -------------------------------------------------------------------------------- 1 | # Enable auto-env through the sdkman_auto_env config 2 | # Add key=value pairs of SDKs to use below 3 | <<<<<<< HEAD 4 | java=8.0.265.j9-adpt 5 | ======= 6 | java=8.0.282.hs-adpt 7 | >>>>>>> 998cb79 (Add sdkmanrc file and set to use JDK8) 8 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/rack-protection/1.5.3/rack-protection-1.5.3.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/base-plugin/src/integTest/mavenrepo/rubygems/rack-protection/1.5.3/rack-protection-1.5.3.gem -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/0.1.15/jar-dependencies-0.1.15.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/0.1.15/jar-dependencies-0.1.15.gem -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /base-plugin/src/gradleTest/jrubyExec/scripts/requiresGem.rb: -------------------------------------------------------------------------------- 1 | require 'credit_card_validator' 2 | 3 | CreditCardValidator::Validator.options[:test_numbers_are_valid] = true 4 | 5 | if !CreditCardValidator::Validator.valid?('1111 2222 3333 4444') 6 | puts 'Not valid' 7 | end -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/0.1.16.pre/jar-dependencies-0.1.16.pre.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/0.1.16.pre/jar-dependencies-0.1.16.pre.gem -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/lookout-rack-utils/3.1.0.12/lookout-rack-utils-3.1.0.12.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jruby-gradle/jruby-gradle-plugin/HEAD/base-plugin/src/integTest/mavenrepo/rubygems/lookout-rack-utils/3.1.0.12/lookout-rack-utils-3.1.0.12.gem -------------------------------------------------------------------------------- /docs/news.html.haml: -------------------------------------------------------------------------------- 1 | --- 2 | layout: base 3 | title: "JRuby/Gradle News" 4 | --- 5 | 6 | - for post in site.posts 7 | .post 8 | %h1 9 | %a{:href=>post.url}= post.title 10 | %strong 11 | = post.date.strftime( '%d %B %Y' ) 12 | .content 13 | = post.content 14 | -------------------------------------------------------------------------------- /examples/run-ruby-binscript/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 30 00:38:28 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip 7 | -------------------------------------------------------------------------------- /examples/self-executing-jar/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 21 21:07:50 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip 7 | -------------------------------------------------------------------------------- /examples/run-simple-ruby-script/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 21 16:49:32 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip 7 | -------------------------------------------------------------------------------- /examples/run-script-with-jruby-args/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 21 16:49:32 PDT 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip 7 | -------------------------------------------------------------------------------- /examples/run-simple-ruby-script/print-script.rb: -------------------------------------------------------------------------------- 1 | require 'colorize' 2 | 3 | puts "-" * 20 4 | puts "Ruby version: #{RUBY_VERSION}" 5 | puts "Ruby platform: #{RUBY_PLATFORM}" 6 | puts "-" * 20 7 | 8 | puts "Roses are red".red 9 | puts "Violets are blue".blue 10 | puts "I can use JRuby/Gradle".green 11 | puts "And now you can too!".yellow 12 | -------------------------------------------------------------------------------- /examples/run-script-with-jruby-args/print-script.rb: -------------------------------------------------------------------------------- 1 | require 'colorize' 2 | 3 | puts "-" * 20 4 | puts "Ruby version: #{RUBY_VERSION}" 5 | puts "Ruby platform: #{RUBY_PLATFORM}" 6 | puts "-" * 20 7 | 8 | puts "Roses are red".red 9 | puts "Violets are blue".blue 10 | puts "I can use JRuby/Gradle".green 11 | puts "And now you can too!".yellow 12 | -------------------------------------------------------------------------------- /docs/_ext/pipeline.rb: -------------------------------------------------------------------------------- 1 | 2 | 3 | Awestruct::Extensions::Pipeline.new do 4 | extension Awestruct::Extensions::Posts.new( '/news', :posts ) 5 | extension Awestruct::Extensions::Indexifier.new 6 | extension Awestruct::Extensions::Sitemap.new 7 | extension Awestruct::Extensions::Atomizer.new(:posts, '/news.atom', :feed_title => 'JRuby/Gradle News') 8 | end 9 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/lookout-rack-utils/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | rubygems 3 | lookout-rack-utils 4 | 5 | 6 | 3.1.0.12 7 | 8 | 20150507132343 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/docs.adoc: -------------------------------------------------------------------------------- 1 | = JRuby/Gradle API Documentation 2 | :page-layout: base 3 | 4 | == Plugin docs 5 | 6 | * link:/base/[Base] 7 | * link:/jar/[Jar] 8 | * link:/war/[War] 9 | * link:/storm/[Storm] 10 | 11 | == Groovydoc 12 | 13 | * link:/groovydoc/jruby-gradle-base-plugin/[jruby-gradle-base-plugin] 14 | * link:/groovydoc/jruby-gradle-jar-plugin/[jruby-gradle-jar-plugin] 15 | * link:/groovydoc/jruby-gradle-war-plugin/[jruby-gradle-war-plugin] 16 | 17 | -------------------------------------------------------------------------------- /base-plugin/src/main/resources/META-INF/gradle-plugins/rubystub.template: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## Hack our GEM_HOME to make sure that the `rubygems` support can find our 4 | # jars and unpacked gems in the given GEMFOLDER 5 | export GEM_HOME="%%GEMFOLDER%%" 6 | export GEM_PATH="%%GEMFOLDER%%" 7 | export JARS_HOME=$GEM_HOME/jars 8 | export JARS_LOCK=$GEM_HOME/Jars.lock 9 | 10 | exec java -cp %%JRUBYEXEC_CLASSPATH%% org.jruby.Main -rjars/setup -S $@ 11 | 12 | -------------------------------------------------------------------------------- /docs/storm.adoc: -------------------------------------------------------------------------------- 1 | = Storm plugin 2 | :page-layout: base 3 | :toc: right 4 | 5 | 6 | image::https://travis-ci.org/jruby-gradle/jruby-gradle-storm-plugin.svg?branch=master["Build Status", link="https://travis-ci.org/jruby-gradle/jruby-gradle-storm-plugin"] 7 | 8 | image::https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-storm-plugin/images/download.svg[link="https://bintray.com/jruby-gradle/plugins/jruby-gradle-storm-plugin/_latestVersion"] 9 | 10 | -------------------------------------------------------------------------------- /docs/_config/site.yml: -------------------------------------------------------------------------------- 1 | base_url: http://jruby-gradle.org/ 2 | local_tz: UTC 3 | generation: 4 | :in_threads: 0 5 | asciidoctor: 6 | :safe: unsafe 7 | :base_dir: null 8 | :attributes: 9 | compat-mode: '@' 10 | attribute-missing: warn 11 | relfileprefix: '../' 12 | outfilesuffix: '/' 13 | idprefix: '' 14 | idseparator: '-' 15 | icons: font 16 | sectanchors: '' 17 | linkattrs: '' 18 | source-highlighter: coderay 19 | prewrap: null 20 | -------------------------------------------------------------------------------- /docs/cookbook.adoc: -------------------------------------------------------------------------------- 1 | = JRuby Gradle Cookbook 2 | 3 | == Running RSpec 4 | 5 | [source,gradle] 6 | .build.gradle 7 | ---- 8 | include::examples/rspec.gradle[] 9 | ---- 10 | 11 | == Building an executable .jar file 12 | 13 | [source,gradle] 14 | .build.gradle 15 | ---- 16 | include::examples/executable-jar.gradle[] 17 | ---- 18 | 19 | == Creating a .war file 20 | 21 | [source,gradle] 22 | .build.gradle 23 | ---- 24 | include::examples/building-wars.gradle[] 25 | ---- 26 | 27 | // vim: ft=asciidoc 28 | -------------------------------------------------------------------------------- /gradle/license.gradle: -------------------------------------------------------------------------------- 1 | apply plugin : 'com.github.hierynomus.license' 2 | 3 | license { 4 | header = rootProject.file('gradle/license.txt') 5 | strictCheck = true 6 | ignoreFailures = false 7 | ext.year = project.copyrightYear 8 | excludes([ 9 | '**/*.ad', 10 | '**/*.asciidoc', 11 | '**/*.adoc', 12 | '**/rubystub.template' 13 | ]) 14 | } 15 | 16 | pluginManager.withPlugin('org.ysb33r.gradletest') { 17 | licenseGradleTest.enabled = false 18 | } 19 | 20 | -------------------------------------------------------------------------------- /examples/self-executing-jar/entrypoint.rb: -------------------------------------------------------------------------------- 1 | require 'colorize' 2 | 3 | java_import 'org.slf4j.Logger' 4 | java_import 'org.slf4j.LoggerFactory' 5 | 6 | logger = LoggerFactory.getLogger('demo') 7 | 8 | puts "-" * 20 9 | logger.info "Ruby version: #{RUBY_VERSION}" 10 | logger.info "Ruby platform: #{RUBY_PLATFORM}" 11 | logger.info "Current file: #{__FILE__}" 12 | puts "-" * 20 13 | 14 | puts "Roses are red".red 15 | puts "Violets are blue".blue 16 | puts "I can use JRuby/Gradle".green 17 | puts "And now you can too!".yellow 18 | -------------------------------------------------------------------------------- /base-plugin/src/gradleTest/jrubyExec/build.gradle: -------------------------------------------------------------------------------- 1 | import com.github.jrubygradle.JRubyExec 2 | 3 | apply plugin : 'com.github.jruby-gradle.base' 4 | 5 | configurations { 6 | jrubyExec 7 | } 8 | 9 | repositories { 10 | ruby.gems() 11 | } 12 | 13 | dependencies { 14 | jrubyExec 'rubygems:credit_card_validator:1.1.0' 15 | } 16 | 17 | 18 | task requiresGems( type : JRubyExec ) { 19 | jruby { 20 | gemConfiguration 'jrubyExec' 21 | } 22 | 23 | script 'scripts/requiresGem.rb' 24 | } 25 | 26 | task runGradleTest { 27 | dependsOn requiresGems 28 | } 29 | 30 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | version=2.1.0-beta.6 2 | group=com.github.jruby-gradle 3 | copyrightYear=2014-2023 4 | 5 | org.gradle.daemon=true 6 | org.gradle.caching=true 7 | org.gradle.parallel=false 8 | org.gradle.configureondemand=false 9 | 10 | releaseBuild=false 11 | 12 | targetCompatibility=1.8 13 | sourceCompatibility=1.8 14 | 15 | grolifantVersion=1.3.3 16 | jrubyVersion=9.4.2.0 17 | jettyVersion=9.2.12.v20150709 18 | bcprovVersion=1.46 19 | httpbuilderNgVersion=1.0.3 20 | dropwizardMetricsCoreVersion=3.1.0 21 | torqueboxProxy=http://rubygems-proxy.torquebox.org/releases 22 | ratpackVersion=1.6.1 23 | # unit test / integration test only 24 | -------------------------------------------------------------------------------- /docs/community.adoc: -------------------------------------------------------------------------------- 1 | = JRuby/Gradle Community 2 | :page-layout: base 3 | 4 | 5 | == Chat 6 | 7 | 8 | The JRuby/Gradle community can be found primarily on 9 | link:https://gitter.im/jruby-gradle/jruby-gradle-plugin[the jruby-gradle-plugin 10 | Gitter] chat hosted on link:http://gitter.im[gitter.im]. 11 | 12 | You can join the chat with your existing link:https://github.com[GitHub] 13 | account. 14 | 15 | == Mailing List 16 | 17 | For more asynchronous communications, the 18 | link:https://groups.google.com/forum/#!forum/jruby-gradle[jruby-gradle mailing 19 | list] can be used. If you wish to subscribe to the mailing list, email 20 | `jruby-gradle+subscribe@googlegroups.com` 21 | 22 | -------------------------------------------------------------------------------- /docs/stylesheets/jrubygradle.css: -------------------------------------------------------------------------------- 1 | #main_nav { 2 | background: #1A1A1A; 3 | text-align: center; 4 | padding: 4px 0; 5 | font-size: 1.1em; 6 | } 7 | #main_nav ul { 8 | margin: 0; 9 | padding: 0; 10 | } 11 | #main_nav li { 12 | display: inline; 13 | margin: 0 6px; 14 | } 15 | #main_nav a { 16 | color: #CCC; 17 | text-decoration: none; 18 | } 19 | #main_nav a img { 20 | vertical-align: middle; 21 | } 22 | #main_nav a:hover { 23 | color: #EEE; 24 | text-decoration: none; 25 | } 26 | #main_nav .on a { 27 | color: #FFF; 28 | } 29 | 30 | #improve { 31 | margin-right: 5px; 32 | margin-bottom: 15px; 33 | font-weight: bold; 34 | font-size: 0.8em; 35 | float: right; 36 | } 37 | -------------------------------------------------------------------------------- /docs/plugins/storm.adoc: -------------------------------------------------------------------------------- 1 | = The Storm Plugin 2 | 3 | The 4 | link:http://plugins.gradle.org/plugin/com.github.jruby-gradle.storm[jruby-gradle 5 | storm plugin] enables developers to build, test and deploy 6 | link:http://storm;apache.org[Apache Storm] topologies in JRuby. 7 | 8 | NOTE: To learn more about Apache Storm itself, please consult 9 | link:http://storm.apache.org/documentation/Home.html[their documentation]. This 10 | documentation intends only to cover the JRuby Gradle plugin's functionality. 11 | 12 | 13 | 14 | == Working with a basic topology 15 | 16 | [source,gradle] 17 | .build.gradle 18 | ---- 19 | include::examples/basic-topology.gradle[] 20 | ---- 21 | 22 | 23 | // vim: ft=asciidoc 24 | -------------------------------------------------------------------------------- /docs/examples/building-wars.gradle: -------------------------------------------------------------------------------- 1 | /* Add the JRuby Gradle "war" plugin as a dependency of our build script */ 2 | buildscript { 3 | repositories { jcenter() } 4 | 5 | dependencies { 6 | classpath 'com.github.jruby-gradle:jruby-gradle-war-plugin:0.1.5' 7 | } 8 | } 9 | 10 | apply plugin: 'com.github.jruby-gradle.war' 11 | 12 | dependencies { 13 | /* Enumerate some dependencies that will get pulled into the .war */ 14 | gems 'rubygems:colorize:0.7.3' 15 | gems 'rubygems:sinatra:1.4.5' 16 | } 17 | 18 | jrubyWar { 19 | webInf { 20 | /* Include our app inside of `my.war/WEB-INF` */ 21 | from 'app.rb' 22 | /* Include the config.ru to boot the app properly */ 23 | from 'config.ru' 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /docs/examples/rspec.gradle: -------------------------------------------------------------------------------- 1 | /* Add the JRuby Gradle "base" plugin as a dependency of our build script */ 2 | buildscript { 3 | repositories { jcenter() } 4 | dependencies { 5 | classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.9' 6 | } 7 | } 8 | 9 | /* 10 | * Importing the JRubyExec type class so we can create our own JRubyExec-based 11 | * task below 12 | */ 13 | import com.github.jrubygradle.JRubyExec 14 | 15 | dependencies { 16 | /* We need RSpec gems from rubygems.org to run RSpec */ 17 | jrubyExec group: 'rubygems', name: 'rspec', version: '3.1.+' 18 | } 19 | 20 | task spec(type: JRubyExec) { 21 | group 'JRuby' 22 | description 'Execute the RSpecs in JRuby' 23 | jrubyArgs '-S' 24 | script 'rspec' 25 | } 26 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/rack-protection/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | rubygems 3 | rack-protection 4 | 5 | 6 | 0.1.0 7 | 1.0.0 8 | 1.1.2 9 | 1.1.3 10 | 1.1.4 11 | 1.2.0 12 | 1.3.1 13 | 1.3.2 14 | 1.4.0 15 | 1.5.0 16 | 1.5.1 17 | 1.5.2 18 | 1.5.3 19 | 20 | 20150507131958 21 | 22 | 23 | -------------------------------------------------------------------------------- /war-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | description = 'This plugin encapsulates web archive building functionality for JRuby Gradle projects' 2 | 3 | 4 | dependencies { 5 | compile project(':jruby-gradle-base-plugin') 6 | compile group: 'com.github.jruby-gradle', name: 'warbler-bootstrap', version: '0.2.0+' 7 | 8 | testCompile(spockVersion) { 9 | exclude module: 'groovy-all' 10 | } 11 | } 12 | 13 | artifacts { 14 | archives sourcesJar 15 | } 16 | 17 | pluginBundle { 18 | plugins { 19 | gradlePlugin { 20 | id = 'com.github.jruby-gradle.war' 21 | displayName = 'JRuby/Gradle base plugin' 22 | description = 'This plugin encapsulates building deployable WARs using JRuby' 23 | tags = (['jruby', 'war']) 24 | } 25 | } 26 | } 27 | 28 | // vim: ft=groovy 29 | -------------------------------------------------------------------------------- /examples/run-script-with-jruby-args/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This project is intended to be used as an acceptance test *and* a 3 | * documentation example. If you change this file, please be sure that it 4 | * renders appropriately in the generated documentation 5 | */ 6 | import com.github.jrubygradle.JRubyExec 7 | 8 | plugins { 9 | id 'com.github.jruby-gradle.base' 10 | } 11 | 12 | repositories { 13 | ruby.gems() 14 | } 15 | 16 | dependencies { 17 | gems "rubygems:colorize:0.7.7+" 18 | } 19 | 20 | task printSomePrettyOutputPlease(type: JRubyExec) { 21 | description "Execute our nice local print-script.rb" 22 | script "${projectDir}/print-script.rb" 23 | jrubyArgs '--dev' 24 | } 25 | 26 | 27 | /* 28 | * This task is only here for the execution fo the gradleTest 29 | */ 30 | task runGradleTest { 31 | dependsOn printSomePrettyOutputPlease 32 | } 33 | -------------------------------------------------------------------------------- /examples/run-simple-ruby-script/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This project is intended to be used as an acceptance test *and* a 3 | * documentation example. If you change this file, please be sure that it 4 | * renders appropriately in the generated documentation 5 | */ 6 | import com.github.jrubygradle.JRubyExec 7 | 8 | plugins { 9 | id 'com.github.jruby-gradle.base' 10 | } 11 | 12 | repositories { 13 | ruby.gems() 14 | } 15 | 16 | dependencies { 17 | /* Using the built-in `gems` configuration to describe the 18 | * dependencies our JRubyExec-based tasks will need 19 | */ 20 | gems "rubygems:colorize:0.7.7+" 21 | } 22 | 23 | task printSomePrettyOutputPlease(type: JRubyExec) { 24 | description "Execute our nice local print-script.rb" 25 | script "${projectDir}/print-script.rb" 26 | } 27 | 28 | /* 29 | * This task is only here for the execution of the gradleTest 30 | */ 31 | task runGradleTest { 32 | dependsOn printSomePrettyOutputPlease 33 | } 34 | -------------------------------------------------------------------------------- /examples/run-ruby-binscript/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This project is intended to be used as an acceptance test *and* a 3 | * documentation example. If you change this file, please be sure that it 4 | * renders appropriately in the generated documentation 5 | */ 6 | import com.github.jrubygradle.JRubyExec 7 | 8 | plugins { 9 | id 'com.github.jruby-gradle.base' 10 | } 11 | 12 | repositories { 13 | ruby.gems() 14 | } 15 | 16 | dependencies { 17 | /* Using the built-in `gems` configuration to describe the 18 | * dependencies our JRubyExec-based tasks will need. 19 | */ 20 | gems "rubygems:asciidoctor:2.0.20+" 21 | } 22 | 23 | task verifyAsciidoctorWorks(type: JRubyExec) { 24 | description "Verify that we can execute the `asciidoctor` command line tool" 25 | script "asciidoctor" 26 | scriptArgs "--version" 27 | } 28 | 29 | 30 | /* 31 | * This task is only here for the execution of the gradleTest 32 | */ 33 | task runGradleTest { 34 | dependsOn verifyAsciidoctorWorks 35 | } 36 | -------------------------------------------------------------------------------- /changelog.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'json' 4 | require 'net/https' 5 | require 'uri' 6 | 7 | def uri_for(project, milestone) 8 | return URI("https://api.github.com/repos/jruby-gradle/#{project}/issues?state=closed&milestone=#{milestone}") 9 | end 10 | 11 | def changelog_for(project, milestone) 12 | uri = uri_for(project, milestone) 13 | http = Net::HTTP.new(uri.host, uri.port) 14 | http.use_ssl = true 15 | response = http.get(uri.request_uri) 16 | 17 | raise "Status #{response.code}" unless response.code.to_i == 200 18 | 19 | body = JSON.parse(response.body) 20 | 21 | body.reverse.each do |issue| 22 | puts "* [##{issue['number']}](#{issue['html_url']}) - #{issue['title']}" 23 | end 24 | end 25 | 26 | print 'What project? > ' 27 | project = STDIN.gets.chomp 28 | 29 | print 'What milestone? > ' 30 | milestone = STDIN.gets.chomp 31 | 32 | puts 33 | puts "Computing changelog for '#{project}' and milestone '#{milestone}'" 34 | puts 35 | puts '-------------------' 36 | 37 | changelog_for(project, milestone) 38 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | rubygems 3 | jar-dependencies 4 | 5 | 6 | 0.0.2 7 | 0.0.3 8 | 0.0.4 9 | 0.0.5 10 | 0.0.6 11 | 0.0.7 12 | 0.0.8 13 | 0.0.9 14 | 0.1.0 15 | 0.1.1 16 | 0.1.2 17 | 0.1.3 18 | 0.1.4 19 | 0.1.7 20 | 0.1.8 21 | 0.1.10 22 | 0.1.11 23 | 0.1.12 24 | 0.1.13 25 | 0.1.14 26 | 0.1.15 27 | 28 | 20150729140506 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/examples/executable-jar.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { mavenLocal() } 3 | dependencies { 4 | classpath 'com.github.jruby-gradle:jruby-gradle-plugin:0.1.9' 5 | } 6 | } 7 | plugins { 8 | id "com.github.jruby-gradle.jar" version "0.1.2" 9 | id "com.github.johnrengelman.shadow" version "1.1.2" 10 | } 11 | 12 | apply plugin: 'java' 13 | 14 | dependencies { 15 | gems group: 'rubygems', name: 'protobuf', version: '3.0.+' 16 | gems group: 'rubygems', name: 'rake', version: '10.3.+' 17 | } 18 | 19 | 20 | jrubyJavaBootstrap { 21 | jruby { 22 | initScript = 'bin/rake' 23 | } 24 | } 25 | 26 | // Pull the contents of lib and bin into the root of the created jar file 27 | sourceSets { 28 | main { 29 | resources.srcDirs = ['lib', 'bin'] 30 | } 31 | } 32 | 33 | shadowJar { 34 | baseName 'blick-agent' 35 | exclude '*.sw*', '*.gitkeep', '*.md' 36 | 37 | jruby { 38 | // Use the default GEM installation directory 39 | defaultGems() 40 | defaultMainClass() 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | implementation "io.github.http-builder-ng:http-builder-ng-okhttp:${httpbuilderNgVersion}" 3 | implementation "io.ratpack:ratpack-core:${ratpackVersion}" 4 | integrationTestCompile gradleTestKit() 5 | 6 | testCompile(spockVersion) { 7 | exclude module: 'groovy-all' 8 | exclude group: 'org.codehaus.groovy' 9 | } 10 | 11 | integrationTestCompile(spockVersion) { 12 | exclude module: 'groovy-all' 13 | exclude group: 'org.codehaus.groovy' 14 | } 15 | } 16 | 17 | artifacts { 18 | archives sourcesJar 19 | } 20 | 21 | pluginBundle { 22 | plugins { 23 | gradlePlugin { 24 | id = 'com.github.jruby-gradle.core' 25 | displayName = 'JRuby/Gradle core plugin' 26 | description = 'This plugin provides some core dependency resolution for JRuby/Gradle' 27 | tags = (['jruby']) 28 | } 29 | } 30 | } 31 | 32 | processResources { 33 | filesMatching '**/com.jrubygradle.core-plugin.version.properties', { 34 | expand VERSION : project.version 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /jar-plugin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 JRuby Gradle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /war-plugin/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 JRuby Gradle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gradle/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) ${year}, R. Tyler Croy , 2 | Schalk Cronje , Christian Meier, Lookout, Inc. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | jruby-gradle-plugin is distributed under the following license: 2 | ---------------------------------------------------- 3 | 4 | Copyright (c) 2019, R. Tyler Croy , Schalk Cronje, Christian Meier, Lookout, Inc. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | "Software"), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env groovy 2 | 3 | node('docker') { 4 | stage 'Checkout source' 5 | checkout scm 6 | 7 | stage 'Build and test' 8 | List javas = ['7', '8'] 9 | List plugins = ['base', 'war', 'jar'] 10 | Map parallelSteps = [:] 11 | 12 | for (int j = 0; j < javas.size(); j++) { 13 | for (int i = 0; i < plugins.size(); i++) { 14 | def javaVersion = "${javas.get(j)}-jdk" 15 | def plugin = "jruby-gradle-${plugins.get(i)}-plugin" 16 | parallelSteps["${javaVersion}-${plugin}"] = { 17 | node('docker') { 18 | checkout scm 19 | try { 20 | docker.image("openjdk:${javaVersion}").inside { 21 | timeout(45) { 22 | sh "./gradlew -Si ${plugin}:check ${plugin}:gradleTest ${plugin}:assemble" 23 | } 24 | } 25 | } 26 | finally { 27 | junit '**/build/test-results/**/*.xml' 28 | archiveArtifacts artifacts: '**/build/libs/*.jar,build/*.zip', fingerprint: true 29 | } 30 | } 31 | } 32 | } 33 | } 34 | parallel(parallelSteps) 35 | } 36 | -------------------------------------------------------------------------------- /base-plugin/src/test/resources/helloWorld.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | puts "Hello, World" 26 | -------------------------------------------------------------------------------- /HACKING.adoc: -------------------------------------------------------------------------------- 1 | == Running Tests 2 | 3 | This project has both unit tests and integration tests. In our context the distinguishing point is that integration tests 4 | need network connectivity, and unit tests need no more than local file system access. We also expect unit tests to be 5 | very quick, whereas integration tests are allowed to take a _little_ longer. 6 | 7 | Unit tests are in 'src/test' and integration tests are in 'src/integTest'. To run integration tests you would need to 8 | do `./gradlew check` or `./gradlew build`. For unittests just doing `./gradlew test` is enough. 9 | 10 | Test logging is controlled via `logback-test.xml`. Be aware that integration tests generate a lot of debug information. 11 | Please do not commit the config file back with DEBUG turned on. 12 | 13 | === Running single test suites 14 | 15 | If you only want to run the unittests in say `JRubyPlugin` then you can do `./gradlew test --tests JRubyPlugin`. 16 | In a similar manner for integration tests one can do `./gradlew integrationTest --tests JRubyIntegrationSpec`. 17 | 18 | === Running tests in IntelliJ 19 | 20 | Go to `File` -> `Settings` -> `Build, Execution, Deployment` -> `Gradle` -> `Runner`, then check `Delete build/run actions to Gradle` and select `Platform Test Runner`. 21 | 22 | On a Mac use `IntelliJ IDEA` -> `Preferences` instead of `File/Settings`. 23 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/resources/scripts/helloWorld.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | puts "Hello, World" 26 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/resources/scripts/helloName.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | puts "Hello, " + ARGV[0] 26 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/resources/scripts/envVars.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | puts ENV.map { |k, v| "#{k}=#{v}" }.join("\n") 26 | -------------------------------------------------------------------------------- /core-plugin/src/main/resources/META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | version=${VERSION} -------------------------------------------------------------------------------- /base-plugin/src/main/resources/META-INF/gradle-plugins/com.github.jruby-gradle.base.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | implementation-class=com.github.jrubygradle.JRubyPlugin 26 | -------------------------------------------------------------------------------- /jar-plugin/src/main/resources/META-INF/gradle-plugins/com.github.jruby-gradle.jar.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | implementation-class=com.github.jrubygradle.jar.JRubyJarPlugin 26 | -------------------------------------------------------------------------------- /war-plugin/src/main/resources/META-INF/gradle-plugins/com.github.jruby-gradle.war.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | implementation-class=com.github.jrubygradle.war.JRubyWarPlugin 26 | -------------------------------------------------------------------------------- /core-plugin/src/main/resources/META-INF/gradle-plugins/com.github.jruby-gradle.core.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | implementation-class=com.github.jrubygradle.api.core.JRubyCorePlugin 26 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/resources/scripts/require-a-gem.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | require 'a' 26 | 27 | if spec = Gem.loaded_specs['a'] 28 | puts "loaded 'a' gem with version #{spec.version}" 29 | end 30 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | = JRuby/Gradle plugins 2 | 3 | image::https://github.com/jruby-gradle/jruby-gradle-plugin/actions/workflows/build.yml/badge.svg["Build Status", link="https://github.com/jruby-gradle/jruby-gradle-plugin/actions/workflows/build.yml"] 4 | image::https://badges.gitter.im/Join%20Chat.svg[link="https://gitter.im/jruby-gradle/jruby-gradle-plugin", title="Gitter"] 5 | 6 | You can also join us on the link:https://groups.google.com/forum/#!forum/jruby-gradle[JRuby/Gradle mailing list] 7 | 8 | JRuby/Gradle brings the power and flexibility of 9 | link:http://gradle.org[Gradle] 10 | to the Ruby ecosystem! With JRuby/Gradle you can specify your Java and Ruby dependencies together, build jar files, run tests, and much more!. 11 | 12 | 13 | Use of this plugin replaces the need for Rake, link:http://bundler.io[Bundler] 14 | and link:https://github.com/jruby/warbler[Warbler]. 15 | 16 | 17 | NOTE: JRuby/Gradle 2.1 relies on JRuby 9.4 and later. + 18 | JRuby/Gradle 2.0 relies on JRuby 9.x and later. 19 | 20 | 21 | This repository contains the: 22 | 23 | * `core` (in `core-plugin/`): Rubygems proxy. 24 | * `base` (in `base-plugin/`): dependency resolution, executing Ruby, etc. 25 | * `jar` (in `jar-plugin/`): packaging JRuby-based `.jar` files 26 | * `war` (in `war-plugin/`): packaging JRuby-based `.war` files 27 | 28 | 29 | NOTE: More documentation can be found on link:http://jruby-gradle.org[jruby-gradle.org] 30 | 31 | NOTE: The plugins are published at link:https://plugins.gradle.org/u/rtyler[plugins.gradle.org]. -------------------------------------------------------------------------------- /base-plugin/src/integTest/resources/scripts/requiresGem.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2014-2023, R. Tyler Croy , 3 | # Schalk Cronje , Christian Meier, Lookout, Inc. 4 | # 5 | # Permission is hereby granted, free of charge, to any person obtaining 6 | # a copy of this software and associated documentation files (the 7 | # "Software"), to deal in the Software without restriction, including 8 | # without limitation the rights to use, copy, modify, merge, publish, 9 | # distribute, sublicense, and/or sell copies of the Software, and to 10 | # permit persons to whom the Software is furnished to do so, subject to 11 | # the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be 14 | # included in all copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | # 24 | 25 | require 'credit_card_validator' 26 | 27 | CreditCardValidator::Validator.options[:test_numbers_are_valid] = true 28 | 29 | if !CreditCardValidator::Validator.valid?('1111 2222 3333 4444') 30 | puts 'Not valid' 31 | end 32 | -------------------------------------------------------------------------------- /docs/news/2015-08-16-introduction-at-jrubyconfeu.adoc: -------------------------------------------------------------------------------- 1 | = JRuby/Gradle at JRubyConf EU 2015 2 | :page-layout: base 3 | 4 | A couple weeks ago, link:https://github.com/ysb33r[Schalk], 5 | link:https://github.com/mkristian[Christian] and 6 | link:https://github.com/rtyler[I] were fortunate enough to participate in the 7 | wonderful link:http://2015.jrubyconf.eu[JRubyConf EU 2015] in Potsdam Germany. 8 | In the days that preceeded the conference we pulled together and finished up 9 | what would become the link:/news/2015/08/04/jrubygradle-one-point-oh/[1.0 10 | release] of the core plugins. Just in time for my presentation to introduce the 11 | JRuby/Gradle toolchain to the audience. 12 | 13 | Below is a video recoded by link:http://confreaks.tv[Confreaks.tv] of the talk 14 | titled **JRuby/Gradle: Bringing Java Powertools to Ruby**: 15 | 16 | ++++ 17 |
18 | ++++ 19 | 20 | 21 | The link:http://confreaks.tv/events/jrubyconf2015[other sessions] are also 22 | worth checking out as there was a lot of great, in-depth, technical content 23 | presented at the single-track one-day conference. 24 | 25 | 26 | On behalf of the 27 | link:https://www.flickr.com/photos/agentdero/20372579815/[JRuby/Gradle core 28 | team], I'd like to thank the conference organizers (especially 29 | link:https://github.com/pragtob[Tobi]) for hosting such a wonderful event and 30 | allowing us the opportunity to participate. Hopefully we'll be back next year 31 | with more to talk about! 32 | -------------------------------------------------------------------------------- /examples/self-executing-jar/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This project is intended to be used as an acceptance test *and* a 3 | * documentation example. If you change this file, please be sure that it 4 | * renders appropriately in the generated documentation 5 | */ 6 | buildscript { 7 | repositories { jcenter() } 8 | 9 | dependencies { 10 | /* here to make sure that our dependencies get loaded in properly under 11 | * GradleTest, this is NOT needed by end-users 12 | */ 13 | classpath 'com.github.jengelman.gradle.plugins:shadow:[1.2.2,2.0)' 14 | } 15 | } 16 | 17 | plugins { 18 | id 'com.github.jruby-gradle.jar' 19 | } 20 | 21 | repositories { 22 | jcenter() 23 | ruby.gems() 24 | } 25 | 26 | dependencies { 27 | /* Using the built-in `jrubyJar` configuration to describe the 28 | * dependencies our jrubyJar task will need, so the gem is properly 29 | * included in the resulting .jar file 30 | */ 31 | jrubyJar "rubygems:colorize:0.7.7+" 32 | jrubyJar 'org.slf4j:slf4j-simple:1.7.12' 33 | } 34 | 35 | jrubyJar { 36 | /* We want to use this Ruby script as our start point when the jar executes 37 | */ 38 | initScript "${projectDir}/entrypoint.rb" 39 | } 40 | 41 | 42 | /* 43 | * This task is only here for the execution fo the gradleTest 44 | */ 45 | task runGradleTest(type: Exec) { 46 | dependsOn jrubyJar 47 | description "Execute the constructed self-executing jar" 48 | environment [:] 49 | workingDir "${buildDir}/libs" 50 | commandLine 'java', '-jar', jrubyJar.outputs.files.singleFile.absolutePath 51 | } 52 | -------------------------------------------------------------------------------- /docs/download.adoc: -------------------------------------------------------------------------------- 1 | = Download JRuby/Gradle 2 | :page-layout: base 3 | :toc: right 4 | 5 | 6 | You can find historical versions of all the released plugins 7 | on link:https://bintray.com/jruby-gradle/plugins[Bintray], or use the code 8 | snippets below to incorporate the latest plugins into your own link:http://gradle.org[Gradle] file. 9 | 10 | == Base plugin 11 | 12 | .build.gradle 13 | [source, gradle] 14 | ---- 15 | buildscript { 16 | repositories { jcenter() } 17 | 18 | dependencies { 19 | classpath "com.github.jruby-gradle:jruby-gradle-plugin:[1.1.2,1.2)" 20 | } 21 | } 22 | apply plugin: "com.github.jruby-gradle.base" 23 | ---- 24 | 25 | 26 | == Jar plugin 27 | 28 | .build.gradle 29 | [source, gradle] 30 | ---- 31 | buildscript { 32 | repositories { jcenter() } 33 | 34 | dependencies { 35 | classpath "com.github.jruby-gradle:jruby-gradle-jar-plugin:[1.1.2,1.2)" 36 | } 37 | } 38 | apply plugin: "com.github.jruby-gradle.jar" 39 | ---- 40 | 41 | == War plugin 42 | 43 | .build.gradle 44 | [source, gradle] 45 | ---- 46 | buildscript { 47 | repositories { jcenter() } 48 | 49 | dependencies { 50 | classpath "com.github.jruby-gradle:jruby-gradle-war-plugin:[1.1.2,1.2)-alpha" 51 | } 52 | } 53 | apply plugin: "com.github.jruby-gradle.war" 54 | ---- 55 | 56 | == Storm plugin 57 | 58 | .build.gradle 59 | [source, gradle] 60 | ---- 61 | buildscript { 62 | repositories { jcenter() } 63 | 64 | dependencies { 65 | classpath "com.github.jruby-gradle:jruby-gradle-storm-plugin:[0.4.2,0.5)" 66 | } 67 | } 68 | apply plugin: "com.github.jruby-gradle.storm" 69 | ---- 70 | 71 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyAwareTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core; 25 | 26 | import org.gradle.api.Task; 27 | 28 | /** For tasks that require JRuby in some form 29 | * 30 | * @author Schalk W. Cronjé 31 | * 32 | * @since 2.0 33 | */ 34 | public interface JRubyAwareTask extends Task { 35 | } 36 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/JarDependency.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.gems; 25 | 26 | /** JAR dependency as specified by a GEM spec. 27 | * 28 | */ 29 | public interface JarDependency extends GemDependency { 30 | /** Group/organisation that the JAR belongs to 31 | * 32 | * @return Can be {@code null} if no organisation. 33 | */ 34 | String getGroup(); 35 | } 36 | -------------------------------------------------------------------------------- /gradle/integration-tests.gradle: -------------------------------------------------------------------------------- 1 | // This is based upon what Rob Fletcher has done at 2 | // https://raw.githubusercontent.com/robfletcher/gradle-compass/master/gradle/integration-tests.gradle 3 | 4 | configurations { 5 | integrationTestCompile { 6 | extendsFrom testCompile 7 | } 8 | integrationTestRuntime { 9 | extendsFrom integrationTestCompile, testRuntime 10 | } 11 | integrationTestGems 12 | } 13 | 14 | dependencies { 15 | integrationTestCompile gradleTestKit() 16 | 17 | /* We want to cache jruby-complete at this alternative version which we use 18 | * in many places 19 | */ 20 | integrationTestGems "org.jruby:jruby-complete:${olderJRubyVersion}" 21 | } 22 | 23 | sourceSets { 24 | integrationTest { 25 | java.srcDir file("src/integTest/java") 26 | groovy.srcDir file("src/integTest/groovy") 27 | resources.srcDir file("src/integTest/resources") 28 | compileClasspath = sourceSets.main.output + configurations.integrationTestCompile 29 | runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime 30 | } 31 | } 32 | 33 | task copyIntegrationTestGems (type:Copy) { 34 | from ({configurations.integrationTestGems.files}) 35 | into new File(buildDir,'tmp/integrationTest/flatRepo') 36 | } 37 | 38 | task integrationTest(type: Test, dependsOn: jar) { 39 | testClassesDirs = sourceSets.integrationTest.output.classesDirs 40 | classpath = sourceSets.integrationTest.runtimeClasspath 41 | dependsOn copyIntegrationTestGems 42 | mustRunAfter test 43 | systemProperties TMP_FOLDER : file('build/tmp/integrationTestTempFolder').absolutePath 44 | } 45 | check.dependsOn integrationTest 46 | -------------------------------------------------------------------------------- /base-plugin/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 26 | 27 | 28 | 29 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /jar-plugin/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 26 | 27 | 28 | 29 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 26 | 27 | 28 | 29 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/core/ApiException.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core 25 | 26 | import groovy.transform.CompileStatic 27 | import groovy.transform.InheritConstructors 28 | 29 | /** Throws when there are issues with the RubyGems REST API. 30 | * 31 | * @author Schalk W. Cronjé 32 | * 33 | * @since 2.0 34 | */ 35 | @InheritConstructors 36 | @CompileStatic 37 | class ApiException extends Exception { 38 | } 39 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemInstallException.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.gems 25 | 26 | import groovy.transform.CompileStatic 27 | import groovy.transform.InheritConstructors 28 | 29 | /** Throws when there are issues installing and extracting GEMs. 30 | * 31 | * @author Schalk W. Cronjé 32 | * 33 | * @since 2.0 34 | */ 35 | @InheritConstructors 36 | @CompileStatic 37 | class GemInstallException extends Exception { 38 | } 39 | -------------------------------------------------------------------------------- /base-plugin/src/main/groovy/com/github/jrubygradle/UninitialisedParameterException.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import groovy.transform.CompileStatic 27 | import groovy.transform.InheritConstructors 28 | 29 | /** Thrown when a parameter has not been correctly initialised. 30 | * 31 | * @author Schalk W. Cronjé 32 | * 33 | * @since 2.0 34 | */ 35 | @CompileStatic 36 | @InheritConstructors 37 | class UninitialisedParameterException extends Exception { 38 | } 39 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/core/GemRepositoryConfiguration.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core 25 | 26 | import groovy.transform.CompileStatic 27 | 28 | /** Additional options for configuring a remote GEM repository 29 | * 30 | * @author Schalk W. Cronjé 31 | * 32 | * @since 2.0 33 | */ 34 | @CompileStatic 35 | class GemRepositoryConfiguration { 36 | 37 | /** Set whether pre-release GEMs should be considered. 38 | * 39 | */ 40 | boolean prerelease = false 41 | } 42 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersionException.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.gems 25 | 26 | import com.github.jrubygradle.api.core.ApiException 27 | import groovy.transform.CompileStatic 28 | import groovy.transform.InheritConstructors 29 | 30 | /** Thrown when GEM version strings cannot be correctly parsed. 31 | * 32 | * @author Schalk W. Cronjé 33 | * 34 | * @since 2.0 35 | */ 36 | @InheritConstructors 37 | @CompileStatic 38 | class GemVersionException extends ApiException { 39 | } 40 | -------------------------------------------------------------------------------- /docs/examples/basic-topology.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { jcenter() } 3 | dependencies { 4 | classpath 'com.github.jruby-gradle:jruby-gradle-storm-plugin:0.1.6+' 5 | } 6 | } 7 | 8 | apply plugin: 'com.github.jruby-gradle.storm' 9 | 10 | /* Need the JRubyStormLocal task to run a "local topology" */ 11 | import com.github.jrubygradle.storm.JRubyStormLocal 12 | 13 | dependencies { 14 | /* Including a Ruby gem dependency for our topology */ 15 | gems 'rubygems:colorize:0.7.3+' 16 | 17 | /* Our topology consumes from Kafka so we need our Java dependencies to be 18 | * enumerated under the `jrubyStorm` configuration so they get properly 19 | * unpacked into the resulting topology .jar file 20 | */ 21 | jrubyStorm group: 'org.apache.storm', 22 | name: 'storm-kafka', 23 | version: '0.9.2-incubating', 24 | transitive: false 25 | jrubyStorm group: 'org.apache.kafka', 26 | name: 'kafka_2.10', 27 | version: '0.8.1.+' 28 | 29 | /* Excluding Zookeeper because storm-core is already pulling in ZK as 30 | * dependency to prevent conflicts 31 | */ 32 | jrubyStorm('org.apache.curator:curator-framework:2+') { 33 | exclude module: 'zookeeper' 34 | } 35 | } 36 | 37 | // topologies/ and bolts/ are already included by default, so we just need to 38 | // add a few more files to the jar file 39 | jrubyStorm { 40 | /* Pull our code from lib/ into the root of the topology */ 41 | from 'lib' 42 | /* Pull the code in config/ into a config/ dir in the topology */ 43 | into('config') { from 'config' } 44 | } 45 | 46 | task runLocal(type: JRubyStormLocal) { 47 | description 'Run the topology in local topology mode' 48 | topology 'topologies/basic_topology.rb' 49 | standardInput System.in 50 | } 51 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/DefaultJarDependency.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.gems 25 | 26 | import com.github.jrubygradle.api.gems.JarDependency 27 | import groovy.transform.CompileStatic 28 | 29 | /** Defining a JAR dependency. 30 | * 31 | * @author Schalk W. Cronjé 32 | * 33 | * @since 2.0 34 | */ 35 | @CompileStatic 36 | class DefaultJarDependency extends DefaultGemDependency implements JarDependency { 37 | /** Name of group / organisation. 38 | * 39 | */ 40 | String group 41 | } 42 | -------------------------------------------------------------------------------- /docs/_layouts/base.html.haml: -------------------------------------------------------------------------------- 1 | %html 2 | %head 3 | %link(href='/stylesheets/foundation.css' rel='stylesheet') 4 | %link(href='/stylesheets/jrubygradle.css' rel='stylesheet') 5 | %link(rel="alternate" type="application/atom+xml" title="JRuby/Gradle News" href="/news.atom") 6 | %title 7 | = page.title 8 | %body 9 | %a(href="https://github.com/jruby-gradle") 10 | %img(style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png") 11 | %div#main_nav 12 | %ul 13 | %li 14 | %a(href='/') 15 | Home 16 | %li 17 | %a(href='/docs/') 18 | Documentation 19 | %li 20 | %a(href='/community/') 21 | Community 22 | %li 23 | %a(href='/news/') 24 | News 25 | %li 26 | %a(href='/download/') 27 | Download 28 | %li 29 | %a(href="https://travis-ci.org/jruby-gradle/jruby-gradle-plugin") 30 | %img(src="https://travis-ci.org/jruby-gradle/jruby-gradle-plugin.svg?branch=master")/ 31 | %li 32 | %a(href="https://bintray.com/jruby-gradle/plugins") 33 | %img(src="https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-plugin/images/download.svg")/ 34 | 35 | %div#content 36 | %h1 37 | = page.title 38 | = content 39 | 40 | %hr/ 41 | 42 | %div#improve 43 | %a{:href => "https://github.com/jruby-gradle/jruby-gradle-plugin/edit/master/docs/#{page.relative_source_path}"} 44 | improve this page 45 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/rack/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | rubygems 3 | rack 4 | 5 | 6 | 0.1.0 7 | 0.2.0 8 | 0.3.0 9 | 0.4.0 10 | 0.9.0 11 | 0.9.1 12 | 1.0.0 13 | 1.0.1 14 | 1.1.0 15 | 1.1.1 16 | 1.1.2 17 | 1.1.3 18 | 1.1.4 19 | 1.1.5 20 | 1.1.6 21 | 1.2.0 22 | 1.2.1 23 | 1.2.2 24 | 1.2.3 25 | 1.2.4 26 | 1.2.5 27 | 1.2.6 28 | 1.2.7 29 | 1.2.8 30 | 1.3.0 31 | 1.3.1 32 | 1.3.2 33 | 1.3.3 34 | 1.3.4 35 | 1.3.5 36 | 1.3.6 37 | 1.3.7 38 | 1.3.8 39 | 1.3.9 40 | 1.3.10 41 | 1.4.0 42 | 1.4.1 43 | 1.4.2 44 | 1.4.3 45 | 1.4.4 46 | 1.4.5 47 | 1.5.0 48 | 1.5.1 49 | 1.5.2 50 | 1.5.3 51 | 1.6.0 52 | 53 | 20150507131306 54 | 55 | 56 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemDependency.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.gems; 25 | 26 | /** Description of a transitive GEM dependency. 27 | * 28 | * @author Schalk W. Cronjé 29 | * 30 | * @since 2.0 31 | */ 32 | public interface GemDependency { 33 | 34 | /** Name of transitive GEM dependency. 35 | * 36 | * @return GEM name 37 | */ 38 | String getName(); 39 | 40 | /** Version requirements that is requested upon this transitive dependency. 41 | * 42 | * @return Version requirements in GEM format. 43 | */ 44 | String getRequirements(); 45 | } 46 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/DefaultGemDependency.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.gems 25 | 26 | import com.github.jrubygradle.api.gems.GemDependency 27 | import groovy.transform.CompileStatic 28 | 29 | /** Defining a GEM dependency. 30 | * 31 | * @author Schalk W. Cronjé 32 | * 33 | * @since 2.0 34 | */ 35 | @CompileStatic 36 | class DefaultGemDependency implements GemDependency { 37 | 38 | /** Name of transitive dependency. 39 | * 40 | */ 41 | String name 42 | 43 | /** Version requirements upon this transitive dependency. 44 | * 45 | */ 46 | String requirements 47 | } 48 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemOverwriteAction.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.gems 25 | 26 | import groovy.transform.CompileStatic 27 | 28 | /** Overwrite actions when installing GEMs locally into the build area 29 | * 30 | * @author Schalk W. Cronjé 31 | * @author R Tyler Croy 32 | * @author Christian Meier 33 | * 34 | * @since 2.0 35 | */ 36 | @CompileStatic 37 | enum GemOverwriteAction { 38 | /** Fail if GEM exists. 39 | * 40 | */ 41 | FAIL, 42 | 43 | /** Skip GEM installation if GEM exists. 44 | * 45 | */ 46 | SKIP, 47 | 48 | /** Overwrite any existing installation. 49 | * 50 | */ 51 | OVERWRITE 52 | } -------------------------------------------------------------------------------- /jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJarPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.jar 25 | 26 | import org.gradle.api.Plugin 27 | import org.gradle.api.Project 28 | 29 | import static com.github.jrubygradle.jar.JRubyJar.DEFAULT_JRUBYJAR_CONFIG 30 | 31 | /** 32 | * @author Schalk W. Cronjé 33 | * @author Christian Meier 34 | */ 35 | class JRubyJarPlugin implements Plugin { 36 | void apply(Project project) { 37 | project.apply plugin: 'com.github.jruby-gradle.base' 38 | project.apply plugin: 'java-base' 39 | project.configurations.maybeCreate(DEFAULT_JRUBYJAR_CONFIG) 40 | project.tasks.create('jrubyJar', JRubyJar) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /docs/errors/jrubyexec-version-conflict.adoc: -------------------------------------------------------------------------------- 1 | = JRubyExec conflict on jrubyVersion 2 | :page-layout: base 3 | :toc: right 4 | 5 | == What's going on? 6 | 7 | The 8 | link:/groovydoc/jruby-gradle-base-plugin/com/github/jrubygradle/JRubyExec.html[JRubyExec] 9 | task allows the user to define a specific version of 10 | link:http://jruby.org[JRuby] via the `jrubyVersion` property. This requires the 11 | requested version of JRuby to be added to a dependency graph. In order to 12 | prevent unintentional conflicts in the dependency graph, the link:/base/[base] 13 | plugin will prevent a `JRubyExec` task from adding a different JRuby version to 14 | the _default_ `jrubyExec` 15 | link:https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html[configuration]. 16 | 17 | 18 | == How to fix it 19 | 20 | Fixing this behavior is relatively easy, the `JRubyExec` task which requires 21 | its own custom version of JRuby to be installed should _also_ use a custom, 22 | user-defined, link:https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html[configuration]. E.g. 23 | 24 | .build.gradle 25 | [source, gradle] 26 | ---- 27 | configurations { 28 | backwardsCompat 29 | } 30 | 31 | dependencies { 32 | backwardsCompat 'rubygems:sinatra:1.0.0' 33 | } 34 | 35 | task checkBackwardsCompatibility(type: JRubyExec) { 36 | configuration backwardsCompat 37 | script 'smoke-test.rb' 38 | jrubyVersion '1.7.19' 39 | } 40 | ---- 41 | 42 | 43 | === Okay, that didn't work 44 | 45 | If that work-around didn't help fix the issue, then you may have encountered an 46 | unknown **bug!**. Please 47 | link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues[file an issue] 48 | so we can correct the broken behavior! 49 | 50 | == Links 51 | 52 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/157[issue #157] 53 | captures the first reported side-effect of the previous behavior which 54 | led to the restriction behind defined in the link:/base/[base] plugin 55 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/sinatra/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | rubygems 3 | sinatra 4 | 5 | 6 | 0.1.0 7 | 0.1.5 8 | 0.1.6 9 | 0.1.7 10 | 0.2.0 11 | 0.2.1 12 | 0.2.2 13 | 0.3.0 14 | 0.3.1 15 | 0.3.2 16 | 0.3.3 17 | 0.9.0 18 | 0.9.0.1 19 | 0.9.0.2 20 | 0.9.0.3 21 | 0.9.0.4 22 | 0.9.0.5 23 | 0.9.1 24 | 0.9.1.1 25 | 0.9.2 26 | 0.9.4 27 | 0.9.5 28 | 0.9.6 29 | 1.0 30 | 1.1.0 31 | 1.1.2 32 | 1.1.3 33 | 1.1.4 34 | 1.2.0 35 | 1.2.1 36 | 1.2.2 37 | 1.2.3 38 | 1.2.6 39 | 1.2.7 40 | 1.2.8 41 | 1.2.9 42 | 1.3.0 43 | 1.3.1 44 | 1.3.2 45 | 1.3.3 46 | 1.3.4 47 | 1.3.5 48 | 1.3.6 49 | 1.4.0 50 | 1.4.1 51 | 1.4.2 52 | 1.4.3 53 | 1.4.4 54 | 1.4.5 55 | 56 | 20150507131528 57 | 58 | 59 | -------------------------------------------------------------------------------- /war-plugin/src/test/groovy/com/github/jrubygradle/war/JRubyWarPluginSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.war 25 | 26 | import org.gradle.api.tasks.bundling.War 27 | import org.gradle.testfixtures.ProjectBuilder 28 | import spock.lang.Specification 29 | 30 | /** 31 | * @author R. Tyler Croy 32 | * 33 | */ 34 | class JRubyWarPluginSpec extends Specification { 35 | 36 | def project 37 | 38 | void setup() { 39 | project = ProjectBuilder.builder().build() 40 | project.apply plugin: 'com.github.jruby-gradle.war' 41 | 42 | } 43 | 44 | def "Basic sanity check"() { 45 | expect: 46 | project.tasks.jrubyWar.group == 'JRuby' 47 | project.tasks.jrubyWar instanceof War 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import org.gradle.api.Project 27 | import org.gradle.testfixtures.ProjectBuilder 28 | import spock.lang.Specification 29 | 30 | class JRubyPluginSpec extends Specification { 31 | public static final String RUBYGEMS = 'https://rubygems.org' 32 | 33 | Project project = ProjectBuilder.builder().build() 34 | 35 | void setup() { 36 | project.apply plugin: 'com.github.jruby-gradle.base' 37 | } 38 | 39 | void "applying the plugin with no properties should have jruby.defaultVersion defaulted"() { 40 | when: 41 | project.evaluate() 42 | 43 | then: 44 | project.jruby.defaultVersion == JRubyPluginExtension.DEFAULT_JRUBY_VERSION 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.adoc: -------------------------------------------------------------------------------- 1 | = Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of 4 | fostering an open and welcoming community, we pledge to respect all people who 5 | contribute through reporting issues, posting feature requests, updating 6 | documentation, submitting pull requests or patches, and other activities. 7 | 8 | We are committed to making participation in this project a harassment-free 9 | experience for everyone, regardless of level of experience, gender, gender 10 | identity and expression, sexual orientation, disability, personal appearance, 11 | body size, race, ethnicity, age, religion, or nationality. 12 | 13 | Examples of unacceptable behavior by participants include: 14 | 15 | * The use of sexualized language or imagery 16 | * Personal attacks 17 | * Trolling or insulting/derogatory comments 18 | * Public or private harassment 19 | * Publishing other's private information, such as physical or electronic addresses, without explicit permission 20 | * Other unethical or unprofessional conduct 21 | 22 | Project maintainers have the right and responsibility to remove, edit, or 23 | reject comments, commits, code, wiki edits, issues, and other contributions 24 | that are not aligned to this Code of Conduct. By adopting this Code of Conduct, 25 | project maintainers commit themselves to fairly and consistently applying these 26 | principles to every aspect of managing this project. Project maintainers who do 27 | not follow or enforce the Code of Conduct may be permanently removed from the 28 | project team. 29 | 30 | This code of conduct applies both within project spaces and in public spaces 31 | when an individual is representing the project or its community. 32 | 33 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 34 | reported by opening an issue or contacting one or more of the project 35 | maintainers. 36 | 37 | This Code of Conduct is adapted from the 38 | link:http://contributor-covenant.org[Contributor Covenant], version 1.2.0, 39 | available at 40 | link:http://contributor-covenant.org/version/1/2/0/[contributor-covenant.org/version/1/2/0/] 41 | -------------------------------------------------------------------------------- /war-plugin/src/test/groovy/com/github/jrubygradle/war/JRubyWarSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.war 25 | 26 | import org.gradle.testfixtures.ProjectBuilder 27 | import spock.lang.Specification 28 | 29 | /** 30 | * @author R. Tyler Croy 31 | * 32 | */ 33 | class JRubyWarSpec extends Specification { 34 | static final String TASK_NAME = 'WarWarTask' 35 | 36 | def project 37 | def warTask 38 | 39 | void setup() { 40 | project = ProjectBuilder.builder().build() 41 | project.apply plugin: 'com.github.jruby-gradle.war' 42 | warTask = project.task(TASK_NAME, type: JRubyWar) 43 | } 44 | 45 | def "basic sanity check"() { 46 | expect: "warTask to be an instance" 47 | warTask instanceof com.github.jrubygradle.war.JRubyWar 48 | project.tasks.jrubyWar.group == 'JRuby' 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /core-plugin/src/test/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtensionSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core 25 | 26 | import org.gradle.api.Project 27 | import org.gradle.testfixtures.ProjectBuilder 28 | import spock.lang.Specification 29 | 30 | class RepositoryHandlerExtensionSpec extends Specification { 31 | 32 | Project project = ProjectBuilder.builder().build() 33 | 34 | void 'Add Maven repository'() { 35 | when: 36 | project.allprojects { 37 | apply plugin: JRubyCorePlugin 38 | 39 | repositories { 40 | ruby { 41 | mavengems() 42 | mavengems('https://goo1') 43 | mavengems('goo2', 'https://goo2') 44 | } 45 | } 46 | } 47 | 48 | then: 49 | project.repositories.size() == 3 50 | } 51 | } -------------------------------------------------------------------------------- /jar-plugin/README.adoc: -------------------------------------------------------------------------------- 1 | image::https://travis-ci.org/jruby-gradle/jruby-gradle-plugin.svg?branch=master["Build Status", link="https://travis-ci.org/jruby-gradle/jruby-gradle-plugin"] 2 | 3 | image::https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-jar-plugin/images/download.svg[link="https://bintray.com/jruby-gradle/plugins/jruby-gradle-jar-plugin/_latestVersion"] 4 | 5 | 6 | == Getting Started 7 | 8 | === Compatibility 9 | 10 | This plugin requires link::http://gradle.org[Gradle] 4.9 or better 11 | 12 | === Installing 13 | 14 | .build.gradle 15 | [source, groovy] 16 | ---- 17 | buildscript { 18 | repositories { jcenter() } 19 | 20 | dependencies { 21 | /* check jruby-gradle.org for the latest release */ 22 | classpath "com.github.jruby-gradle:jruby-gradle-jar-plugin:[1.1.4,2.0)" 23 | } 24 | } 25 | 26 | apply plugin: 'com.github.jruby-gradle.jar' 27 | ---- 28 | 29 | ==== Implicitly loaded plugins 30 | 31 | Currently, the `jar` plugin only depends on the link:/base/[base] plugin of the 32 | same version as the jar plugin and the `java-base` plugin included with your 33 | version of Gradle. 34 | 35 | 36 | == Tasks 37 | 38 | === JRubyJar 39 | 40 | .build.gradle 41 | [source, gradle] 42 | ---- 43 | jrubyJar { 44 | /* All methods and properties from `Jar` */ 45 | from 'app' 46 | } 47 | ---- 48 | 49 | ==== Types of jars 50 | 51 | * <> 52 | * <> 53 | 54 | 55 | [[runnable]] 56 | == Runnable Jars 57 | 58 | .build.gradle 59 | [source, gradle] 60 | ---- 61 | jrubyJar { 62 | // tell the plugin to pack a runnable jar 63 | initScript runnable() 64 | 65 | // Use the default bootstrap class (can be omitted) 66 | defaultMainClass() 67 | 68 | // Make the JAR executable by supplying your own main class 69 | mainClass 'my.own.main' 70 | } 71 | ---- 72 | 73 | [[library]] 74 | == Library Jars 75 | 76 | A library jar isn't really much more than a container which includes the 77 | configured gems and jar dependencies inside of the packaged `.jar` file. 78 | 79 | .build.gradle 80 | [source, gradle] 81 | ---- 82 | jrubyJar { 83 | // tell the plugin to pack a runnable jar (no bootstrap script) 84 | initScript library() 85 | } 86 | ---- 87 | -------------------------------------------------------------------------------- /docs/news/2015-09-10-jruby-gradle-1.0.4.adoc: -------------------------------------------------------------------------------- 1 | = "v1.0.4 and a few squashed bugs" 2 | :page-layout: base 3 | 4 | We've just released a minor bug fix release of the 5 | link:https://github.com/jruby-gradle/jruby-gradle-plugin/tree/release-1.0.x[1.0.x 6 | branch] of the JRuby/Gradle core plugins. We wanted to get a few bug fixes out 7 | to users before we release 8 | link:https://github.com/jruby-gradle/jruby-gradle-plugin/milestones/1.1.0%20-%20Dresden[1.1.0 9 | - Dresden], a release which contains some great new features which are still 10 | baking in the oven. 11 | 12 | 13 | Upgrading to this release is as easy as editing your `build.gradle` files: 14 | 15 | .build.gradle 16 | [source,gradle] 17 | ---- 18 | buildscript { 19 | repositories { jcenter() } 20 | dependencies { 21 | classpath "com.github.jruby-gradle:jruby-gradle-plugin:1.0.4" 22 | } 23 | } 24 | apply plugin: 'com.github.jruby-gradle.base' 25 | ---- 26 | 27 | The full diff from 28 | link:https://github.com/jruby-gradle/jruby-gradle-plugin/compare/v1.0.3...v1.0.4[1.0.3 29 | to 1.0.4 can be found here]. 30 | 31 | == Improvements 32 | 33 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/211[#211]: 34 | Upgrade to use JRuby link:http://jruby.org/2015/09/02/jruby-9-0-1-0.html[9.0.1.0] 35 | by default 36 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/193[#193]: 37 | Avoid packing a redundant copy of 38 | link:https://github.com/jruby/jruby-mains[jruby-mains] inside packed jars 39 | 40 | 41 | == Bug fixes 42 | 43 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/190[#190]: generated 44 | gradle.rb needs to follow the jars/gems setup we have everywhere else 45 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/213[#213]: 46 | cannot resolve gems with `~> 0.10.4.0` to `0.10.4` the way bundler does 47 | * link:https://github.com/jruby-gradle/jruby-gradle-storm-plugin/issues/21[jruby-gradle-storm-plugin#21]: 48 | enable easier subclassing of `JRubyJar` so subclasses can override 49 | properties cleanly. 50 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/220[#220]: 51 | prepareJRubyJar doesn't cache results and reinstalls gems every single run 52 | 53 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/VersionFinder.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.testhelper 25 | 26 | import java.util.regex.Pattern 27 | 28 | /** 29 | * @author Schalk W. Cronjé. 30 | */ 31 | class VersionFinder { 32 | @SuppressWarnings(['NoDef']) 33 | static String find(final File repoDir, final String artifact, final String extension) { 34 | Pattern pat = ~/^${artifact}-(.+)\.${extension}/ 35 | def files = repoDir.list([ accept: { File dir, String name -> 36 | name ==~ pat 37 | } ] as FilenameFilter) 38 | 39 | if (files.size()) { 40 | def matcher = files[0] =~ pat 41 | matcher[0][1] 42 | } else { 43 | null 44 | } 45 | } 46 | 47 | static String findDependency(final File repoDir, final String organisation, final String artifact, final String extension) { 48 | "${organisation}:${artifact}:${find(repoDir, artifact, extension)}@${extension}" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /core-plugin/src/test/groovy/com/github/jrubygradle/internal/gems/GemToIvySpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.gems 25 | 26 | import spock.lang.Specification 27 | 28 | class GemToIvySpec extends Specification { 29 | 30 | void 'Write Ivy Xml'() { 31 | given: 32 | def gem = new DefaultGemInfo( 33 | name: 'foo_module', 34 | version: '1.2.3', 35 | dependencies: [new DefaultGemDependency(name: 'foo', requirements: '< 13.0')], 36 | jarRequirements: [new DefaultJarDependency(group: 'bar', name: 'foo', requirements: '>=2.2')] 37 | ) 38 | def gemToIvy = new GemToIvy('https://foo'.toURI()) 39 | 40 | when: 41 | def result = gemToIvy.write(gem) 42 | 43 | then: 44 | result.contains("info organisation='rubygems' module='foo_module' revision='1.2.3'") 45 | result.contains(", 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.core 25 | 26 | import groovy.transform.CompileStatic 27 | 28 | /** Provides some metadata about this plugin 29 | * 30 | * @author Schalk W. Cronjé 31 | * 32 | * @since 2.0.0 33 | * 34 | */ 35 | @CompileStatic 36 | class PluginMetadata { 37 | 38 | /** Plugin version 39 | * 40 | * @return Version of this plugin. 41 | */ 42 | static String version() { 43 | METADATA['version'] 44 | } 45 | 46 | private static Map loadProperties() { 47 | final String location = 'META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties' 48 | final Properties props = new Properties() 49 | PluginMetadata.classLoader.getResourceAsStream(location).withCloseable { strm -> 50 | props.load(strm) 51 | } 52 | props as Map 53 | } 54 | 55 | private static final Map METADATA = loadProperties() 56 | } 57 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/rack/1.5.3/rack-1.5.3.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | rubygems 4 | rack 5 | 1.5.3 6 | gem 7 | a modular Ruby webserver interface 8 | http://rack.github.com/ 9 | Rack provides a minimal, modular and adaptable interface for developing 10 | web applications in Ruby. By wrapping HTTP requests and responses in 11 | the simplest way possible, it unifies and distills the API for web 12 | servers, web frameworks, and software in between (the so-called 13 | middleware) into a single method call. 14 | 15 | Also see http://rack.github.com/. 16 | 17 | 18 | 19 | Christian Neukirchen 20 | chneukirchen@gmail.com 21 | 22 | 23 | 24 | https://rack.github.com.git 25 | http://rack.github.com/ 26 | 27 | 28 | utf-8 29 | 1.0.4 30 | 31 | 32 | 33 | rubygems 34 | bacon 35 | [0,) 36 | gem 37 | test 38 | 39 | 40 | rubygems 41 | rake 42 | [0,) 43 | gem 44 | test 45 | 46 | 47 | 48 | 49 | 50 | de.saumya.mojo 51 | gem-extension 52 | ${jruby.plugins.version} 53 | 54 | 55 | ${basedir}/pkg 56 | 57 | 58 | de.saumya.mojo 59 | gem-maven-plugin 60 | ${jruby.plugins.version} 61 | 62 | rack-1.5.3.gemspec 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /docs/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | gradlePluginPortal() 5 | } 6 | dependencies { 7 | /* wow. so recursion */ 8 | classpath "com.github.jruby-gradle:jruby-gradle-plugin:2.0.2" 9 | classpath 'org.ysb33r.gradle:grolifant:0.17.0' 10 | } 11 | } 12 | apply plugin: 'groovy' 13 | apply plugin: 'org.ajoberstar.github-pages' 14 | apply plugin: 'com.github.jruby-gradle.base' 15 | 16 | import com.github.jrubygradle.JRubyExec 17 | 18 | configurations { 19 | asciidoctor 20 | } 21 | 22 | repositories { 23 | ruby.gems() 24 | } 25 | 26 | dependencies { 27 | asciidoctor('rubygems:awestruct:0.6.6') 28 | asciidoctor('rubygems:coderay:1.1.3') 29 | asciidoctor('rubygems:http_parser.rb:0.6.0') 30 | asciidoctor('rubygems:public_suffix:4.0.7') 31 | asciidoctor('rubygems:spoon:0.0.6') 32 | asciidoctor('rubygems:htmlcompressor:0.4.0') 33 | asciidoctor('rubygems:uglifier:4.2.0') 34 | } 35 | 36 | task prepareGroovyDocs(type: Copy) { 37 | description "Copy Groovydocs into our site directory for deployment/publication" 38 | into "${buildDir}/_site/groovydoc" 39 | 40 | rootProject.subprojects.each { 41 | def task = it.tasks.findByName('groovydoc') 42 | 43 | if ((task) && (task.outputs.files)) { 44 | into(it.name) { from task.outputs.files } 45 | } 46 | } 47 | dependsOn rootProject.subprojects.collect { ":${it.name}:groovydoc" } 48 | } 49 | 50 | task compileAsciidoc(type: JRubyExec) { 51 | script 'awestruct' 52 | scriptArgs "--generate", "--verbose", 53 | "--output-dir", "${buildDir}/_site", 54 | '--force' 55 | /* without the --force option, awestruct is not smart enough to regenerate 56 | * files based on includes */ 57 | configuration 'asciidoctor' 58 | inputs.files fileTree(projectDir).include('**/*.adoc') 59 | } 60 | 61 | task assembleDocs { 62 | dependsOn compileAsciidoc, prepareGroovyDocs 63 | } 64 | 65 | githubPages { 66 | repoUri = 'git@github.com:jruby-gradle/jruby-gradle.github.io' 67 | targetBranch = 'master' 68 | pages { 69 | from "${buildDir}/_site" 70 | from "${rootProject.projectDir}/CNAME" 71 | } 72 | } 73 | publishGhPages.dependsOn assembleDocs 74 | 75 | /* We don't need an upload task in here */ 76 | //bintrayUpload.enabled = false 77 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/sinatra/1.4.5/sinatra-1.4.5.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | rubygems 4 | sinatra 5 | 1.4.5 6 | gem 7 | Classy web-development dressed in a DSL 8 | http://www.sinatrarb.com/ 9 | Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort. 10 | 11 | 12 | Blake Mizerany 13 | sinatrarb@googlegroups.com 14 | 15 | 16 | Ryan Tomayko 17 | 18 | 19 | Simon Rozet 20 | 21 | 22 | Konstantin Haase 23 | 24 | 25 | 26 | utf-8 27 | 1.0.4 28 | 29 | 30 | 31 | rubygems 32 | rack 33 | [1.4,1.99999] 34 | gem 35 | 36 | 44 | 45 | rubygems 46 | rack-protection 47 | [1.4,1.99999] 48 | gem 49 | 50 | 51 | 52 | 53 | 54 | de.saumya.mojo 55 | gem-extension 56 | ${jruby.plugins.version} 57 | 58 | 59 | ${basedir}/pkg 60 | 61 | 62 | de.saumya.mojo 63 | gem-maven-plugin 64 | ${jruby.plugins.version} 65 | 66 | sinatra-1.4.5.gemspec 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /docs/index.adoc: -------------------------------------------------------------------------------- 1 | = JRuby/Gradle 2 | :page-layout: base 3 | 4 | image::images/jruby-gradle.png[role="right"] 5 | 6 | link:https://github.com/jruby-gradle/[JRuby/Gradle] is a collection of 7 | link:http://www.gradle.org[Gradle] plugins which make it easy to build, test, 8 | manage and package Ruby applications. By combining the portability of 9 | link:http://jruby.org[JRuby] with Gradle's excellent task and dependency 10 | management, *JRuby/Gradle* provides high quality build tooling for 11 | Ruby and Java developers alike. 12 | 13 | NOTE: As from version 2.0.0 you will need at least Gradle 4.2. 14 | 15 | *Plugins available:* 16 | 17 | * link:base/[Base] 18 | * link:jar/[Jar] 19 | * link:war/[War] 20 | * link:storm/[Storm] 21 | * link:core/[Core] 22 | 23 | == Quick Start 24 | 25 | === Running some Ruby 26 | 27 | The simplest example is a hello-world from Gradle, using JRuby/Gradle we can 28 | execute a Ruby script, which has Ruby-based dependencies: 29 | 30 | .build.gradle (link:https://github.com/jruby-gradle/jruby-gradle-plugin/blob/master/examples/run-simple-ruby-script/build.gradle[full source]) 31 | [source, gradle] 32 | ---- 33 | include::../examples/run-simple-ruby-script/build.gradle[lines=6..30] 34 | ---- 35 | 36 | .print-script.rb (link:https://github.com/jruby-gradle/jruby-gradle-plugin/blob/master/examples/run-simple-ruby-script/print-script.rb[full source]) 37 | [source, ruby] 38 | ---- 39 | include::../examples/run-simple-ruby-script/print-script.rb[] 40 | ---- 41 | 42 | 43 | Executing `./gradlew printSomePrettyOutputPlease` results in the following: 44 | 45 | image::images/print-script-output.png[] 46 | 47 | 48 | === Packaging some Ruby 49 | 50 | .build.gradle (link:https://github.com/jruby-gradle/jruby-gradle-plugin/blob/master/examples/self-executing-jar/build.gradle[full source]) 51 | [source, gradle] 52 | ---- 53 | include::../examples/self-executing-jar/build.gradle[lines=6..40] 54 | ---- 55 | 56 | .entrypoint.rb (link:https://github.com/jruby-gradle/jruby-gradle-plugin/blob/master/examples/self-executing-jar/entrypoint.rb[full source]) 57 | [source, ruby] 58 | ---- 59 | include::../examples/self-executing-jar/entrypoint.rb[] 60 | ---- 61 | 62 | 63 | Executing `./gradlew jrubyJar` will build a `.jar` file inside of the 64 | `build/libs` directory which can then be invoked: 65 | 66 | `% java -jar build/libs/self-executing-jar-jruby.jar` 67 | 68 | image::images/self-executing-jar-output.png[] 69 | 70 | -------------------------------------------------------------------------------- /docs/errors/jar-deprecated-jrubyversion.adoc: -------------------------------------------------------------------------------- 1 | = Deprecated version of JRuby for JRubyJar 2 | :page-layout: base 3 | :toc: right 4 | 5 | == What's going on? 6 | 7 | Starting with JRuby link:http://jruby.org/2015/05/05/jruby-1-7-20.html[1.7.20] 8 | there were substantial improvements introduced to JRuby core which make running 9 | JRuby in an "embedded" scenario more reliable. Packing a `JRubyJar` being a 10 | fairly typical "embedded JRuby" use-case, there is certain functionality that 11 | relies on these improvements. 12 | 13 | 14 | NOTE: As of JRuby/Gradle 2.0.0, the JRuby 1.7.x releases are no longer supported. 15 | 16 | This does **not** mean older versions of JRuby won't work in `JRubyJar` 17 | archives but rather: you are _likely_ going to experience problems with a more 18 | complex use-case on an older JRuby. For example, Rails applications will not 19 | function properly if embedded in a `.jar` with JRuby 1.7.19. 20 | 21 | == How to fix it 22 | 23 | Since JRuby/Gradle 1.0 and later default to 24 | link:http://jruby.org/2015/07/22/jruby-9-0-0-0.html[9.0.0.0] and later, the 25 | easiest fix is to stop overriding the default (read: latest stable) JRuby 26 | version enummerated by the plugin. 27 | 28 | If the latest is viable for the project you're working with, at least update 29 | the version to something later than 30 | link:http://jruby.org/2015/08/20/jruby-1-7-22.html[1.7.22] via: 31 | 32 | .build.gradle 33 | [source, gradle] 34 | ---- 35 | jruby { 36 | defaultVersion '1.7.22' 37 | } 38 | ---- 39 | 40 | 41 | === Okay that didn't work 42 | 43 | If for whatever reason you cannot upgrade your version of JRuby, you can try to 44 | disable the embedded behavior in the `JRubyJar` and switch Jar's Main-Class to 45 | a "self-extracting" main provided by 46 | link:https://github.com/jruby/jruby-mains[jruby-mains]. 47 | 48 | This is **untested as of this document's writing** but the basic idea is that 49 | instead of trying to execute the Ruby code from a fully embedded scenario, the 50 | self-extracting Main will first unzip the jar file into `/tmp` before setting 51 | up the JRuby environment. 52 | 53 | .build.gradle 54 | [source, gradle] 55 | ---- 56 | jrubyJar { 57 | mainClass 'org.jruby.mains.ExtractingMain' 58 | } 59 | ---- 60 | 61 | 62 | == Links 63 | 64 | * link:https://github.com/jruby-gradle/jruby-gradle-plugin/issues/191[issue 65 | #191] outlines the feature request that led to this behavior being introduced 66 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/DefaultGemInfo.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.gems 25 | 26 | import com.github.jrubygradle.api.gems.GemInfo 27 | import com.github.jrubygradle.api.gems.GemDependency 28 | import com.github.jrubygradle.api.gems.JarDependency 29 | import groovy.transform.CompileStatic 30 | 31 | /** An implementation of GEM metadata. 32 | * 33 | * Elements in this class match directly to the Rubgems REST API. 34 | * 35 | * @author Schalk W. Cronjé 36 | * 37 | * @since 2.0 38 | */ 39 | @CompileStatic 40 | class DefaultGemInfo implements GemInfo { 41 | String name 42 | String version 43 | String platform 44 | String summary 45 | String description 46 | String sha 47 | String rubyVersion 48 | String rubyGemsVersion 49 | 50 | boolean prerelease 51 | 52 | URI projectUri 53 | URI gemUri 54 | URI homepageUri 55 | URI documentationUri 56 | 57 | List authors = [] 58 | 59 | List dependencies = [] 60 | List developmentDependencies = [] 61 | List jarRequirements = [] 62 | } 63 | -------------------------------------------------------------------------------- /base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginExtensionSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import org.gradle.api.Project 27 | import org.gradle.testfixtures.ProjectBuilder 28 | import spock.lang.Specification 29 | 30 | /** 31 | * Unit test covering the JRuby extensions (i.e. project.jruby) 32 | */ 33 | class JRubyPluginExtensionSpec extends Specification { 34 | Project project = ProjectBuilder.builder().build() 35 | 36 | void "changing the defaultVersion via a method should work"() { 37 | given: 38 | JRubyPluginExtension ext = new JRubyPluginExtension(project) 39 | final String version = '9.0.1.0' 40 | 41 | when: 42 | ext.jrubyVersion { version } 43 | 44 | then: 45 | ext.jrubyVersion == version 46 | } 47 | 48 | void "changing the defaultVersion with a setter should work"() { 49 | given: 50 | JRubyPluginExtension ext = new JRubyPluginExtension(project) 51 | final String version = '9.0.1.0' 52 | 53 | when: 54 | ext.jrubyVersion = version 55 | 56 | then: 57 | ext.jrubyVersion == version 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemGroups.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.gems 25 | 26 | import com.github.jrubygradle.api.core.RepositoryHandlerExtension 27 | import groovy.transform.CompileStatic 28 | 29 | import static com.github.jrubygradle.api.core.RepositoryHandlerExtension.DEFAULT_GROUP_NAME 30 | 31 | /** Defines groups which contains GEMs 32 | * 33 | * @author Schalk W. Cronjé 34 | * 35 | * @since 2.0 36 | */ 37 | @CompileStatic 38 | class GemGroups { 39 | 40 | public static final String NAME = 'gemGroups' 41 | 42 | /** Is this group/organisation a GEM group ? 43 | * 44 | * @param groupName Name of group/organisation. 45 | * @return {@code true} is group is a GEM group. 46 | */ 47 | boolean isGemGroup(final String groupName) { 48 | groups.contains(groupName) 49 | } 50 | 51 | /** Add a new group for GEMs. 52 | * 53 | * @param groupName Name of group to add. 54 | */ 55 | void addGemGroup(final String groupName) { 56 | groups.add(groupName) 57 | } 58 | 59 | private final Set groups = [RepositoryHandlerExtension.DEFAULT_GROUP_NAME].toSet() 60 | } 61 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/Transform.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.core 25 | 26 | import groovy.transform.CompileStatic 27 | 28 | import java.util.function.Function 29 | import java.util.stream.Collectors 30 | 31 | /** Transforms a collection to another collection. 32 | * 33 | * Deals with Groovy 2.4/2.5 backwards incompatibility. 34 | * 35 | * @author Schalk W. Cronjé 36 | * 37 | * @since 2.0 38 | * 39 | */ 40 | @CompileStatic 41 | class Transform { 42 | static List toList(final Collection collection, Function tx ) { 43 | collection.stream().map(tx).collect(Collectors.toList()) 44 | } 45 | 46 | static List toList(final I[] collection, Function tx ) { 47 | collection.toList().stream().map(tx).collect(Collectors.toList()) 48 | } 49 | 50 | static Set toSet(final Collection collection, Function tx ) { 51 | collection.stream().map(tx).collect(Collectors.toSet()) 52 | } 53 | 54 | static Set toSet(final Iterable collection, Function tx ) { 55 | collection.toList().stream().map(tx).collect(Collectors.toSet()) 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /jar-plugin/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## v0.2.0 4 | 5 | * no more dependency to shadowJar plugin 6 | * no generation of bootStrap class, will use jruby-mains instead 7 | * all jars from gem dependencies will be added as jars into the fat-jar 8 | * there is JRubyJar task now 9 | * the plugin can pack 10 | * library jar which is basically include embedded gems (with their jar depdencies) to the jar. there is jruby extension for the Jar task 11 | * executable jar: jruby executes a bootstrap script 12 | * runnable jar: jruby can launch any executable from an embedded gem 13 | * the library jar (and all other jars) are packed in way which works for all possible classloader, i.e. it generates .jrubydir files for embedded ruby directories. 14 | 15 | ## v0.1.4 16 | 17 | ### Bugfixes 18 | 19 | * [#14](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/14) - Configuration changes for `jrubyJavaBootstrap` 20 | did not result in a clean build. 21 | * [#20](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/20) - jrubyJavaBootstrap should set `GEM_HOME` 22 | and `GEM_PATH`. 23 | 24 | ### Improvements 25 | 26 | * [#26](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/26) - Remove any dependency on warbler-bootstrap 27 | * [#24](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/24) - Unittests are no longer going online to pull 28 | down dependencies 29 | * Rolled back to support JDK 1.6 30 | 31 | ## v0.1.3 32 | 33 | * Shadow plugin is now an implicit dependency 34 | 35 | ## v0.1.2 36 | 37 | * [#10](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/10) - Shouldn't the plugin specify a dependency on base? 38 | * [#11](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/pull/11) - Correct references to the `com.github.jruby-gradle` group 39 | * [#12](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/12) - jar plugin doesn't specify the jruby dependency 40 | * [#15](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/pull/15) - Explicitly set the JRuby compile-time dependency 41 | 42 | ## v0.1.1 43 | 44 | * [#2](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/2) - Plugin should have a JRubyAppJar task for building runnable jars 45 | * [#9](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/pull/9) - Fixed it so that 'java-base' instead of 'java' plugin is applied 46 | 47 | ## v0.1.0 48 | 49 | * [#1](https://github.com/jruby-gradle/jruby-gradle-jar-plugin/issues/1) - Extension to build JARs containing GEMs. 50 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyUtils.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal.core 25 | 26 | import groovy.transform.CompileDynamic 27 | import groovy.transform.CompileStatic 28 | import groovy.xml.MarkupBuilder 29 | 30 | /** Utilities for dealing with Ivy formats. 31 | * 32 | * @author Schalk W. Cronjé 33 | * 34 | * @since 2.0 35 | */ 36 | @CompileStatic 37 | class IvyUtils { 38 | 39 | /** Converts a list of revisions to an HTML directory listing. 40 | * 41 | * @param revisions List of GEM revisions. 42 | * @return HTML-based directory listing which can be use to serve up 43 | * something in the way that Gradle would expect it to be. 44 | */ 45 | @CompileDynamic 46 | static String revisionsAsHtmlDirectoryListing(List revisions) { 47 | StringWriter out = new StringWriter() 48 | new MarkupBuilder(out).html { 49 | head() 50 | body { 51 | revisions.each { rev -> 52 | pre { 53 | a(href: "${rev}/", rel: 'nofollow') 54 | } 55 | } 56 | } 57 | } 58 | out.toString() 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /base-plugin/src/main/groovy/com/github/jrubygradle/internal/JRubyPrepareUtils.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.internal 25 | 26 | import groovy.transform.CompileStatic 27 | 28 | import static com.github.jrubygradle.JRubyPlugin.DEFAULT_CONFIGURATION 29 | import static com.github.jrubygradle.JRubyPlugin.DEFAULT_PREPARE_TASK 30 | 31 | /** Utilities to deal with JRubPrepare tasks 32 | * 33 | * @author Schalk W. Cronjé 34 | * 35 | * @since 2.0 36 | */ 37 | @CompileStatic 38 | class JRubyPrepareUtils { 39 | 40 | /** JRubyPrepare task name by convention 41 | * 42 | * @param configurationName Name of a GEM configuration. 43 | * @return Associated task name. 44 | */ 45 | static String taskName(String configurationName) { 46 | configurationName == DEFAULT_CONFIGURATION ? DEFAULT_PREPARE_TASK : 47 | "jrubyPrepare${configurationName.capitalize()}" 48 | } 49 | 50 | /** GEM working (unpack) relative path by convention. 51 | * 52 | * @param configurationName Name of a GEM configuration. 53 | * @return Associated relative path to project directory. 54 | */ 55 | static String gemRelativePath(String configurationName) { 56 | configurationName == DEFAULT_CONFIGURATION ? '.gems' : 57 | ".gems-${configurationName}" 58 | } 59 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import com.github.jrubygradle.testhelper.IntegrationSpecification 27 | import spock.lang.IgnoreIf 28 | 29 | /** 30 | * @author Schalk W. Cronjé. 31 | * @author Christian Meier 32 | */ 33 | @IgnoreIf({ IntegrationSpecification.OFFLINE }) 34 | class JRubyPrepareJarsIntegrationSpec extends IntegrationSpecification { 35 | 36 | def "Check that default 'jrubyPrepare' uses the correct directory for the jars"() { 37 | given: 38 | String testVer = testProperties.dropwizardMetricsCoreVersion 39 | buildFile.text = """ 40 | ${projectWithRubyGemsRepo} 41 | 42 | dependencies { 43 | gems "io.dropwizard.metrics:metrics-core:${testVer}" 44 | } 45 | """ 46 | 47 | when: 48 | gradleRunner('jrubyPrepare', '-i').build() 49 | 50 | then: 51 | new File(projectDir, 'build/.gems/Jars.lock').text.trim() == 52 | "io.dropwizard.metrics:metrics-core:${testProperties.dropwizardMetricsCoreVersion}:runtime:" 53 | new File( 54 | projectDir, 55 | "build/.gems/jars/io/dropwizard/metrics/metrics-core/${testVer}/metrics-core-${testVer}.jar" 56 | ).exists() 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServer.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core; 25 | 26 | import java.net.URI; 27 | import java.nio.file.Path; 28 | 29 | /** 30 | * Proxy service which can translate RubyGems structures into Ivy structures 31 | * and vice-versa. 32 | * 33 | * @author Schalk W. Cronjé 34 | * 35 | * @since 2.0 36 | */ 37 | public interface IvyXmlProxyServer extends Runnable { 38 | 39 | /** Local bind address of the proxy server. 40 | * 41 | * @return URI of service. 42 | */ 43 | URI getBindAddress(); 44 | 45 | /** Location of cached {@code ivy.xml} file. 46 | * 47 | * @param group Group associated with GEMs. This is the group that will be used inside Gradle 48 | * as a Maven group or an Ivy organisation. As Rubygems does not have this concept 49 | * it is purely for usage inside Gradle. 50 | * @param name Name of GEM. 51 | * @param revision Verison of GEM. 52 | * @return Location of cached file (even if file does not exist yet). 53 | */ 54 | Path ivyFile(String group, String name, String revision); 55 | 56 | /** Set proxy service to refresh dependencies on a subsequent run. 57 | * 58 | * @param refresh {@code true} if service should refresh dependencies. 59 | */ 60 | void setRefreshDependencies(boolean refresh); 61 | } 62 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyCorePlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core 25 | 26 | import com.github.jrubygradle.api.gems.GemResolverStrategy 27 | import com.github.jrubygradle.internal.gems.GemVersionResolver 28 | import groovy.transform.CompileStatic 29 | import org.gradle.api.Plugin 30 | import org.gradle.api.Project 31 | import org.gradle.api.artifacts.Configuration 32 | import org.gradle.api.plugins.ExtensionAware 33 | import org.ysb33r.grolifant.api.core.ProjectOperations 34 | 35 | /** Provides only a repository handler extensiosn for looking up rubygem 36 | * metadata. 37 | * 38 | * @author Schalk W. Cronjé 39 | * 40 | * @since 2.0 41 | */ 42 | @CompileStatic 43 | class JRubyCorePlugin implements Plugin { 44 | @Override 45 | void apply(Project project) { 46 | ProjectOperations.maybeCreateExtension(project) 47 | GemResolverStrategy gemGroups = project.extensions.create(GemResolverStrategy.NAME, GemResolverStrategy) 48 | 49 | ((ExtensionAware) project.repositories).extensions.create( 50 | RepositoryHandlerExtension.NAME, 51 | RepositoryHandlerExtension, 52 | project 53 | ) 54 | 55 | project.configurations.all { Configuration cfg -> 56 | GemVersionResolver.addGemResolver(cfg, gemGroups, new GemVersionResolver(gemGroups, project.logger, cfg)) 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/JRubyJarIntegrationSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.jar 25 | 26 | import org.gradle.api.Project 27 | import spock.lang.Ignore 28 | import spock.lang.Specification 29 | 30 | /* 31 | * A series of tests which expect to use the JRubyJar task in more of an integration 32 | * test fashion, i.e. evaluating the Project, etc 33 | */ 34 | 35 | @Ignore 36 | class JRubyJarIntegrationSpec extends Specification { 37 | static final File TESTROOT = new File("${System.getProperty('TESTROOT') ?: 'build/tmp/test/unittests'}/jrjps") 38 | static final File TESTREPO_LOCATION = new File("${System.getProperty('TESTREPO_LOCATION') ?: 'build/tmp/test/repo'}") 39 | 40 | Project project 41 | 42 | def setup() { 43 | project = ProjectBuilder.builder().build() 44 | project.gradle.startParameter.offline = true 45 | 46 | project.buildscript { 47 | repositories { 48 | flatDir dirs: TESTREPO_LOCATION.absolutePath 49 | } 50 | } 51 | project.buildDir = TESTROOT 52 | project.with { 53 | logging.level = LIFECYCLE 54 | apply plugin: 'com.github.jruby-gradle.jar' 55 | jruby.defaultRepositories = false 56 | 57 | repositories { 58 | flatDir dirs: TESTREPO_LOCATION.absolutePath 59 | } 60 | } 61 | } 62 | 63 | } 64 | 65 | -------------------------------------------------------------------------------- /war-plugin/src/main/groovy/com/github/jrubygradle/war/JRubyWarPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.war 25 | 26 | import org.gradle.api.Plugin 27 | import org.gradle.api.Project 28 | 29 | import com.github.jrubygradle.JRubyPlugin 30 | 31 | /** 32 | * Created by schalkc on 27/08/2014. 33 | */ 34 | class JRubyWarPlugin implements Plugin { 35 | void apply(Project project) { 36 | project.apply plugin: 'war' 37 | project.apply plugin: 'com.github.jruby-gradle.base' 38 | project.configurations.create(JRubyWar.JRUBYWAR_CONFIG) 39 | project.configurations.maybeCreate('jrubyEmbeds') 40 | 41 | project.afterEvaluate { 42 | JRubyWar.updateJRubyDependencies(project) 43 | 44 | project.dependencies { 45 | jrubyEmbeds group: 'com.github.jruby-gradle', name: 'warbler-bootstrap', version: '0.2.0+' 46 | } 47 | } 48 | 49 | // Only jRubyWar will depend on jrubyPrepare. Other JRubyWar tasks created by 50 | // build script authors will be under their own control 51 | // jrubyWar task will use jrubyWar as configuration 52 | project.task('jrubyWar', type: JRubyWar) { 53 | group JRubyPlugin.TASK_GROUP_NAME 54 | description 'Create a JRuby-based web archive' 55 | dependsOn project.tasks.jrubyPrepare 56 | classpath project.configurations.jrubyWar 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /examples/run-ruby-binscript/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /examples/run-simple-ruby-script/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /examples/self-executing-jar/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /examples/run-script-with-jruby-args/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /core-plugin/src/test/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core 25 | 26 | import com.github.jrubygradle.internal.core.IvyXmlRatpackProxyServer 27 | import groovyx.net.http.HttpBuilder 28 | import groovyx.net.http.OkHttpBuilder 29 | import org.junit.Rule 30 | import org.junit.rules.TemporaryFolder 31 | import spock.lang.Specification 32 | 33 | class IvyXmlProxyServerSpec extends Specification { 34 | 35 | public static final String CREDIT_CARD = RubyGemQueryRestApiSpec.CREDIT_CARD 36 | public static final String TEST_IVY_PATH = "${CREDIT_CARD}/1.3.2/ivy.xml" 37 | 38 | IvyXmlProxyServer server 39 | HttpBuilder httpBuilder 40 | 41 | @Rule 42 | TemporaryFolder projectRoot 43 | 44 | void setup() { 45 | server = new IvyXmlRatpackProxyServer( 46 | projectRoot.root, 47 | 'https://rubygems.org'.toURI(), 48 | 'rubygems', 49 | new GemRepositoryConfiguration() 50 | ) 51 | server.run() 52 | httpBuilder = OkHttpBuilder.configure { 53 | request.uri = server.bindAddress 54 | } 55 | } 56 | 57 | void 'Build an Ivy Xml file from a query to Rubygems'() { 58 | when: 'I query the local proxy server' 59 | httpBuilder.get { 60 | request.uri.path = "/rubygems/${TEST_IVY_PATH}" 61 | } 62 | 63 | then: 'The Ivy file should be generated and cached locally' 64 | new File(projectRoot.root, TEST_IVY_PATH) 65 | } 66 | } -------------------------------------------------------------------------------- /docs/news/2015-08-04-jrubygradle-one-point-oh.adoc: -------------------------------------------------------------------------------- 1 | = JRuby/Gradle 1.0 Announced 2 | :page-layout: base 3 | 4 | Less than one year after the link:http://github.com/jruby-gradle[JRuby/Gradle] 5 | project was founded, we are pleased to announce the release of *1.0* for the 6 | core plugins, which includes link:/base/[the base plugin], link:/jar/[the jar 7 | plugin] and an alpha version of the link:/war/[war plugin]. This release marks 8 | the stability of the core task and configuration APIs for the lifetime of the 9 | `1.x` branch of development. 10 | 11 | 12 | == Notable Features 13 | 14 | This release includes a number of notable features which can help developers 15 | build high quality Ruby projects, based on link:http://jruby.org[JRuby]. 16 | 17 | * Defaulted to the major milestone release: link:jruby.org/2015/07/22/jruby-9-0-0-0.html[JRuby 9.0.0.0] 18 | * Native Java dependency resolution via Gradle's built-in support of Maven 19 | repositories and with Gem dependency resolution via a 20 | link:http://rubygems.org[rubygems.org] link:http://rubygems.lasagna.io/proxy/maven/releases[proxy]. 21 | * Execution of local Ruby script via the link:/base/#jrubyexec[JRubyExec task] 22 | * Execution of scripts provided by a gem dependency, e.g. `rspec` via 23 | link:/base/#jrubyexec[JRubyExec task] 24 | * Support for distinct 25 | link:https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html[configurations] 26 | to isolate dependencies, even JRuby versions, between link:/base/#jrubyexec[JRubyExec tasks]. 27 | * Similar support for different configurations between link:/jar/#jrubyjar[JRubyJar 28 | tasks] 29 | 30 | 31 | == Project History 32 | 33 | The JRuby/Gradle project was originally started to address the challenges faced 34 | when attempting to build complex Ruby applications based on 35 | link:http://jruby.org[JRuby]. With such applications it is desirable to leverage 36 | the vast libraries available to JVM-based languages, as well as many of the 37 | user-friendly gems built by Ruby developers 38 | 39 | After trying to make multiple tools, which weren't designed to support non-Java 40 | projects, work with Ruby link:https://github.com/rtyler[R. Tyler Croy] started 41 | building a prototype with Gradle to package up a JRuby application as a jar. 42 | Shortly after publishing the prototype, link:https://github.com/ysb33r[Schalke 43 | W. Cronje] discovered the fledgling project and with his Gradle development 44 | experience helped bring it from a weekend hack project to a well-tested, 45 | well-structured set of Gradle plugins. Eventually 46 | link:https://github.com/mkristian[Christian Meier], whose 47 | link:https://github.com/torquebox/rubygems-servlets] code helped make the 48 | project originally possible, joined the team to help improve support in JRuby 49 | itself for the different embedded operating modes that the JRuby/Gradle 50 | toolchain makes use of. 51 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/0.1.15/jar-dependencies-0.1.15.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | rubygems 4 | jar-dependencies 5 | 0.1.15 6 | gem 7 | manage jar dependencies for gems 8 | https://github.com/mkristian/jar-dependencies 9 | manage jar dependencies for gems and keep track which jar was already loaded using maven artifact coordinates. it warns on version conflicts and loads only ONE jar assuming the first one is compatible to the second one otherwise your project needs to lock down the right version by providing a Jars.lock file. 10 | 11 | 12 | christian meier 13 | mkristian@web.de 14 | 15 | 16 | 17 | https://github.com/mkristian/jar-dependencies.git 18 | https://github.com/mkristian/jar-dependencies 19 | 20 | 21 | utf-8 22 | 1.0.4 23 | 24 | 25 | 26 | rubygems 27 | minitest 28 | [5.3,5.99999] 29 | gem 30 | test 31 | 32 | 33 | rubygems 34 | rake 35 | [10.2,10.99999] 36 | gem 37 | test 38 | 39 | 40 | rubygems 41 | ruby-maven 42 | [3.3.0,3.3.99999] 43 | gem 44 | test 45 | 46 | 47 | rubygems 48 | ruby-maven-libs 49 | [3.3.0,3.3.99999] 50 | gem 51 | test 52 | 53 | 54 | 55 | 56 | 57 | de.saumya.mojo 58 | gem-extension 59 | ${jruby.plugins.version} 60 | 61 | 62 | ${basedir}/pkg 63 | 64 | 65 | de.saumya.mojo 66 | gem-maven-plugin 67 | ${jruby.plugins.version} 68 | 69 | jar-dependencies-0.1.15.gemspec 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/mavenrepo/rubygems/jar-dependencies/0.1.16.pre/jar-dependencies-0.1.16.pre.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | rubygems 4 | jar-dependencies 5 | 0.1.16.pre 6 | gem 7 | manage jar dependencies for gems 8 | https://github.com/mkristian/jar-dependencies 9 | manage jar dependencies for gems and keep track which jar was already loaded using maven artifact coordinates. it warns on version conflicts and loads only ONE jar assuming the first one is compatible to the second one otherwise your project needs to lock down the right version by providing a Jars.lock file. 10 | 11 | 12 | christian meier 13 | mkristian@web.de 14 | 15 | 16 | 17 | https://github.com/mkristian/jar-dependencies.git 18 | https://github.com/mkristian/jar-dependencies 19 | 20 | 21 | utf-8 22 | 1.0.4 23 | 24 | 25 | 26 | rubygems 27 | minitest 28 | [5.3,5.99999] 29 | gem 30 | test 31 | 32 | 33 | rubygems 34 | rake 35 | [10.2,10.99999] 36 | gem 37 | test 38 | 39 | 40 | rubygems 41 | ruby-maven 42 | [3.3.0,3.3.99999] 43 | gem 44 | test 45 | 46 | 47 | rubygems 48 | ruby-maven-libs 49 | [3.3.0,3.3.99999] 50 | gem 51 | test 52 | 53 | 54 | 55 | 56 | 57 | de.saumya.mojo 58 | gem-extension 59 | ${jruby.plugins.version} 60 | 61 | 62 | ${basedir}/pkg 63 | 64 | 65 | de.saumya.mojo 66 | gem-maven-plugin 67 | ${jruby.plugins.version} 68 | 69 | jar-dependencies-0.1.16.pre.gemspec 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import com.github.jrubygradle.api.core.AbstractJRubyPrepare 27 | import com.github.jrubygradle.internal.JRubyExecUtils 28 | import groovy.transform.CompileStatic 29 | import org.gradle.api.provider.Provider 30 | 31 | import java.util.concurrent.Callable 32 | 33 | /** Task for preparing a project-local installation of GEMs & JARs. 34 | * 35 | * @author Schalk W. Cronjé 36 | * @author R Tyler Croy 37 | * @author Christian Meier 38 | */ 39 | @CompileStatic 40 | class JRubyPrepare extends AbstractJRubyPrepare { 41 | 42 | JRubyPrepare() { 43 | super() 44 | this.jruby = extensions.create(JRubyPluginExtension.NAME, JRubyPluginExtension, this) 45 | this.jrubyJarLocation = project.provider({ JRubyPluginExtension jrubyExt -> 46 | JRubyExecUtils.jrubyJar(jrubyExt.jrubyConfiguration) 47 | }.curry(this.jruby) as Callable) 48 | } 49 | 50 | /** Location of {@code jruby-complete} JAR. 51 | * 52 | * @return Path on local filesystem 53 | */ 54 | @Override 55 | protected Provider getJrubyJarLocation() { 56 | this.jrubyJarLocation 57 | } 58 | 59 | /** Version of JRuby to be used. 60 | * 61 | * This method should not resolve any files to obtain the version. 62 | * 63 | * @return Intended version of JRuby. 64 | */ 65 | @Override 66 | protected String getProposedJRubyVersion() { 67 | jruby.jrubyVersion 68 | } 69 | 70 | private final JRubyPluginExtension jruby 71 | private final Provider jrubyJarLocation 72 | } 73 | 74 | -------------------------------------------------------------------------------- /base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import com.github.jrubygradle.testhelper.IntegrationSpecification 27 | import org.ysb33r.grolifant.api.core.OperatingSystem 28 | import spock.lang.IgnoreIf 29 | 30 | /** 31 | * @author Schalk W. Cronjé 32 | */ 33 | @IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') }) 34 | class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification { 35 | 36 | static final String DEFAULT_TASK_NAME = 'RubyWax' 37 | 38 | @IgnoreIf({ OperatingSystem.current().isWindows() }) 39 | def "Generate gradle.rb"() { 40 | given: "A set of gems" 41 | buildFile.text = """ 42 | import com.github.jrubygradle.GenerateGradleRb 43 | 44 | ${projectWithRubyGemsRepo} 45 | 46 | task ${DEFAULT_TASK_NAME} (type: GenerateGradleRb) { 47 | gemInstallDir 'build/gems' 48 | } 49 | """ 50 | 51 | def expected = new File(projectDir, 'gradle.rb') 52 | 53 | when: "The load path file is generated " 54 | gradleRunner(DEFAULT_TASK_NAME, '-i', '-s').build() 55 | 56 | then: "Expect to be in the configured destinationDir and be called gradle.rb" 57 | expected.exists() 58 | 59 | when: 60 | String content = expected.text 61 | 62 | then: "The GEM_HOME to include gemInstallDir" 63 | content.contains "export GEM_HOME=\"${new File(projectDir, 'build/gems').absolutePath}" 64 | 65 | and: "The JARS_HOME is set" 66 | content.contains('export JARS_HOME=') 67 | 68 | and: "The java command invoked with the -cp flag" 69 | // with this test setup it is just jrubyExec.asPath 70 | content.contains "-cp ${flatRepoLocation.absolutePath}" 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /core-plugin/README.adoc: -------------------------------------------------------------------------------- 1 | == Core plugin 2 | 3 | The core plugin is not meant for consumption by build script authors. It is rather targeted at authors of other plugins that might require some core JRuby functionality without the conventional and extensions that is associated with other JRuby-Gradle plugins. 4 | 5 | This plugin offers the following functionality: 6 | 7 | * A repository handler extension to resolve GEMs directly from https://rubygems.org or another GEM repository that serves the same REST API. 8 | * Conversion between GEM-style and Ivy-style dependencies notations. 9 | * An abstract task class (`AbstractJRubyPrepare`) for preparing local GEM + JAR installations. 10 | 11 | == Getting Started 12 | 13 | === Compatibility 14 | 15 | This plugin requires link:http://gradle.org[Gradle] 4.3 or better 16 | 17 | === Installing 18 | 19 | .build.gradle 20 | [source, groovy] 21 | ---- 22 | plugins { 23 | id 'com.github.jruby-gradle.core' version 'VERSION-OF-PLUGIN' 24 | } 25 | ---- 26 | 27 | === Adding repositories 28 | 29 | .build.gradle 30 | [source,groovy] 31 | ---- 32 | repositories { 33 | ruby.gems() // <1> 34 | ruby.gems { // <2> 35 | prerelease = true 36 | } 37 | ruby.gems('https://foo.bar') // <3> 38 | ruby.gems('acme-rubygems', 'https://foo.bar') // <4> 39 | 40 | ruby.mavengems() // <5> 41 | ruby.mavengems('https://foo.bar') // <6> 42 | ruby.mavengems('acme-rubygems', 'https://foo.bar') // <7> 43 | } 44 | ---- 45 | <1> Proxy rubygems.org directly and use `rubygems` as the Maven coordinate group. 46 | <2> Proxy rubygems.org directly and allow prerelease GEMs to be considered. Use `rubygems` as the Maven coordinate group. 47 | <3> Proxy a custom rubygems repository. 48 | <4> Proxy a custom rubygems repository and assign a custom Maven coordinate group. 49 | <5> Adds a Maven repository that uses the one official supported by the JRuby group. In order to use this, GEM dependencies should all be placed in the `rubygems` group. 50 | <6> Adds a custom Maven repository that will proxy a GEMs repository. In order to use this, GEM dependencies should all be placed in the `rubygems` group. 51 | <7> Adds a custom Maven repository that will proxy a GEMs repository, but allocate a custom dedicated Maven group. This is useful where you would want to use both the public repository and your own, but you want to save network query traffic, by only query repositories where you know the dependencies should exist. 52 | 53 | == Advanced 54 | 55 | === Customising GEM resolving 56 | 57 | By default the `rubygems` configuration and others added via `ruby.mavengems()` and `ruby.gems()` will have additional resolving strategies applied that mimicks GEM behaviour rather then Gradle behaviour. It is possible to customise this behaviour. 58 | 59 | .build.gradle 60 | [source,groovy] 61 | ---- 62 | gemResolverStrategy { 63 | excludeConfigurations 'foo', 'bar' // <1> 64 | excludeModule 'foo.*' // <2> 65 | excludeModule 'foo.*', /1\.2.*/ // <3> 66 | useGemVersionResolver 'gems2' // <4> 67 | } 68 | ---- 69 | <1> Exclude configurations `foo` and `bar` from being considered for GEM resolver strategies. 70 | <2> Exclude module that matches regular expression from GEM resolver strategies. 71 | <3> Exclude module and version that matches regular expression from GEM resolver strategies. 72 | <4> Apply GEM resolver strategies to a specific configuration. -------------------------------------------------------------------------------- /jar-plugin/build.gradle: -------------------------------------------------------------------------------- 1 | ext { 2 | testRepoDir = new File(buildDir, 'tmp/test/repo') 3 | } 4 | 5 | configurations { 6 | testRepo 7 | /* this configuration is to dump old versions of things into the flatrepo */ 8 | testRepoOldFiles 9 | } 10 | 11 | generateTestConfig { 12 | testProperties mavenrepo: new File(project(':jruby-gradle-base-plugin').projectDir, 'src/integTest/mavenrepo').absolutePath, 13 | flatrepo: testRepoDir.absolutePath 14 | } 15 | 16 | dependencies { 17 | compile project(':jruby-gradle-base-plugin') 18 | /* 19 | * NOTE: version 5.0.0 of the shadow plugin supports only Gradle 5.x and later 20 | */ 21 | compile 'com.github.jengelman.gradle.plugins:shadow:5.2.0' 22 | compile 'org.codehaus.plexus:plexus-utils:[3.2.0,3.3)' 23 | compile 'org.apache.commons:commons-io:1.3.2' 24 | compile 'org.ow2.asm:asm-commons:[6.1,6.99)' 25 | compile 'org.apache.ant:ant:[1.10.6,2.0)' 26 | 27 | testCompile(spockVersion) { 28 | exclude module: 'groovy-all' 29 | } 30 | 31 | // For the testRepo tests I am locking the versions, instead of a open version, as it makes 32 | // unit testing easier, This does not affect the final artifact. 33 | // If you change values here, you need to update JRubyJarPluginSpec as well. 34 | testRepo("org.jruby:jruby-complete:${jrubyVersion}") { 35 | transitive = false 36 | } 37 | 38 | testRepo('rubygems:jar-dependencies:0.1.15') { 39 | transitive = false 40 | } 41 | 42 | testRepo('org.jruby.mains:jruby-mains:0.6.1') { 43 | transitive = false 44 | } 45 | 46 | testRepoOldFiles('de.saumya.mojo:jruby-mains:0.3.0') { 47 | transitive = false 48 | } 49 | 50 | testRepoOldFiles("org.jruby:jruby-complete:1.7.11") { 51 | transitive = false 52 | } 53 | 54 | testRepo(spockVersion) { 55 | transitive = false 56 | } 57 | } 58 | 59 | 60 | task prepareTestRepo(type: Copy) { 61 | into testRepoDir 62 | from project.configurations.testRepo 63 | from project.configurations.testRepoOldFiles 64 | 65 | } 66 | 67 | test { 68 | dependsOn prepareTestRepo 69 | } 70 | 71 | groovydoc { 72 | docTitle = "${archivesBaseName} ${version}" 73 | } 74 | 75 | task installGroovyDoc(type: Copy) { 76 | from({ new File(buildDir, 'docs/groovydoc') }) { 77 | include '**' 78 | } 79 | into { new File(project.properties.jrubyGradleWebsiteInstallDir, "docs/api/${archivesBaseName}/${version}") } 80 | onlyIf { project.hasProperty('jrubyGradleWebsiteInstallDir') } 81 | } 82 | 83 | artifacts { 84 | archives sourcesJar 85 | } 86 | 87 | pluginBundle { 88 | plugins { 89 | gradlePlugin { 90 | id = 'com.github.jruby-gradle.jar' 91 | displayName = 'JRuby/Gradle base plugin' 92 | description = 'This plugin encapsulates java archive building functionality for JRuby Gradle projects' 93 | tags = (['jruby', 'fatjar']) 94 | } 95 | } 96 | } 97 | 98 | gradleTest { 99 | dependsOn jar 100 | mustRunAfter test, integrationTest 101 | enabled = false // TODO: Fix jar plugin as it has a DoS in jar construction. 102 | } 103 | 104 | integrationTest { 105 | dependsOn prepareTestRepo 106 | } 107 | // vim: ft=groovy 108 | -------------------------------------------------------------------------------- /jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/helpers/IntegrationSpecification.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.jar.helpers 25 | 26 | import org.gradle.testkit.runner.GradleRunner 27 | import org.junit.Rule 28 | import org.junit.rules.TemporaryFolder 29 | import spock.lang.Shared 30 | import spock.lang.Specification 31 | 32 | class IntegrationSpecification extends Specification { 33 | static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE') 34 | static final File PARENT_TEST_FOLDER = new File(System.getProperty('TEST_TEMP_FOLDER', './build/tmp/integrationTests')) 35 | 36 | @Shared 37 | Map testProperties 38 | @Shared 39 | File flatRepoLocation 40 | @Shared 41 | File mavenRepoLocation 42 | 43 | @Rule 44 | TemporaryFolder testFolder = new TemporaryFolder(PARENT_TEST_FOLDER) 45 | 46 | File projectDir 47 | File buildFile 48 | File settingsFile 49 | 50 | void setupSpec() { 51 | PARENT_TEST_FOLDER.mkdirs() 52 | testProperties = loadTestProperties() 53 | flatRepoLocation = new File(testProperties.flatrepo) 54 | mavenRepoLocation = new File(testProperties.mavenrepo) 55 | } 56 | 57 | void setup() { 58 | projectDir = testFolder.root 59 | buildFile = new File(projectDir, 'build.gradle') 60 | settingsFile = new File(projectDir, 'settings.gradle') 61 | 62 | settingsFile.text = 'rootProject.name="testproject"' 63 | } 64 | 65 | GradleRunner gradleRunner(List args) { 66 | GradleRunner.create() 67 | .withProjectDir(projectDir) 68 | .withDebug(true) 69 | .withArguments(args) 70 | .withPluginClasspath() 71 | .withTestKitDir(PARENT_TEST_FOLDER) 72 | .forwardOutput() 73 | } 74 | 75 | String pathAsUriStr(final File path) { 76 | path.absoluteFile.toURI().toString() 77 | } 78 | 79 | private Map loadTestProperties() { 80 | this.class.getResource('/jruby-gradle-testconfig.properties').withInputStream { strm -> 81 | Properties props = new Properties() 82 | props.load(strm) 83 | props as Map 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /jar-plugin/gradle/integration-test.gradle: -------------------------------------------------------------------------------- 1 | import groovy.json.JsonOutput 2 | 3 | configurations { 4 | testJRubyPrepare 5 | integrationTestCompile.extendsFrom testCompile 6 | integrationTestRuntime.extendsFrom testRuntime, integrationTestCompile 7 | } 8 | 9 | sourceSets { 10 | integrationTest { 11 | groovy { 12 | srcDir file("${projectDir}/src/integTest/groovy") 13 | } 14 | compileClasspath = sourceSets.main.output + configurations.integrationTestCompile 15 | runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime 16 | } 17 | } 18 | 19 | task prepareGradleTestKitClasspath { 20 | group 'Build Setup' 21 | description 'Prepare the plugin classpath until TestKit supports it more natively' 22 | File outputDir = file("$buildDir/$name") 23 | 24 | inputs.files sourceSets.main.runtimeClasspath 25 | outputs.dir outputDir 26 | 27 | doLast { 28 | outputDir.mkdirs() 29 | List files = sourceSets.main.runtimeClasspath.files.collect { File f -> f.absolutePath } 30 | file("$outputDir/plugin-classpath.json").text = JsonOutput.toJson(files) 31 | } 32 | } 33 | 34 | task copyIntegrationTestJRuby (type:Copy) { 35 | from ({configurations.testJRubyPrepare.files}) 36 | into new File(buildDir,'tmp/test/repo') 37 | } 38 | 39 | task integrationTest(type: Test) { 40 | group 'Verification' 41 | description 'Run the TestKit-based integration tests' 42 | dependsOn prepareGradleTestKitClasspath, copyIntegrationTestJRuby, test 43 | classpath = sourceSets.integrationTest.runtimeClasspath 44 | testClassesDirs = sourceSets.integrationTest.output.classesDirs 45 | 46 | testLogging { 47 | showStandardStreams = true 48 | exceptionFormat "full" 49 | } 50 | } 51 | check.dependsOn integrationTest 52 | 53 | dependencies { 54 | /* Without pruning the groovy-all dependency from this file list, we end up 55 | * with two groovys running around and this exception at runtime: 56 | * groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-all is loaded in version 2.3.10 and you are trying to load version 2.3.3 57 | at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:509) 58 | at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:77) 59 | at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:71) 60 | at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:53) 61 | at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:110) 62 | at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:71) 63 | at groovy.lang.GroovySystem.(GroovySystem.java:33) 64 | */ 65 | integrationTestCompile files(gradleTestKit().resolve().findAll { File f -> !f.name.matches(/groovy-all-(.*).jar/) } ) 66 | /* add our TestKit classpath to our test runtime so we can find it again */ 67 | integrationTestRuntime files(prepareGradleTestKitClasspath) 68 | 69 | gradleTest project(':jruby-gradle-plugin') 70 | gradleTest 'com.github.jengelman.gradle.plugins:shadow:[1.2.2,2.0)' 71 | 72 | testJRubyPrepare "org.jruby:jruby-complete:1.7.19" 73 | } 74 | -------------------------------------------------------------------------------- /base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPlugin.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle 25 | 26 | import com.github.jrubygradle.api.core.JRubyCorePlugin 27 | import com.github.jrubygradle.internal.JRubyExecDelegate 28 | import groovy.transform.CompileStatic 29 | import org.gradle.api.Action 30 | import org.gradle.api.Plugin 31 | import org.gradle.api.Project 32 | import org.gradle.api.Task 33 | import org.gradle.api.artifacts.Configuration 34 | 35 | import static org.ysb33r.grolifant.api.v4.TaskProvider.registerTask 36 | 37 | /** Base plugin for JRuby. 38 | * 39 | * @author Schalk W. Cronjé 40 | * @author R Tyler Croy 41 | * @author Christian Meier 42 | * 43 | */ 44 | @CompileStatic 45 | class JRubyPlugin implements Plugin { 46 | public static final String TASK_GROUP_NAME = 'JRuby' 47 | public static final String DEFAULT_CONFIGURATION = 'gems' 48 | public static final String DEFAULT_PREPARE_TASK = 'jrubyPrepare' 49 | public static final String PROJECT_JRUBYEXEC = 'jrubyexec' 50 | 51 | void apply(Project project) { 52 | project.apply plugin: JRubyCorePlugin 53 | Configuration gems = project.configurations.create(DEFAULT_CONFIGURATION) 54 | 55 | JRubyPluginExtension jruby = project.extensions.create( 56 | JRubyPluginExtension.NAME, 57 | JRubyPluginExtension, 58 | project 59 | ) 60 | jruby.gemConfiguration = gems 61 | 62 | JRubyExecDelegate.addToProject(project, PROJECT_JRUBYEXEC) 63 | 64 | registerTask( 65 | project.tasks, 66 | 'generateGradleRb', 67 | GenerateGradleRb 68 | ).configure(generateGradleRbConfiguration(project)) 69 | } 70 | 71 | private Action generateGradleRbConfiguration(Project project) { 72 | new Action() { 73 | @Override 74 | void execute(GenerateGradleRb ggrb) { 75 | ggrb.with { 76 | group = TASK_GROUP_NAME 77 | description = 'Generate a gradle.rb stub for executing Ruby binstubs' 78 | dependsOn DEFAULT_PREPARE_TASK 79 | gemInstallDir { "${project.buildDir}/.gems" } 80 | } 81 | } 82 | } as Action 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at rtyler@brokencod.de. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RubyGemQueryRestApi.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2014-2023, R. Tyler Croy , 3 | * Schalk Cronje , Christian Meier, Lookout, Inc. 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | package com.github.jrubygradle.api.core; 25 | 26 | import com.github.jrubygradle.api.gems.GemInfo; 27 | 28 | import java.util.List; 29 | 30 | /** Interface for querying a service that confirorms to the RubyGem API. 31 | * 32 | * @author Schalk W. Cronjé 33 | * 34 | * @since 2.0. 35 | * 36 | * @see {@link https://guides.rubygems.org/rubygems-org-api} 37 | */ 38 | public interface RubyGemQueryRestApi { 39 | 40 | /** 41 | * Return all published versions for a specific GEM 42 | * 43 | * @param gemName Name of GEM. 44 | * @return List of versions. Can be empty if the GEM does not have any versions. Never {@code null}. 45 | * @throws {@link ApiException} if a networking or parser error occurs. 46 | */ 47 | List allVersions(String gemName) throws ApiException; 48 | 49 | /** 50 | * Return all published versions for a specific GEM 51 | * 52 | * @param gemName Name of GEM. 53 | * @param includePrelease Whether pre-release versions should be included. 54 | * @return List of versions. Can be empty if the GEM does not have any versions. Never {@code null}. 55 | * @throws {@link ApiException} if a networking or parser error occurs. 56 | */ 57 | List allVersions(String gemName, boolean includePrelease) throws ApiException; 58 | 59 | /** 60 | * Return latest published version of GEM. 61 | * 62 | * @param gemName Name of GEM. 63 | * @return Version of GEM 64 | * @throws {@link ApiException} if GEM does not exist. 65 | */ 66 | String latestVersion(String gemName) throws ApiException; 67 | 68 | /** 69 | * Return latest published version of GEM. 70 | * 71 | * @param gemName Name of GEM. 72 | * @param allowPrerelease Whether a prereleased version can be considered a latest version. 73 | * @return Version of GEM 74 | * @throws {@link ApiException} if GEM does not exist. 75 | */ 76 | String latestVersion(String gemName, boolean allowPrerelease) throws ApiException; 77 | 78 | /** Returns the basic metadata for a GEM. 79 | * 80 | * @param gemName Name of GEM. 81 | * @param version Version of GEM. 82 | * @return Metadata for GEM 83 | * @throws {@link ApiException} if GEM + version does not exist. 84 | */ 85 | GemInfo metadata(String gemName, String version) throws ApiException; 86 | } 87 | --------------------------------------------------------------------------------