Mercurial > hg > icedrobot > ika
changeset 8:b2827d00500a
Mavenize IKA.
author | Roman Kennke <roman.kennke@sun.com> |
---|---|
date | Wed, 16 Mar 2011 22:47:21 +0100 |
parents | 4e841dd81d28 |
children | a1b265c4f7f8 |
files | .hgignore build.xml lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar lib/jopt-simple-3.2.jar lib/junit_4/junit-4.5-api.zip lib/junit_4/junit-4.5-src.jar lib/junit_4/junit-4.5.jar lib/nblibraries.properties manifest.mf nbproject/build-impl.xml nbproject/genfiles.properties nbproject/private/config.properties nbproject/private/private.properties nbproject/private/private.xml nbproject/project.properties nbproject/project.xml pom.xml resources/core_plugins.properties resources/org/icedrobot/ika/plugins/borg/icedrobot.properties resources/org/icedrobot/ika/plugins/borg/repositories.properties resources/org/icedrobot/ika/plugins/borg/subrepositories.properties src/main/java/org/icedrobot/ika/Ika.java src/main/java/org/icedrobot/ika/IkaMain.java src/main/java/org/icedrobot/ika/plugins/IkaPlugin.java src/main/java/org/icedrobot/ika/plugins/IkaPluginException.java src/main/java/org/icedrobot/ika/plugins/IkaPluginResult.java src/main/java/org/icedrobot/ika/plugins/borg/AndroidAssimilator.java src/main/java/org/icedrobot/ika/plugins/borg/ClonerTask.java src/main/java/org/icedrobot/ika/plugins/borg/IcedRobotCloner.java src/main/java/org/icedrobot/ika/plugins/git/IkaGitWrapper.java src/main/java/org/icedrobot/ika/plugins/help/IkaVersion.java src/main/java/org/icedrobot/ika/plugins/scm/GITRepository.java src/main/java/org/icedrobot/ika/plugins/scm/HGRepository.java src/main/java/org/icedrobot/ika/plugins/scm/Repository.java src/main/resources/core_plugins.properties src/main/resources/org/icedrobot/ika/plugins/borg/icedrobot.properties src/main/resources/org/icedrobot/ika/plugins/borg/repositories.properties src/main/resources/org/icedrobot/ika/plugins/borg/subrepositories.properties src/org/icedrobot/ika/Ika.java src/org/icedrobot/ika/IkaMain.java src/org/icedrobot/ika/plugins/IkaPlugin.java src/org/icedrobot/ika/plugins/IkaPluginException.java src/org/icedrobot/ika/plugins/IkaPluginResult.java src/org/icedrobot/ika/plugins/borg/AndroidAssimilator.java src/org/icedrobot/ika/plugins/borg/ClonerTask.java src/org/icedrobot/ika/plugins/borg/IcedRobotCloner.java src/org/icedrobot/ika/plugins/git/IkaGitWrapper.java src/org/icedrobot/ika/plugins/help/IkaVersion.java src/org/icedrobot/ika/plugins/scm/GITRepository.java src/org/icedrobot/ika/plugins/scm/HGRepository.java src/org/icedrobot/ika/plugins/scm/Repository.java |
diffstat | 50 files changed, 1216 insertions(+), 2286 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Tue Mar 15 00:13:34 2011 +0100 +++ b/.hgignore Wed Mar 16 22:47:21 2011 +0100 @@ -1,23 +1,4 @@ -(^|/)CVS($|/) -(^|/)\.hg($|/) -(^|/)\.hgtags($|/) -^project.log$ -^tailor.state$ -^tailor.state.old$ -^tailor.state.journal$ -autom4te.cache - -syntax:glob -*~ -*\# -syntax: glob -*.orig -libs -*.out -dist -gensrc/headers/ -gensrc/native -out/ -build/ - - +.project +.classpath +.settings +target
--- a/build.xml Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- You may freely edit this file. See commented blocks below for --> -<!-- some examples of how to customize the build. --> -<!-- (If you delete it and reopen the project it will be recreated.) --> -<!-- By default, only the Clean and Build commands use this build script. --> -<!-- Commands such as Run, Debug, and Test only use this build script if --> -<!-- the Compile on Save feature is turned off for the project. --> -<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> -<!-- in the project's Project Properties dialog box.--> -<project name="ika" default="default" basedir="."> - <description>Builds, tests, and runs the project ika.</description> - <import file="nbproject/build-impl.xml"/> - <!-- - - There exist several targets which are by default empty and which can be - used for execution of your tasks. These targets are usually executed - before and after some main targets. They are: - - -pre-init: called before initialization of project properties - -post-init: called after initialization of project properties - -pre-compile: called before javac compilation - -post-compile: called after javac compilation - -pre-compile-single: called before javac compilation of single file - -post-compile-single: called after javac compilation of single file - -pre-compile-test: called before javac compilation of JUnit tests - -post-compile-test: called after javac compilation of JUnit tests - -pre-compile-test-single: called before javac compilation of single JUnit test - -post-compile-test-single: called after javac compilation of single JUunit test - -pre-jar: called before JAR building - -post-jar: called after JAR building - -post-clean: called after cleaning build products - - (Targets beginning with '-' are not intended to be called on their own.) - - Example of inserting an obfuscator after compilation could look like this: - - <target name="-post-compile"> - <obfuscate> - <fileset dir="${build.classes.dir}"/> - </obfuscate> - </target> - - For list of available properties check the imported - nbproject/build-impl.xml file. - - - Another way to customize the build is by overriding existing main targets. - The targets of interest are: - - -init-macrodef-javac: defines macro for javac compilation - -init-macrodef-junit: defines macro for junit execution - -init-macrodef-debug: defines macro for class debugging - -init-macrodef-java: defines macro for class execution - -do-jar-with-manifest: JAR building (if you are using a manifest) - -do-jar-without-manifest: JAR building (if you are not using a manifest) - run: execution of project - -javadoc-build: Javadoc generation - test-report: JUnit report generation - - An example of overriding the target for project execution could look like this: - - <target name="run" depends="ika-impl.jar"> - <exec dir="bin" executable="launcher.exe"> - <arg file="${dist.jar}"/> - </exec> - </target> - - Notice that the overridden target depends on the jar target and not only on - the compile target as the regular run target does. Again, for a list of available - properties which you can use, check the target you are overriding in the - nbproject/build-impl.xml file. - - --> -</project>
--- a/lib/nblibraries.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -libs.CopyLibs.classpath=\ - ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar -libs.junit.classpath=\ - ${base}/junit/junit-3.8.2.jar -libs.junit.javadoc=\ - ${base}/junit/junit-3.8.2-api.zip -libs.junit_4.classpath=\ - ${base}/junit_4/junit-4.5.jar -libs.junit_4.javadoc=\ - ${base}/junit_4/junit-4.5-api.zip -libs.junit_4.src=\ - ${base}/junit_4/junit-4.5-src.jar
--- a/manifest.mf Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build -
--- a/nbproject/build-impl.xml Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,928 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -*** GENERATED FROM project.xml - DO NOT EDIT *** -*** EDIT ../build.xml INSTEAD *** - -For the purpose of easier reading the script -is divided into following sections: - - - initialization - - compilation - - jar - - execution - - debugging - - javadoc - - junit compilation - - junit execution - - junit debugging - - applet - - cleanup - - --> -<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="ika-impl"> - <fail message="Please build using Ant 1.7.1 or higher."> - <condition> - <not> - <antversion atleast="1.7.1"/> - </not> - </condition> - </fail> - <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> - <!-- - ====================== - INITIALIZATION SECTION - ====================== - --> - <target name="-pre-init"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="-pre-init" name="-init-private"> - <property file="nbproject/private/config.properties"/> - <property file="nbproject/private/configs/${config}.properties"/> - <property file="nbproject/private/private.properties"/> - </target> - <target name="-pre-init-libraries"> - <property location="./lib/nblibraries.properties" name="libraries.path"/> - <dirname file="${libraries.path}" property="libraries.dir.nativedirsep"/> - <pathconvert dirsep="/" property="libraries.dir"> - <path path="${libraries.dir.nativedirsep}"/> - </pathconvert> - <basename file="${libraries.path}" property="libraries.basename" suffix=".properties"/> - <available file="${libraries.dir}/${libraries.basename}-private.properties" property="private.properties.available"/> - </target> - <target depends="-pre-init-libraries" if="private.properties.available" name="-init-private-libraries"> - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.dir}/${libraries.basename}-private.properties"> - <filterchain> - <replacestring from="$${base}" to="${libraries.dir}"/> - <escapeunicode/> - </filterchain> - </loadproperties> - </target> - <target depends="-pre-init,-init-private,-init-private-libraries" name="-init-libraries"> - <loadproperties encoding="ISO-8859-1" srcfile="${libraries.path}"> - <filterchain> - <replacestring from="$${base}" to="${libraries.dir}"/> - <escapeunicode/> - </filterchain> - </loadproperties> - </target> - <target depends="-pre-init,-init-private,-init-libraries" name="-init-user"> - <property file="${user.properties.file}"/> - <!-- The two properties below are usually overridden --> - <!-- by the active platform. Just a fallback. --> - <property name="default.javac.source" value="1.4"/> - <property name="default.javac.target" value="1.4"/> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user" name="-init-project"> - <property file="nbproject/configs/${config}.properties"/> - <property file="nbproject/project.properties"/> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init"> - <available file="${manifest.file}" property="manifest.available"/> - <available file="${application.splash}" property="splashscreen.available"/> - <condition property="main.class.available"> - <and> - <isset property="main.class"/> - <not> - <equals arg1="${main.class}" arg2="" trim="true"/> - </not> - </and> - </condition> - <condition property="manifest.available+main.class"> - <and> - <isset property="manifest.available"/> - <isset property="main.class.available"/> - </and> - </condition> - <condition property="do.mkdist"> - <and> - <isset property="libs.CopyLibs.classpath"/> - <not> - <istrue value="${mkdist.disabled}"/> - </not> - </and> - </condition> - <condition property="manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class}"/> - <isset property="do.mkdist"/> - </and> - </condition> - <condition property="manifest.available+main.class+mkdist.available+splashscreen.available"> - <and> - <istrue value="${manifest.available+main.class+mkdist.available}"/> - <istrue value="${splashscreen.available}"/> - </and> - </condition> - <condition property="do.archive"> - <not> - <istrue value="${jar.archive.disabled}"/> - </not> - </condition> - <condition property="do.archive+manifest.available"> - <and> - <isset property="manifest.available"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="do.archive+manifest.available+main.class"> - <and> - <istrue value="${manifest.available+main.class}"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="do.archive+manifest.available+main.class+mkdist.available"> - <and> - <istrue value="${manifest.available+main.class+mkdist.available}"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available"> - <and> - <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/> - <istrue value="${do.archive}"/> - </and> - </condition> - <condition property="have.tests"> - <or> - <available file="${test.src.dir}"/> - </or> - </condition> - <condition property="have.sources"> - <or> - <available file="${src.dir}"/> - <available file="${src.resources.dir}"/> - </or> - </condition> - <condition property="netbeans.home+have.tests"> - <and> - <isset property="netbeans.home"/> - <isset property="have.tests"/> - </and> - </condition> - <condition property="no.javadoc.preview"> - <and> - <isset property="javadoc.preview"/> - <isfalse value="${javadoc.preview}"/> - </and> - </condition> - <property name="run.jvmargs" value=""/> - <property name="javac.compilerargs" value=""/> - <property name="work.dir" value="${basedir}"/> - <condition property="no.deps"> - <and> - <istrue value="${no.dependencies}"/> - </and> - </condition> - <property name="javac.debug" value="true"/> - <property name="javadoc.preview" value="true"/> - <property name="application.args" value=""/> - <property name="source.encoding" value="${file.encoding}"/> - <property name="runtime.encoding" value="${source.encoding}"/> - <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> - <and> - <isset property="javadoc.encoding"/> - <not> - <equals arg1="${javadoc.encoding}" arg2=""/> - </not> - </and> - </condition> - <property name="javadoc.encoding.used" value="${source.encoding}"/> - <property name="includes" value="**"/> - <property name="excludes" value=""/> - <property name="do.depend" value="false"/> - <condition property="do.depend.true"> - <istrue value="${do.depend}"/> - </condition> - <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> - <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> - <length length="0" string="${endorsed.classpath}" when="greater"/> - </condition> - <property name="javac.fork" value="false"/> - <property name="jar.index" value="false"/> - <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> - </target> - <target name="-post-init"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init" name="-init-check"> - <fail unless="src.dir">Must set src.dir</fail> - <fail unless="src.resources.dir">Must set src.resources.dir</fail> - <fail unless="test.src.dir">Must set test.src.dir</fail> - <fail unless="build.dir">Must set build.dir</fail> - <fail unless="dist.dir">Must set dist.dir</fail> - <fail unless="build.classes.dir">Must set build.classes.dir</fail> - <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> - <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> - <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> - <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> - <fail unless="dist.jar">Must set dist.jar</fail> - </target> - <target name="-init-macrodef-property"> - <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute name="name"/> - <attribute name="value"/> - <sequential> - <property name="@{name}" value="${@{value}}"/> - </sequential> - </macrodef> - </target> - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}:${src.resources.dir}" name="srcdir"/> - <attribute default="${build.classes.dir}" name="destdir"/> - <attribute default="${javac.classpath}" name="classpath"/> - <attribute default="${javac.processorpath}" name="processorpath"/> - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="${javac.debug}" name="debug"/> - <attribute default="${empty.dir}" name="sourcepath"/> - <attribute default="${empty.dir}" name="gensrcdir"/> - <element name="customize" optional="true"/> - <sequential> - <property location="${build.dir}/empty" name="empty.dir"/> - <mkdir dir="${empty.dir}"/> - <mkdir dir="@{apgeneratedsrcdir}"/> - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> - <src> - <dirset dir="@{gensrcdir}" erroronmissingdir="false"> - <include name="*"/> - </dirset> - </src> - <classpath> - <path path="@{classpath}"/> - </classpath> - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> - <compilerarg line="${javac.compilerargs}"/> - <compilerarg value="-processorpath"/> - <compilerarg path="@{processorpath}:${empty.dir}"/> - <compilerarg line="${ap.processors.internal}"/> - <compilerarg line="${annotation.processing.processor.options}"/> - <compilerarg value="-s"/> - <compilerarg path="@{apgeneratedsrcdir}"/> - <compilerarg line="${ap.proc.none.internal}"/> - <customize/> - </javac> - </sequential> - </macrodef> - </target> - <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> - <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}:${src.resources.dir}" name="srcdir"/> - <attribute default="${build.classes.dir}" name="destdir"/> - <attribute default="${javac.classpath}" name="classpath"/> - <attribute default="${javac.processorpath}" name="processorpath"/> - <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="${javac.debug}" name="debug"/> - <attribute default="${empty.dir}" name="sourcepath"/> - <attribute default="${empty.dir}" name="gensrcdir"/> - <element name="customize" optional="true"/> - <sequential> - <property location="${build.dir}/empty" name="empty.dir"/> - <mkdir dir="${empty.dir}"/> - <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> - <src> - <dirset dir="@{gensrcdir}" erroronmissingdir="false"> - <include name="*"/> - </dirset> - </src> - <classpath> - <path path="@{classpath}"/> - </classpath> - <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> - <compilerarg line="${javac.compilerargs}"/> - <customize/> - </javac> - </sequential> - </macrodef> - </target> - <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> - <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${src.dir}:${src.resources.dir}" name="srcdir"/> - <attribute default="${build.classes.dir}" name="destdir"/> - <attribute default="${javac.classpath}" name="classpath"/> - <sequential> - <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> - <classpath> - <path path="@{classpath}"/> - </classpath> - </depend> - </sequential> - </macrodef> - <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${build.classes.dir}" name="destdir"/> - <sequential> - <fail unless="javac.includes">Must set javac.includes</fail> - <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> - <path> - <filelist dir="@{destdir}" files="${javac.includes}"/> - </path> - <globmapper from="*.java" to="*.class"/> - </pathconvert> - <tempfile deleteonexit="true" property="javac.includesfile.binary"/> - <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> - <delete> - <files includesfile="${javac.includesfile.binary}"/> - </delete> - <delete file="${javac.includesfile.binary}"/> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-junit"> - <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${includes}" name="includes"/> - <attribute default="${excludes}" name="excludes"/> - <attribute default="**" name="testincludes"/> - <sequential> - <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}"> - <batchtest todir="${build.test.results.dir}"> - <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> - <filename name="@{testincludes}"/> - </fileset> - </batchtest> - <classpath> - <path path="${run.test.classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <formatter type="brief" usefile="false"/> - <formatter type="xml"/> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${run.jvmargs}"/> - </junit> - </sequential> - </macrodef> - </target> - <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> - <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute default="${main.class}" name="name"/> - <attribute default="${debug.classpath}" name="classpath"/> - <attribute default="" name="stopclassname"/> - <sequential> - <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> - <classpath> - <path path="@{classpath}"/> - </classpath> - </nbjpdastart> - </sequential> - </macrodef> - <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute default="${build.classes.dir}" name="dir"/> - <sequential> - <nbjpdareload> - <fileset dir="@{dir}" includes="${fix.classes}"> - <include name="${fix.includes}*.class"/> - </fileset> - </nbjpdareload> - </sequential> - </macrodef> - </target> - <target name="-init-debug-args"> - <property name="version-output" value="java version "${ant.java.version}"/> - <condition property="have-jdk-older-than-1.4"> - <or> - <contains string="${version-output}" substring="java version "1.0"/> - <contains string="${version-output}" substring="java version "1.1"/> - <contains string="${version-output}" substring="java version "1.2"/> - <contains string="${version-output}" substring="java version "1.3"/> - </or> - </condition> - <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> - <istrue value="${have-jdk-older-than-1.4}"/> - </condition> - <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> - <os family="windows"/> - </condition> - <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> - <isset property="debug.transport"/> - </condition> - </target> - <target depends="-init-debug-args" name="-init-macrodef-debug"> - <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> - <attribute default="${main.class}" name="classname"/> - <attribute default="${debug.classpath}" name="classpath"/> - <element name="customize" optional="true"/> - <sequential> - <java classname="@{classname}" dir="${work.dir}" fork="true"> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg line="${debug-args-line}"/> - <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> - <jvmarg line="${run.jvmargs}"/> - <classpath> - <path path="@{classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="run-sys-prop."/> - <mapper from="run-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <customize/> - </java> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-java"> - <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> - <attribute default="${main.class}" name="classname"/> - <attribute default="${run.classpath}" name="classpath"/> - <element name="customize" optional="true"/> - <sequential> - <java classname="@{classname}" dir="${work.dir}" fork="true"> - <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> - <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> - <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> - <jvmarg line="${run.jvmargs}"/> - <classpath> - <path path="@{classpath}"/> - </classpath> - <syspropertyset> - <propertyref prefix="run-sys-prop."/> - <mapper from="run-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <customize/> - </java> - </sequential> - </macrodef> - </target> - <target name="-init-macrodef-copylibs"> - <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> - <element name="customize" optional="true"/> - <sequential> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <pathconvert property="run.classpath.without.build.classes.dir"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to=""/> - </pathconvert> - <pathconvert pathsep=" " property="jar.classpath"> - <path path="${run.classpath.without.build.classes.dir}"/> - <chainedmapper> - <flattenmapper/> - <globmapper from="*" to="lib/*"/> - </chainedmapper> - </pathconvert> - <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> - <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> - <fileset dir="${build.classes.dir}"/> - <manifest> - <attribute name="Class-Path" value="${jar.classpath}"/> - <customize/> - </manifest> - </copylibs> - </sequential> - </macrodef> - </target> - <target name="-init-presetdef-jar"> - <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> - <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> - <j2seproject1:fileset dir="${build.classes.dir}"/> - </jar> - </presetdef> - </target> - <target name="-init-ap-cmdline-properties"> - <property name="annotation.processing.enabled" value="true"/> - <property name="annotation.processing.processors.list" value=""/> - <property name="annotation.processing.processor.options" value=""/> - <property name="annotation.processing.run.all.processors" value="true"/> - <property name="javac.processorpath" value="${javac.classpath}"/> - <property name="javac.test.processorpath" value="${javac.test.classpath}"/> - <condition property="ap.supported.internal" value="true"> - <not> - <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> - </not> - </condition> - </target> - <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> - <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> - <isfalse value="${annotation.processing.run.all.processors}"/> - </condition> - <condition else="" property="ap.proc.none.internal" value="-proc:none"> - <isfalse value="${annotation.processing.enabled}"/> - </condition> - </target> - <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> - <property name="ap.cmd.line.internal" value=""/> - </target> - <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> - <!-- - =================== - COMPILATION SECTION - =================== - --> - <target name="-deps-jar-init" unless="built-jar.properties"> - <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> - <delete file="${built-jar.properties}" quiet="true"/> - </target> - <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> - <echo level="warn" message="Cycle detected: ika was already built"/> - </target> - <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> - <mkdir dir="${build.dir}"/> - <touch file="${built-jar.properties}" verbose="false"/> - <property file="${built-jar.properties}" prefix="already.built.jar."/> - <antcall target="-warn-already-built-jar"/> - <propertyfile file="${built-jar.properties}"> - <entry key="${basedir}" value=""/> - </propertyfile> - </target> - <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> - <target depends="init" name="-check-automatic-build"> - <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> - </target> - <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> - <antcall target="clean"/> - </target> - <target depends="init,deps-jar" name="-pre-pre-compile"> - <mkdir dir="${build.classes.dir}"/> - </target> - <target name="-pre-compile"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target if="do.depend.true" name="-compile-depend"> - <pathconvert property="build.generated.subdirs"> - <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> - <include name="*"/> - </dirset> - </pathconvert> - <j2seproject3:depend srcdir="${src.dir}:${src.resources.dir}:${build.generated.subdirs}"/> - </target> - <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> - <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> - <copy todir="${build.classes.dir}"> - <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - <fileset dir="${src.resources.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - </copy> - </target> - <target if="has.persistence.xml" name="-copy-persistence-xml"> - <mkdir dir="${build.classes.dir}/META-INF"/> - <copy todir="${build.classes.dir}/META-INF"> - <fileset dir="${meta.inf.dir}" includes="persistence.xml"/> - </copy> - </target> - <target name="-post-compile"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> - <target name="-pre-compile-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> - <j2seproject3:force-recompile/> - <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}:${src.resources.dir}"/> - </target> - <target name="-post-compile-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> - <!-- - ==================== - JAR BUILDING SECTION - ==================== - --> - <target depends="init" name="-pre-pre-jar"> - <dirname file="${dist.jar}" property="dist.jar.dir"/> - <mkdir dir="${dist.jar.dir}"/> - </target> - <target name="-pre-jar"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available"> - <j2seproject1:jar/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class"> - <j2seproject1:jar manifest="${manifest.file}"/> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> - <j2seproject1:jar manifest="${manifest.file}"> - <j2seproject1:manifest> - <j2seproject1:attribute name="Main-Class" value="${main.class}"/> - </j2seproject1:manifest> - </j2seproject1:jar> - <echo>To run this application from the command line without Ant, try:</echo> - <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <pathconvert property="run.classpath.with.dist.jar"> - <path path="${run.classpath}"/> - <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> - </pathconvert> - <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen"> - <basename file="${application.splash}" property="splashscreen.basename"/> - <mkdir dir="${build.classes.dir}/META-INF"/> - <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> - <j2seproject3:copylibs> - <customize> - <attribute name="Main-Class" value="${main.class}"/> - <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> - </customize> - </j2seproject3:copylibs> - <echo>To run this application from the command line without Ant, try:</echo> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <echo>java -jar "${dist.jar.resolved}"</echo> - </target> - <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available"> - <j2seproject3:copylibs> - <customize> - <attribute name="Main-Class" value="${main.class}"/> - </customize> - </j2seproject3:copylibs> - <echo>To run this application from the command line without Ant, try:</echo> - <property location="${dist.jar}" name="dist.jar.resolved"/> - <echo>java -jar "${dist.jar.resolved}"</echo> - </target> - <target name="-post-jar"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> - <!-- - ================= - EXECUTION SECTION - ================= - --> - <target depends="init,compile" description="Run a main class." name="run"> - <j2seproject1:java> - <customize> - <arg line="${application.args}"/> - </customize> - </j2seproject1:java> - </target> - <target name="-do-not-recompile"> - <property name="javac.includes.binary" value=""/> - </target> - <target depends="init,compile-single" name="run-single"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <j2seproject1:java classname="${run.class}"/> - </target> - <target depends="init,compile-test-single" name="run-test-with-main"> - <fail unless="run.class">Must select one file in the IDE or set run.class</fail> - <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> - </target> - <!-- - ================= - DEBUGGING SECTION - ================= - --> - <target depends="init" if="netbeans.home" name="-debug-start-debugger"> - <j2seproject1:nbjpdastart name="${debug.class}"/> - </target> - <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> - </target> - <target depends="init,compile" name="-debug-start-debuggee"> - <j2seproject3:debug> - <customize> - <arg line="${application.args}"/> - </customize> - </j2seproject3:debug> - </target> - <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> - <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> - <j2seproject1:nbjpdastart stopclassname="${main.class}"/> - </target> - <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> - <j2seproject3:debug classname="${debug.class}"/> - </target> - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> - <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> - <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> - <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> - </target> - <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> - <target depends="init" name="-pre-debug-fix"> - <fail unless="fix.includes">Must set fix.includes</fail> - <property name="javac.includes" value="${fix.includes}.java"/> - </target> - <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> - <j2seproject1:nbjpdareload/> - </target> - <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> - <!-- - =============== - JAVADOC SECTION - =============== - --> - <target depends="init" if="have.sources" name="-javadoc-build"> - <mkdir dir="${dist.javadoc.dir}"/> - <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> - <classpath> - <path path="${javac.classpath}"/> - </classpath> - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> - <filename name="**/*.java"/> - </fileset> - <fileset dir="${src.resources.dir}" excludes="${excludes}" includes="${includes}"> - <filename name="**/*.java"/> - </fileset> - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> - <include name="**/*.java"/> - </fileset> - </javadoc> - <copy todir="${dist.javadoc.dir}"> - <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> - <filename name="**/doc-files/**"/> - </fileset> - <fileset dir="${src.resources.dir}" excludes="${excludes}" includes="${includes}"> - <filename name="**/doc-files/**"/> - </fileset> - <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> - <include name="**/doc-files/**"/> - </fileset> - </copy> - </target> - <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> - <nbbrowse file="${dist.javadoc.dir}/index.html"/> - </target> - <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> - <!-- - ========================= - JUNIT COMPILATION SECTION - ========================= - --> - <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> - <mkdir dir="${build.test.classes.dir}"/> - </target> - <target name="-pre-compile-test"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target if="do.depend.true" name="-compile-test-depend"> - <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> - </target> - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> - <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> - <copy todir="${build.test.classes.dir}"> - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - </copy> - </target> - <target name="-post-compile-test"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> - <target name="-pre-compile-test-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> - <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> - <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> - <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> - <copy todir="${build.test.classes.dir}"> - <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> - </copy> - </target> - <target name="-post-compile-test-single"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> - <!-- - ======================= - JUNIT EXECUTION SECTION - ======================= - --> - <target depends="init" if="have.tests" name="-pre-test-run"> - <mkdir dir="${build.test.results.dir}"/> - </target> - <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> - <j2seproject3:junit testincludes="**/*Test.java"/> - </target> - <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> - </target> - <target depends="init" if="have.tests" name="test-report"/> - <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> - <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> - <target depends="init" if="have.tests" name="-pre-test-run-single"> - <mkdir dir="${build.test.results.dir}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> - <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> - <j2seproject3:junit excludes="" includes="${test.includes}"/> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> - <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> - </target> - <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> - <!-- - ======================= - JUNIT DEBUGGING SECTION - ======================= - --> - <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test"> - <fail unless="test.class">Must select one file in the IDE or set test.class</fail> - <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/> - <delete file="${test.report.file}"/> - <mkdir dir="${build.test.results.dir}"/> - <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}"> - <customize> - <syspropertyset> - <propertyref prefix="test-sys-prop."/> - <mapper from="test-sys-prop.*" to="*" type="glob"/> - </syspropertyset> - <arg value="${test.class}"/> - <arg value="showoutput=true"/> - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/> - <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/> - </customize> - </j2seproject3:debug> - </target> - <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> - <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> - </target> - <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> - <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> - <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> - </target> - <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> - <!-- - ========================= - APPLET EXECUTION SECTION - ========================= - --> - <target depends="init,compile-single" name="run-applet"> - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> - <j2seproject1:java classname="sun.applet.AppletViewer"> - <customize> - <arg value="${applet.url}"/> - </customize> - </j2seproject1:java> - </target> - <!-- - ========================= - APPLET DEBUGGING SECTION - ========================= - --> - <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> - <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> - <j2seproject3:debug classname="sun.applet.AppletViewer"> - <customize> - <arg value="${applet.url}"/> - </customize> - </j2seproject3:debug> - </target> - <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> - <!-- - =============== - CLEANUP SECTION - =============== - --> - <target name="-deps-clean-init" unless="built-clean.properties"> - <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> - <delete file="${built-clean.properties}" quiet="true"/> - </target> - <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> - <echo level="warn" message="Cycle detected: ika was already built"/> - </target> - <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> - <mkdir dir="${build.dir}"/> - <touch file="${built-clean.properties}" verbose="false"/> - <property file="${built-clean.properties}" prefix="already.built.clean."/> - <antcall target="-warn-already-built-clean"/> - <propertyfile file="${built-clean.properties}"> - <entry key="${basedir}" value=""/> - </propertyfile> - </target> - <target depends="init" name="-do-clean"> - <delete dir="${build.dir}"/> - <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> - </target> - <target name="-post-clean"> - <!-- Empty placeholder for easier customization. --> - <!-- You can override this target in the ../build.xml file. --> - </target> - <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> - <target name="-check-call-dep"> - <property file="${call.built.properties}" prefix="already.built."/> - <condition property="should.call.dep"> - <not> - <isset property="already.built.${call.subproject}"/> - </not> - </condition> - </target> - <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> - <ant antfile="${call.script}" inheritall="false" target="${call.target}"> - <propertyset> - <propertyref prefix="transfer."/> - <mapper from="transfer.*" to="*" type="glob"/> - </propertyset> - </ant> - </target> -</project>
--- a/nbproject/genfiles.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -build.xml.data.CRC32=e658de56 -build.xml.script.CRC32=8a6bb6b2 -build.xml.stylesheet.CRC32=28e38971@1.38.3.45 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=e658de56 -nbproject/build-impl.xml.script.CRC32=a0fb1379 -nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45
--- a/nbproject/private/private.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -compile.on.save=true -do.depend=false -do.jar=true -javac.debug=true -javadoc.preview=true -user.properties.file=/home/neugens/.netbeans/6.9/build.properties
--- a/nbproject/private/private.xml Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> - <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> -</project-private>
--- a/nbproject/project.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=ika -application.vendor=neugens -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/ika.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.jopt-simple-3.2.jar=lib/jopt-simple-3.2.jar -includes=** -jar.archive.disabled=${jnlp.enabled} -jar.compress=false -jar.index=${jnlp.enabled} -javac.classpath=\ - ${file.reference.jopt-simple-3.2.jar} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.6 -javac.target=1.6 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir}:\ - ${libs.junit.classpath}:\ - ${libs.junit_4.classpath} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -jnlp.codebase.type=no.codebase -jnlp.descriptor=application -jnlp.enabled=false -jnlp.mixed.code=defaut -jnlp.offline-allowed=false -jnlp.signed=false -main.class=org.icedrobot.ika.IkaMain -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value -# or test-sys-prop.name=value to set system properties for unit tests): -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -src.resources.dir=resources -test.src.dir=test
--- a/nbproject/project.xml Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://www.netbeans.org/ns/project/1"> - <type>org.netbeans.modules.java.j2seproject</type> - <configuration> - <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> - <name>ika</name> - <source-roots> - <root id="src.dir"/> - <root id="src.resources.dir"/> - </source-roots> - <test-roots> - <root id="test.src.dir"/> - </test-roots> - </data> - <libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1"> - <definitions>./lib/nblibraries.properties</definitions> - </libraries> - </configuration> -</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pom.xml Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,87 @@ +<!-- + IKA - IcedRobot Kiosk Application + Copyright (C) 2011 IcedRobot team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + --> +<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> + + <groupId>org.icedrobot</groupId> + <artifactId>ika</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>ika</name> + <url>http://maven.apache.org</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>org.icedrobot.ika.IkaMain</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.2.1</version> + <configuration> + <descriptorRefs> + <descriptorRef>jar-with-dependencies</descriptorRef> + </descriptorRefs> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>org.icedrobot.ika.IkaMain</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.sf.jopt-simple</groupId> + <artifactId>jopt-simple</artifactId> + <version>3.2</version> + </dependency> + </dependencies> +</project>
--- a/resources/core_plugins.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -# list of core plugins, the keys are the names and the values the class name -version=org.icedrobot.ika.plugins.help.IkaVersion -assimilate=org.icedrobot.ika.plugins.borg.IcedRobotCloner -git=org.icedrobot.ika.plugins.git.IkaGitWrapper
--- a/resources/org/icedrobot/ika/plugins/borg/icedrobot.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -# defautl location for the icedrobot root repositories -icedrobot=http://icedtea.classpath.org/icedrobot/hg/icedrobot/ -
--- a/resources/org/icedrobot/ika/plugins/borg/repositories.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# list of android repositories -dalvik=.,git://android.git.kernel.org/platform/dalvik.git,android-2.3.2_r1 -core=system,git://android.git.kernel.org/platform/system/core.git,android-2.3.2_r1 -safe-iop=external,git://android.git.kernel.org/platform/external/safe-iop.git,android-2.3.2_r1 -base=frameworks,git://android.git.kernel.org/platform/frameworks/base.git,android-2.3.2_r1
--- a/resources/org/icedrobot/ika/plugins/borg/subrepositories.properties Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# subrepository configurations -dalvik=vm,libnativehelper,libdex -safe-iop=. -core=libcutils -base=.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/Ika.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,130 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika; + +import org.icedrobot.ika.plugins.IkaPluginException; +import org.icedrobot.ika.plugins.IkaPlugin; + +import java.io.IOException; + +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class Ika { + + public static final String VERSION = "0.1"; + public static final String CORE_PLUGIN_LIST = "/core_plugins.properties"; + + private Map<String, IkaPlugin> plugins = new HashMap<String, IkaPlugin>(); + + private static final Ika theInstance = new Ika(); + public static Ika getInstance() { + return theInstance; + } + + private Ika() { + /* nothing to do */ + } + + /** + * Loads the core plugins list from the internal resource file. + * The plugins are also initialised here, by calling their + * {@link IkaPlugin#initPlugin() } method. + */ + private void loadCorePluginsList() { + + Properties corePlugins = new Properties(); + try { + corePlugins.load(Ika.class.getResourceAsStream(CORE_PLUGIN_LIST)); + + } catch (IOException ex) { + throw new IkaPluginException("cannot load plugin list", ex); + } + + for (String pluginName : corePlugins.stringPropertyNames()) { + // try to load the plugin, ne exception will be thrown + // at this point if the plugin is not found + // the plugins must all be in the classpath + String pluginClass = corePlugins.getProperty(pluginName); + try { + Logger.getLogger(Ika.class.getName()).log(Level.FINEST, + "loading: {0}", pluginClass); + + Class<IkaPlugin> _plugin = + (Class<IkaPlugin>) Class.forName(pluginClass); + IkaPlugin plugin = _plugin.newInstance(); + + plugins.put(pluginName, plugin); + + } catch (InstantiationException ex) { + Logger.getLogger(Ika.class.getName()).log(Level.WARNING, + "cannot instantiate plugin: " + + pluginClass, ex); + + } catch (IllegalAccessException ex) { + Logger.getLogger(Ika.class.getName()).log(Level.WARNING, + "cannot access plugin: " + pluginClass, ex); + + } catch (ClassNotFoundException ex) { + Logger.getLogger(Ika.class.getName()).log(Level.WARNING, + "cannot load plugin: " + pluginClass, ex); + } + } + } + + /** + * Parses the command line and reseach the module to load accordingly + */ + public void parseArgumentAndInvoke(String ... args) { + + loadCorePluginsList(); + + if (args == null || args.length == 0 || + "version".equalsIgnoreCase(args[0]) || + "--version".equalsIgnoreCase(args[0])) + { + // print a short help message and return + plugins.get("version").execute(args); + + } else { + // check if there is a plugin with the name passed as + // argument + IkaPlugin plugin = plugins.get(args[0]); + if (plugin != null) { + plugin.execute(args); + + } else { + System.err.println("No plugins found: " + args[0]); + System.err.println("maybe you mean one of:"); + System.err.println(""); + plugins.get("version").execute(new String[]{"--list-plugins"}); + } + } + } + + public Map<String, IkaPlugin> getPlugins() { + return plugins; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/IkaMain.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,32 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika; + +/** + * Main launcher for ika. + * + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class IkaMain { + + static public void main(String [] args) { + + Ika.getInstance().parseArgumentAndInvoke(args); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/IkaPlugin.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,29 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public interface IkaPlugin { + + public String getName(); + public String getDescription(); + public IkaPluginResult execute(String [] args); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/IkaPluginException.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,38 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins; + + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class IkaPluginException extends RuntimeException { + + public IkaPluginException(String string) { + super(string); + } + + public IkaPluginException(String string, Throwable ex) { + super(string, ex); + } + + public IkaPluginException(String string, Exception ex) { + super(string, ex); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/IkaPluginResult.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,27 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public enum IkaPluginResult { + + OK, FAILURE; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/borg/AndroidAssimilator.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,83 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.borg; + +import org.icedrobot.ika.plugins.scm.Repository; +import org.icedrobot.ika.plugins.scm.GITRepository; +import java.io.File; +import java.io.IOException; +import java.util.Properties; +import java.util.concurrent.CyclicBarrier; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.icedrobot.ika.plugins.IkaPluginException; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +class AndroidAssimilator { + + static String ANDROID_REPOS_CONFIGS = + "/org/icedrobot/ika/plugins/borg/repositories.properties"; + + static String ANDROID_SUBREPOS_CONFIGS = + "/org/icedrobot/ika/plugins/borg/subrepositories.properties"; + + static void assimilate(File base) { + + // contains all the remote repositories that we need to create and + // jeopardise + Properties configs = new Properties(); + try { + configs.load(AndroidAssimilator.class. + getResourceAsStream(ANDROID_REPOS_CONFIGS)); + + } catch (IOException ex) { + throw new IkaPluginException("cannot load configurations", ex); + } + + // we spawn as many thread as a repositories to clone + // so all the cloning (and assimilating) operations are + // actually perfomed in parallel per repository + CyclicBarrier barrier = new CyclicBarrier(configs.size() + 1); + for (Object name : configs.keySet()) { + + String[] data = configs.getProperty((String) name).split(","); + Repository repository = new GITRepository((String) name, base, + data[0], data[1], + data[2]); + + ClonerTask task = new ClonerTask(repository, barrier); + Thread thread = new Thread(task, repository.getName()); + thread.setDaemon(true); + thread.start(); + } + + // wait that all task are terinated before returning + try { + barrier.await(); + System.err.println("done!"); + } catch (Throwable ex) { + Logger.getLogger(ClonerTask.class.getName()).log(Level.SEVERE, + ex.getMessage(), ex); + throw new IkaPluginException(ex.getMessage(), ex); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/borg/ClonerTask.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,97 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.borg; + +import org.icedrobot.ika.plugins.scm.Repository; +import org.icedrobot.ika.plugins.scm.HGRepository; +import java.io.File; + +import java.util.Properties; + +import java.util.concurrent.CyclicBarrier; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.icedrobot.ika.plugins.IkaPluginException; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +class ClonerTask implements Runnable { + + private Repository repository; + private CyclicBarrier barrier; + + public ClonerTask(Repository repository, CyclicBarrier barrier) { + + this.repository = repository; + this.barrier = barrier; + } + + @Override + public void run() { + try { + // create the local path first, if it doesn't exist already + // then start populating it with the Android code + System.err.println("create local directory: " + repository); + repository.createRoot(); + + // second, clone the main icedrobot repository + + System.err.println("cloning: " + repository.getRemotePath()); + repository.makeClone(); + + Properties configs = new Properties(); + configs.load(AndroidAssimilator.class.getResourceAsStream( + AndroidAssimilator.ANDROID_SUBREPOS_CONFIGS)); + + String subrepos = configs.getProperty(repository.getName()); + for (String repo : subrepos.split(",")) { + Repository subRepository = + repository.makeSubRepository(repo, repo, "icedrobot"); + + String sep = File.separator; + Repository hgPatchQueue = + new HGRepository(repo, subRepository.getFullPath(), + ".git" + sep + "patches", + repository.getBaseDirectory() + + sep + "icedrobot" + sep + "projects" + + sep + subRepository.getName() + sep + + "patches"); + hgPatchQueue.createRoot(); + hgPatchQueue.makeClone(); + + subRepository.applyPatchQueue(); + } + + // synchronise with other tasks + barrier.await(); + + } catch (Throwable ex) { + + barrier.reset(); + Logger.getLogger(ClonerTask.class.getName()).log(Level.SEVERE, + ex.getMessage(), ex); + throw new IkaPluginException(ex.getMessage(), ex); + } + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/borg/IcedRobotCloner.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,146 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.borg; + +import org.icedrobot.ika.plugins.scm.Repository; +import org.icedrobot.ika.plugins.scm.HGRepository; +import java.io.File; +import java.io.IOException; +import java.util.Properties; + +import joptsimple.OptionParser; +import joptsimple.OptionSet; + +import org.icedrobot.ika.plugins.IkaPlugin; +import org.icedrobot.ika.plugins.IkaPluginException; +import org.icedrobot.ika.plugins.IkaPluginResult; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class IcedRobotCloner implements IkaPlugin { + + static final String ICEDROBOT_REPOS_CONFIGS = + "/org/icedrobot/ika/plugins/borg/icedrobot.properties"; + + @Override + public String getName() { + return "assimilate"; + } + + @Override + public String getDescription() { + return "clone the necessary Android respositories and " + + "assimilate IcedRobot"; + } + + @Override + public IkaPluginResult execute(String[] args) { + + String destinationDir = null; + String icedrobot = null; + if (args != null) { + OptionParser parser = new OptionParser(); + parser.accepts("dest").withRequiredArg(); + parser.accepts("icedrobot").withRequiredArg(); + parser.accepts("help"); + + OptionSet options = parser.parse(args); + if (options.has("help")) { + displayUsage(); + return IkaPluginResult.OK; + } + + if (options.has("dest")) { + destinationDir = (String) options.valueOf("dest"); + } + + if (options.has("icedrobot")) { + icedrobot = (String) options.valueOf("icedrobot"); + } + } + + if (icedrobot == null) { + Properties configs = new Properties(); + try { + configs.load(IcedRobotCloner.class. + getResourceAsStream(ICEDROBOT_REPOS_CONFIGS)); + icedrobot = configs.getProperty("icedrobot"); + + } catch (IOException ex) { + throw new IkaPluginException("cannot determine icedrobot " + + "repository location", ex); + } + } + + if (destinationDir == null) { + displayUsage(); + return IkaPluginResult.FAILURE; + } + + // create first the main source directory + System.out.println("creating main repository container into " + + "directory \"" + destinationDir + "\"..."); + + File repositoryLocation = new File(destinationDir); + if (repositoryLocation.exists()) { + throw new IkaPluginException("destination directory " + + repositoryLocation + + " already existing"); + } + if (!repositoryLocation.mkdir()) { + throw new IkaPluginException("cannot create directory " + + repositoryLocation); + } + + // now clone the icedrobot reposutory + System.out.println("...done... now cloning icedrobot: " + icedrobot); + Repository icedrobotRepository = + new HGRepository("icedrobot", repositoryLocation, "icedrobot", + icedrobot); + icedrobotRepository.createRoot(); + icedrobotRepository.makeClone(); + + // now assimilate! + System.out.println("cloning repositories..."); + AndroidAssimilator.assimilate(repositoryLocation); + + System.out.println("creating main repository container..."); + + System.out.println("resistance is futile, IcedRobot assimilated"); + return IkaPluginResult.OK; + } + + private void displayUsage() { + System.out.println("Usage: ika assimilate --dest=" + + "<destination directory> " + + "--icedrobot=<source repository>"); + System.out.println("\t--dest"); + System.out.println("\t\t\tdirectory where to create the " + + "IcedRobot snapshot"); + System.out.println("\t\t\tThis argument is mandatory."); + System.out.println("\t--icedrobot"); + System.out.println("\t\t\tlocation of the remote repository"); + System.out.println("\t\t\tThis argument is optional, if not given"); + System.out.println("\t\t\tthen the default is retrived from " + + "the configuration files"); + System.out.println("\t--help"); + System.out.println("\t\t\tprint usage information"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/git/IkaGitWrapper.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,95 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package org.icedrobot.ika.plugins.git; + +import java.io.File; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import org.icedrobot.ika.plugins.IkaPlugin; +import org.icedrobot.ika.plugins.IkaPluginResult; +import org.icedrobot.ika.plugins.scm.GITRepository; +import org.icedrobot.ika.plugins.scm.HGRepository; +import org.icedrobot.ika.plugins.scm.Repository; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class IkaGitWrapper implements IkaPlugin { + + @Override + public String getName() { + return "git"; + } + + @Override + public String getDescription() { + return "handles various git tasks for IcedRobot"; + } + + @Override + public IkaPluginResult execute(String[] args) { + + if (args != null) { + OptionParser parser = new OptionParser(); + parser.accepts("makerepo").withRequiredArg(); + + OptionSet options = parser.parse(args); + + if (options.has("makerepo")) { + String destinationDir = (String) options.valueOf("makerepo"); + + File base = new File(destinationDir); + if (!base.exists()) { + System.out.println("desitination directory doesn't exist"); + return IkaPluginResult.FAILURE; + } + + System.err.println("base.getName(): " + base.getName()); + Repository repository = new GITRepository(base.getName(), base, + "", "", "icedrobot"); + repository.create(); + + repository.initPatchQueue(); + + String s = File.separator; + File basePath = new File(repository.getFullPath() + s + + ".git" + s + "patches"); + + Repository hgRepo = new HGRepository(base.getName(), basePath, + "", ""); + hgRepo.create(); + + + return IkaPluginResult.OK; + } + } + displayUsage(); + return IkaPluginResult.OK; + } + + private void displayUsage() { + System.out.println("Usage: ika git --makerepo=" + + "<destination directory>"); + System.out.println("\t--makerepo"); + System.out.println("\t\t\tdirectory where to create the " + + "new git repository"); + System.out.println("\t\t\tThis argument is mandatory."); + System.out.println("\t\t\tThe respository is created with a default"); + System.out.println("\t\t\t\"icedrobot\" branch"); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/help/IkaVersion.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,70 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.help; + +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import org.icedrobot.ika.Ika; +import org.icedrobot.ika.plugins.IkaPlugin; +import org.icedrobot.ika.plugins.IkaPluginResult; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class IkaVersion implements IkaPlugin { + + private static final String VERSION_INFO = + "ika: IcedRobot Kiosk Application version " + Ika.VERSION; + + @Override + public IkaPluginResult execute(String [] args) { + + if (args != null) { + + OptionParser parser = new OptionParser(); + parser.accepts("list-plugins"); + parser.accepts("version"); + + OptionSet options = parser.parse(args); + + if (options.has("list-plugins")) { + for (IkaPlugin plugin : Ika.getInstance().getPlugins().values()) + { + System.out.println(" " + plugin.getName() + ":\n\t\t" + + plugin.getDescription()); + } + System.out.println(""); + } + } + + System.out.println(VERSION_INFO); + + return IkaPluginResult.OK; + } + + @Override + public String getDescription() { + return "display version information and return"; + } + + @Override + public String getName() { + return "version"; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/scm/GITRepository.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,129 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.scm; + +import java.io.File; +import java.io.IOException; +import org.icedrobot.ika.plugins.IkaPluginException; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class GITRepository extends Repository { + + /** + * Creates a new git Repository with the give name as ID, the + * base directory as the location where the clone will be performed, the + * relativePath as the name of the cloned repository, the remotePath as the + * location of the source repository and branch as the version of the + * repository to clone. + */ + public GITRepository(String name, File baseDirectory, String relativePath, + String remotePath, String branch) { + + this.name = name; + this.baseDirectory = baseDirectory; + this.relativePath = relativePath; + this.remotePath = remotePath; + + this.branch = branch; + + String canonicalPath; + try { + canonicalPath = baseDirectory.getCanonicalPath(); + } catch (IOException ex) { + throw new IkaPluginException(ex.getMessage(), ex); + } + + this.fullPath = new File(canonicalPath + File.separator + relativePath); + } + + /** + * + */ + @Override + public void makeClone() { + String command = "git clone -b " + getBranch() + " " + remotePath; + System.err.println(command); + exec(command, getFullPath()); + } + + + /** + * + */ + @Override + public void create() { + + String command = "git init ."; + System.err.println(command); + exec(command, getFullPath()); + + command = "git add --all"; + System.err.println(command); + exec(command, getFullPath()); + + command = "git commit -m initial_repository --verbose"; + System.err.println(command); + exec(command, getFullPath()); + + command = "git branch " + branch; + System.err.println(command); + exec(command, getFullPath()); + + command = "git checkout " + branch; + System.err.println(command); + exec(command, getFullPath()); + + System.err.println(">>>>>>>> done: " + this + " <<<<<<<<"); + } + + /** + * + */ + @Override + public Repository makeSubRepository(String name, String relativePath, + String branch) { + + if (name.equals(".")) { + name = this.getName(); + } + Repository subRepository = + new GITRepository(name, new File(getFullPath() + File.separator + + getName()), + relativePath, null, branch); + subRepository.create(); + return subRepository; + } + + @Override + public void applyPatchQueue() { + String command = "guilt push --all"; + System.err.println(command); + exec(command, getFullPath()); + } + + @Override + public void initPatchQueue() { + + String command = "guilt init"; + System.err.println(command); + exec(command, getFullPath()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/scm/HGRepository.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,99 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.scm; + +import java.io.File; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public class HGRepository extends Repository { + + /** + * Creates a new mercurial forest Repository with the give name as ID, the + * base directory as the location where the clone will be performed, the + * relativePath as the name of the cloned repository, the remotePath as the + * location of the source repository. The Forest extension is needed + * to create the repository. The branch is always HEAD. + */ + public HGRepository(String name, File baseDirectory, + String relativePath, + String remotePath) { + + this.name = name; + this.baseDirectory = baseDirectory; + this.relativePath = relativePath; + this.remotePath = remotePath; + + this.fullPath = new File(baseDirectory.getAbsolutePath() + + File.separator + relativePath); + } + + /** + * + */ + @Override + public void makeClone() { + String command = "hg clone " + remotePath + " " + getFullPath(); + System.err.println(command); + exec(command, getFullPath()); + } + + @Override + public String getBranch() { + // only HEAD is supported + return "HEAD"; + } + + /** + * + */ + @Override + public Repository makeSubRepository(String name, String relativePath, + String branch) { + + throw new UnsupportedOperationException("not supported yet"); + } + + @Override + public void applyPatchQueue() { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void create() { + + String command = "hg init ."; + System.err.println(command); + exec(command, getFullPath()); + + command = "hg add"; + System.err.println(command); + exec(command, getFullPath()); + + command = "hg commit -minitial_repository"; + System.err.println(command); + exec(command, getFullPath()); + } + + @Override + public void initPatchQueue() { + throw new UnsupportedOperationException("Not supported yet."); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/org/icedrobot/ika/plugins/scm/Repository.java Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,133 @@ +/* + * IKA - IcedRobot Kiosk Application + * Copyright (C) 2011 IcedRobot team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.icedrobot.ika.plugins.scm; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.icedrobot.ika.plugins.IkaPluginException; + +/** + * @author Mario Torre <neugens.limasoftware@gmail.com> + */ +public abstract class Repository { + + protected String name; + protected File baseDirectory; + protected File fullPath; + + protected String relativePath; + protected String remotePath; + protected String branch; + + public abstract void create(); + abstract public void initPatchQueue(); + public abstract void applyPatchQueue(); + public abstract void makeClone(); + public abstract Repository makeSubRepository(String name, + String relativePath, + String branch); + + protected static void exec(String command, File path) { + try { + System.err.println("command: " + command + ", path: " + path); + Process process = Runtime.getRuntime().exec(command, null, path); + + InputStream is = process.getInputStream(); + InputStreamReader reader = new InputStreamReader(is); + + BufferedReader br = new BufferedReader(reader); + + String line; + while ((line = br.readLine()) != null) { + System.out.println(line); + } + + } catch (IOException ex) { + Logger.getLogger(Repository.class.getName()). + log(Level.SEVERE, "cannot execute: " + command, ex); + throw new IkaPluginException("cannot execute: " + command, ex); + } + } + + /** + * Create the directory under which this repository will be located if it + * doesn't exist. + */ + public void createRoot() { + getFullPath().mkdir(); + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the baseDirectory + */ + public File getBaseDirectory() { + return baseDirectory; + } + + /** + * @return the fullPath + */ + public File getFullPath() { + try { + return fullPath.getCanonicalFile(); + } catch (IOException ex) { + throw new IkaPluginException(ex.toString(), ex); + } + } + + /** + * @return the relativePath + */ + public String getRelativePath() { + return relativePath; + } + + /** + * @return the remotePath + */ + public String getRemotePath() { + return remotePath; + } + + /** + * @return the branch + */ + public String getBranch() { + return branch; + } + + @Override + public String toString() { + return fullPath.toString(); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/core_plugins.properties Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,4 @@ +# list of core plugins, the keys are the names and the values the class name +version=org.icedrobot.ika.plugins.help.IkaVersion +assimilate=org.icedrobot.ika.plugins.borg.IcedRobotCloner +git=org.icedrobot.ika.plugins.git.IkaGitWrapper
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/org/icedrobot/ika/plugins/borg/icedrobot.properties Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,3 @@ +# defautl location for the icedrobot root repositories +icedrobot=http://icedtea.classpath.org/icedrobot/hg/icedrobot/ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/org/icedrobot/ika/plugins/borg/repositories.properties Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,5 @@ +# list of android repositories +dalvik=.,git://android.git.kernel.org/platform/dalvik.git,android-2.3.2_r1 +core=system,git://android.git.kernel.org/platform/system/core.git,android-2.3.2_r1 +safe-iop=external,git://android.git.kernel.org/platform/external/safe-iop.git,android-2.3.2_r1 +base=frameworks,git://android.git.kernel.org/platform/frameworks/base.git,android-2.3.2_r1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/resources/org/icedrobot/ika/plugins/borg/subrepositories.properties Wed Mar 16 22:47:21 2011 +0100 @@ -0,0 +1,5 @@ +# subrepository configurations +dalvik=vm,libnativehelper,libdex +safe-iop=. +core=libcutils +base=.
--- a/src/org/icedrobot/ika/Ika.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika; - -import org.icedrobot.ika.plugins.IkaPluginException; -import org.icedrobot.ika.plugins.IkaPlugin; - -import java.io.IOException; - -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class Ika { - - public static final String VERSION = "0.1"; - public static final String CORE_PLUGIN_LIST = "/core_plugins.properties"; - - private Map<String, IkaPlugin> plugins = new HashMap<String, IkaPlugin>(); - - private static final Ika theInstance = new Ika(); - public static Ika getInstance() { - return theInstance; - } - - private Ika() { - /* nothing to do */ - } - - /** - * Loads the core plugins list from the internal resource file. - * The plugins are also initialised here, by calling their - * {@link IkaPlugin#initPlugin() } method. - */ - private void loadCorePluginsList() { - - Properties corePlugins = new Properties(); - try { - corePlugins.load(Ika.class.getResourceAsStream(CORE_PLUGIN_LIST)); - - } catch (IOException ex) { - throw new IkaPluginException("cannot load plugin list", ex); - } - - for (String pluginName : corePlugins.stringPropertyNames()) { - // try to load the plugin, ne exception will be thrown - // at this point if the plugin is not found - // the plugins must all be in the classpath - String pluginClass = corePlugins.getProperty(pluginName); - try { - Logger.getLogger(Ika.class.getName()).log(Level.FINEST, - "loading: {0}", pluginClass); - - Class<IkaPlugin> _plugin = - (Class<IkaPlugin>) Class.forName(pluginClass); - IkaPlugin plugin = _plugin.newInstance(); - - plugins.put(pluginName, plugin); - - } catch (InstantiationException ex) { - Logger.getLogger(Ika.class.getName()).log(Level.WARNING, - "cannot instantiate plugin: " + - pluginClass, ex); - - } catch (IllegalAccessException ex) { - Logger.getLogger(Ika.class.getName()).log(Level.WARNING, - "cannot access plugin: " + pluginClass, ex); - - } catch (ClassNotFoundException ex) { - Logger.getLogger(Ika.class.getName()).log(Level.WARNING, - "cannot load plugin: " + pluginClass, ex); - } - } - } - - /** - * Parses the command line and reseach the module to load accordingly - */ - public void parseArgumentAndInvoke(String ... args) { - - loadCorePluginsList(); - - if (args == null || args.length == 0 || - "version".equalsIgnoreCase(args[0]) || - "--version".equalsIgnoreCase(args[0])) - { - // print a short help message and return - plugins.get("version").execute(args); - - } else { - // check if there is a plugin with the name passed as - // argument - IkaPlugin plugin = plugins.get(args[0]); - if (plugin != null) { - plugin.execute(args); - - } else { - System.err.println("No plugins found: " + args[0]); - System.err.println("maybe you mean one of:"); - System.err.println(""); - plugins.get("version").execute(new String[]{"--list-plugins"}); - } - } - } - - public Map<String, IkaPlugin> getPlugins() { - return plugins; - } -}
--- a/src/org/icedrobot/ika/IkaMain.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika; - -/** - * Main launcher for ika. - * - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class IkaMain { - - static public void main(String [] args) { - - Ika.getInstance().parseArgumentAndInvoke(args); - } -}
--- a/src/org/icedrobot/ika/plugins/IkaPlugin.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public interface IkaPlugin { - - public String getName(); - public String getDescription(); - public IkaPluginResult execute(String [] args); -}
--- a/src/org/icedrobot/ika/plugins/IkaPluginException.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins; - - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class IkaPluginException extends RuntimeException { - - public IkaPluginException(String string) { - super(string); - } - - public IkaPluginException(String string, Throwable ex) { - super(string, ex); - } - - public IkaPluginException(String string, Exception ex) { - super(string, ex); - } -}
--- a/src/org/icedrobot/ika/plugins/IkaPluginResult.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public enum IkaPluginResult { - - OK, FAILURE; -}
--- a/src/org/icedrobot/ika/plugins/borg/AndroidAssimilator.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.borg; - -import org.icedrobot.ika.plugins.scm.Repository; -import org.icedrobot.ika.plugins.scm.GITRepository; -import java.io.File; -import java.io.IOException; -import java.util.Properties; -import java.util.concurrent.CyclicBarrier; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.icedrobot.ika.plugins.IkaPluginException; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -class AndroidAssimilator { - - static String ANDROID_REPOS_CONFIGS = - "/org/icedrobot/ika/plugins/borg/repositories.properties"; - - static String ANDROID_SUBREPOS_CONFIGS = - "/org/icedrobot/ika/plugins/borg/subrepositories.properties"; - - static void assimilate(File base) { - - // contains all the remote repositories that we need to create and - // jeopardise - Properties configs = new Properties(); - try { - configs.load(AndroidAssimilator.class. - getResourceAsStream(ANDROID_REPOS_CONFIGS)); - - } catch (IOException ex) { - throw new IkaPluginException("cannot load configurations", ex); - } - - // we spawn as many thread as a repositories to clone - // so all the cloning (and assimilating) operations are - // actually perfomed in parallel per repository - CyclicBarrier barrier = new CyclicBarrier(configs.size() + 1); - for (Object name : configs.keySet()) { - - String[] data = configs.getProperty((String) name).split(","); - Repository repository = new GITRepository((String) name, base, - data[0], data[1], - data[2]); - - ClonerTask task = new ClonerTask(repository, barrier); - Thread thread = new Thread(task, repository.getName()); - thread.setDaemon(true); - thread.start(); - } - - // wait that all task are terinated before returning - try { - barrier.await(); - System.err.println("done!"); - } catch (Throwable ex) { - Logger.getLogger(ClonerTask.class.getName()).log(Level.SEVERE, - ex.getMessage(), ex); - throw new IkaPluginException(ex.getMessage(), ex); - } - } -}
--- a/src/org/icedrobot/ika/plugins/borg/ClonerTask.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,97 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.borg; - -import org.icedrobot.ika.plugins.scm.Repository; -import org.icedrobot.ika.plugins.scm.HGRepository; -import java.io.File; - -import java.util.Properties; - -import java.util.concurrent.CyclicBarrier; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.icedrobot.ika.plugins.IkaPluginException; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -class ClonerTask implements Runnable { - - private Repository repository; - private CyclicBarrier barrier; - - public ClonerTask(Repository repository, CyclicBarrier barrier) { - - this.repository = repository; - this.barrier = barrier; - } - - @Override - public void run() { - try { - // create the local path first, if it doesn't exist already - // then start populating it with the Android code - System.err.println("create local directory: " + repository); - repository.createRoot(); - - // second, clone the main icedrobot repository - - System.err.println("cloning: " + repository.getRemotePath()); - repository.makeClone(); - - Properties configs = new Properties(); - configs.load(AndroidAssimilator.class.getResourceAsStream( - AndroidAssimilator.ANDROID_SUBREPOS_CONFIGS)); - - String subrepos = configs.getProperty(repository.getName()); - for (String repo : subrepos.split(",")) { - Repository subRepository = - repository.makeSubRepository(repo, repo, "icedrobot"); - - String sep = File.separator; - Repository hgPatchQueue = - new HGRepository(repo, subRepository.getFullPath(), - ".git" + sep + "patches", - repository.getBaseDirectory() + - sep + "icedrobot" + sep + "projects" + - sep + subRepository.getName() + sep + - "patches"); - hgPatchQueue.createRoot(); - hgPatchQueue.makeClone(); - - subRepository.applyPatchQueue(); - } - - // synchronise with other tasks - barrier.await(); - - } catch (Throwable ex) { - - barrier.reset(); - Logger.getLogger(ClonerTask.class.getName()).log(Level.SEVERE, - ex.getMessage(), ex); - throw new IkaPluginException(ex.getMessage(), ex); - } - } - - -}
--- a/src/org/icedrobot/ika/plugins/borg/IcedRobotCloner.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,146 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.borg; - -import org.icedrobot.ika.plugins.scm.Repository; -import org.icedrobot.ika.plugins.scm.HGRepository; -import java.io.File; -import java.io.IOException; -import java.util.Properties; - -import joptsimple.OptionParser; -import joptsimple.OptionSet; - -import org.icedrobot.ika.plugins.IkaPlugin; -import org.icedrobot.ika.plugins.IkaPluginException; -import org.icedrobot.ika.plugins.IkaPluginResult; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class IcedRobotCloner implements IkaPlugin { - - static final String ICEDROBOT_REPOS_CONFIGS = - "/org/icedrobot/ika/plugins/borg/icedrobot.properties"; - - @Override - public String getName() { - return "assimilate"; - } - - @Override - public String getDescription() { - return "clone the necessary Android respositories and " + - "assimilate IcedRobot"; - } - - @Override - public IkaPluginResult execute(String[] args) { - - String destinationDir = null; - String icedrobot = null; - if (args != null) { - OptionParser parser = new OptionParser(); - parser.accepts("dest").withRequiredArg(); - parser.accepts("icedrobot").withRequiredArg(); - parser.accepts("help"); - - OptionSet options = parser.parse(args); - if (options.has("help")) { - displayUsage(); - return IkaPluginResult.OK; - } - - if (options.has("dest")) { - destinationDir = (String) options.valueOf("dest"); - } - - if (options.has("icedrobot")) { - icedrobot = (String) options.valueOf("icedrobot"); - } - } - - if (icedrobot == null) { - Properties configs = new Properties(); - try { - configs.load(IcedRobotCloner.class. - getResourceAsStream(ICEDROBOT_REPOS_CONFIGS)); - icedrobot = configs.getProperty("icedrobot"); - - } catch (IOException ex) { - throw new IkaPluginException("cannot determine icedrobot " + - "repository location", ex); - } - } - - if (destinationDir == null) { - displayUsage(); - return IkaPluginResult.FAILURE; - } - - // create first the main source directory - System.out.println("creating main repository container into " + - "directory \"" + destinationDir + "\"..."); - - File repositoryLocation = new File(destinationDir); - if (repositoryLocation.exists()) { - throw new IkaPluginException("destination directory " + - repositoryLocation + - " already existing"); - } - if (!repositoryLocation.mkdir()) { - throw new IkaPluginException("cannot create directory " + - repositoryLocation); - } - - // now clone the icedrobot reposutory - System.out.println("...done... now cloning icedrobot: " + icedrobot); - Repository icedrobotRepository = - new HGRepository("icedrobot", repositoryLocation, "icedrobot", - icedrobot); - icedrobotRepository.createRoot(); - icedrobotRepository.makeClone(); - - // now assimilate! - System.out.println("cloning repositories..."); - AndroidAssimilator.assimilate(repositoryLocation); - - System.out.println("creating main repository container..."); - - System.out.println("resistance is futile, IcedRobot assimilated"); - return IkaPluginResult.OK; - } - - private void displayUsage() { - System.out.println("Usage: ika assimilate --dest=" + - "<destination directory> " + - "--icedrobot=<source repository>"); - System.out.println("\t--dest"); - System.out.println("\t\t\tdirectory where to create the " + - "IcedRobot snapshot"); - System.out.println("\t\t\tThis argument is mandatory."); - System.out.println("\t--icedrobot"); - System.out.println("\t\t\tlocation of the remote repository"); - System.out.println("\t\t\tThis argument is optional, if not given"); - System.out.println("\t\t\tthen the default is retrived from " + - "the configuration files"); - System.out.println("\t--help"); - System.out.println("\t\t\tprint usage information"); - } -}
--- a/src/org/icedrobot/ika/plugins/git/IkaGitWrapper.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -package org.icedrobot.ika.plugins.git; - -import java.io.File; -import joptsimple.OptionParser; -import joptsimple.OptionSet; -import org.icedrobot.ika.plugins.IkaPlugin; -import org.icedrobot.ika.plugins.IkaPluginResult; -import org.icedrobot.ika.plugins.scm.GITRepository; -import org.icedrobot.ika.plugins.scm.HGRepository; -import org.icedrobot.ika.plugins.scm.Repository; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class IkaGitWrapper implements IkaPlugin { - - @Override - public String getName() { - return "git"; - } - - @Override - public String getDescription() { - return "handles various git tasks for IcedRobot"; - } - - @Override - public IkaPluginResult execute(String[] args) { - - if (args != null) { - OptionParser parser = new OptionParser(); - parser.accepts("makerepo").withRequiredArg(); - - OptionSet options = parser.parse(args); - - if (options.has("makerepo")) { - String destinationDir = (String) options.valueOf("makerepo"); - - File base = new File(destinationDir); - if (!base.exists()) { - System.out.println("desitination directory doesn't exist"); - return IkaPluginResult.FAILURE; - } - - System.err.println("base.getName(): " + base.getName()); - Repository repository = new GITRepository(base.getName(), base, - "", "", "icedrobot"); - repository.create(); - - repository.initPatchQueue(); - - String s = File.separator; - File basePath = new File(repository.getFullPath() + s + - ".git" + s + "patches"); - - Repository hgRepo = new HGRepository(base.getName(), basePath, - "", ""); - hgRepo.create(); - - - return IkaPluginResult.OK; - } - } - displayUsage(); - return IkaPluginResult.OK; - } - - private void displayUsage() { - System.out.println("Usage: ika git --makerepo=" + - "<destination directory>"); - System.out.println("\t--makerepo"); - System.out.println("\t\t\tdirectory where to create the " + - "new git repository"); - System.out.println("\t\t\tThis argument is mandatory."); - System.out.println("\t\t\tThe respository is created with a default"); - System.out.println("\t\t\t\"icedrobot\" branch"); - } -}
--- a/src/org/icedrobot/ika/plugins/help/IkaVersion.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.help; - -import joptsimple.OptionParser; -import joptsimple.OptionSet; -import org.icedrobot.ika.Ika; -import org.icedrobot.ika.plugins.IkaPlugin; -import org.icedrobot.ika.plugins.IkaPluginResult; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class IkaVersion implements IkaPlugin { - - private static final String VERSION_INFO = - "ika: IcedRobot Kiosk Application version " + Ika.VERSION; - - @Override - public IkaPluginResult execute(String [] args) { - - if (args != null) { - - OptionParser parser = new OptionParser(); - parser.accepts("list-plugins"); - parser.accepts("version"); - - OptionSet options = parser.parse(args); - - if (options.has("list-plugins")) { - for (IkaPlugin plugin : Ika.getInstance().getPlugins().values()) - { - System.out.println(" " + plugin.getName() + ":\n\t\t" + - plugin.getDescription()); - } - System.out.println(""); - } - } - - System.out.println(VERSION_INFO); - - return IkaPluginResult.OK; - } - - @Override - public String getDescription() { - return "display version information and return"; - } - - @Override - public String getName() { - return "version"; - } -}
--- a/src/org/icedrobot/ika/plugins/scm/GITRepository.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.scm; - -import java.io.File; -import java.io.IOException; -import org.icedrobot.ika.plugins.IkaPluginException; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class GITRepository extends Repository { - - /** - * Creates a new git Repository with the give name as ID, the - * base directory as the location where the clone will be performed, the - * relativePath as the name of the cloned repository, the remotePath as the - * location of the source repository and branch as the version of the - * repository to clone. - */ - public GITRepository(String name, File baseDirectory, String relativePath, - String remotePath, String branch) { - - this.name = name; - this.baseDirectory = baseDirectory; - this.relativePath = relativePath; - this.remotePath = remotePath; - - this.branch = branch; - - String canonicalPath; - try { - canonicalPath = baseDirectory.getCanonicalPath(); - } catch (IOException ex) { - throw new IkaPluginException(ex.getMessage(), ex); - } - - this.fullPath = new File(canonicalPath + File.separator + relativePath); - } - - /** - * - */ - @Override - public void makeClone() { - String command = "git clone -b " + getBranch() + " " + remotePath; - System.err.println(command); - exec(command, getFullPath()); - } - - - /** - * - */ - @Override - public void create() { - - String command = "git init ."; - System.err.println(command); - exec(command, getFullPath()); - - command = "git add --all"; - System.err.println(command); - exec(command, getFullPath()); - - command = "git commit -m initial_repository --verbose"; - System.err.println(command); - exec(command, getFullPath()); - - command = "git branch " + branch; - System.err.println(command); - exec(command, getFullPath()); - - command = "git checkout " + branch; - System.err.println(command); - exec(command, getFullPath()); - - System.err.println(">>>>>>>> done: " + this + " <<<<<<<<"); - } - - /** - * - */ - @Override - public Repository makeSubRepository(String name, String relativePath, - String branch) { - - if (name.equals(".")) { - name = this.getName(); - } - Repository subRepository = - new GITRepository(name, new File(getFullPath() + File.separator + - getName()), - relativePath, null, branch); - subRepository.create(); - return subRepository; - } - - @Override - public void applyPatchQueue() { - String command = "guilt push --all"; - System.err.println(command); - exec(command, getFullPath()); - } - - @Override - public void initPatchQueue() { - - String command = "guilt init"; - System.err.println(command); - exec(command, getFullPath()); - } -}
--- a/src/org/icedrobot/ika/plugins/scm/HGRepository.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.scm; - -import java.io.File; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public class HGRepository extends Repository { - - /** - * Creates a new mercurial forest Repository with the give name as ID, the - * base directory as the location where the clone will be performed, the - * relativePath as the name of the cloned repository, the remotePath as the - * location of the source repository. The Forest extension is needed - * to create the repository. The branch is always HEAD. - */ - public HGRepository(String name, File baseDirectory, - String relativePath, - String remotePath) { - - this.name = name; - this.baseDirectory = baseDirectory; - this.relativePath = relativePath; - this.remotePath = remotePath; - - this.fullPath = new File(baseDirectory.getAbsolutePath() + - File.separator + relativePath); - } - - /** - * - */ - @Override - public void makeClone() { - String command = "hg clone " + remotePath + " " + getFullPath(); - System.err.println(command); - exec(command, getFullPath()); - } - - @Override - public String getBranch() { - // only HEAD is supported - return "HEAD"; - } - - /** - * - */ - @Override - public Repository makeSubRepository(String name, String relativePath, - String branch) { - - throw new UnsupportedOperationException("not supported yet"); - } - - @Override - public void applyPatchQueue() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void create() { - - String command = "hg init ."; - System.err.println(command); - exec(command, getFullPath()); - - command = "hg add"; - System.err.println(command); - exec(command, getFullPath()); - - command = "hg commit -minitial_repository"; - System.err.println(command); - exec(command, getFullPath()); - } - - @Override - public void initPatchQueue() { - throw new UnsupportedOperationException("Not supported yet."); - } -}
--- a/src/org/icedrobot/ika/plugins/scm/Repository.java Tue Mar 15 00:13:34 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* - * IKA - IcedRobot Kiosk Application - * Copyright (C) 2011 IcedRobot team - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.icedrobot.ika.plugins.scm; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.icedrobot.ika.plugins.IkaPluginException; - -/** - * @author Mario Torre <neugens.limasoftware@gmail.com> - */ -public abstract class Repository { - - protected String name; - protected File baseDirectory; - protected File fullPath; - - protected String relativePath; - protected String remotePath; - protected String branch; - - public abstract void create(); - abstract public void initPatchQueue(); - public abstract void applyPatchQueue(); - public abstract void makeClone(); - public abstract Repository makeSubRepository(String name, - String relativePath, - String branch); - - protected static void exec(String command, File path) { - try { - System.err.println("command: " + command + ", path: " + path); - Process process = Runtime.getRuntime().exec(command, null, path); - - InputStream is = process.getInputStream(); - InputStreamReader reader = new InputStreamReader(is); - - BufferedReader br = new BufferedReader(reader); - - String line; - while ((line = br.readLine()) != null) { - System.out.println(line); - } - - } catch (IOException ex) { - Logger.getLogger(Repository.class.getName()). - log(Level.SEVERE, "cannot execute: " + command, ex); - throw new IkaPluginException("cannot execute: " + command, ex); - } - } - - /** - * Create the directory under which this repository will be located if it - * doesn't exist. - */ - public void createRoot() { - getFullPath().mkdir(); - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the baseDirectory - */ - public File getBaseDirectory() { - return baseDirectory; - } - - /** - * @return the fullPath - */ - public File getFullPath() { - try { - return fullPath.getCanonicalFile(); - } catch (IOException ex) { - throw new IkaPluginException(ex.toString(), ex); - } - } - - /** - * @return the relativePath - */ - public String getRelativePath() { - return relativePath; - } - - /** - * @return the remotePath - */ - public String getRemotePath() { - return remotePath; - } - - /** - * @return the branch - */ - public String getBranch() { - return branch; - } - - @Override - public String toString() { - return fullPath.toString(); - } -}