pass version to MW client app and get it to run

pull/34/head
Zlatin Balevsky 2019-11-30 03:16:10 +00:00
parent efef0f3734
commit b981f9199b
4 changed files with 19 additions and 6 deletions

View File

@ -49,7 +49,7 @@ task pluginConfig {
task clientsConfig {
doLast {
def binding = [ "libname" : libDirPath()]
def binding = [ "libname" : libDirPath(), "version" : project.version ]
def templateFile = new File("$projectDir/templates/clients.config.template")
def engine = new groovy.text.SimpleTemplateEngine()
def output = engine.createTemplate(templateFile).make(binding)
@ -70,10 +70,13 @@ task pluginDir {
java.nio.file.Files.copy(it.toPath(), dest.toPath())
}
}
def jarFile = webapp.configurations.jarArtifact.getAllArtifacts().file[0]
def dest = new File(libDir, jarFile.getName())
java.nio.file.Files.copy(jarFile.toPath(), dest.toPath())
webAppDir.mkdirs()
def warFile = webapp.configurations.warArtifact.getAllArtifacts().file[0]
def dest = new File(webAppDir, "MuWire.war")
dest = new File(webAppDir, "MuWire.war")
java.nio.file.Files.copy(warFile.toPath(), dest.toPath())
"zip -d ${dest.toString()} *.jar".execute()
}
@ -128,7 +131,8 @@ task sign {
}
webappConfig.dependsOn pluginDir
clientsConfig.dependsOn webappConfig
pack.dependsOn webappConfig
pluginZip.dependsOn(webappConfig,pluginConfig,pack)
pluginZip.dependsOn(webappConfig,pluginConfig,clientsConfig,pack)
sign.dependsOn pluginZip
assemble.dependsOn sign

View File

@ -1,5 +1,6 @@
clientApp.0.main=com.muwire.webui.MuWireClient
clientApp.0.name=MuWire
clientApp.0.startOnLoad=false
clientApp.0.startOnLoad=true
clientApp.0.delay=5
clientApp.0.classpath=${libname}
clientApp.0.args=version=${version}

View File

@ -1,5 +1,6 @@
configurations {
warArtifact
jarArtifact
}
apply plugin : 'war'
@ -56,4 +57,5 @@ war.dependsOn generateWebXML
artifacts {
warArtifact war
jarArtifact jar
}

View File

@ -10,6 +10,7 @@ public class MuWireClient implements RouterApp {
private final RouterContext ctx;
private final ClientAppManager mgr;
private final String[] args;
private final String version;
private ClientAppState state;
@ -17,12 +18,17 @@ public class MuWireClient implements RouterApp {
this.ctx = ctx;
this.mgr = mgr;
this.args = args;
String version = null;
for (String arg : args) {
String [] split = arg.split("=");
if (split[0].equals("version"))
version = split[1];
}
this.version = version;
}
@Override
public void startup() throws Throwable {
// TODO Auto-generated method stub
}
@Override