diff options
author | Henri Sara <hesara@vaadin.com> | 2015-07-13 11:50:39 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-07-13 08:56:36 +0000 |
commit | 7007941fbb5ba3586e68d8369e30668f8ffabb5c (patch) | |
tree | b7321b14f72ccd477d0b8366cd98d6150550dce5 /scripts | |
parent | eb69c6dffba85eb8b4fd03d7fe32337240c65106 (diff) | |
download | vaadin-framework-7007941fbb5ba3586e68d8369e30668f8ffabb5c.tar.gz vaadin-framework-7007941fbb5ba3586e68d8369e30668f8ffabb5c.zip |
Update archetype validation script to use single repo URL
Change-Id: Icda479927bbb52c2eedf5cb5477726042f55434d
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/BuildArchetypes.py | 13 | ||||
-rw-r--r-- | scripts/BuildHelpers.py | 36 |
2 files changed, 21 insertions, 28 deletions
diff --git a/scripts/BuildArchetypes.py b/scripts/BuildArchetypes.py index 754c13a981..fa6dba2c56 100644 --- a/scripts/BuildArchetypes.py +++ b/scripts/BuildArchetypes.py @@ -7,7 +7,7 @@ # Python3 is required as this script uses some Python3 specific features. # Might work with Python2, haven't tested. # -# python BuildArchetypes.py version fw-repo-id archetype-repo-id plugin-repo-id +# python BuildArchetypes.py version --repo staging-repo-url # import subprocess, sys @@ -41,8 +41,8 @@ def generateArchetype(archetype, artifactId, repo): cmd.append("-DarchetypeGroupId=%s" % (archetypeGroup)) cmd.append("-DarchetypeArtifactId=%s" % (archetype)) cmd.append("-DarchetypeVersion=%s" % (args.version)) - if hasattr(args, "archetype") and args.archetype != None: - cmd.append("-DarchetypeRepository=%s" % (repo % (args.archetype))) + if hasattr(args, "repo") and args.repo != None: + cmd.append("-DarchetypeRepository=%s" % repo) cmd.append("-DgroupId=%s" % (group)) cmd.append("-DartifactId=%s" % (artifactId)) cmd.append("-Dversion=1.0-SNAPSHOT") @@ -63,10 +63,7 @@ if __name__ == "__main__": from DeployHelpers import deployWar # Add command line arguments for staging repos - parser.add_argument("framework", type=int, help="Framework repo id (comvaadin-XXXX)", nargs='?') - parser.add_argument("archetype", type=int, help="Archetype repo id (comvaadin-XXXX)", nargs='?') - parser.add_argument("plugin", type=int, help="Maven Plugin repo id (comvaadin-XXXX)", nargs='?') - parser.add_argument("--repo", type=str, help="Staging repository template", required=True) + parser.add_argument("--repo", type=str, help="Staging repository URL", required=True) archetypesFailed = False @@ -81,7 +78,7 @@ if __name__ == "__main__": try: log = getLogFile(archetype) generateArchetype(archetype, artifactId, args.repo) - updateRepositories(join(resultPath, artifactId)) + updateRepositories(join(resultPath, artifactId), args.repo) mavenValidate(artifactId, logFile=log) warFiles = copyWarFiles(artifactId, name=archetype) for war in warFiles: diff --git a/scripts/BuildHelpers.py b/scripts/BuildHelpers.py index 8da0671819..cbcf821632 100644 --- a/scripts/BuildHelpers.py +++ b/scripts/BuildHelpers.py @@ -9,9 +9,6 @@ from os import listdir, makedirs from shutil import copy, rmtree from glob import glob -# Staging repo base url -repo = "http://oss.sonatype.org/content/repositories/comvaadin-%d" - # Directory where the resulting war files are stored # TODO: deploy results resultPath = join("result", "demos") @@ -70,16 +67,17 @@ def getArgs(): return args # Maven Package and Validation -def mavenValidate(artifactId, mvnCmd = mavenCmd, logFile = sys.stdout, repoIds = None): - if repoIds is None: - repoIds = getArgs() +def mavenValidate(artifactId, mvnCmd = mavenCmd, logFile = sys.stdout, version = None, mavenParams = None): + if version is None: + version = getArgs().version + if mavenParams is None: + mavenParams = getArgs().maven print("Do maven clean package validate") cmd = [mvnCmd] - if hasattr(repoIds, "version") and repoIds.version is not None: - cmd.append("-Dvaadin.version=%s" % (repoIds.version)) - if hasattr(repoIds, "maven") and repoIds.maven is not None: - cmd.extend(repoIds.maven.strip('"').split(" ")) + cmd.append("-Dvaadin.version=%s" % (version)) + if mavenParams is not None: + cmd.extend(mavenParams.strip('"').split(" ")) cmd.extend(["clean", "package", "validate"]) print("executing: %s" % (" ".join(cmd))) subprocess.check_call(cmd, cwd=join(resultPath, artifactId), stdout=logFile) @@ -111,10 +109,10 @@ def readPomFile(pomFile): return ElementTree.parse(pomFile), nameSpace # Recursive pom.xml update script -def updateRepositories(path, repoIds = None, repoUrl = repo): +def updateRepositories(path, repoUrl = None, version = None): # If versions are not supplied, parse arguments - if repoIds is None: - repoIds = getArgs() + if version is None: + version = getArgs().version # Read pom.xml pomXml = join(path, "pom.xml") @@ -130,9 +128,8 @@ def updateRepositories(path, repoIds = None, repoUrl = repo): if repoNode is not None: print("Add staging repositories to " + pomXml) - if hasattr(repoIds, "framework") and repoIds.framework is not None: - # Add framework staging repository - addRepo(repoNode, "repository", "vaadin-%s-staging" % (repoIds.version), repoUrl % (repoIds.framework)) + # Add framework staging repository + addRepo(repoNode, "repository", "vaadin-%s-staging" % (version), repoUrl) # Find the correct pluginRepositories node pluginRepo = tree.getroot().find("{%s}pluginRepositories" % (nameSpace)) @@ -140,9 +137,8 @@ def updateRepositories(path, repoIds = None, repoUrl = repo): # Add pluginRepositories node if needed pluginRepo = ElementTree.SubElement(tree.getroot(), "pluginRepositories") - if hasattr(repoIds, "plugin") and repoIds.plugin is not None: - # Add plugin staging repository - addRepo(pluginRepo, "pluginRepository", "vaadin-%s-plugin-staging" % (repoIds.version), repoUrl % (repoIds.plugin)) + # Add plugin staging repository + addRepo(pluginRepo, "pluginRepository", "vaadin-%s-plugin-staging" % (version), repoUrl) # Overwrite the modified pom.xml tree.write(pomXml, encoding='UTF-8') @@ -151,7 +147,7 @@ def updateRepositories(path, repoIds = None, repoUrl = repo): for i in listdir(path): file = join(path, i) if isdir(file): - updateRepositories(join(path, i), repoIds, repoUrl) + updateRepositories(join(path, i), repoUrl, version) # Add a repository of repoType to given repoNode with id and URL def addRepo(repoNode, repoType, id, url): |