Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1.5.0: changed org.linkedin.cmdline plugin to allow more configurable…

… resources

use of official gradle 0.9 release!
  • Loading branch information...
commit da5a0695d1462ef43818730790c8825a9134f19e 1 parent d2f5a2e
@ypujante ypujante authored
View
4 README.md
@@ -11,7 +11,7 @@ In order to use the plugins you need to add this to your build script:
mavenCentral()
}
dependencies {
- classpath 'org.linkedin:org.linkedin.gradle-plugins:1.3.1'
+ classpath 'org.linkedin:org.linkedin.gradle-plugins:1.5.0'
}
}
@@ -131,7 +131,7 @@ as `cmdline`:
In order to compile the code you need
* java 1.6
-* [gradle 0.9-rc2](http://www.gradle.org/)
+* [gradle 0.9](http://www.gradle.org/)
At the top simply run
View
5 RELEASE.md
@@ -1,3 +1,8 @@
+1.5.0 (2010/12/20)
+------------------
+* changed `org.linkedin.cmdline` plugin to allow more configurable `resources` (every entry can now be a map)
+* use of official `gradle 0.9` release!
+
1.4.0 (2010/12/14)
------------------
* changed `org.linkedin.cmdline` plugin to use a `resources` convention (instead of `resourcesDir`) which is a list of whatever can be provided as an input of `CopySpec.from` (with a default of `'src/cmdline/resources'`)
View
44 buildSrc/src/main/groovy/org/linkedin/gradle/plugins/CmdLinePlugin.groovy
@@ -24,6 +24,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.api.tasks.bundling.Compression
import org.linkedin.gradle.tasks.Tar
import org.gradle.api.artifacts.Configuration
+import org.gradle.api.plugins.BasePlugin
class CmdLinePlugin implements Plugin<Project>
{
@@ -33,6 +34,8 @@ class CmdLinePlugin implements Plugin<Project>
void apply(Project project)
{
+ project.getPlugins().apply(BasePlugin.class);
+
this.project = project
def libConfiguration = ReleasePlugin.findOrAddConfiguration(project, LIB_CONFIGURATION)
@@ -73,12 +76,32 @@ class CmdLinePlugin implements Plugin<Project>
}
convention.resources?.each { resource ->
+ def resourceInto = convention.assemblePackageFile
+ def replaceTokens = true
+ def resourceFrom = null
+
+ if(resource instanceof Map)
+ {
+ resourceInto = resource.into ?: resourceInto
+ replaceTokens = resource.replaceTokens == null ? replaceTokens : resource.replaceTokens
+ resourceFrom = resource.from
+ }
+ else
+ {
+ resourceFrom = resource
+ }
+
+ if(!resourceFrom)
+ {
+ throw new IllegalArgumentException("missing 'from' for ${resource}")
+ }
+
project.copy {
- from(resource) {
- if(convention.replacementTokens)
+ from(resourceFrom) {
+ if(replaceTokens && convention.replacementTokens)
filter(tokens: convention.replacementTokens, ReplaceTokens)
}
- into convention.assemblePackageFile
+ into resourceInto
}
}
@@ -194,6 +217,21 @@ class CmdLinePluginConvention
File installDir
File installFile
def replacementTokens = [:]
+
+ /**
+ * Each entry in the list is a map with the following:
+ * <li>from: anything that can be used directly in the 'from' field of the copy task</li>
+ * <li>into: anything that can be used directly in the 'into'
+ * field of the copy task (optional => default to {@link #assemblePackageFile})</li>
+ * <li>replaceTokens: a <code>boolean</code> to replace tokens or not (default to
+ * <code>true</code>)</li>
+ *
+ * For convenience, you can use a shortcut notation containing only the 'from' part in which case
+ * it will be converted as:
+ * <pre>
+ * [from: from, into: <assemblePackageFile>, replaceTokens: true]
+ * </pre>
+ */
def resources = ['src/cmdline/resources']
def folders = ['logs']
String cmdlineLogLevel = "info"
View
3  buildSrc/src/main/groovy/org/linkedin/gradle/plugins/ReleasePlugin.groovy
@@ -20,6 +20,7 @@ import org.gradle.api.Project
import org.gradle.api.Plugin
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.artifacts.Configuration
+import org.gradle.api.plugins.BasePlugin
/**
* This plugin adds a 'release' and 'publish' task.
@@ -53,6 +54,8 @@ class ReleasePlugin implements Plugin<Project>
void apply(Project project)
{
+ project.getPlugins().apply(BasePlugin.class);
+
if(!project.rootProject.plugins.hasPlugin('org.linkedin.repository'))
{
project.rootProject.apply plugin: RepositoryPlugin
View
8 project-spec.groovy
@@ -16,7 +16,7 @@
spec = [
name: 'gradle-plugins',
group: 'org.linkedin',
- version: '1.4.0',
+ version: '1.5.0',
versions: [
groovy: '1.7.5'
@@ -25,10 +25,10 @@ spec = [
// information about the build framework itself
build: [
type: "gradle",
- version: "0.9-rc-2",
- uri: "http://dist.codehaus.org/gradle/gradle-0.9-rc-2-all.zip",
+ version: "0.9",
+ uri: "http://gradle.artifactoryonline.com/gradle/distributions/gradle-0.9-all.zip",
commands: [
- "snapshot": "gradle -Psnapshot=true release",
+ "snapshot": "gradle release",
"release": "gradle -Prelease=true release"
]
]
Please sign in to comment.
Something went wrong with that request. Please try again.