<!--
  Copyright 2016 Huawei Technologies Co., Ltd.
 
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
      <groupId>org.openo.gso.gui</groupId>
      <artifactId>gso-gui</artifactId>
      <version>1.0.0-SNAPSHOT</version>
    </parent>
    <artifactId>servicegateway</artifactId>
    <name>servicegateway</name>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <modules>
        <module>service</module>
        <module>deployment</module>
    </modules>

    <profiles>
        <profile>
            <activation>
                <file>
                    <exists>src/main/release/pub</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.3</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.10</version>
                        <executions>
                            <execution>
                                <id>copy-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/deploydependencis</outputDirectory>
                                    <overWriteReleases>false</overWriteReleases>
                                    <overWriteSnapshots>false</overWriteSnapshots>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                    <includeScope>compile</includeScope>
                                    <includeScope>runtime</includeScope>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.gmaven</groupId>
                        <artifactId>gmaven-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>make new jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <source>
                                        private String getWebContextFromManifest(File warFile) {
                                        String context = null;
                                        java.util.jar.JarFile jarFile = null;
                                        try {
                                        jarFile = new java.util.jar.JarFile(warFile);
                                        context =
                                        jarFile.getManifest().getMainAttributes().getValue("WebContext-Name");
                                        context = context == null ? "ROOT" : context;
                                        context = context.replace("\", "/");
                                        context = context.replaceAll("[/]{2,}", "/");
                                        context = context.endsWith("/") ? context.substring(0, context.length() - 1) : context;
                                        context = context.startsWith("/") ? context.substring(1, context.length()) : context;
                                        context = context.replaceAll("/", "#");
                                        return context;
                                        } catch (Exception e) {
                                        System.out.println("-------------------context eror: ",e);
                                        context = "ROOT";
                                        } finally {
                                        if (jarFile != null) {
                                        jarFile.close();
                                        }
                                        }
                                        System.out.println("-------------------context is: " + context);
                                        return context;
                                        }

                                        System.out.println("------------------------------1")
                                        List contexts=new ArrayList();
                                        deploydependencisdir = "${project.build.directory}/deploydependencis";
                                        unzipdir =
                                        "${project.build.directory}/deployunzip";
                                        outputdir =
                                        "${project.build.directory}/deployoutput";
                                        resourcesdir =
                                        "${project.basedir}/src/main/release";
                                        jarsdir = "${unzipdir}/lib";
                                        toolpath =
                                        "${project.build.directory}/deployoutputjars";

                                        System.out.println("------------------------------2")
                                        ant = new AntBuilder()
                                        ant.delete(dir: "${unzipdir}")
                                        ant.mkdir(dir: "${unzipdir}")
                                        ant.mkdir(dir:
                                        toolpath)
                                        ant.delete(dir: "${outputdir}")
                                        ant.mkdir(dir: "${outputdir}")
                                        ant.delete(dir: "${jarsdir}")
                                        ant.mkdir(dir: "${jarsdir}")
                                        outputFileName =
                                        "${project.name}"

                                        System.out.println("------------------------------3")
                                        if(new
                                        File("${deploydependencisdir}").exists()){
                                        for (File file : new File("${deploydependencisdir}").listFiles())
                                        {
                                        String filePath = file.getAbsolutePath();
                                        fileName = file.getName();
                                        if (fileName.endsWith(".war")) {
                                        context = getWebContextFromManifest(file)
                                        ant.mkdir(dir: "${unzipdir}/webapps/" + context)
                                        ant.unzip(src: filePath, dest: "${unzipdir}/webapps/" + context)
                                        ant.copy(todir: toolpath) {
                                        fileset(dir: "${unzipdir}/webapps/" + context + "/WEB-INF/lib") {
                                        include(name: "*.jar")
                                        }
                                        }

                                        }
                                        }

                                        contexts.add(toolpath)
                                        ant.copy(todir: toolpath) {
                                        fileset(dir: "${deploydependencisdir}") {
                                        include(name: "*.jar")
                                        }
                                        }
                                        }


                                        System.out.println("------------------------------4")
                                        ant.copy(todir: toolpath) {
                                        fileset(dir: "${project.build.directory}") {
                                        include(name: "*.jar")
                                        }
                                        }

                                        ant.copy(todir: "${unzipdir}") {
                                        fileset(dir: "${resourcesdir}") {
                                        include(name: "**")
                                        }
                                        }


                                        /* compile python .py files. */
                                        System.out.println("------------------------------5------------------")
                                        pythonFile = "${project.basedir}/src/main/python";
                                        if(new
                                        File(pythonFile).exists()) {
                                        try {
                                        ant.exec(dir: "${project.basedir}/src/main/python", executable: "python") {
                                        arg(value: "-m")
                                        arg(value: "compileall")
                                        arg(value: ".")
                                        }

                                        ant.copy(todir: "${unzipdir}") {
                                        fileset(dir: "${project.basedir}/src/main/python") {
                                        include(name: "**/*.*")
                                        exclude(name: "**/*.py")
                                        }
                                        }
                                        } catch (Exception eee) {
                                        System.out.println("----------------&gt;&gt;&gt;"+eee.toString())
                                        }
                                        }

                                        /* copy all dependencies to $APP_ROOT/lib. */
                                        System.out.println("------------------------------6------------------")
                                        for(String temPath : contexts)
                                        {
                                        if(new File(temPath).exists())
                                        {
                                        try {
                                        for (File file : new File(temPath).listFiles()) {
                                        fileName = file.getName();
                                        if (fileName.endsWith(".jar")) {
                                        ant.copy(file: file.getAbsolutePath(), todir: "${jarsdir}")
                                        }
                                        }
                                        } catch (Exception e) {
                                        e.printStackTrace()
                                        }
                                        }
                                        }

                                        /* deploy the upzip file to ${outputdir}/${outputFileName} */
                                        System.out.println("------------------------------7------------------")
                                        outputFileName =
                                        outputFileName.endsWith("Deployment")?outputFileName:outputFileName+"Deployment";
                                        outputFileName = outputFileName.substring(0, outputFileName.length() -
                                        "Deployment".length());
                                        outputFileName = outputFileName +
                                        "-${project.version}.zip";

                                        outputFileName = outputFileName.replace("-SNAPSHOT",
                                        "." + new java.text.SimpleDateFormat("yyyyMMddHHmmss").format(
                                        new Date()));

                                        ant.delete(dir: "${unzipdir}/webapps/ROOT/WEB-INF/lib");
                                        ant.mkdir(dir:
                                        "${unzipdir}/webapps/ROOT/WEB-INF/lib");
                                        ant.copy(todir:
                                        "${unzipdir}/webapps/ROOT/WEB-INF/lib") {
                                        fileset(dir: "${unzipdir}/lib") {
                                        include(name: "org.openo.common-services.common-utilities.commonlib.db-*.jar")
                                        include(name: "org.openo.common-services.common-utilities.commonlib.cbb-*.jar")
                                        }
                                        }

                                        ant.delete() {
                                        fileset(dir: "${unzipdir}/lib") {
                                        include(name: "org.openo.common-services.common-utilities.commonlib.db-*.jar")
                                        include(name: "org.openo.common-services.common-utilities.commonlib.cbb-*.jar")
                                        }
                                        }

                                        /* generate dependencies.list in $APP_ROOT/lib. Requirement for install disk size. */
                                        System.out.println("------------------------------8------------------")
                                        dependenciesPath="${unzipdir}/lib";
                                        try {
                                        def writer = new File(dependenciesPath+"/dependencies.list").newWriter('UTF-8')
                                        for (String fileName : new File(dependenciesPath).list()) {
                                        if (fileName.endsWith(".jar")) {
                                        writer.writeLine(fileName);
                                        }
                                        }
                                        writer.close()
                                        } catch (Exception e) {
                                        e.printStackTrace()
                                        }

                                        /* make the archive. */
                                        System.out.println("------------------------------9------------------")
                                        ant.zip(destfile:
                                        "${outputdir}/${outputFileName}") {
                                        fileset(dir: "${unzipdir}") {
                                        exclude(name: "**/.gitignore")
                                        }
                                        }

                                        System.out.println("------------------------------done")
                                    </source>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
