Compare commits

...

20 Commits

Author SHA1 Message Date
Schalk Cronje 7bdd0ea12f Workaround plugin portal issue. Point to repo and not website 2021-05-03 19:42:09 +02:00
Schalk Cronje 0cd68d410b Use secrets inline in gradle arguments 2021-05-03 19:18:57 +02:00
Schalk Cronje f8287eb4e9 debug: Checking use of secrets 2021-05-03 18:57:18 +02:00
Schalk Cronje 1dcf24b69a debug: checking whether secrets are passed to Gradle correctly 2021-05-03 16:17:00 +02:00
Schalk W. Cronjé e162ad9e0c
only set pluginBundle for plugin subprojects 2021-05-02 22:46:43 +02:00
Schalk W. Cronjé 4986474e1b
Describe plugin bundle #386 2021-05-02 22:41:52 +02:00
Schalk W. Cronjé a68d8551a5
Merge pull request #426 from jruby-gradle/master
Release 2.1.0-alpha.3
2021-05-02 22:14:42 +02:00
Schalk W. Cronjé c673c36e20
Merge pull request #425 from ysb33r/386-automate-publishing
Automate publishing
2021-05-02 21:54:55 +02:00
Schalk Cronje 98a282d204 (#386) Setup initial publishing from GH Actions 2021-05-02 21:43:57 +02:00
Lóránt Pintér 6b47d5dca7 Fix problems with task properties 2021-05-02 20:18:29 +02:00
Schalk W. Cronjé 218b74701a
Merge pull request #424 from ysb33r/fix-codenarc
Adjust license to include 2021
2021-05-02 20:14:11 +02:00
Schalk Cronje 08751e9317 Adjust license to include 2021 2021-05-02 19:15:20 +02:00
Schalk Cronje 2304bd4d4e Fix GH Yaml 2021-05-02 16:46:09 +02:00
Schalk W. Cronjé 608805bd8a
Merge pull request #423 from ysb33r/386-move-away-from-travis
Move away from travis
2021-05-02 16:42:11 +02:00
Schalk Cronje 65871700bc Add GH actions (#386) 2021-05-02 16:37:13 +02:00
Schalk Cronje d2c32b51ac Update integration specifications 2021-02-07 21:06:49 +01:00
Schalk Cronje c55d80b4cb Merge branch 'master' of https://github.com/jruby-gradle/jruby-gradle-plugin 2021-02-07 21:06:19 +01:00
Schalk W. Cronjé b4453643d9
Merge pull request #418 from lptr/lptr/fix-validation-warnings
Fix task property annotation problems
2021-02-07 22:04:38 +02:00
Lóránt Pintér 9374f94648
Fix problems with task properties 2021-02-01 18:30:11 +01:00
Lóránt Pintér cd0da9b064
Enable strict validation 2021-01-29 18:22:59 +01:00
31 changed files with 307 additions and 226 deletions

172
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,172 @@
name: Build
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: 11
# Cache
- name: Cache .gradle/caches
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-cache-
- name: Cache .gradle/wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-wrapper-
# Licensing
- name: Licensing
uses: eskatos/gradle-command-action@v1
with:
arguments: --console=plain -S license
# Coding style
- name: Coding style
uses: eskatos/gradle-command-action@v1
with:
arguments: --console=plain -i codenarcMain codenarcTest codenarcIntTest
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
# use a short path to avoid exceeding the path limit on Windows... sigh
with:
path: 'w'
- uses: actions/setup-java@v1
with:
java-version: 11
# Cache
- name: Cache .gradle/caches
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-cache-
- name: Cache .gradle/wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-wrapper-
# Build
- name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: --console=plain --warning-mode=all clean assemble
# Test
- name: UnitTest
uses: eskatos/gradle-command-action@v1
with:
arguments: --console=plain --warning-mode=all --no-parallel test
# Test
- name: IntegrationTest
uses: eskatos/gradle-command-action@v1
with:
arguments: --console=plain --warning-mode=all --no-parallel intTest
# Test
- name: CompatibilityTest
uses: eskatos/gradle-command-action@v1
with:
arguments: --console=plain --warning-mode=all --no-parallel gradleTest
# Stop gradlew to avoid locking issues
- name: Cleanup
uses: eskatos/gradle-command-action@v1
with:
arguments: --stop
- name: Store reports
uses: actions/upload-artifact@v2
if: always()
with:
name: Test reports Windows
path: "**/build/reports/**"
retention-days: 5
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
java: [ 8, 11 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
# Cache
- name: Cache .gradle/caches
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-cache-
- name: Cache .gradle/wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-wrapper-
# Build
- name: Build
uses: eskatos/gradle-command-action@v1
with:
arguments: -i -S --console=plain --no-build-cache assemble validateTaskProperties
# Unit tests
- name: Unit tests
uses: eskatos/gradle-command-action@v1
with:
arguments: -i -s --console=plain --no-build-cache test
# Integration tests
- name: Integration tests
uses: eskatos/gradle-command-action@v1
with:
arguments: -i -s --console=plain --no-build-cache intTest
# Gradle tests
- name: Compatibility tests
uses: eskatos/gradle-command-action@v1
with:
arguments: -i -s --console=plain --no-build-cache gradleTest
- name: Store reports
uses: actions/upload-artifact@v2
if: always()
with:
name: Test reports
path: "**/build/reports/**"
retention-days: 5
publish:
runs-on: ubuntu-latest
# on:
# push:
# branches:
# - release
needs: build
if: ${{ github.repository == 'jruby-gradle/jruby-gradle-plugin' && github.ref == 'refs/heads/release' }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: 8
- name: Cache .gradle/caches
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-cache-
- name: Cache .gradle/wrapper
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-wrapper-
- name: Publish to Gradle Portal
uses: eskatos/gradle-command-action@v1
with:
arguments: -i --console=plain --no-build-cache assemble publishPlugins -Dgradle.publish.key=${{ secrets.PUBLISH_KEY }} -Dgradle.publish.secret=${{ secrets.PUBLISH_SECRET }}
- name: Publish documentation
uses: eskatos/gradle-command-action@v1
with:
arguments: -i --console=plain --no-build-cache docs:publishGhPages -Dorg.ajoberstar.grgit.auth.username=${{ secrets.GH_PAGES_PUSH_USER }} -Dorg.ajoberstar.grgit.auth.password=${{ secrets.GH_PAGES_PUSH_TOKEN }} -Dorg.ajoberstar.grgit.auth.force=hardcoded

7
.sdkmanrc Normal file
View File

@ -0,0 +1,7 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
<<<<<<< HEAD
java=8.0.265.j9-adpt
=======
java=8.0.282.hs-adpt
>>>>>>> 998cb79 (Add sdkmanrc file and set to use JDK8)

View File

@ -1,14 +0,0 @@
language: java
sudo: true
#env:
# - GRADLE_OPTS="-Xmx768m -Xms256m -Xss1m"
script:
- ./gradlew -S -i --max-workers=2 --no-daemon clean check build --scan
jdk:
- openjdk8
- openjdk11
os:
- linux
cache:
directories:
- $HOME/.gradle

View File

@ -1,24 +0,0 @@
version: "{branch} {build}"
build:
verbosity: detailed
build_script:
- gradlew.bat assemble --info --no-daemon --scan
test_script:
- gradlew.bat test check gradleTest --info --no-daemon --scan
branches:
only:
- master
- development
environment:
matrix:
- JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0
cache:
- C:\Users\appveyor\.gradle

View File

@ -102,47 +102,17 @@ task installGroovyDoc(type: Copy) {
onlyIf { project.hasProperty('jrubyGradleWebsiteInstallDir') } onlyIf { project.hasProperty('jrubyGradleWebsiteInstallDir') }
} }
pluginBundle {
publishing { plugins {
publications { gradlePlugin {
maven(MavenPublication) { id = 'com.github.jruby-gradle.base'
// groupId project.group displayName = 'JRuby/Gradle base plugin'
// artifactId project.archivesBaseName description = 'The purpose of plugin is to encapsulate useful Gradle functionality for JRuby projects'
// version project.version tags = (['jruby'])
artifact sourcesJar {
classifier "sources"
}
from components.java
} }
} }
} }
bintray {
user = project.bintrayUser
key = project.bintrayKey
publish = true
dryRun = false
publications = ['maven']
pkg {
userOrg = 'jruby-gradle'
repo = 'plugins'
name = 'jruby-gradle-plugin'
labels = ['jruby']
version {
name = project.version
vcsTag = "v${project.version}"
attributes = ['gradle-plugin': 'com.github.jruby-gradle.base:com.github.jruby-gradle:jruby-gradle-plugin']
desc = 'The purpose of plugin is to encapsulate useful Gradle functionality for JRuby projects.'
}
}
}
bintrayUpload.dependsOn assemble
gradleTest.mustRunAfter integrationTest gradleTest.mustRunAfter integrationTest
// vim: ft=groovy // vim: ft=groovy

View File

@ -30,7 +30,7 @@ import spock.lang.IgnoreIf
/** /**
* @author Schalk W. Cronjé * @author Schalk W. Cronjé
*/ */
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')}) @IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') })
class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification { class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec' public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'

View File

@ -25,11 +25,7 @@ package com.github.jrubygradle
import com.github.jrubygradle.testhelper.IntegrationSpecification import com.github.jrubygradle.testhelper.IntegrationSpecification
import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.BuildResult
import spock.lang.IgnoreIf
import spock.lang.Issue import spock.lang.Issue
import spock.lang.PendingFeature
import static com.github.jrubygradle.internal.JRubyExecUtils.DEFAULT_JRUBYEXEC_CONFIG
class JRubyExecIntegrationSpec extends IntegrationSpecification { class JRubyExecIntegrationSpec extends IntegrationSpecification {
static final String DEFAULT_TASK_NAME = 'RubyWax' static final String DEFAULT_TASK_NAME = 'RubyWax'
@ -151,9 +147,9 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
script 'rspec' script 'rspec'
""" """
File specDir = new File(projectDir,'spec') File specDir = new File(projectDir, 'spec')
specDir.mkdirs() specDir.mkdirs()
new File(specDir,'sample.rb').text = '' new File(specDir, 'sample.rb').text = ''
when: when:
BuildResult result = build() BuildResult result = build()

View File

@ -30,7 +30,7 @@ import spock.lang.IgnoreIf
/** /**
* @author Schalk W. Cronjé * @author Schalk W. Cronjé
*/ */
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')}) @IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') })
class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification { class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
static final String DEFAULT_TASK_NAME = 'RubyWax' static final String DEFAULT_TASK_NAME = 'RubyWax'

View File

@ -106,7 +106,6 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
lockAllConfigurations() lockAllConfigurations()
} }
""" """
withDependencies """ withDependencies """
gems "rubygems:sinatra:1.4.5" gems "rubygems:sinatra:1.4.5"

