diff --git a/wscript b/wscript index 561c7703424..e21e23c5e95 100644 --- a/wscript +++ b/wscript @@ -307,6 +307,26 @@ def runant(tsk): return ret Utils.runant = runant +def runmvn(tsk): + environ = dict(os.environ) + environ["CATALINA_HOME"] = tsk.env.TOMCATHOME + if not "M2_HOME" in environ: + raise Utils.WafError("Maven not installed or M2_HOME not set") + if tsk.generator.env.DISTRO == "Windows": + stanzas = [ + _join(environ["M2_HOME"],"bin","mvn.bat") + ] + else: + stanzas = [ + _join(environ["M2_HOME"],"bin","mvn") + ] + #stanzas += tsk.generator.mvnargs + ret = Utils.exec_command(" ".join(stanzas),cwd=tsk.generator.bld.srcnode.abspath(),env=environ,log=True) + if ret != 0: raise Utils.WafError("Maven phase %s failed with error value %s"%(stanzas,ret)) + return ret +Utils.runmvn = runmvn + + @throws_command_errors def run_java(classname,classpath,options=None,arguments=None): if not options: options = [] diff --git a/wscript_build b/wscript_build index ff4b22f4155..4abc0319cf0 100644 --- a/wscript_build +++ b/wscript_build @@ -105,31 +105,30 @@ def build_jars (): Implementation_Version = bld.env.VERSION # this is to trigger recompilation / cache avoidance if the relevant environment for ant changes - ant_args = [ - "build-all", + mvn_args = [ + "package", "-Dimpl.version=%s" % Implementation_Version, "-Dtarget.dir=%s" % targetdir, "-Ddist.dir=%s" % distdir, - "-Dbase.dir=%s" % sourcedir, - "-f %s" % Utils.relpath (_join(sourcedir, "build.xml")), + "-Dbase.dir=%s" % sourcedir ] if buildpremium: - ant_args.append("-Dbuild.premium=true") + mvn_args.append("-Dbuild.premium=true") tgen = bld(features='subst', name='version-info', source="version-info.in", target="version-info") - tgen.dict = { "Implementation_Version":Implementation_Version,"ant_args":ant_args } + tgen.dict = { "Implementation_Version":Implementation_Version,"mvn_args":mvn_args } bld.install_files("${DOCDIR}","version-info") bld.srcnode.ensure_dir_node_from_path("target/jar") bld.srcnode.ensure_dir_node_from_path("dist") - tgen = bld.new_task_gen (rule = Utils.runant, - name = "runant", - antargs = ant_args) + tgen = bld.new_task_gen (rule = Utils.runmvn, + name = "runmvn", + mvnargs = mvn_args) - jarnode = bld.srcnode.find_dir ('target/jar') - jars_str = jarnode.ant_glob ('*.jar').split () + jarnode = bld.srcnode.find_dir ('.') + jars_str = jarnode.ant_glob ('**/target/*.jar').split () ant_jars = [] excludes = ["cloud-xstream-1.3.1.jar", "cloud-commons-dbcp-1.2.2.jar", "cloud-commons-httpclient-3.1.jar", "cloud-commons-pool-1.4.jar", @@ -146,7 +145,6 @@ def build_jars (): bld.install_files ('${JAVADIR}', ant_jars) - def build_premium (): if buildpremium: bld.recurse(["cloudstack-proprietary/"],'build') @@ -201,9 +199,9 @@ def build_patches (): def build_systemvm_patch (): if bld.env.DISTRO not in ["Windows","Mac"]: # patch creation - bld.install_files ("${AGENTLIBDIR}/vms", "%s/systemvm.zip" % distdir) + bld.install_files ("${AGENTLIBDIR}/vms", "console-proxy/dist/systemvm.zip" ) # ISO creation - bld.install_as("${AGENTLIBDIR}/vms/systemvm.iso", "%s/systemvm.iso" % distdir) + bld.install_as("${AGENTLIBDIR}/vms/systemvm.iso", "console-proxy/dist/systemvm.iso" ) def build_systemvm_iso (): if buildpremium: @@ -361,13 +359,14 @@ def build_xml_api_description (): relationship = Utils.relpath(sourcedir,os.getcwd()) cp = [ _join(relationship,x) for x in task.generator.env.CLASSPATH.split(pathsep) ] - jarnames = ['utils','server','core', 'api', 'server-extras'] + jarnames = ['utils','server','core', 'api'] props = ["client/tomcatconf/commands.properties.in"] sources = [] for i in jarnames: - str = 'target/jar/cloud-%s.jar' % i - sources.append (str) + str = _glob("../%s/target/*jar" % i ) + for j in str: + sources.append ("%s/target/%s" % (i, os.path.basename(j))) sources.append ("client/tomcatconf/commands.properties.in") if buildpremium: sources.append("client/tomcatconf/commands-ext.properties.in")