Changeset b963e2a


Ignore:
Timestamp:
Jan 10, 2011 6:41:39 AM (9 years ago)
Author:
mathiasdm <mathiasdm@…>
Branches:
master
Children:
5371481
Parents:
6cfb2ba (diff), 7710b22 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

propagate from branch 'i2p.i2p' (head 1b82a3bfd792b71321bcbd8f3b8344664db2dc45)

to branch 'i2p.i2p.mathiasdm.desktopgui' (head 4e485a19a83a3e30425e1b1a03836f35fa4ebb50)

Files:
15 added
49 deleted
5 edited
4 moved

Legend:

Unmodified
Added
Removed
  • apps/desktopgui/build.xml

    r6cfb2ba rb963e2a  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <!-- You may freely edit this file. See commented blocks below for -->
    3 <!-- some examples of how to customize the build. -->
    4 <!-- (If you delete it and reopen the project it will be recreated.) -->
    5 <!-- By default, only the Clean and Build commands use this build script. -->
    6 <!-- Commands such as Run, Debug, and Test only use this build script if -->
    7 <!-- the Compile on Save feature is turned off for the project. -->
    8 <!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
    9 <!-- in the project's Project Properties dialog box.-->
    10 <project name="desktopgui" default="default" basedir=".">
    11     <description>Builds, tests, and runs the project desktopgui.</description>
    12     <import file="nbproject/build-impl.xml"/>
    13     <!--
     2<project basedir="." default="all" name="desktopgui">
    143
    15     There exist several targets which are by default empty and which can be
    16     used for execution of your tasks. These targets are usually executed
    17     before and after some main targets. They are:
     4        <property name="src" value="src"/>
     5        <property name="build" value="build"/>
     6        <property name="dist"  location="dist"/>
     7        <property name="jar" value="desktopgui.jar"/>
     8        <property name="resources" value="resources"/>
     9    <property name="javadoc" value="javadoc"/>
    1810
    19       -pre-init:                 called before initialization of project properties
    20       -post-init:                called after initialization of project properties
    21       -pre-compile:              called before javac compilation
    22       -post-compile:             called after javac compilation
    23       -pre-compile-single:       called before javac compilation of single file
    24       -post-compile-single:      called after javac compilation of single file
    25       -pre-compile-test:         called before javac compilation of JUnit tests
    26       -post-compile-test:        called after javac compilation of JUnit tests
    27       -pre-compile-test-single:  called before javac compilation of single JUnit test
    28       -post-compile-test-single: called after javac compilation of single JUunit test
    29       -pre-jar:                  called before JAR building
    30       -post-jar:                 called after JAR building
    31       -post-clean:               called after cleaning build products
     11        <property name="javac.compilerargs" value=""/>
    3212
    33     (Targets beginning with '-' are not intended to be called on their own.)
     13        <target name="init">
     14                <mkdir dir="${build}"/>
     15        <mkdir dir="${build}/${resources}"/>
     16        <mkdir dir="${build}/${javadoc}"/>
     17                <mkdir dir="${dist}"/>
     18        </target>
    3419
    35     Example of inserting an obfuscator after compilation could look like this:
     20        <target name="clean">
     21                <delete dir="${build}"/>
     22                <delete dir="${dist}"/>
     23        </target>
    3624
    37         <target name="-post-compile">
    38             <obfuscate>
    39                 <fileset dir="${build.classes.dir}"/>
    40             </obfuscate>
    41         </target>
     25        <target name="compile" depends="init">
     26                <javac debug="true" deprecation="on" source="1.5" target="1.5"
     27                       srcdir="${src}" destdir="${build}">
     28            <compilerarg line="${javac.compilerargs}" />
     29            <classpath>
     30                <pathelement location="../../core/java/build/i2p.jar" />
     31                <!-- doesn't matter if we're not on win32, we just need the java classes, not the platform-dependent code -->
     32                <pathelement location="../../installer/lib/wrapper/win32/wrapper.jar" />
     33                <pathelement location="../../router/java/build/router.jar" />
     34            </classpath>
     35                </javac>
     36        <copy todir="${build}/desktopgui/${resources}">
     37            <fileset dir="${resources}" />
     38        </copy>
     39        </target>
    4240
    43     For list of available properties check the imported
    44     nbproject/build-impl.xml file.
     41        <target name="jar" depends="compile">
     42        <exec executable="sh" osfamily="unix" failifexecutionfails="true" >
     43            <arg value="./bundle-messages.sh" />
     44        </exec>
     45        <exec executable="sh" osfamily="mac" failifexecutionfails="true" >
     46            <arg value="./bundle-messages.sh" />
     47        </exec>
    4548
     49                <jar basedir="${build}" destfile="${dist}/${jar}">
     50                        <manifest>
     51                                <attribute name="Main-Class" value="net.i2p.desktopgui.Main"/>
     52                        </manifest>
     53                </jar>
     54        </target>
    4655
    47     Another way to customize the build is by overriding existing main targets.
    48     The targets of interest are:
    49 
    50       -init-macrodef-javac:     defines macro for javac compilation
    51       -init-macrodef-junit:     defines macro for junit execution
    52       -init-macrodef-debug:     defines macro for class debugging
    53       -init-macrodef-java:      defines macro for class execution
    54       -do-jar-with-manifest:    JAR building (if you are using a manifest)
    55       -do-jar-without-manifest: JAR building (if you are not using a manifest)
    56       run:                      execution of project
    57       -javadoc-build:           Javadoc generation
    58       test-report:              JUnit report generation
    59 
    60     An example of overriding the target for project execution could look like this:
    61 
    62         <target name="run" depends="BOB-impl.jar">
    63             <exec dir="bin" executable="launcher.exe">
    64                 <arg file="${dist.jar}"/>
    65             </exec>
    66         </target>
    67 
    68     Notice that the overridden target depends on the jar target and not only on
    69     the compile target as the regular run target does. Again, for a list of available
    70     properties which you can use, check the target you are overriding in the
    71     nbproject/build-impl.xml file.
    72 
    73     -->
    74     <property name="build_src" location="src"/>
    75     <property name="build_bin" location="bin"/>
    76     <property name="build_dist" location="dist"/>
    77     <property name="build_lib" location="lib"/>
    78     <property name="build_i2pref" location="../../build"/>
    79     <property name="build_routerconsole" location="../routerconsole/java/build/"/>
    80     <property name="build_i2ptunnel" location="../i2ptunnel/java/build/"/>
    81        
    82     <path id="build_classpath">
    83         <fileset dir="${build_lib}" includes="**/*.jar"/>
    84         <fileset dir="${build_i2pref}" includes="**/*.jar"/>
    85         <fileset dir="${build_routerconsole}" includes="**/*.jar"/>
    86         <fileset dir="${build_i2ptunnel}" includes="**/*.jar"/>
    87     </path>
    88     <target name="build_init">
    89         <!-- Create the time stamp -->
    90         <tstamp/>
    91             <mkdir dir="${build_dist}"/>
    92             <mkdir dir="${build_bin}"/>
    93     </target>
    94     <target name="build_compile" depends="build_init"
    95         description="compile the source " >
    96         <!-- Compile the java code from ${src} into ${bin} -->
    97         <javac srcdir="${build_src}" destdir="${build_bin}"  classpathref="build_classpath"/>
    98             <copy todir="${build_bin}">
    99                 <fileset dir="${build_src}">
    100                         <exclude name="**/*.java"/>
    101                 </fileset>
    102             </copy>
    103     </target>
    104     <target name="build_jar" depends="build_compile"
    105         description="generate the distribution" >
    106         <!-- Create the distribution directory -->
    107         <mkdir dir="${build_dist}/lib"/>
    108 
    109         <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    110         <zip destfile="${build_dist}/desktopgui.jar" basedir="${build_bin}" />
     56    <target name="javadoc">
     57        <mkdir dir="${build}" />
     58        <mkdir dir="${build}/${javadoc}" />
     59        <javadoc
     60            sourcepath="${src}" destdir="${build}/${javadoc}"
     61            packagenames="*"
     62            use="true"
     63            splitindex="true"
     64            windowtitle="Desktopgui">
     65            <classpath>
     66                <pathelement location="../../router/java/build/router.jar" />
     67                <pathelement location="../../core/java/build/i2p.jar" />
     68            </classpath>
     69        </javadoc>
    11170    </target>
    11271
    113     <target name="build_clean"
    114         description="clean up" >
    115         <!-- Delete the ${build} and ${dist} directory trees -->
    116         <delete dir="${build_bin}"/>
    117         <delete dir="${build_dist}"/>
     72    <target name="poupdate">
     73        <exec executable="sh" osfamily="unix" failifexecutionfails="true" >
     74            <arg value="./bundle-messages.sh" />
     75            <arg value="-p" />
     76        </exec>
     77        <exec executable="sh" osfamily="mac" failifexecutionfails="true" >
     78            <arg value="./bundle-messages.sh" />
     79            <arg value="-p" />
     80        </exec>
    11881    </target>
     82
     83        <target name="dist" depends="jar" />   
     84        <target name="all" depends="jar" />
    11985</project>
     86
  • apps/routerconsole/java/src/net/i2p/router/web/ContentHelper.java

    r6cfb2ba rb963e2a  
    1919        _startAtBeginning = Boolean.valueOf(""+moo).booleanValue();
    2020    }
    21     public void setLang(String l) { _lang = l; }
     21    public void setLang(String l) {
     22        if((_lang == null || !_lang.equals(l)) && (l != null)) {
     23            //Set language for router console
     24            _lang = l;
     25
     26            if(_context == null) {
     27                setContextId(null);
     28            }
     29
     30            //Set language persistently throughout I2P
     31            _context.router().setConfigSetting(Messages.PROP_LANG, _lang);
     32            _context.router().saveConfig();
     33            _context.setProperty(Messages.PROP_LANG, _lang);
     34        }
     35    }
    2236   
    2337    public void setMaxLines(String lines) {
  • build.xml

    r6cfb2ba rb963e2a  
    3333        <echo message="  distclean: clean up all derived files" />
    3434        <echo message="  syndie:    generate a standalone syndie install" />
     35        <echo message="  desktopgui: generate a standalone desktopgui install" />
    3536        <echo message="  i2psnark:  generate a standalone i2psnark install" />
    3637        <echo message="  justBOB:  generate a standalone BOB-one.jar" />
     
    4142        <echo message="          (libc6-i686 and libc6-amd64 required, ant>=1.8 required)" />
    4243        <echo message="  debianrepo: build a Debian repository (reprepro required)" />
    43         <echo message="  updaterWithDesktopgui: tar the built files and desktopgui in an i2pupdate.zip" />
    44         <echo message="  pkgWithDesktopgui: distclean then package everything up with the desktopgui" />
    45         <echo message="  distWithDesktopgui: pkgWithDesktopgui and javadoc" />
    46         <echo message="  distcleanWithDesktopgui: clean up all derived files (including desktopgui files)" />
    4744        <echo message="  poupdate: update the .po files for translators" />
    4845    </target>
     
    737734                <ant dir="router/java/" target="fullclovertest" />
    738735    </target>
     736    <target name="desktopgui" depends="builddepSmall">
     737        <ant dir="apps/desktopgui" target="jar" />
     738        <copy file="apps/desktopgui/dist/desktopgui.jar" todir="." />
     739    </target>
    739740    <target name="syndie" >
    740741        <ant dir="apps/syndie/java/" target="standalone" />
     
    790791        <echo message="Findbugs output stored in i2p.fba" />
    791792        <echo message="Now run: findbugs i2p.fba" />
    792     </target>
    793     <target name="buildWithDesktopgui" depends="buildrouter,builddepSmall">
    794         <ant dir="apps/desktopgui" target="build_jar" />
    795     </target>
    796     <target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
    797         <copy file="apps/desktopgui/dist/desktopgui.jar" todir="pkg-temp/lib/" />
    798         <copy file="apps/desktopgui/lib/swing-worker.jar" todir="pkg-temp/lib/" />
    799         <copy file="apps/desktopgui/lib/appframework.jar" todir="pkg-temp/lib/" />
    800         <mkdir dir="pkg-temp/desktopgui/resources/" />
    801         <copy todir="pkg-temp/desktopgui/resources/">
    802             <fileset dir="apps/desktopgui/desktopgui/resources/" />
    803         </copy>
    804     </target>
    805     <target name="installerWithDesktopgui" depends="preppkgWithDesktopgui,installer" />
    806     <target name="prepupdateWithDesktopgui" depends="buildWithDesktopgui,prepupdate">
    807         <copy file="apps/desktopgui/dist/desktopgui.jar" todir="pkg-temp/lib/" />
    808         <copy file="apps/desktopgui/lib/swing-worker.jar" todir="pkg-temp/lib/" />
    809         <copy file="apps/desktopgui/lib/appframework.jar" todir="pkg-temp/lib/" />
    810         <mkdir dir="pkg-temp/desktopgui/resources/" />
    811         <copy todir="pkg-temp/desktopgui/resources/">
    812             <fileset dir="apps/desktopgui/desktopgui/resources/" />
    813         </copy>
    814     </target>
    815     <target name="updaterWithDesktopgui" depends="prepupdateWithDesktopgui,updater" />
    816     <target name="pkgWithDesktopgui" depends="distclean, updaterWithDesktopgui, installerWithDesktopgui, preppkg" />
    817     <target name="distWithDesktopgui" depends="pkgWithDesktopgui, javadoc" />
    818     <target name="distcleanWithDesktopgui" depends="distclean">
    819         <ant dir="apps/desktopgui" target="build_clean" />
    820793    </target>
    821794
  • core/java/src/net/i2p/I2PAppContext.java

    r6cfb2ba rb963e2a  
    3131import net.i2p.util.FileUtil;
    3232import net.i2p.util.FortunaRandomSource;
     33import net.i2p.util.I2PProperties;
    3334import net.i2p.util.KeyRing;
    3435import net.i2p.util.LogManager;
     
    3637import net.i2p.util.RandomSource;
    3738import net.i2p.util.SecureDirectory;
     39import net.i2p.util.I2PProperties.I2PPropertyCallback;
    3840
    3941/**
     
    6668    protected static I2PAppContext _globalAppContext;
    6769   
    68     private Properties _overrideProps;
     70    protected I2PProperties _overrideProps;
    6971   
    7072    private StatManager _statManager;
     
    169171            }
    170172        }
    171         _overrideProps = envProps;
     173        _overrideProps = new I2PProperties(envProps);
    172174        _statManager = null;
    173175        _sessionKeyManager = null;
     
    485487   
    486488    /**
     489     * Add a callback, which will fire upon changes in the property
     490     * given in the specific callback.
     491     * Unimplemented in I2PAppContext: this only makes sense in a router context.
     492     * @param callback The implementation of the callback.
     493     */
     494    public void addPropertyCallback(I2PPropertyCallback callback) {}
     495   
     496    /**
    487497     * The statistics component with which we can track various events
    488498     * over time.
  • router/java/src/net/i2p/router/RouterContext.java

    r6cfb2ba rb963e2a  
    2525import net.i2p.util.Clock;
    2626import net.i2p.util.KeyRing;
     27import net.i2p.util.I2PProperties.I2PPropertyCallback;
    2728
    2829/**
     
    106107        return envProps;
    107108    }
     109   
     110    /**
     111     * Modify the configuration attributes of this context, changing
     112     * one of the properties provided during the context construction.
     113     * @param propName The name of the property.
     114     * @param value The new value for the property.
     115     */
     116    public void setProperty(String propName, String value) {
     117        if(_overrideProps != null) {
     118                _overrideProps.setProperty(propName, value);
     119        }
     120    }
     121
     122   
     123    public void addPropertyCallback(I2PPropertyCallback callback) {
     124        _overrideProps.addCallBack(callback);
     125    }
     126
    108127
    109128    public void initAll() {
Note: See TracChangeset for help on using the changeset viewer.