View File

@ -23,7 +23,6 @@
*/ */
package com.github.jrubygradle.testhelper package com.github.jrubygradle.testhelper
import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule import org.junit.Rule
import org.junit.rules.TemporaryFolder import org.junit.rules.TemporaryFolder
@ -55,7 +54,7 @@ class IntegrationSpecification extends Specification {
Map artifactVersions Map artifactVersions
@Rule @Rule
TemporaryFolder testFolder TemporaryFolder testFolder = new TemporaryFolder(new File(System.getProperty('TMP_FOLDER')))
File projectDir File projectDir
File buildFile File buildFile
@ -65,6 +64,7 @@ class IntegrationSpecification extends Specification {
testProperties = loadTestProperties() testProperties = loadTestProperties()
flatRepoLocation = new File(testProperties.flatrepo) flatRepoLocation = new File(testProperties.flatrepo)
mavenRepoLocation = new File(testProperties.mavenrepo) mavenRepoLocation = new File(testProperties.mavenrepo)
new File(System.getProperty('TMP_FOLDER')).mkdirs()
artifactVersions = [ artifactVersions = [
'credit_card_validator': testProperties.creditCardValidatorVersion, 'credit_card_validator': testProperties.creditCardValidatorVersion,
@ -77,7 +77,7 @@ class IntegrationSpecification extends Specification {
} }
void setup() { void setup() {
projectDir = testFolder.root projectDir = testFolder.root.absoluteFile
buildFile = new File(projectDir, 'build.gradle') buildFile = new File(projectDir, 'build.gradle')
settingsFile = new File(projectDir, 'settings.gradle') settingsFile = new File(projectDir, 'settings.gradle')
@ -90,7 +90,7 @@ class IntegrationSpecification extends Specification {
destination.text = this.class.getResource("/scripts/${name}").text destination.text = this.class.getResource("/scripts/${name}").text
} }
@SuppressWarnings('ThrowRuntimeException')
String findDependency(final String organisation, final String artifact, final String extension) { String findDependency(final String organisation, final String artifact, final String extension) {
String ver = artifactVersions[artifact] String ver = artifactVersions[artifact]
if (!ver) { if (!ver) {

View File

@ -33,6 +33,7 @@ import org.gradle.api.file.CopySpec
import org.gradle.api.file.FileCopyDetails import org.gradle.api.file.FileCopyDetails
import org.gradle.api.file.RelativePath import org.gradle.api.file.RelativePath
import org.gradle.api.tasks.Input import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import org.ysb33r.grolifant.api.core.ProjectOperations import org.ysb33r.grolifant.api.core.ProjectOperations
@ -74,6 +75,7 @@ class GenerateGradleRb extends DefaultTask implements JRubyAwareTask {
this.gemInstallDir = dir this.gemInstallDir = dir
} }
@Internal
File getDestinationDir() { File getDestinationDir() {
projectOperations.file(destinationDir) projectOperations.file(destinationDir)
} }
@ -88,10 +90,16 @@ class GenerateGradleRb extends DefaultTask implements JRubyAwareTask {
StringUtils.stringize(baseName) StringUtils.stringize(baseName)
} }
@Internal
File getGemInstallDir() { File getGemInstallDir() {
projectOperations.file(this.gemInstallDir) projectOperations.file(this.gemInstallDir)
} }
@Input
protected String getGemInstallDirPath() {
getGemInstallDir().absolutePath
}
@TaskAction @TaskAction
@CompileDynamic @CompileDynamic
@SuppressWarnings('DuplicateStringLiteral') @SuppressWarnings('DuplicateStringLiteral')
@ -99,7 +107,7 @@ class GenerateGradleRb extends DefaultTask implements JRubyAwareTask {
Object source = getSourceFromResource() Object source = getSourceFromResource()
File destination = destinationFile().parentFile File destination = destinationFile().parentFile
String path = classpathFromConfiguration(jruby.jrubyConfiguration).join(File.pathSeparator) String path = classpathFromConfiguration(jruby.jrubyConfiguration).join(File.pathSeparator)
String gemDir = getGemInstallDir().absolutePath String gemDir = getGemInstallDirPath()
String bootstrapName = getBaseName() String bootstrapName = getBaseName()
String bootstrapTemplate = BOOTSTRAP_TEMPLATE String bootstrapTemplate = BOOTSTRAP_TEMPLATE
logger.info("GenerateGradleRb - source: ${source}, destination: ${destination}, baseName: ${baseName}") logger.info("GenerateGradleRb - source: ${source}, destination: ${destination}, baseName: ${baseName}")

View File

@ -29,10 +29,12 @@ import com.github.jrubygradle.internal.JRubyExecUtils
import groovy.transform.CompileStatic import groovy.transform.CompileStatic
import org.gradle.api.Task import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Configuration
import org.gradle.api.model.ReplacedBy
import org.gradle.api.provider.Provider import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Input import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.Optional import org.gradle.api.tasks.LocalState
import org.gradle.api.tasks.TaskContainer import org.gradle.api.tasks.TaskContainer
import org.gradle.process.JavaExecSpec import org.gradle.process.JavaExecSpec
import org.gradle.util.GradleVersion import org.gradle.util.GradleVersion
@ -70,6 +72,16 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
this.jruby = extensions.create(JRubyPluginExtension.NAME, JRubyPluginExtension, this) this.jruby = extensions.create(JRubyPluginExtension.NAME, JRubyPluginExtension, this)
this.projectOperations = ProjectOperations.create(project) this.projectOperations = ProjectOperations.create(project)
this.tasks = project.tasks this.tasks = project.tasks
this.inputs.property 'script-path', { scr ->
File f = resolveScript(projectOperations, scr)
if (!f) {
''
} else if (f.exists()) {
f.text
} else {
stringize(scr)
}
}.curry(this.script)
inputs.property 'jrubyver', { JRubyPluginExtension jruby -> inputs.property 'jrubyver', { JRubyPluginExtension jruby ->
jruby.jrubyVersion jruby.jrubyVersion
@ -99,8 +111,10 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
/** Script to execute. /** Script to execute.
* @return The path to the script (or {@code null} if not set) * @return The path to the script (or {@code null} if not set)
*/ */
@Optional // @Optional
@Input // @InputFile
// @PathSensitive(PathSensitivity.NONE)
@Internal
File getScript() { File getScript() {
resolveScript(projectOperations, this.script) resolveScript(projectOperations, this.script)
} }
@ -185,6 +199,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
* *
* @return Provider of GEM working directory. * @return Provider of GEM working directory.
*/ */
@LocalState
Provider<File> getGemWorkDir() { Provider<File> getGemWorkDir() {
this.gemWorkDir this.gemWorkDir
} }
@ -196,6 +211,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
* *
*/ */
@Deprecated @Deprecated
@ReplacedBy('jruby.jrubyVersion')
String getJrubyVersion() { String getJrubyVersion() {
deprecated('Use jruby.getJrubyVersion() rather getJrubyVersion()') deprecated('Use jruby.getJrubyVersion() rather getJrubyVersion()')
jruby.jrubyVersion jruby.jrubyVersion

View File

@ -23,7 +23,6 @@
*/ */
package com.github.jrubygradle package com.github.jrubygradle
import org.gradle.api.InvalidUserDataException import org.gradle.api.InvalidUserDataException
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Configuration
@ -80,7 +79,7 @@ class JRubyExecTaskSpec extends Specification {
execTask.jruby.jrubyVersion != project.jruby.jrubyVersion execTask.jruby.jrubyVersion != project.jruby.jrubyVersion
and: "jrubyConfigurationName must point to this new configuration" and: "jrubyConfigurationName must point to this new configuration"
execTask.jruby.getGemConfiguration().name == configurationName execTask.jruby.gemConfiguration.name == configurationName
and: "configuration must exist" and: "configuration must exist"
project.configurations.findByName(configurationName) project.configurations.findByName(configurationName)
@ -178,6 +177,6 @@ class JRubyExecTaskSpec extends Specification {
} }
then: then:
execTask.jruby.getGemConfiguration().name == customConfig.name execTask.jruby.gemConfiguration.name == customConfig.name
} }
} }

View File

@ -24,8 +24,6 @@
package com.github.jrubygradle package com.github.jrubygradle
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.artifacts.repositories.ArtifactRepository
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.testfixtures.ProjectBuilder import org.gradle.testfixtures.ProjectBuilder
import spock.lang.Specification import spock.lang.Specification
@ -45,12 +43,4 @@ class JRubyPluginSpec extends Specification {
then: then:
project.jruby.defaultVersion == JRubyPluginExtension.DEFAULT_JRUBY_VERSION project.jruby.defaultVersion == JRubyPluginExtension.DEFAULT_JRUBY_VERSION
} }
private Collection hasRepositoryUrl(Project p, String url) {
p.repositories.findAll { ArtifactRepository r ->
r instanceof IvyArtifactRepository
}.findAll {
it.ivyPattern.contains(url)
}
}
} }

View File

@ -115,7 +115,7 @@ class JRubyExecUtilsSpec extends Specification {
void "Prepare a basic JRuby environment"() { void "Prepare a basic JRuby environment"() {
when: when:
Map preparedEnv = prepareJRubyEnvironment([:],false, new File('tmp/foo')) Map preparedEnv = prepareJRubyEnvironment([:], false, new File('tmp/foo'))
then: then:
preparedEnv.size() > 0 preparedEnv.size() > 0
@ -128,7 +128,7 @@ class JRubyExecUtilsSpec extends Specification {
'GEM_HOME' : '/tmp/spock', 'GEM_HOME' : '/tmp/spock',
'RUBY_VERSION' : 'notaversion', 'RUBY_VERSION' : 'notaversion',
'rvm_ruby_string': 'jruby-head', 'rvm_ruby_string': 'jruby-head',
],false, gemWorkDir) ], false, gemWorkDir)
then: then:
preparedEnv['GEM_HOME'] == gemWorkDir.absolutePath preparedEnv['GEM_HOME'] == gemWorkDir.absolutePath

View File

@ -1,11 +1,10 @@
plugins { plugins {
id 'com.gradle.build-scan' version '2.0.2' id 'com.gradle.build-scan' version '2.0.2'
id 'org.ysb33r.gradletest' version '2.0-rc.4' apply false id 'org.ysb33r.gradletest' version '2.0-rc.4' apply false
id 'com.jfrog.bintray' version '1.8.4' apply false
id 'org.ajoberstar.github-pages' version '1.2.0' apply false id 'org.ajoberstar.github-pages' version '1.2.0' apply false
id 'org.ysb33r.cloudci.appveyor.testreporter' version '2.5' apply false
id 'com.github.hierynomus.license' version '0.14.0' apply false id 'com.github.hierynomus.license' version '0.14.0' apply false
id 'io.ratpack.ratpack-java' version "1.6.1" apply false id 'io.ratpack.ratpack-java' version "1.6.1" apply false
id 'com.gradle.plugin-publish' version '0.14.0' apply false
} }
buildScan { buildScan {
@ -33,10 +32,9 @@ allprojects {
} }
subprojects { subprojects {
apply plugin: 'maven'
repositories { repositories {
jcenter() mavenCentral()
gradlePluginPortal()
} }
if (project.name != 'docs') { if (project.name != 'docs') {
@ -44,10 +42,8 @@ subprojects {
apply plugin: 'java-gradle-plugin' apply plugin: 'java-gradle-plugin'
apply plugin: 'groovy' apply plugin: 'groovy'
apply plugin: 'codenarc' apply plugin: 'codenarc'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'org.ysb33r.gradletest' apply plugin: 'org.ysb33r.gradletest'
apply plugin: 'maven-publish' apply plugin: 'com.gradle.plugin-publish'
apply plugin: 'org.ysb33r.cloudci.appveyor.testreporter'
apply from: "${rootProject.projectDir}/gradle/integration-tests.gradle" apply from: "${rootProject.projectDir}/gradle/integration-tests.gradle"
apply from: "${rootProject.projectDir}/gradle/license.gradle" apply from: "${rootProject.projectDir}/gradle/license.gradle"
@ -91,8 +87,11 @@ subprojects {
dependsOn jar dependsOn jar
} }
install.dependsOn check pluginBundle {
website = 'https://github.com/jruby-gradle/jruby-gradle-plugin' // 'http://jruby-gradle.org/'
vcsUrl = 'https://github.com/jruby-gradle/jruby-gradle-plugin.git'
}
tasks.withType(Test) { tasks.withType(Test) {
if (gradle.startParameter.isOffline()) { if (gradle.startParameter.isOffline()) {
@ -106,8 +105,14 @@ subprojects {
ideReport.enabled = true ideReport.enabled = true
ideReport.destination = file( "${project.codenarc.reportsDir}/${reportName}.ide.txt") ideReport.destination = file( "${project.codenarc.reportsDir}/${reportName}.ide.txt")
} }
tasks.withType(ValidateTaskProperties) { validateTaskProperties ->
validateTaskProperties.failOnWarning = true
validateTaskProperties.enableStricterValidation = true
}
} }
idea { idea {
module { module {
downloadJavadoc = true downloadJavadoc = true

View File

@ -18,33 +18,19 @@ artifacts {
archives sourcesJar archives sourcesJar
} }
bintray { pluginBundle {
user = project.bintrayUser plugins {
key = project.bintrayKey gradlePlugin {
publish = true id = 'com.github.jruby-gradle.core'
dryRun = false displayName = 'JRuby/Gradle core plugin'
configurations = ['archives'] description = 'This plugin provides some core dependency resolution for JRuby/Gradle'
tags = (['jruby'])
pkg {
userOrg = 'jruby-gradle'
repo = 'plugins'
name = 'jruby-gradle-core-plugin'
labels = ['jruby']
version {
name = project.version
vcsTag = "v${project.version}"
attributes = ['gradle-plugin': 'com.github.jruby-gradle.core:com.github.jruby-gradle:jruby-gradle-core-plugin']
desc = 'This plugin provides some core dependency resolution for JRuby/Gradle'
} }
} }
} }
processResources { processResources {
filesMatching '**/com.jrubygradle.core-plugin.version.properties', { filesMatching '**/com.jrubygradle.core-plugin.version.properties', {
expand VERSION : project.version expand VERSION : project.version
} }
} }
bintrayUpload.dependsOn assemble

View File

@ -30,7 +30,6 @@ import org.junit.rules.TemporaryFolder
import spock.lang.IgnoreIf import spock.lang.IgnoreIf
import spock.lang.Issue import spock.lang.Issue
import spock.lang.Specification import spock.lang.Specification
import spock.lang.Unroll
import java.util.regex.Pattern import java.util.regex.Pattern
@ -104,7 +103,6 @@ class IvyXmlProxyServerIntegrationSpec extends Specification {
new File(projectDir, 'build/something/base_app-1.0.6.gem').exists() new File(projectDir, 'build/something/base_app-1.0.6.gem').exists()
} }
void 'Download Asciidoctor Reveal.JS GEM and friends'() { void 'Download Asciidoctor Reveal.JS GEM and friends'() {
setup: setup:
withBuildFile ''' withBuildFile '''

View File

@ -34,12 +34,14 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.TaskAction
import org.ysb33r.grolifant.api.core.ProjectOperations import org.ysb33r.grolifant.api.core.ProjectOperations
import static com.github.jrubygradle.api.gems.GemOverwriteAction.SKIP import static com.github.jrubygradle.api.gems.GemOverwriteAction.SKIP
import static com.github.jrubygradle.api.gems.GemUtils.extractGems import static com.github.jrubygradle.api.gems.GemUtils.extractGems
import static com.github.jrubygradle.api.gems.GemUtils.setupJars import static com.github.jrubygradle.api.gems.GemUtils.setupJars
import static org.gradle.api.tasks.PathSensitivity.ABSOLUTE
/** Abstract base class for building custom tasks for preparing GEMs. /** Abstract base class for building custom tasks for preparing GEMs.
* *
@ -86,10 +88,25 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
/** All GEMs that have been supplied as dependencies. /** All GEMs that have been supplied as dependencies.
* *
* @return Collection of GEMs. * @return Collection of GEMs.
*
* @see #getGemsAsFileCollection()
* @deprecated Use {@link #getGemsAsFileCollection()} instead.
*/
@Deprecated
FileCollection gemsAsFileCollection() {
gemsAsFileCollection
}
/** All GEMs that have been supplied as dependencies.
*
* @return Collection of GEMs.
*
* @since 2.1.0
*/ */
@InputFiles @InputFiles
FileCollection gemsAsFileCollection() { @PathSensitive(ABSOLUTE)
return GemUtils.getGems(projectOperations.files(this.dependencies)) FileCollection getGemsAsFileCollection() {
GemUtils.getGems(projectOperations.files(this.dependencies))
} }
@Internal @Internal
@ -99,7 +116,6 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
* *
* @param f One or more of file, directory, configuration or list of gems. * @param f One or more of file, directory, configuration or list of gems.
*/ */
@Optional
void dependencies(Object... f) { void dependencies(Object... f) {
this.dependencies.addAll(f.toList()) this.dependencies.addAll(f.toList())
} }
@ -110,6 +126,7 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
* *
* @since 2.1.0 * @since 2.1.0
*/ */
@Internal
protected ProjectOperations getProjectOperations() { protected ProjectOperations getProjectOperations() {
this.projectOperations this.projectOperations
} }

View File

@ -61,6 +61,6 @@ class IvyXmlProxyServerSpec extends Specification {
} }
then: 'The Ivy file should be generated and cached locally' then: 'The Ivy file should be generated and cached locally'
new File(projectRoot.root,TEST_IVY_PATH) new File(projectRoot.root, TEST_IVY_PATH)
} }
} }

View File

@ -27,7 +27,6 @@ import org.gradle.api.Project
import org.gradle.testfixtures.ProjectBuilder import org.gradle.testfixtures.ProjectBuilder
import spock.lang.Specification import spock.lang.Specification
class RepositoryHandlerExtensionSpec extends Specification { class RepositoryHandlerExtensionSpec extends Specification {
Project project = ProjectBuilder.builder().build() Project project = ProjectBuilder.builder().build()
@ -35,13 +34,13 @@ class RepositoryHandlerExtensionSpec extends Specification {
void 'Add Maven repository'() { void 'Add Maven repository'() {
when: when:
project.allprojects { project.allprojects {
apply plugin : JRubyCorePlugin apply plugin: JRubyCorePlugin
repositories { repositories {
ruby { ruby {
mavengems() mavengems()
mavengems('https://goo1') mavengems('https://goo1')
mavengems('goo2','https://goo2') mavengems('goo2', 'https://goo2')
} }
} }
} }

View File

@ -23,8 +23,6 @@
*/ */
package com.github.jrubygradle.api.gems package com.github.jrubygradle.api.gems
import com.github.jrubygradle.api.gems.GemOverwriteAction
import com.github.jrubygradle.api.gems.GemUtils
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.file.DuplicateFileCopyingException import org.gradle.api.file.DuplicateFileCopyingException
import org.gradle.testfixtures.ProjectBuilder import org.gradle.testfixtures.ProjectBuilder

View File

@ -35,7 +35,7 @@ class GemVersionSpec extends Specification {
@Unroll @Unroll
void "#gemRequirement (gem requirement) ⇒ #ivyNotation (ivy)"() { void "#gemRequirement (gem requirement) ⇒ #ivyNotation (ivy)"() {
when: when:
String ivy = gemVersionFromGemRequirement(gemRequirement).toString() String ivy = gemVersionFromGemRequirement(gemRequirement)
then: then:
ivy == ivyNotation ivy == ivyNotation

View File

@ -23,7 +23,6 @@
*/ */
package com.github.jrubygradle.internal.gems package com.github.jrubygradle.internal.gems
import spock.lang.Specification import spock.lang.Specification
class GemToIvySpec extends Specification { class GemToIvySpec extends Specification {

View File

@ -1,9 +1,7 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven { gradlePluginPortal()
url "https://plugins.gradle.org/m2/"
}
} }
dependencies { dependencies {
/* wow. so recursion */ /* wow. so recursion */
@ -30,7 +28,7 @@ dependencies {
} }
task prepareGroovyDocs(type: Copy) { task prepareGroovyDocs(type: Copy) {
description "Copy Groovydocs into our site directory for deploybment/publication" description "Copy Groovydocs into our site directory for deployment/publication"
into "${buildDir}/_site/groovydoc" into "${buildDir}/_site/groovydoc"
rootProject.subprojects.each { rootProject.subprojects.each {

View File

@ -1,4 +1,4 @@
version=2.1.0-alpha.2 version=2.1.0-alpha.3
group=com.github.jruby-gradle group=com.github.jruby-gradle
copyrightYear=2014-2020 copyrightYear=2014-2020
@ -14,7 +14,7 @@ releaseBuild=false
targetCompatibility=1.8 targetCompatibility=1.8
sourceCompatibility=1.8 sourceCompatibility=1.8
grolifantVersion=1.0.0-alpha.4 grolifantVersion=1.0.0-alpha.6
jrubyVersion=9.2.9.0 jrubyVersion=9.2.9.0
jettyVersion=9.2.12.v20150709 jettyVersion=9.2.12.v20150709
bcprovVersion=1.46 bcprovVersion=1.46

View File

@ -40,5 +40,6 @@ task integrationTest(type: Test, dependsOn: jar) {
classpath = sourceSets.integrationTest.runtimeClasspath classpath = sourceSets.integrationTest.runtimeClasspath
dependsOn copyIntegrationTestGems dependsOn copyIntegrationTestGems
mustRunAfter test mustRunAfter test
systemProperties TMP_FOLDER : file('build/tmp/integrationTestTempFolder').absolutePath
} }
check.dependsOn integrationTest check.dependsOn integrationTest

View File

@ -20,7 +20,7 @@ dependencies {
/* /*
* NOTE: version 5.0.0 of the shadow plugin supports only Gradle 5.x and later * NOTE: version 5.0.0 of the shadow plugin supports only Gradle 5.x and later
*/ */
compile 'com.github.jengelman.gradle.plugins:shadow:4.0.4' compile 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
compile 'org.codehaus.plexus:plexus-utils:[3.2.0,3.3)' compile 'org.codehaus.plexus:plexus-utils:[3.2.0,3.3)'
compile 'org.apache.commons:commons-io:1.3.2' compile 'org.apache.commons:commons-io:1.3.2'
compile 'org.ow2.asm:asm-commons:[6.1,6.99)' compile 'org.ow2.asm:asm-commons:[6.1,6.99)'
@ -87,36 +87,21 @@ artifacts {
archives sourcesJar archives sourcesJar
} }
bintray { pluginBundle {
user = project.bintrayUser plugins {
key = project.bintrayKey gradlePlugin {
publish = true id = 'com.github.jruby-gradle.jar'
dryRun = false displayName = 'JRuby/Gradle base plugin'
configurations = ['archives'] description = 'This plugin encapsulates java archive building functionality for JRuby Gradle projects'
tags = (['jruby','fatjar'])
pkg {
userOrg = 'jruby-gradle'
repo = 'plugins'
name = 'jruby-gradle-jar-plugin'
labels = ['jruby']
version {
name = project.version
vcsTag = "v${project.version}"
attributes = ['gradle-plugin' : 'com.github.jruby-gradle.jar:com.github.jruby-gradle:jruby-gradle-jar-plugin']
desc = 'This plugin encapsulates java archive building functionality for JRuby Gradle projects'
} }
} }
} }
bintrayUpload {
dependsOn assemble
}
gradleTest { gradleTest {
dependsOn jar dependsOn jar
mustRunAfter test, integrationTest mustRunAfter test, integrationTest
enabled = false // TODO: Fix jar plugin as it has a DoS in jar construction.
} }
integrationTest { integrationTest {

View File

@ -26,7 +26,7 @@ package com.github.jrubygradle.jar
import com.github.jrubygradle.jar.helpers.IntegrationSpecification import com.github.jrubygradle.jar.helpers.IntegrationSpecification
import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.TaskOutcome import org.gradle.testkit.runner.TaskOutcome
import spock.lang.IgnoreIf import spock.lang.Ignore
import spock.lang.Issue import spock.lang.Issue
import java.util.zip.ZipEntry import java.util.zip.ZipEntry
@ -34,6 +34,7 @@ import java.util.zip.ZipFile
import static com.github.jrubygradle.jar.JRubyJar.DEFAULT_MAIN_CLASS import static com.github.jrubygradle.jar.JRubyJar.DEFAULT_MAIN_CLASS
@Ignore
class JRubyJarTestKitSpec extends IntegrationSpecification { class JRubyJarTestKitSpec extends IntegrationSpecification {
public static final String DEFAULT_TASK_NAME = 'jrubyJar' public static final String DEFAULT_TASK_NAME = 'jrubyJar'
@ -173,23 +174,7 @@ class JRubyJarTestKitSpec extends IntegrationSpecification {
""" """
} }
private void withRepoSetup(String content) { private void withPreamble(String content) {
this.repoSetup = """
repositories {
${content}
}
"""
}
private void withDependencies(String content) {
this.deps = """
dependencies {
${content}
}
"""
}
private void withPreamble(String content) {
this.preamble = content this.preamble = content
} }

View File

@ -31,6 +31,7 @@ import spock.lang.Specification
class IntegrationSpecification extends Specification { class IntegrationSpecification extends Specification {
static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE') static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE')
static final File PARENT_TEST_FOLDER = new File(System.getProperty('TEST_TEMP_FOLDER', './build/tmp/integrationTests'))
@Shared @Shared
Map testProperties Map testProperties
@ -40,13 +41,14 @@ class IntegrationSpecification extends Specification {
File mavenRepoLocation File mavenRepoLocation
@Rule @Rule
TemporaryFolder testFolder TemporaryFolder testFolder = new TemporaryFolder(PARENT_TEST_FOLDER)
File projectDir File projectDir
File buildFile File buildFile
File settingsFile File settingsFile
void setupSpec() { void setupSpec() {
PARENT_TEST_FOLDER.mkdirs()
testProperties = loadTestProperties() testProperties = loadTestProperties()
flatRepoLocation = new File(testProperties.flatrepo) flatRepoLocation = new File(testProperties.flatrepo)
mavenRepoLocation = new File(testProperties.mavenrepo) mavenRepoLocation = new File(testProperties.mavenrepo)
@ -62,11 +64,12 @@ class IntegrationSpecification extends Specification {
GradleRunner gradleRunner(List<String> args) { GradleRunner gradleRunner(List<String> args) {
GradleRunner.create() GradleRunner.create()
.withProjectDir(projectDir) .withProjectDir(projectDir)
.withDebug(true) .withDebug(true)
.withArguments(args) .withArguments(args)
.withPluginClasspath() .withPluginClasspath()
.forwardOutput() .withTestKitDir(PARENT_TEST_FOLDER)
.forwardOutput()
} }
String pathAsUriStr(final File path) { String pathAsUriStr(final File path) {

View File

@ -5,8 +5,8 @@ dependencies {
compile project(':jruby-gradle-plugin') compile project(':jruby-gradle-plugin')
compile group: 'com.github.jruby-gradle', name: 'warbler-bootstrap', version: '0.2.0+' compile group: 'com.github.jruby-gradle', name: 'warbler-bootstrap', version: '0.2.0+'
testCompile (spockVersion) { testCompile(spockVersion) {
exclude module : 'groovy-all' exclude module: 'groovy-all'
} }
} }
@ -14,27 +14,15 @@ artifacts {
archives sourcesJar archives sourcesJar
} }
bintray { pluginBundle {
user = project.bintrayUser plugins {
key = project.bintrayKey gradlePlugin {
publish = true id = 'com.github.jruby-gradle.jar'
dryRun = false displayName = 'JRuby/Gradle base plugin'
configurations = ['archives'] description = 'This plugin encapsulates building deployable WARs using JRuby'
tags = (['jruby', 'war'])
pkg {
userOrg = 'jruby-gradle'
repo = 'plugins'
name = 'jruby-gradle-war-plugin'
labels = ['jruby','war','java']
version {
name = project.version
vcsTag = "v${project.version}"
attributes = ['gradle-plugin' : 'com.github.jruby-gradle.war:com.github.jruby-gradle:jruby-gradle-war-plugin']
desc = project.description
} }
} }
} }
bintrayUpload.dependsOn assemble
// vim: ft=groovy // vim: ft=groovy