Repository: aurora
Updated Branches:
  refs/heads/master 2130f7e9a -> ae6e8575b


Modify the gradle build to optionally prefix CLASSPATH with a custom value when 
running installDist.

This enables much greater iteration speed when working on the Aurora UI.

Bugs closed: AURORA-1425

Reviewed at https://reviews.apache.org/r/37092/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/ae6e8575
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/ae6e8575
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/ae6e8575

Branch: refs/heads/master
Commit: ae6e8575be0b51eff1c80562311d7de6ed96b248
Parents: 2130f7e
Author: Joshua Cohen <[email protected]>
Authored: Wed Aug 5 13:55:52 2015 -0500
Committer: Joshua Cohen <[email protected]>
Committed: Wed Aug 5 13:55:52 2015 -0500

----------------------------------------------------------------------
 build.gradle                        | 12 ++++++++++++
 docs/developing-aurora-scheduler.md | 19 +++++++++++++++++++
 examples/vagrant/aurorabuild.sh     |  4 +++-
 3 files changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/ae6e8575/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index fa2e268..afb9b80 100644
--- a/build.gradle
+++ b/build.gradle
@@ -496,3 +496,15 @@ run {
   main = 'org.apache.aurora.scheduler.app.local.LocalSchedulerMain'
   classpath += sourceSets.test.output
 }
+
+startScripts {
+  def environmentClasspathPrefix = System.env.CLASSPATH_PREFIX
+
+  if (!environmentClasspathPrefix?.trim()) {
+    return
+  }
+
+  doLast {
+    unixScript.text = unixScript.text.replace('CLASSPATH=', 
"CLASSPATH=${environmentClasspathPrefix}:")
+  }
+}

http://git-wip-us.apache.org/repos/asf/aurora/blob/ae6e8575/docs/developing-aurora-scheduler.md
----------------------------------------------------------------------
diff --git a/docs/developing-aurora-scheduler.md 
b/docs/developing-aurora-scheduler.md
index 17cfc18..f52c76e 100644
--- a/docs/developing-aurora-scheduler.md
+++ b/docs/developing-aurora-scheduler.md
@@ -90,6 +90,25 @@ use the following commands to view and modify the bower repo 
at
     bower update <library name>
     bower help
 
+Faster Iteration in Vagrant
+---------------------------
+The scheduler serves UI assets from the classpath. For production deployments 
this means the assets
+are served from within a jar. However, for faster development iteration, the 
vagrant image is
+configured to add `/vagrant/dist/resources/main` to the head of CLASSPATH. 
This path is configured
+as a shared filesystem to the path on the host system where your Aurora 
repository lives. This means
+that any updates to dist/resources/main in your checkout will be reflected 
immediately in the UI
+served from within the vagrant image.
+
+The one caveat to this is that this path is under `dist` not `src`. This is 
because the assets must
+be processed by gradle before they can be served. So, unfortunately, you 
cannot just save your local
+changes and see them reflected in the UI, you must first run `./gradlew 
processResources`. This is
+less than ideal, but better than having to restart the scheduler after every 
change. Additionally,
+gradle makes this process somewhat easier with the use of the `--continuous` 
flag. If you run:
+`./gradlew processResources --continuous` gradle will monitor the filesystem 
for changes and run the
+task automatically as necessary. This doesn't quite provide hot-reload 
capabilities, but it does
+allow for <5s from save to changes being visibile in the UI with no further 
action required on the
+part of the developer.
+
 Developing the Aurora Build System
 ==================================
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/ae6e8575/examples/vagrant/aurorabuild.sh
----------------------------------------------------------------------
diff --git a/examples/vagrant/aurorabuild.sh b/examples/vagrant/aurorabuild.sh
index 8850e93..92066e8 100755
--- a/examples/vagrant/aurorabuild.sh
+++ b/examples/vagrant/aurorabuild.sh
@@ -43,7 +43,9 @@ function build_admin_client {
 }
 
 function build_scheduler {
-  ./gradlew installDist
+  # This CLASSPATH_PREFIX is inserted at the front of the CLASSPATH to enable 
"hot" reloads of the
+  # UI code (c.f. the startScripts task in build.gradle).
+  CLASSPATH_PREFIX=/vagrant/dist/resources/main ./gradlew installDist
 
   export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
   sudo mkdir -p /var/db/aurora

Reply via email to