From 833c41e7dbf168dd13a48a682fad1bcee42d63e9 Mon Sep 17 00:00:00 2001 From: thijslemmens Date: Fri, 26 Oct 2018 11:43:20 +0200 Subject: [PATCH] Rename property for DE in config + add README description. (#5) Update name for in extension for Dynamic Extension amps. Added a bit of documentation in the readme. --- README.md | 17 ++++++++++++----- .../examples/simple-de-project/build.gradle | 2 +- .../eu/xenit/gradle/alfrescosdk/AmpPlugin.java | 2 +- .../gradle/alfrescosdk/config/AmpConfig.java | 10 +++++----- .../xenit/gradle/alfrescosdk/AmpPluginTest.java | 4 ++-- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e69e00b..d003124 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,18 @@ unit tests. An amp has some typical files and folders. The module.properties file is required. You can override their locations in the ```ampConfig``` extension: -| property | description | default location | required | -|------------------|-----------------------------------------------------------------|--------------------------------|----------| -| moduleProperties | The file that describes your extension. | src/main/amp/module.properties | false | -| configDir | This folder will be put on the classpath of the war. | src/main/amp/config | false | -| web | This folder will end up in the "web" directory of the amp file. | src/main/amp/web | false | +| property | description | default | required | +| ---------------- | ------------------------------------------------------------ | ---------------------------------------------------- | -------- | +| moduleProperties | The file that describes your extension. | ```project.file('src/main/amp/module.properties')``` | false | +| configDir | This folder will be put on the classpath of the war. | ```project.file('src/main/amp/config')``` | false | +| web | This folder will end up in the "web" directory of the amp file. | ```project.file('src/main/amp/web')``` | false | +| dynamicExtension | Jar and dependencies are treated as Dynamic Extensions. | false | false | + +More information about Dynamic Extensions for Alfresco can be found +[here](https://github.com/xenit-eu/dynamic-extensions-for-alfresco). +This plugin can bundle Dynamic Extensions in an ```amp``` file. This means +that the jar and dependencies should be put in the correct location in +the ```amp``` file. ## Usage diff --git a/src/integration-test/resources/examples/simple-de-project/build.gradle b/src/integration-test/resources/examples/simple-de-project/build.gradle index 29093e3..c66161f 100644 --- a/src/integration-test/resources/examples/simple-de-project/build.gradle +++ b/src/integration-test/resources/examples/simple-de-project/build.gradle @@ -12,7 +12,7 @@ plugins { apply plugin: 'alfresco-dynamic-extension' ampConfig { - dynamicExtensionAmp = true + dynamicExtension = true } description = "HelloWorld Webscript, very useful" diff --git a/src/main/java/eu/xenit/gradle/alfrescosdk/AmpPlugin.java b/src/main/java/eu/xenit/gradle/alfrescosdk/AmpPlugin.java index 371f6bc..b65b587 100644 --- a/src/main/java/eu/xenit/gradle/alfrescosdk/AmpPlugin.java +++ b/src/main/java/eu/xenit/gradle/alfrescosdk/AmpPlugin.java @@ -33,7 +33,7 @@ public void apply(Project project) { FileCollection jars = runtime.plus(jarArtifact); amp.setLibs(jars); project.afterEvaluate(p -> { - if (ampConfig.getDynamicExtensionAmp()) { + if (ampConfig.getDynamicExtension()) { amp.de((CopySpec c) -> c.from(jars)); // Reset libs only when they have not been changed directly in the task if(amp.getLibs() == jars) { diff --git a/src/main/java/eu/xenit/gradle/alfrescosdk/config/AmpConfig.java b/src/main/java/eu/xenit/gradle/alfrescosdk/config/AmpConfig.java index f5058a5..c873725 100644 --- a/src/main/java/eu/xenit/gradle/alfrescosdk/config/AmpConfig.java +++ b/src/main/java/eu/xenit/gradle/alfrescosdk/config/AmpConfig.java @@ -13,7 +13,7 @@ public class AmpConfig { private Supplier configDir; private Supplier webDir; private Supplier fileMappingProperties; - private boolean dynamicExtensionAmp = false; + private boolean dynamicExtension = false; private final Project project; public AmpConfig(Project project){ @@ -105,11 +105,11 @@ public Supplier getFileMappingPropertiesSupplier() { return this.fileMappingProperties; } - public boolean getDynamicExtensionAmp() { - return this.dynamicExtensionAmp; + public boolean getDynamicExtension() { + return this.dynamicExtension; } - public void setDynamicExtensionAmp(boolean dynamicExtensionAmp) { - this.dynamicExtensionAmp = dynamicExtensionAmp; + public void setDynamicExtension(boolean dynamicExtension) { + this.dynamicExtension = dynamicExtension; } } diff --git a/src/test/java/eu/xenit/gradle/alfrescosdk/AmpPluginTest.java b/src/test/java/eu/xenit/gradle/alfrescosdk/AmpPluginTest.java index 797201c..10b083c 100644 --- a/src/test/java/eu/xenit/gradle/alfrescosdk/AmpPluginTest.java +++ b/src/test/java/eu/xenit/gradle/alfrescosdk/AmpPluginTest.java @@ -38,7 +38,7 @@ public void testConfigDirectoryExists(){ public void testDeProjectWithEmptyLib(){ DefaultProject project = getDefaultProject(); project.getPluginManager().apply(AlfrescoPlugin.class); - project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtensionAmp(true)); + project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtension(true)); Amp ampTask = (Amp) project.getTasks().getByName("amp"); project.evaluate(); // Evaluate the project so that the afterEvaluate can run, which should clear the libs @@ -49,7 +49,7 @@ public void testDeProjectWithEmptyLib(){ public void testDeProjectWithConfiguredLib(){ DefaultProject project = getDefaultProject(); project.getPluginManager().apply(AlfrescoPlugin.class); - project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtensionAmp(true)); + project.getExtensions().configure("ampConfig", (AmpConfig ampConfig) -> ampConfig.setDynamicExtension(true)); Amp ampTask = (Amp) project.getTasks().getByName("amp"); ampTask.setLibs(project.files("this/doesnt/exist"));