Merge pull request #399 from ysb33r/master
If the plugin version changes, resolve all dependencies again (#398)
This commit is contained in:
commit
b308fd2b0d
|
@ -26,6 +26,9 @@ package com.github.jrubygradle
|
|||
import com.github.jrubygradle.api.core.AbstractJRubyPrepare
|
||||
import com.github.jrubygradle.internal.JRubyExecUtils
|
||||
import groovy.transform.CompileStatic
|
||||
import org.gradle.api.provider.Provider
|
||||
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
/** Task for preparing a project-local installation of GEMs & JARs.
|
||||
*
|
||||
|
@ -46,8 +49,21 @@ class JRubyPrepare extends AbstractJRubyPrepare {
|
|||
* @return Path on local filesystem
|
||||
*/
|
||||
@Override
|
||||
protected File getJrubyJarLocation() {
|
||||
JRubyExecUtils.jrubyJar(this.jruby.jrubyConfiguration)
|
||||
protected Provider<File> getJrubyJarLocation() {
|
||||
project.provider({ JRubyPluginExtension jrubyExt ->
|
||||
JRubyExecUtils.jrubyJar(jrubyExt.jrubyConfiguration)
|
||||
}.curry(this.jruby) as Callable<File>)
|
||||
}
|
||||
|
||||
/** Version of JRuby to be used.
|
||||
*
|
||||
* This method should not resolve any files to obtain the version.
|
||||
*
|
||||
* @return Intended version of JRuby.
|
||||
*/
|
||||
@Override
|
||||
protected String getJrubyVersion() {
|
||||
jruby.jrubyVersion
|
||||
}
|
||||
|
||||
private final JRubyPluginExtension jruby
|
||||
|
|
|
@ -39,4 +39,12 @@ bintray {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
processResources {
|
||||
filesMatching '**/com.jrubygradle.core-plugin.version.properties', {
|
||||
expand VERSION : project.version
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.dependsOn assemble
|
||||
|
|
|
@ -29,10 +29,11 @@ import groovy.transform.CompileStatic
|
|||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.artifacts.Configuration
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.InputFiles
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.Optional
|
||||
import org.gradle.api.tasks.OutputFile
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
import static com.github.jrubygradle.api.gems.GemOverwriteAction.SKIP
|
||||
|
@ -102,13 +103,22 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
|
|||
*
|
||||
* @return Path on local filesystem
|
||||
*/
|
||||
@OutputFile
|
||||
abstract protected File getJrubyJarLocation()
|
||||
@Internal
|
||||
abstract protected Provider<File> getJrubyJarLocation()
|
||||
|
||||
/** Version of JRuby to be used.
|
||||
*
|
||||
* This method should not resolve any files to obtain the version.
|
||||
*
|
||||
* @return Intended version of JRuby.
|
||||
*/
|
||||
@Input
|
||||
abstract protected String getJrubyVersion()
|
||||
|
||||
@TaskAction
|
||||
void exec() {
|
||||
File out = getOutputDir()
|
||||
File jrubyJar = jrubyJarLocation
|
||||
File jrubyJar = jrubyJarLocation.get()
|
||||
extractGems(project, jrubyJar, gemsAsFileCollection(), out, SKIP)
|
||||
|
||||
dependencies.findAll {
|
||||
|
|
|
@ -44,7 +44,7 @@ class IvyXmlGlobalProxyRegistry {
|
|||
* @param project Associated project.
|
||||
*/
|
||||
IvyXmlGlobalProxyRegistry(Project project) {
|
||||
rootCacheDir = new File(project.gradle.gradleUserHomeDir, 'rubygems-ivyxml-cache')
|
||||
rootCacheDir = new File(project.gradle.gradleUserHomeDir, "rubygems-ivyxml-cache/${PluginMetadata.version()}")
|
||||
refresh = project.gradle.startParameter.refreshDependencies
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
|
||||
* Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.github.jrubygradle.internal.core
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
|
||||
/** Provides some metadata about this plugin
|
||||
*
|
||||
* @author Schalk W. Cronjé
|
||||
*
|
||||
* @since 2.0.0
|
||||
*
|
||||
*/
|
||||
@CompileStatic
|
||||
class PluginMetadata {
|
||||
|
||||
/** Plugin version
|
||||
*
|
||||
* @return Version of this plugin.
|
||||
*/
|
||||
static String version() {
|
||||
METADATA['version']
|
||||
}
|
||||
|
||||
private static Map<String,String> loadProperties() {
|
||||
final String location = 'META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties'
|
||||
final Properties props = new Properties()
|
||||
PluginMetadata.classLoader.getResourceAsStream(location).withCloseable { strm ->
|
||||
props.load(strm)
|
||||
}
|
||||
props as Map<String,String>
|
||||
}
|
||||
|
||||
private static final Map<String,String> METADATA = loadProperties()
|
||||
}
|
|
@ -147,7 +147,7 @@ class GemToIvy {
|
|||
writer.toString()
|
||||
}
|
||||
|
||||
/** Writes the SHA1 checksum of the {@code ivy.xmnl} file.
|
||||
/** Writes the SHA1 checksum of the {@code ivy.xml} file.
|
||||
*
|
||||
* @param ivyXml Fle containing the {@code ivy.xml} content/
|
||||
* @return Checksum file.
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
|
||||
# Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
version=${VERSION}
|
|
@ -1,4 +1,4 @@
|
|||
version=2.0.0-alpha.4
|
||||
version=2.0.0-alpha.5
|
||||
group=com.github.jruby-gradle
|
||||
copyrightYear=2014-2019
|
||||
|
||||
|
|
Loading…
Reference in New Issue