diff --git a/README.md b/README.md index b7c638eb0..c38387f02 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![Build Status](http://img.shields.io/travis/akhikhl/gretty.svg)](https://travis-ci.org/akhikhl/gretty) ![Maintenance Status](http://img.shields.io/maintenance/yes/2017.svg) -[![Latest release](http://img.shields.io/badge/release-1.4.1-47b31f.svg)](https://github.com/akhikhl/gretty/tags/v1.4.1) -[![Snapshot](http://img.shields.io/badge/current-1.4.2--SNAPSHOT-47b31f.svg)](https://github.com/akhikhl/gretty/tree/master) +[![Latest release](http://img.shields.io/badge/release-1.4.2-47b31f.svg)](https://github.com/akhikhl/gretty/tags/v1.4.2) +[![Snapshot](http://img.shields.io/badge/current-1.4.3--SNAPSHOT-47b31f.svg)](https://github.com/akhikhl/gretty/tree/master) [![License](http://img.shields.io/badge/license-MIT-47b31f.svg)](#copyright-and-license) Gretty is a feature-rich gradle plugin for running web-apps on embedded servlet containers. @@ -20,15 +20,13 @@ If you are new with Gretty, try [getting started](http://akhikhl.github.io/grett #### :star: What's new -Feb 1, 2017, Gretty 1.4.1 is out immediately available at [Bintray](https://bintray.com/akhikhl/maven/gretty/view) and [Maven Central](http://search.maven.org/#search|ga|1|g%3A%22org.akhikhl.gretty%22). +March 13, 2017, Gretty 1.4.2 is out and immediately available at [Bintray](https://bintray.com/akhikhl/maven/gretty/view) and [Maven Central](http://search.maven.org/#search|ga|1|g%3A%22org.akhikhl.gretty%22). -Changes in this version: +* Changes in this version: -* The most significant change is compatibility with Gradle 3.3. +* Compatibility with Gradle 3.4.1 -* Pull Requests #198, #205, #266, #293, #297 and #312 were merged into master. - -* Issues #296, #300, #307, #317, #320, #322, #323 were resolved. +* Issues #326, #329 were resolved. See also: [complete list of changes](changes.md) for more information. diff --git a/build.gradle b/build.gradle index 381704d33..67d5dc0a2 100644 --- a/build.gradle +++ b/build.gradle @@ -31,14 +31,14 @@ import org._10ne.gradle.rest.RestPlugin import org._10ne.gradle.rest.RestTask import groovyx.net.http.ContentType -apply plugin: 'base' // import clean task -apply plugin: 'maven-publish' +plugins { + id 'base' + id 'maven-publish' +} + apply plugin: 'com.jfrog.artifactory' apply plugin: RestPlugin -ext { -} - ext { project_website = "https://github.com/${developerId}/${projectId}" project_scm = "scm:git@github.com:${developerId}/${projectId}.git" diff --git a/changes.md b/changes.md index 9dd5c4bea..996e966a9 100644 --- a/changes.md +++ b/changes.md @@ -2,6 +2,14 @@ [![logo](http://akhikhl.github.io/gretty-doc/images/gretty_logo.png "gretty logo")](https://github.com/akhikhl/gretty) +### Version 1.4.2 + +* Now Gretty is compatible with Gradle versions from 2.14.1 to 3.4.1 + +* resolved issue #326: Gradle 3.3 compatibility work breaks earlier versions of Gradle + +* resolved issue #329: Cannot call TaskInputs.property(String, Object) on task ':jettyStart' after task has started execution + ### Version 1.4.1 * The most significant change is compatibility with Gradle 3.3. diff --git a/common.gradle b/common.gradle index ffac2dc1f..6ce227342 100644 --- a/common.gradle +++ b/common.gradle @@ -139,7 +139,7 @@ tasks.bintrayUpload.dependsOn assemble if(!bintrayDryRun) { tasks.bintrayUpload.finalizedBy rootProject.tasks.bintraySign - rootProject.tasks.bintraySign.onlyIf { !tasks.bintrayUpload.getStatus().getFailure() } + rootProject.tasks.bintraySign.onlyIf { !tasks.bintrayUpload.getState().getFailure() } } } // afterEvaluate diff --git a/gradle.properties b/gradle.properties index 35d01cc03..d4c0ced5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,12 @@ rootProjectName = gretty-root projectId=gretty -description=Advanced gradle plugin for running web-apps on jetty +description=Advanced gradle plugin for running web-apps on jetty and tomcat projectLabels=gretty,jetty,gradle,plugin,spring,spring-boot developerId=akhikhl developerName=Andrey Hihlovskiy license=The MIT License group=org.akhikhl.gretty -version=1.4.2-SNAPSHOT +version=1.4.2 jetty7_version=7.6.16.v20140903 jetty7_servlet_api_version=2.5 # Cannot upgrade to Jetty 8.1.15 or newer until issue #159 is resolved. diff --git a/libs/gretty/build.gradle b/libs/gretty/build.gradle index 465142f3a..45f3db32d 100644 --- a/libs/gretty/build.gradle +++ b/libs/gretty/build.gradle @@ -1,3 +1,7 @@ +plugins { + id 'com.gradle.plugin-publish' version '0.9.7' +} + apply from: rootProject.file('common.gradle') dependencies { @@ -12,3 +16,17 @@ dependencies { compile "org.eclipse.jetty:jetty-util:$jetty8_version" compile gradleApi() } + +pluginBundle { + website = 'http://akhikhl.github.io/gretty-doc/' + vcsUrl = 'https://github.com/akhikhl/gretty' + description = 'Advanced gradle plugin for running web-apps on jetty and tomcat.' + + plugins { + gretty { + id = 'org.akhikhl.gretty' + displayName = 'Gretty plugin' + tags = [ 'gretty', 'jetty', 'gradle', 'plugin', 'spring', 'spring-boot' ] + } + } +} diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/DummyTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/DummyTask.groovy deleted file mode 100644 index 2f02d7bff..000000000 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/DummyTask.groovy +++ /dev/null @@ -1,359 +0,0 @@ -package org.akhikhl.gretty - -import org.gradle.api.Action -import org.gradle.api.AntBuilder -import org.gradle.api.Project -import org.gradle.api.Task -import org.gradle.api.internal.TaskInputsInternal -import org.gradle.api.internal.TaskInternal -import org.gradle.api.internal.TaskOutputsInternal -import org.gradle.api.internal.tasks.ContextAwareTaskAction -import org.gradle.api.internal.tasks.TaskExecuter -import org.gradle.api.internal.tasks.TaskStateInternal -import org.gradle.api.internal.tasks.execution.TaskValidator -import org.gradle.api.logging.Logger -import org.gradle.api.logging.LoggingManager -import org.gradle.api.plugins.Convention -import org.gradle.api.plugins.ExtensionContainer -import org.gradle.api.specs.Spec -import org.gradle.api.tasks.TaskDependency -import org.gradle.internal.Factory -import org.gradle.logging.StandardOutputCapture - -/** - * Dummy implementation of task plugin - * - * @author sala - */ -class DummyTask implements TaskInternal { - - @Override - List getTaskActions() { - return null - } - - @Override - Set getActionClassLoaders() { - return null - } - - @Override - Spec getOnlyIf() { - return null - } - - @Override - void execute() { - - } - - @Override - StandardOutputCapture getStandardOutputCapture() { - return null - } - - @Override - TaskExecuter getExecuter() { - return null - } - - @Override - void setExecuter(TaskExecuter taskExecuter) { - - } - - @Override - TaskInputsInternal getInputs() { - return null - } - - @Override - TaskOutputsInternal getOutputs() { - return null - } - - @Override - File getTemporaryDir() { - return null - } - - @Override - Task mustRunAfter(Object... objects) { - return null - } - - @Override - void setMustRunAfter(Iterable iterable) { - - } - - @Override - TaskDependency getMustRunAfter() { - return null - } - - @Override - Task finalizedBy(Object... objects) { - return null - } - - @Override - void setFinalizedBy(Iterable iterable) { - - } - - @Override - TaskDependency getFinalizedBy() { - return null - } - - @Override - TaskDependency shouldRunAfter(Object... objects) { - return null - } - - @Override - void setShouldRunAfter(Iterable iterable) { - - } - - @Override - TaskDependency getShouldRunAfter() { - return null - } - - @Override - List getValidators() { - return null - } - - @Override - void addValidator(TaskValidator taskValidator) { - - } - - @Override - String getName() { - return null - } - - @Override - Project getProject() { - return null - } - - @Override - List> getActions() { - return null - } - - @Override - void setActions(List> list) { - - } - - @Override - TaskDependency getTaskDependencies() { - return null - } - - @Override - Set getDependsOn() { - return null - } - - @Override - void setDependsOn(Iterable iterable) { - - } - - @Override - Task dependsOn(Object... objects) { - return null - } - - @Override - void onlyIf(Closure closure) { - - } - - @Override - void onlyIf(Spec spec) { - - } - - @Override - void setOnlyIf(Closure closure) { - - } - - @Override - void setOnlyIf(Spec spec) { - - } - - @Override - TaskStateInternal getState() { - return null - } - - @Override - void setDidWork(boolean b) { - - } - - @Override - boolean getDidWork() { - return false - } - - @Override - String getPath() { - return null - } - - @Override - Task doFirst(Action action) { - return null - } - - @Override - Task doFirst(Closure closure) { - return null - } - - @Override - Task doLast(Action action) { - return null - } - - @Override - Task doLast(Closure closure) { - return null - } - - @Override - Task leftShift(Closure closure) { - return null - } - - @Override - Task deleteAllActions() { - return null - } - - @Override - boolean getEnabled() { - return false - } - - @Override - void setEnabled(boolean b) { - - } - - @Override - Task configure(Closure closure) { - return null - } - - @Override - AntBuilder getAnt() { - return null - } - - @Override - Logger getLogger() { - return null - } - - @Override - LoggingManager getLogging() { - return null - } - - @Override - Object property(String s) throws MissingPropertyException { - return null - } - - @Override - boolean hasProperty(String s) { - return false - } - - @Override - Convention getConvention() { - return null - } - - @Override - String getDescription() { - return null - } - - @Override - void setDescription(String s) { - - } - - @Override - String getGroup() { - return null - } - - @Override - void setGroup(String s) { - - } - - @Override - boolean dependsOnTaskDidWork() { - return false - } - - @Override - boolean getImpliesSubProjects() { - return false - } - - @Override - void setImpliesSubProjects(boolean b) { - - } - - @Override - Factory getTemporaryDirFactory() { - return null - } - - @Override - void prependParallelSafeAction(Action action) { - - } - - @Override - void appendParallelSafeAction(Action action) { - - } - - @Override - boolean isHasCustomActions() { - return false - } - - @Override - int compareTo(Task o) { - return 0 - } - - @Override - ExtensionContainer getExtensions() { - return null - } - - @Override - org.gradle.util.Path getIdentityPath() { - null - } -} diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/JacocoHelper.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/JacocoHelper.groovy index 42f203c89..27989da00 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/JacocoHelper.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/JacocoHelper.groovy @@ -1,67 +1,11 @@ -/* - * Gretty - * - * Copyright (C) 2013-2015 Andrey Hihlovskiy and contributors. - * - * See the file "LICENSE" for copying and usage permission. - * See the file "CONTRIBUTORS" for complete list of contributors. - */ package org.akhikhl.gretty -import org.gradle.api.Task -import org.gradle.api.internal.TaskInputsInternal -import org.gradle.api.internal.TaskOutputsInternal +import org.gradle.api.internal.TaskInternal import org.gradle.api.plugins.ExtensionAware -import org.gradle.api.plugins.ExtensionContainer import org.gradle.process.JavaForkOptions import org.gradle.testing.jacoco.plugins.JacocoTaskExtension -/** - * - * @author akhikhl - */ -class JacocoHelper extends DummyTask implements JavaForkOptions, ExtensionAware { - private final Task task +interface JacocoHelper extends TaskInternal, JavaForkOptions, ExtensionAware { - @Delegate - private final JavaForkOptions javaForkOptions - - JacocoHelper(Task task) { - this.task = task - javaForkOptions = [:] as JavaForkOptions - task.project.jacoco.applyTo(this) - } - - // needed by JacocoPluginExtension.applyTo, dummy - Task doFirst(Closure closure) { - } - - // needed by JacocoPluginExtension.applyTo - ExtensionContainer getExtensions() { - task.getExtensions() - } - - @Override - TaskInputsInternal getInputs() { - task.getInputs() - } - - // needed by JacocoPluginExtension.applyTo - JacocoTaskExtension getJacoco() { - task.extensions.jacoco - } - - // needed by JacocoPluginExtension.applyTo - String getName() { - task.getName() - } - - @Override - TaskOutputsInternal getOutputs() { - task.getOutputs() - } - - File getWorkingDir() { - task.project.projectDir - } -} + JacocoTaskExtension getJacoco() +} \ No newline at end of file diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy index f904f8ae8..dbd6d09a7 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy @@ -10,11 +10,14 @@ package org.akhikhl.gretty import org.akhikhl.gretty.scanner.JDKScannerManager import org.gradle.api.DefaultTask +import org.gradle.api.Task +import org.gradle.api.internal.TaskInternal +import org.gradle.api.plugins.ExtensionAware import org.gradle.api.tasks.TaskAction +import org.gradle.process.JavaForkOptions import org.gradle.testing.jacoco.plugins.JacocoTaskExtension import org.springframework.boot.devtools.autoconfigure.OptionalLiveReloadServer import org.springframework.boot.devtools.livereload.LiveReloadServer - /** * Base task for starting jetty * @@ -35,7 +38,8 @@ abstract class StartBaseTask extends DefaultTask { Map serverStartInfo StartBaseTask() { - getJacoco() + initJacoco() + getOutputs().upToDateWhen { false } } @TaskAction @@ -132,11 +136,26 @@ abstract class StartBaseTask extends DefaultTask { } JacocoTaskExtension getJacoco() { - if(jacocoHelper == null && project.extensions.findByName('jacoco') && project.gretty.jacocoEnabled) { - jacocoHelper = new JacocoHelper(this) + jacocoHelper?.jacoco + } + + private void initJacoco() { + if(project.extensions.findByName('jacoco') && project.gretty.jacocoEnabled) { + Task startTask = this + jacocoHelper = (TaskInternal.methods.collectEntries({ [it.name, {} ] }) + + JavaForkOptions.methods.collectEntries({ [it.name, {} ] }) + + ExtensionAware.methods.collectEntries({ [it.name, {} ] }) + [ + getExtensions: { startTask.getExtensions() }, + getInputs: { startTask.getInputs() }, + getJacoco: { startTask.extensions.jacoco }, + getName: { startTask.getName() }, + getOutputs: { startTask.getOutputs() }, + getProject: { startTask.project }, + getWorkingDir: { project.projectDir }, + ]) as JacocoHelper + project.jacoco.applyTo(jacocoHelper) jacocoHelper.jacoco.enabled = getDefaultJacocoEnabled() } - jacocoHelper?.jacoco } protected final LauncherConfig getLauncherConfig() { diff --git a/pluginScripts/gretty-1.4.2.plugin b/pluginScripts/gretty-1.4.2.plugin new file mode 100644 index 000000000..ed6abbb91 --- /dev/null +++ b/pluginScripts/gretty-1.4.2.plugin @@ -0,0 +1,16 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'org.akhikhl.gretty:gretty:1.4.2' + } +} + +repositories { + jcenter() +} + +if (!project.plugins.findPlugin(org.akhikhl.gretty.GrettyPlugin)) + project.apply(plugin: org.akhikhl.gretty.GrettyPlugin) diff --git a/pluginScripts/gretty.plugin b/pluginScripts/gretty.plugin index 3a6747fea..ed6abbb91 100644 --- a/pluginScripts/gretty.plugin +++ b/pluginScripts/gretty.plugin @@ -4,7 +4,7 @@ buildscript { } dependencies { - classpath 'org.akhikhl.gretty:gretty:1.4.1' + classpath 'org.akhikhl.gretty:gretty:1.4.2' } }