]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add Demo validation script support for using local artifacts
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 7 Jul 2015 12:09:00 +0000 (15:09 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Tue, 7 Jul 2015 12:09:00 +0000 (15:09 +0300)
Change-Id: I47f6bd7b4b73371ffe10a80f6af215146f7895e4

scripts/BuildDemos.py
scripts/BuildHelpers.py

index 6d8445b4d1f30d4080a11662395c0e2be21206cd..721fec4c689af9a530360b984572070caeac314b 100644 (file)
@@ -9,14 +9,16 @@
 # pip install requests
 # Deploy depends on .deployUrl and .deployCredentials files in home folder
 
-import sys
+import sys, os
 try:
        from git import Repo
 except:
        print("BuildDemos depends on gitpython. Install it with `pip install gitpython`")
        sys.exit(1)
-from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs
+from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs, mavenInstall
 from DeployHelpers import deployWar
+from os.path import join, isfile
+from fnmatch import fnmatch
 
 # Validated demos. name -> git url
 demos = {
@@ -30,8 +32,19 @@ def checkout(folder, url):
        Repo.clone_from(url, folder)
 
 if __name__ == "__main__":
-       if getArgs().teamcity:
-               print("Add dependency jars from TeamCity here")
+       if hasattr(getArgs(), "artifactPath") and getArgs().artifactPath is not None:
+               basePath = getArgs().artifactPath
+               poms = []
+               for root, dirs, files in os.walk(basePath):
+                       for name in files:
+                               if fnmatch(name, "*.pom"):
+                                       poms.append(join(root, name))
+               for pom in poms:
+                       jarFile = pom.replace(".pom", ".jar")
+                       if isfile(jarFile):
+                               mavenInstall(pom, jarFile)
+                       else:
+                               mavenInstall(pom)
        
        demosFailed = False
        
index 534ce5344172addbd2e963e87410d16a90db35c4..4fe815fae1752be929c258b359842a6a49b634b8 100644 (file)
@@ -31,7 +31,7 @@ args = None
 parser = argparse.ArgumentParser(description="Automated staging validation")
 parser.add_argument("version", type=str, help="Vaadin version to use")
 parser.add_argument("--maven", help="Additional maven command line parameters", default=None)
-parser.add_argument("--teamcity", help="Use vaadin jars provided by teamcity", action="store_const", const=True, default=False)
+parser.add_argument("--artifactPath", help="Path to local folder with Vaadin artifacts", default=None)
 
 # Parse command line arguments <version>
 def parseArgs():
@@ -167,3 +167,10 @@ def removeDir(subdir):
                # Dangerous relative paths.
                return
        rmtree(join(getcwd(), subdir))
+
+def mavenInstall(pomFile, jarFile = None, mvnCmd = mavenCmd, logFile = sys.stdout):
+       cmd = [mvnCmd, "install:install-file"]
+       cmd.append("-Dfile=%s" % (jarFile if jarFile is not None else pomFile))
+       cmd.append("-DpomFile=%s" % (pomFile))
+       print("executing: %s" % (" ".join(cmd)))
+       subprocess.check_call(cmd, stdout=logFile)