<project>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>mindplot</artifactId>
    <packaging>jar</packaging>
    <name>Mindmap Draw JavaScript Library</name>

    <parent>
        <groupId>org.wisemapping</groupId>
        <artifactId>wisemapping</artifactId>
        <relativePath>../pom.xml</relativePath>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.wisemapping</groupId>
            <artifactId>web2d</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>runtime</scope>
        </dependency>
        <!-- <dependency>
            <groupId>com.google.jstestdriver</groupId>
            <artifactId>maven-jstestdriver-plugin</artifactId>
            <version>1.2.2-SNAPSHOT</version>
            <scope>test</scope>
        </dependency> -->
    </dependencies>

    <repositories>
        <repository>
            <id>jstd-maven-plugin google code repo</id>
            <url>http://jstd-maven-plugin.googlecode.com/svn/maven2</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>merge-js-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>

                                <mkdir dir="${basedir}/target/classes"/>
                                <concat destfile="${basedir}/target/tmp/mindplot.js" append="false">
                                    <filelist dir="${basedir}/src/main/javascript/" files="header.js"/>

                                    <filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
                                              files="Overlay.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
                                              files="MooDialog.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
                                              files="MooDialog.Request.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/libraries/moodialog/"
                                              files="MooDialog.Fx.js"/>

                                    <filelist dir="${basedir}/src/main/javascript/" files="model/IMindmap.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/Mindmap.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/INodeModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/NodeModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/RelationshipModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ActionDispatcher.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="StandaloneActionDispatcher.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DesignerModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="Designer.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ScreenManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="Workspace.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ShrinkConnector.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DesignerKeyboard.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="NodeGraph.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="Topic.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="CentralTopic.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="MainTopic.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DragTopic.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DragManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DragPivot.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ConnectionLine.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="RelationshipLine.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DragConnector.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="TextEditor.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="MultilineTextEditor.js"/>
                                    <!--<filelist dir="${basedir}/src/main/javascript/" files="RichTextEditor.js"/>-->
                                    <filelist dir="${basedir}/src/main/javascript/" files="TextEditorFactory.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="util/Shape.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ModelCodeName.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="XMLMindmapSerializer_Pela.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="XMLMindmapSerializer_Tango.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="XMLMindmapSerializer_Beta.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="Beta2PelaMigrator.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="XMLMindmapSerializerFactory.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="PersistenceManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DwrPersistenceManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="LocalStorageManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="EditorProperties.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="IconGroup.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="BubbleTip.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="Icon.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="LinkIcon.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="NoteIcon.js"/>

                                    <filelist dir="${basedir}/src/main/javascript/" files="ActionIcon.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ImageIcon.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/IconModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/LinkModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="model/NoteModel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="Command.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DesignerActionRunner.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="DesignerUndoManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="ControlPoint.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="EditorOptions.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="RelationshipPivot.js"/>

                                    <filelist dir="${basedir}/src/main/javascript/commands/"
                                              files="GenericFunctionCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/commands/" files="DeleteCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/commands/"
                                              files="DragTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/commands/"
                                              files="AddTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/ChangeLinkToTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/RemoveLinkFromTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/AddIconToTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/RemoveIconFromTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/ChangeNoteToTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/RemoveNoteFromTopicCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/AddRelationshipCommand.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="commands/MoveControlPointCommand.js"/>
                                   <filelist dir="${basedir}/src/main/javascript/"
                                              files="collaboration/CollaborationManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="collaboration/framework/AbstractCollaborativeFramework.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="collaboration/framework/AbstractCollaborativeModelFactory.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarNotifier.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarItem.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="ToolbarPaneItem.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="NoteEditor.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="LinkEditor.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="FloatingTip.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/widget/" files="LinkIconTooltip.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/ColorPalettePanel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/ListToolbarPanel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/FontFamilyPanel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/FontSizePanel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/TopicShapePanel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/IconPanel.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/IMenu.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="widget/Menu.js"/>

                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/EventBusDispatcher.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="layout/ChangeEvent.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/LayoutManager.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/Node.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/RootedTreeSet.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/ChildrenSorterStrategy.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/AbstractBasicSorter.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/BalancedSorter.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/SymmetricSorter.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/GridSorter.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/"
                                              files="layout/OriginalLayout.js"/>
                                    <filelist dir="${basedir}/src/main/javascript/" files="layout/EventBus.js"/>

                                    <filelist dir="${basedir}/src/main/javascript/" files="footer.js"/>
                                </concat>

                                <concat destfile="${basedir}/target/classes/mindplot.js" append="false">
                                    <filelist dir="${basedir}/../web2d/target/classes/" files="web2d.svg-min.js"/>
                                    <filelist dir="${basedir}/target/tmp/" files="mindplot.js"/>
                                </concat>

                                <copy toDir="${basedir}/target/classes/">
                                    <fileset dir="${basedir}/src/main/javascript/">
                                        <include name="libraries/**/*"/>
                                        <include name="widget/colorPalette.*"/>
                                        <include name="widget/*.css"/>
                                    </fileset>
                                </copy>
                            </tasks>
                        </configuration>

                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.sf.alchim</groupId>
                <artifactId>yuicompressor-maven-plugin</artifactId>
                <version>0.7.1</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>compress</goal>
                        </goals>
                        <configuration>
                            <sourceDirectory>${basedir}/target/tmp/</sourceDirectory>
                            <outputDirectory>${basedir}/target/classes/</outputDirectory>

                            <aggregations>
                                <aggregation>
                                    <output>${basedir}/target/classes/mindplot-min.js</output>
                                </aggregation>
                            </aggregations>
                            <jswarn>true</jswarn>
                            <force>true</force>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.4.2</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>

            <!--           <plugin>
               <groupId>com.google.jstestdriver</groupId>
               <artifactId>maven-jstestdriver-plugin</artifactId>
               <version>1.2.2-SNAPSHOT</version>
               <executions>
                   <execution>
                       <id>run-tests</id>
                       <phase>test</phase>
                       <goals>
                           <goal>test</goal>
                       </goals>
                       <configuration>
                           <config>${basedir}/src/test/jsTestDriver.conf</config>
                       </configuration>
                   </execution>
               </executions>
           </plugin> -->
        </plugins>
    </build>
</project>
