You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2014/03/28 22:39:24 UTC
[1/2] git commit: TAP5-2310: Support form actions only triggered if
the form is cancelled
Repository: tapestry-5
Updated Branches:
refs/heads/master ba8b3524e -> e8ca15f1b
TAP5-2310: Support form actions only triggered if the form is cancelled
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e8ca15f1
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e8ca15f1
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e8ca15f1
Branch: refs/heads/master
Commit: e8ca15f1b61dbaadfc597c1e543b1adf922f880f
Parents: e75f644
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Mar 28 14:39:07 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Mar 28 14:39:21 2014 -0700
----------------------------------------------------------------------
54_RELEASE_NOTES.md | 5 ++
.../tapestry5/corelib/components/Form.java | 13 ++++--
.../corelib/components/FormFragment.java | 8 +++-
.../tapestry5/corelib/components/Zone.java | 8 +++-
.../corelib/internal/ComponentActionSink.java | 15 +++++-
.../corelib/internal/FormSupportAdapter.java | 7 ++-
.../corelib/internal/FormSupportImpl.java | 7 ++-
.../apache/tapestry5/services/FormSupport.java | 16 +++++--
.../integration/app1/FormCancelTests.groovy | 19 ++++++++
.../app1/pages/FormCancelActionDemo.java | 48 ++++++++++++++++++++
.../tapestry5/integration/app1/pages/Index.java | 4 +-
.../app1/pages/FormCancelActionDemo.tml | 14 ++++++
12 files changed, 150 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/54_RELEASE_NOTES.md
----------------------------------------------------------------------
diff --git a/54_RELEASE_NOTES.md b/54_RELEASE_NOTES.md
index 8009d86..282c34d 100644
--- a/54_RELEASE_NOTES.md
+++ b/54_RELEASE_NOTES.md
@@ -288,6 +288,11 @@ the typo (the missing 's').
The OperationTracker interface has had a new method added, for performing an IO Operation (that may throw IOException).
+## FormSupport Extended
+
+The FormSupport interface has a new method, storeCancel(), which stores a component action that is only executed
+if the containing form is canceled.
+
## Session Locking
Tapestry now uses a lock on access to the HttpSession; a shared read lock is acquired when reading session attribute
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
index b1aa2e3..971d0bd 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
@@ -1,4 +1,4 @@
-// Copyright 2006-2013 The Apache Software Foundation
+// Copyright 2006-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -485,6 +485,8 @@ public class Form implements ClientElement, FormValidationControl
if (isFormCancelled())
{
+ executeStoredActions(true);
+
resources.triggerContextEvent(EventConstants.CANCELED, context, eventCallback);
if (eventCallback.isAborted())
return true;
@@ -494,7 +496,7 @@ public class Form implements ClientElement, FormValidationControl
didPushBeanValidationContext = true;
- executeStoredActions();
+ executeStoredActions(false);
heartbeat.end();
@@ -622,7 +624,7 @@ public class Form implements ClientElement, FormValidationControl
* stream back to object stream and then
* objects, and executes them.
*/
- private void executeStoredActions()
+ private void executeStoredActions(boolean forFormCancel)
{
String[] values = request.getParameters(FORM_DATA);
@@ -650,8 +652,13 @@ public class Form implements ClientElement, FormValidationControl
while (!eventCallback.isAborted())
{
String componentId = ois.readUTF();
+ boolean cancelAction = ois.readBoolean();
ComponentAction action = (ComponentAction) ois.readObject();
+ // Actions are a mix of ordinary actions and cancel actions. Filter out one set or the other
+ // based on whether the form was submitted or cancelled.
+ if (forFormCancel != cancelAction) { continue; }
+
component = source.getComponent(componentId);
logger.debug("Processing: {} {}", componentId, action);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
index 6a7faab..209a903 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/FormFragment.java
@@ -1,4 +1,4 @@
-// Copyright 2008-2012 The Apache Software Foundation
+// Copyright 2008-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -189,6 +189,12 @@ public class FormFragment implements ClientElement
}
@Override
+ public <T> void storeCancel(T component, ComponentAction<T> action)
+ {
+ componentActions.storeCancel(component, action);
+ }
+
+ @Override
public <T> void storeAndExecute(T component, ComponentAction<T> action)
{
componentActions.store(component, action);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
index 234fcdd..141663f 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Zone.java
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
+// Copyright 2007-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -195,6 +195,12 @@ public class Zone implements ClientBodyElement
}
@Override
+ public <T> void storeCancel(T component, ComponentAction<T> action)
+ {
+ actionSink.storeCancel(component, action);
+ }
+
+ @Override
public <T> void storeAndExecute(T component, ComponentAction<T> action)
{
store(component, action);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/ComponentActionSink.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/ComponentActionSink.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/ComponentActionSink.java
index 729241c..bf4910e 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/ComponentActionSink.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/ComponentActionSink.java
@@ -1,4 +1,4 @@
-// Copyright 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2008-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -48,18 +48,29 @@ public class ComponentActionSink
public <T> void store(T component, ComponentAction<T> action)
{
+ streamAction(component, false, action);
+ }
+
+ public <T> void storeCancel(T component, ComponentAction<T> action)
+ {
+ streamAction(component, true, action);
+ }
+
+ private <T> void streamAction(T component, boolean cancel, ComponentAction<T> action)
+ {
Component castComponent = (Component) component;
assert action != null;
String completeId = castComponent.getComponentResources().getCompleteId();
- logger.debug("Storing action: {} {}", completeId, action);
+ logger.debug("Storing {}: {} {}", cancel ? "cancel action": "action", completeId, action);
try
{
// Writing the complete id is not very efficient, but the GZip filter
// should help out there.
stream.writeUTF(completeId);
+ stream.writeBoolean(cancel);
stream.writeObject(action);
}
catch (IOException ex)
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportAdapter.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportAdapter.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportAdapter.java
index add313c..2f849bd 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportAdapter.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportAdapter.java
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -80,4 +80,9 @@ public class FormSupportAdapter implements FormSupport
{
return delegate.getFormValidationId();
}
+
+ public <T> void storeCancel(T component, ComponentAction<T> action)
+ {
+ delegate.storeCancel(component, action);
+ }
}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportImpl.java
index feef490..9003893 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/internal/FormSupportImpl.java
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010, 2012 The Apache Software Foundation
+// Copyright 2006-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -92,6 +92,11 @@ public class FormSupportImpl implements InternalFormSupport, Locatable
actionSink.store(component, action);
}
+ public <T> void storeCancel(T component, ComponentAction<T> action)
+ {
+ actionSink.storeCancel(component, action);
+ }
+
public <T> void storeAndExecute(T component, ComponentAction<T> action)
{
actionSink.store(component, action);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/main/java/org/apache/tapestry5/services/FormSupport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/FormSupport.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/FormSupport.java
index 888411a..a18e48c 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/FormSupport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/FormSupport.java
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2012 The Apache Software Foundation
+// Copyright 2006-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -42,6 +42,14 @@ public interface FormSupport extends ClientElement
<T> void store(T component, ComponentAction<T> action);
/**
+ * Stores an action for execution in a later request when the containing form is canceled. Cancel actions
+ * are triggered before the form fires its {@link org.apache.tapestry5.EventConstants#CANCELED} event.
+ *
+ * @since 5.4
+ */
+ <T> void storeCancel(T component, ComponentAction<T> action);
+
+ /**
* As with {@link #store(Object, org.apache.tapestry5.ComponentAction)}}, but the action is also invoked
* immediately. This is useful for defining an action that should occur symmetrically in both the render request and
* the form submission's action request.
@@ -88,9 +96,9 @@ public interface FormSupport extends ClientElement
* @param constraint
* additional constraint value, or null for validations that don't require a constraint
* @deprecated Deprecated in 5.4 with no exact replacement; this default implementation now does nothing.
- * Invoke {@link #isClientValidationEnabled()}, and (if true),
- * use {@link org.apache.tapestry5.services.javascript.JavaScriptSupport} to add necessary modules, and add
- * triggering and configuring attributes to the field's {@link org.apache.tapestry5.dom.Element}.
+ * Invoke {@link #isClientValidationEnabled()}, and (if true),
+ * use {@link org.apache.tapestry5.services.javascript.JavaScriptSupport} to add necessary modules, and add
+ * triggering and configuring attributes to the field's {@link org.apache.tapestry5.dom.Element}.
*/
void addValidation(Field field, String validationName, String message, Object constraint);
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormCancelTests.groovy
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormCancelTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormCancelTests.groovy
new file mode 100644
index 0000000..5c439f4
--- /dev/null
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app1/FormCancelTests.groovy
@@ -0,0 +1,19 @@
+package org.apache.tapestry5.integration.app1
+
+import org.testng.annotations.Test
+
+
+class FormCancelTests extends App1TestCase {
+
+ @Test
+ void cancel_events_are_triggered_when_form_submitted() {
+
+ openLinks "Form Cancel Action Demo", "Reset Page State"
+
+ clickAndWait SUBMIT
+
+ assertText "css=#messages > li:first", "action trigger"
+ assertText "css=#messages > li:nth(1)", "cancel event"
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.java
new file mode 100644
index 0000000..dd9d14d
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.java
@@ -0,0 +1,48 @@
+package org.apache.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.ComponentAction;
+import org.apache.tapestry5.annotations.Environmental;
+import org.apache.tapestry5.annotations.Persist;
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.services.FormSupport;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class FormCancelActionDemo
+{
+ @Property
+ @Persist
+ private List<String> messages;
+
+ static class AddMessage implements ComponentAction<FormCancelActionDemo>
+ {
+ public void execute(FormCancelActionDemo component)
+ {
+ component.addMessage("action trigger");
+ }
+ }
+
+ private void addMessage(String s)
+ {
+ if (messages == null)
+ {
+ messages = new ArrayList<String>();
+ }
+
+ messages.add(s);
+ }
+
+ @Environmental
+ private FormSupport formSupport;
+
+ void onBeginRenderFromForm()
+ {
+ formSupport.storeCancel(this, new AddMessage());
+ }
+
+ void onCanceledFromForm()
+ {
+ addMessage("cancel event");
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
index 86d441a..b232b5c 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
@@ -1,4 +1,4 @@
-// Copyright 2006-2013 The Apache Software Foundation
+// Copyright 2006-2014 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -59,6 +59,8 @@ public class Index
private static final List<Item> ITEMS = CollectionFactory
.newList(
+ new Item ("FormCancelActionDemo", "Form Cancel Action Demo", "FormSupport.addCancel() support"),
+
new Item("AjaxRadioDemo", "Ajax Radio Demo", "Radio components inside an Ajax form"),
new Item("TimeIntervalDemo", "TimeInterval Demo", "Interval component, based on Moment.js"),
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8ca15f1/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.tml
new file mode 100644
index 0000000..31f2f4b
--- /dev/null
+++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/FormCancelActionDemo.tml
@@ -0,0 +1,14 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
+
+ <t:form t:id="form" t:mixins="rendernotification">
+ <t:submit mode="cancel" value="Cancel"/>
+ </t:form>
+
+ <ul id="messages">
+ <li t:type="loop" source="messages" value="var:message">
+ ${var:message}
+ </li>
+
+ </ul>
+
+</html>
[2/2] git commit: Simplify dependency overrides
Posted by hl...@apache.org.
Simplify dependency overrides
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e75f6447
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e75f6447
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e75f6447
Branch: refs/heads/master
Commit: e75f64479fe27f5d983663196260dcf067c1cf84
Parents: ba8b352
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Mar 28 13:23:26 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Mar 28 14:39:21 2014 -0700
----------------------------------------------------------------------
build.gradle | 45 ++++++++++++++++++---------------------------
1 file changed, 18 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e75f6447/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 9305312..e19890c 100755
--- a/build.gradle
+++ b/build.gradle
@@ -165,7 +165,7 @@ subprojects {
idea.module {
scopes.PROVIDED.plus += configurations.provided
}
-
+
eclipse.classpath.plusConfigurations += configurations.provided
dependencies {
@@ -265,32 +265,23 @@ subprojects {
// Prefer this version, because it has source artifacts available.
def servletAPI = 'org.mortbay.jetty:servlet-api-2.5:6.1.11'
- def versionOverrides = [
- "antlr:antlr": "2.7.7",
- "cglib:cglib-nodep": "2.2",
- "commons-codec:commons-codec": "1.8",
- "commons-io:commons-io": "2.4",
- "commons-logging:commons-logging": "1.1.3",
- "hsqldb:hsqldb": "2.2.8",
- "org.antlr:antlr-runtime": "3.4",
- "org.apache.tomcat:dbcp": "6.0.32",
- // "org.apache.tomcat:servlet-api": "6.0.30",
- "org.hamcrest:hamcrest-core": "1.3",
- "org.json:json": "20140107",
- "org.yaml:snakeyaml": "1.8",
- "xml-apis:xml-apis": "1.4.01"
- ]
-
configurations.all {
- resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+ resolutionStrategy.force "antlr:antlr:2.7.7",
+ "cglib:cglib-nodep:2.2",
+ "commons-codec:commons-codec:1.8",
+ "commons-io:commons-io:2.4",
+ "commons-logging:commons-logging:1.1.3",
+ "hsqldb:hsqldb:2.2.8",
+ "org.antlr:antlr-runtime:3.4",
+ "org.apache.tomcat:dbcp:6.0.32",
+ "org.hamcrest:hamcrest-core:1.3",
+ "org.json:json:20140107",
+ "org.yaml:snakeyaml:1.8",
+ "xml-apis:xml-apis:1.4.01"
- def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
+ resolutionStrategy.eachDependency { DependencyResolveDetails details ->
- if (overrideVersion != null && details.requested.version != overrideVersion) {
- logger.info "Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion"
- details.useVersion overrideVersion
- }
if (details.requested.name.startsWith("servlet-api")) {
logger.info "Overriding dependency ${details.requested.group}:${details.requested.name}:${details.requested.version} --> $servletAPI"
@@ -375,7 +366,7 @@ task coffeeScriptDocs(type: Exec) {
def sources = files()
subprojects.each { sub ->
- sources += sub.fileTree("src/main/coffeescript", { include "**/*.coffee" })
+ sources += sub.fileTree("src/main/coffeescript", { include "**/*.coffee" })
}
sources += project(":tapestry-core").tasks.preprocessCoffeeScript.outputs.files.asFileTree
@@ -385,7 +376,7 @@ task coffeeScriptDocs(type: Exec) {
// Needs to be installed via "npm install -g docco"
executable isWindows() ? "docco.cmd" : "docco"
args "--output", outputDir
- args sources.files.sort({ a,b -> a.name.compareTo b.name })
+ args sources.files.sort({ a, b -> a.name.compareTo b.name })
inputs.files { sources }
outputs.dir outputDir
@@ -562,8 +553,8 @@ boolean checkJDK() {
def jdkVersion = System.properties['java.version']
def match = jdkVersion =~ /_(\d+)/
- if (! match.find())
- throw new IllegalStateException("""Could not parse minor version number out of "#{jdkVersion}".""")
+ if (!match.find())
+ throw new IllegalStateException("""Could not parse minor version number out of "#{jdkVersion}".""")
def minor = match[0][1].toInteger()
[2/2] git commit: Simplify dependency overrides
Posted by hl...@apache.org.
Simplify dependency overrides
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e75f6447
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e75f6447
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e75f6447
Branch: refs/heads/master
Commit: e75f64479fe27f5d983663196260dcf067c1cf84
Parents: ba8b352
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Mar 28 13:23:26 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Mar 28 14:39:21 2014 -0700
----------------------------------------------------------------------
build.gradle | 45 ++++++++++++++++++---------------------------
1 file changed, 18 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e75f6447/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 9305312..e19890c 100755
--- a/build.gradle
+++ b/build.gradle
@@ -165,7 +165,7 @@ subprojects {
idea.module {
scopes.PROVIDED.plus += configurations.provided
}
-
+
eclipse.classpath.plusConfigurations += configurations.provided
dependencies {
@@ -265,32 +265,23 @@ subprojects {
// Prefer this version, because it has source artifacts available.
def servletAPI = 'org.mortbay.jetty:servlet-api-2.5:6.1.11'
- def versionOverrides = [
- "antlr:antlr": "2.7.7",
- "cglib:cglib-nodep": "2.2",
- "commons-codec:commons-codec": "1.8",
- "commons-io:commons-io": "2.4",
- "commons-logging:commons-logging": "1.1.3",
- "hsqldb:hsqldb": "2.2.8",
- "org.antlr:antlr-runtime": "3.4",
- "org.apache.tomcat:dbcp": "6.0.32",
- // "org.apache.tomcat:servlet-api": "6.0.30",
- "org.hamcrest:hamcrest-core": "1.3",
- "org.json:json": "20140107",
- "org.yaml:snakeyaml": "1.8",
- "xml-apis:xml-apis": "1.4.01"
- ]
-
configurations.all {
- resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+ resolutionStrategy.force "antlr:antlr:2.7.7",
+ "cglib:cglib-nodep:2.2",
+ "commons-codec:commons-codec:1.8",
+ "commons-io:commons-io:2.4",
+ "commons-logging:commons-logging:1.1.3",
+ "hsqldb:hsqldb:2.2.8",
+ "org.antlr:antlr-runtime:3.4",
+ "org.apache.tomcat:dbcp:6.0.32",
+ "org.hamcrest:hamcrest-core:1.3",
+ "org.json:json:20140107",
+ "org.yaml:snakeyaml:1.8",
+ "xml-apis:xml-apis:1.4.01"
- def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
+ resolutionStrategy.eachDependency { DependencyResolveDetails details ->
- if (overrideVersion != null && details.requested.version != overrideVersion) {
- logger.info "Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion"
- details.useVersion overrideVersion
- }
if (details.requested.name.startsWith("servlet-api")) {
logger.info "Overriding dependency ${details.requested.group}:${details.requested.name}:${details.requested.version} --> $servletAPI"
@@ -375,7 +366,7 @@ task coffeeScriptDocs(type: Exec) {
def sources = files()
subprojects.each { sub ->
- sources += sub.fileTree("src/main/coffeescript", { include "**/*.coffee" })
+ sources += sub.fileTree("src/main/coffeescript", { include "**/*.coffee" })
}
sources += project(":tapestry-core").tasks.preprocessCoffeeScript.outputs.files.asFileTree
@@ -385,7 +376,7 @@ task coffeeScriptDocs(type: Exec) {
// Needs to be installed via "npm install -g docco"
executable isWindows() ? "docco.cmd" : "docco"
args "--output", outputDir
- args sources.files.sort({ a,b -> a.name.compareTo b.name })
+ args sources.files.sort({ a, b -> a.name.compareTo b.name })
inputs.files { sources }
outputs.dir outputDir
@@ -562,8 +553,8 @@ boolean checkJDK() {
def jdkVersion = System.properties['java.version']
def match = jdkVersion =~ /_(\d+)/
- if (! match.find())
- throw new IllegalStateException("""Could not parse minor version number out of "#{jdkVersion}".""")
+ if (!match.find())
+ throw new IllegalStateException("""Could not parse minor version number out of "#{jdkVersion}".""")
def minor = match[0][1].toInteger()