diff --git a/Makefile b/Makefile index 52bb04a..2094d98 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ test: p: ./gradlew --configure-on-demand glide-gradle-plugin:jWL && ./gradlew --stop +l: + ./gradlew --configure-on-demand glide-gradle-plugin:pTML + si: ./gradlew --configure-on-demand sandbox:glideInfo diff --git a/glide-gradle-plugin/src/glide/gradle/GlideGradlePlugin.groovy b/glide-gradle-plugin/src/glide/gradle/GlideGradlePlugin.groovy index 04267c5..4507ae6 100644 --- a/glide-gradle-plugin/src/glide/gradle/GlideGradlePlugin.groovy +++ b/glide-gradle-plugin/src/glide/gradle/GlideGradlePlugin.groovy @@ -22,7 +22,7 @@ class GlideGradlePlugin implements Plugin { } if (project.gradle.startParameter.continuous) { - project.logger.debug('we are in continuous mode') + project.logger.info('we are in continuous mode') } diff --git a/glide-gradle-plugin/src/glide/gradle/extn/GlideExtension.groovy b/glide-gradle-plugin/src/glide/gradle/extn/GlideExtension.groovy index 5860a70..dc58882 100644 --- a/glide-gradle-plugin/src/glide/gradle/extn/GlideExtension.groovy +++ b/glide-gradle-plugin/src/glide/gradle/extn/GlideExtension.groovy @@ -27,11 +27,16 @@ class GlideExtension { String env // Experimental feature - boolean daemon = true + boolean daemon = false + /** + * the file representing the local db + */ + File localDbFile GlideExtension(Project project, Properties defaultVersions) { this.project = project + localDbFile = project.file(".db/local_db.bin") versions = new VersionsExtension(defaultVersions) } diff --git a/glide-gradle-plugin/src/glide/gradle/project/decorators/AfterEvaluateProjectConfigurator.groovy b/glide-gradle-plugin/src/glide/gradle/project/decorators/AfterEvaluateProjectConfigurator.groovy index bb0b5b9..ba908f4 100644 --- a/glide-gradle-plugin/src/glide/gradle/project/decorators/AfterEvaluateProjectConfigurator.groovy +++ b/glide-gradle-plugin/src/glide/gradle/project/decorators/AfterEvaluateProjectConfigurator.groovy @@ -167,11 +167,15 @@ class AfterEvaluateProjectConfigurator extends ProjectDecorator { // this may not be required as we are overriding explodedAppDirectory below warDir = this.warRoot - // daemon = true + // oauth2 is sorta mandatory now + appCfg.oauth2 = true + + // instead of this, user can control via appengine extension itself + // daemon = this.configuredGlideExtension.daemon // TODO add following only if we want to reload classes - jvmFlags += ["-Dappengine.fullscan.seconds=${syncFrequency}", - "-Ddatastore.backing_store=../../.local.db.bin"] + jvmFlags += ["-Dappengine.fullscan.seconds=${this.syncFrequency}", + "-Ddatastore.backing_store=${this.configuredGlideExtension.localDbFile.absolutePath}"] } } } @@ -179,6 +183,7 @@ class AfterEvaluateProjectConfigurator extends ProjectDecorator { private void configureGlideTasks() { project.tasks.withType(GlideSetup) { GlideSetup task -> task.webInfDir = this.webInfDir + task.localDbFile = this.configuredGlideExtension.localDbFile } project.tasks.getByName(GlideTaskCreator.GLIDE_COPY_LIBS_TASK_NAME).with { diff --git a/glide-gradle-plugin/src/glide/gradle/project/decorators/GlideTaskCreator.groovy b/glide-gradle-plugin/src/glide/gradle/project/decorators/GlideTaskCreator.groovy index 957770e..84ada45 100644 --- a/glide-gradle-plugin/src/glide/gradle/project/decorators/GlideTaskCreator.groovy +++ b/glide-gradle-plugin/src/glide/gradle/project/decorators/GlideTaskCreator.groovy @@ -1,12 +1,7 @@ package glide.gradle.project.decorators import com.google.appengine.AppEnginePlugin -import glide.gradle.tasks.ForgivingSync -import glide.gradle.tasks.GlideGenerateConf -import glide.gradle.tasks.GlideInfo -import glide.gradle.tasks.GlideSetup -import glide.gradle.tasks.GlideStartSync -import glide.gradle.tasks.GlideSyncOnce +import glide.gradle.tasks.* import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.Copy @@ -44,13 +39,26 @@ class GlideTaskCreator extends ProjectDecorator { def createAndConfigureGlideTasks() { // Create Task objects - GlideSetup glideSetupDir = createGlideTask(GLIDE_SETUP_TASK_NAME, GlideSetup) GlideInfo glideInfo = createGlideTask(GLIDE_INFO_TASK_NAME, GlideInfo) - Copy glideCopyLibs = createGlideTask(GLIDE_COPY_LIBS_TASK_NAME, Copy) - GlideGenerateConf glideGenerateConf = createGlideTask(GLIDE_GENERATE_CONFIG_TASK_NAME, GlideGenerateConf) - ForgivingSync glideAppSync = createGlideTask(GLIDE_APP_SYNC_TASK_NAME, ForgivingSync) - GlideStartSync glideStartSync = createGlideTask(GLIDE_START_SYNC_TASK_NAME, GlideStartSync) - GlideSyncOnce glideSyncOnce = createGlideTask(GLIDE_SYNC_ONCE_TASK_NAME, GlideSyncOnce) + GlideSetup glideSetupDir = createGlideTask(GLIDE_SETUP_TASK_NAME, GlideSetup, + "Creates output directory") + + Copy glideCopyLibs = createGlideTask(GLIDE_COPY_LIBS_TASK_NAME, Copy, + "Copies the dependency jar files to output dir") + + GlideGenerateConf glideGenerateConf = createGlideTask(GLIDE_GENERATE_CONFIG_TASK_NAME, GlideGenerateConf, + "Generates config files required for app engine web application in output dir") + + ForgivingSync glideAppSync = createGlideTask(GLIDE_APP_SYNC_TASK_NAME, ForgivingSync, + "Sync app changes to output dir, useful in continuous mode") + + + GlideStartSync glideStartSync = createGlideTask(GLIDE_START_SYNC_TASK_NAME, GlideStartSync, + "Starts syncing changes from app dir to output dir, also generates config if required (only useful in run mode)") + + GlideSyncOnce glideSyncOnce = createGlideTask(GLIDE_SYNC_ONCE_TASK_NAME, GlideSyncOnce, + "Syncs changes from app dir to output dir, also generates config if required") + Task glidePrepare = createGlideTask(GLIDE_PREPARE_TASK_NAME, Task) // Task glideRunWithSync = createGlideTask('glideRunWithSync', Task) // Task glideRunWithoutSync = createGlideTask('glideRunWithoutSync', Task) @@ -71,9 +79,11 @@ class GlideTaskCreator extends ProjectDecorator { } - public T createGlideTask(String taskName, Class taskClass) { + public T createGlideTask(String taskName, Class taskClass, String description = null) { Task createdTask = this.project.tasks.create(taskName, taskClass) createdTask.group = GLIDE_TASK_GROUP_NAME + if (description) + createdTask.description = description return createdTask } diff --git a/glide-gradle-plugin/src/glide/gradle/tasks/GlideInfo.groovy b/glide-gradle-plugin/src/glide/gradle/tasks/GlideInfo.groovy index b314bf1..8ab86ab 100644 --- a/glide-gradle-plugin/src/glide/gradle/tasks/GlideInfo.groovy +++ b/glide-gradle-plugin/src/glide/gradle/tasks/GlideInfo.groovy @@ -8,6 +8,8 @@ import org.gradle.api.tasks.TaskAction @ParallelizableTask class GlideInfo extends DefaultTask { + String description = "Prints the version" + @TaskAction def print() { def selfVersion = DefaultVersions.get().selfVersion diff --git a/glide-gradle-plugin/src/glide/gradle/tasks/GlideSetup.groovy b/glide-gradle-plugin/src/glide/gradle/tasks/GlideSetup.groovy index dbb3781..a150a05 100644 --- a/glide-gradle-plugin/src/glide/gradle/tasks/GlideSetup.groovy +++ b/glide-gradle-plugin/src/glide/gradle/tasks/GlideSetup.groovy @@ -9,9 +9,11 @@ import org.gradle.api.tasks.TaskAction class GlideSetup extends DefaultTask { File webInfDir // not marking as input, don't need to perform any computation + File localDbFile @TaskAction protected void prepare() { webInfDir?.mkdirs() + localDbFile.parentFile.mkdirs() } }