mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
MAC build is now done manually - no more jarbundler task
git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@206 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
1b428b1074
commit
068674408b
24
build.xml
24
build.xml
@ -23,14 +23,13 @@
|
||||
<taskdef resource="emma_ant.properties" classpathref="emma.lib"/>
|
||||
|
||||
<taskdef name="obfuscate" classname="COM.rl.ant.RetroGuardTask" classpath="${ext}/retroguard/retroguard.jar"/>
|
||||
<taskdef name="mac-jarbundler" classname="net.sourceforge.jarbundler.JarBundler" classpath="${ext}/mac-jarbundler/jarbundler.jar"/>
|
||||
|
||||
<patternset id="classpath.resources">
|
||||
<exclude name="**/*.java"/>
|
||||
</patternset>
|
||||
|
||||
<target name="all" depends="cleanup,compile,package,cleanup_end"/>
|
||||
<!-- <target name="all" depends="cleanup,compile,compile-tests,do-test,package,cleanup_end"/>-->
|
||||
<!--<target name="all" depends="cleanup,compile,compile-tests,do-test,package,cleanup_end"/>-->
|
||||
|
||||
<target name="cleanup">
|
||||
<delete dir="${bin}"/>
|
||||
@ -236,16 +235,25 @@
|
||||
<target name="package-mac">
|
||||
<package-for platform="mac" librocksaw="todo-librocksaw.jnilib"/>
|
||||
<!-- TODO: mac icon -->
|
||||
<mac-jarbundler dir="${dist}.mac" name="${name}"
|
||||
mainclass="${main.class}" jar="${dist}.mac/${ant.project.name}-mac-${version}.jar" jvmversion="1.5+"
|
||||
version="${version}" vmoptions="-XstartOnFirstThread -Xdock:name='Angry IP Scanner'"
|
||||
bundleid="net.azib.ipscan" build="${build.number}"
|
||||
stubfile="${ext}/mac-jarbundler/ipscan"/>
|
||||
<delete file="${dist}.mac/${name}.app/Contents/MacOS/ipscan"/>
|
||||
<copy todir="${dist}.mac">
|
||||
<fileset dir="${ext}/mac-bundle"/>
|
||||
</copy>
|
||||
|
||||
<copy file="${dist}.mac/${ant.project.name}-mac-${version}.jar" todir="${dist}.mac/${name}.app/Contents/Resources/Java"/>
|
||||
|
||||
<exec executable="ln">
|
||||
<arg line="-s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub"/>
|
||||
<arg value="${dist}.mac/${name}.app/Contents/MacOS/ipscan"/>
|
||||
</exec>
|
||||
|
||||
<replace file="${dist}.mac/${name}.app/Contents/Info.plist">
|
||||
<replacefilter token="APPNAME" value="${name}"/>
|
||||
<replacefilter token="VERSION" value="${version}"/>
|
||||
<replacefilter token="BUILD" value="${build.number}"/>
|
||||
<replacefilter token="JARFILE" value="${ant.project.name}-mac-${version}.jar"/>
|
||||
<replacefilter token="MAINCLASS" value="${main.class}"/>
|
||||
</replace>
|
||||
|
||||
<!-- this will preserve symlinks (that zip task cannot do) -->
|
||||
<exec executable="zip" dir="${dist}.mac">
|
||||
<arg value="-ry9"/>
|
||||
|
||||
57
ext/mac-bundle/Angry IP Scanner.app/Contents/Info.plist
Normal file
57
ext/mac-bundle/Angry IP Scanner.app/Contents/Info.plist
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>APPNAME</string>
|
||||
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>VERSION</string>
|
||||
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>VERSION</string>
|
||||
|
||||
<key>CFBundleAllowMixedLocalizations</key>
|
||||
<string>false</string>
|
||||
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>ipscan</string>
|
||||
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
|
||||
<key>CFBundleVersion</key>
|
||||
<string>BUILD</string>
|
||||
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.azib.ipscan</string>
|
||||
|
||||
<key>Java</key>
|
||||
<dict>
|
||||
<key>MainClass</key>
|
||||
<string>MAINCLASS</string>
|
||||
|
||||
<key>JVMVersion</key>
|
||||
<string>1.5+</string>
|
||||
|
||||
<key>ClassPath</key>
|
||||
<array>
|
||||
<string>$JAVAROOT/JARFILE</string>
|
||||
</array>
|
||||
|
||||
<key>StartOnMainThread</key>
|
||||
<true/>
|
||||
|
||||
<key>VMOptions</key>
|
||||
<string>-XstartOnFirstThread</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
1
ext/mac-bundle/Angry IP Scanner.app/Contents/PkgInfo
Normal file
1
ext/mac-bundle/Angry IP Scanner.app/Contents/PkgInfo
Normal file
@ -0,0 +1 @@
|
||||
APPL????
|
||||
@ -1,280 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@ -1 +0,0 @@
|
||||
This is a copy of jarbundler-1.9, modified to remove direct dependency on Xerces.
|
||||
@ -1,127 +0,0 @@
|
||||
<project name="jarbundler" default="jar" basedir=".">
|
||||
|
||||
<property name="version" value="1.9"/>
|
||||
<property name="description" value="ANT task for creating Mac OS X application bundles"/>
|
||||
|
||||
|
||||
<!-- File names -->
|
||||
<property name="jarbundler.jar" value="${ant.project.name}.jar" />
|
||||
<property name="release.zip" value="${ant.project.name}.zip" />
|
||||
<property name="release.tar" value="${ant.project.name}.tar" />
|
||||
|
||||
|
||||
<!-- Needs to reference this in order to compile -->
|
||||
<!-- This path works for OS X, Windows and Linux must redefine -->
|
||||
<property name="ant.jar" value="/Developer/Java/Ant/lib/ant.jar" />
|
||||
|
||||
|
||||
<target name="compile" description="Compile the classes">
|
||||
|
||||
<mkdir dir="classes"/>
|
||||
|
||||
<javac srcdir="src" destdir="classes" source="1.4"
|
||||
classpath="${ant.jar}"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="jar" depends="compile" description="Create JAR file">
|
||||
|
||||
<tstamp/>
|
||||
|
||||
<jar jarfile="${jarbundler.jar}" basedir="classes">
|
||||
<manifest>
|
||||
<attribute name="Version" value="${version}"/>
|
||||
<attribute name="Description" value="${description}"/>
|
||||
<attribute name="Build-Date" value="${TODAY}"/>
|
||||
<attribute name="Built-By" value="${user.name}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<target name="javadocs" depends="compile" description="Create JarBundler API">
|
||||
|
||||
<mkdir dir="javadoc"/>
|
||||
|
||||
<javadoc destdir="javadoc" classpath="${ant.jar}">
|
||||
<package name="net.sourceforge.jarbundler.*"/>
|
||||
<sourcepath location="src"/>
|
||||
</javadoc>
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<target name="release" depends="jar" description="Create zip and tar.gz files">
|
||||
|
||||
<ant dir="./example" target="clean" inheritAll="false"/>
|
||||
|
||||
<mkdir dir="release"/>
|
||||
<mkdir dir="release/dist"/>
|
||||
|
||||
<copy todir="release">
|
||||
<fileset dir="dox"/>
|
||||
</copy>
|
||||
|
||||
|
||||
<!-- Make this file easy to find in the distribution -->
|
||||
<move file="build/${jarbundler.jar}" tofile="${jarbundler.jar}"/>
|
||||
|
||||
<zip destfile="release/dist/${release.zip}">
|
||||
<zipfileset prefix="${ant.project.name}-${version}/" dir="${basedir}" excludes="CVS">
|
||||
<include name="LICENSE.TXT"/>
|
||||
<include name="dox/**"/>
|
||||
<include name="build.xml"/>
|
||||
<include name="src/**"/>
|
||||
<include name="example/**"/>
|
||||
<include name="${jarbundler.jar}"/>
|
||||
</zipfileset>
|
||||
</zip>
|
||||
|
||||
<tar destfile="release/dist/${release.tar}">
|
||||
<tarfileset prefix="${ant.project.name}-${version}/" dir="${basedir}" excludes="CVS">
|
||||
<include name="LICENSE.TXT"/>
|
||||
<include name="dox/**"/>
|
||||
<include name="build.xml"/>
|
||||
<include name="src/**"/>
|
||||
<include name="example/**"/>
|
||||
<include name="${jarbundler.jar}"/>
|
||||
</tarfileset>
|
||||
</tar>
|
||||
|
||||
<!-- Compress the tar -->
|
||||
<gzip src="release/dist/${release.tar}" zipfile="release/dist/${release.tar}.gz"/>
|
||||
|
||||
<!-- Remove the intermediate tar -->
|
||||
<delete quiet="true" file="release/dist/${release.tar}" />
|
||||
|
||||
<!-- Move the product back -->
|
||||
<move file="${jarbundler.jar}" tofile="build/${jarbundler.jar}"/>
|
||||
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
<target name="simple" depends="jar" description="Build an example application">
|
||||
<ant dir="./example" target="simple" inheritAll="false">
|
||||
<property name="jarbundler.jar" value="${basedir}/build/${jarbundler.jar}" />
|
||||
</ant>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="complex" depends="jar" description="Build an example application">
|
||||
<ant dir="./example" target="complex" inheritAll="false">
|
||||
<property name="jarbundler.jar" value="${basedir}/build/${jarbundler.jar}" />
|
||||
</ant>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean" description="Clean up">
|
||||
<delete dir="classes"/>
|
||||
<delete dir="build"/>
|
||||
<delete dir="javadoc"/>
|
||||
<delete dir="release"/>
|
||||
<ant dir="example" target="clean" inheritAll="false"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
Binary file not shown.
@ -1,337 +0,0 @@
|
||||
/*
|
||||
* A Mac OS X Jar Bundler Ant Task.
|
||||
*
|
||||
* Copyright (c) 2003, Seth J. Morabito <sethm@loomcom.com> All rights reserved.
|
||||
*
|
||||
* 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 2 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, write to the Free Software Foundation, Inc., 59 Temple
|
||||
* Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
package net.sourceforge.jarbundler;
|
||||
|
||||
// Java Utility
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
|
||||
// Java language imports
|
||||
import java.lang.String;
|
||||
|
||||
public class AppBundleProperties {
|
||||
|
||||
// Required
|
||||
private String mApplicationName;
|
||||
private String mMainClass;
|
||||
|
||||
// Application short name
|
||||
private String mCFBundleName = null;
|
||||
|
||||
// Finder version, with default
|
||||
private String mCFBundleShortVersionString = "1.0";
|
||||
|
||||
// Get Info string, optional
|
||||
private String mCFBundleGetInfoString = null;
|
||||
|
||||
// Build number, optional
|
||||
private String mCFBundleVersion = null;
|
||||
|
||||
// Help Book folder, optional
|
||||
private String mCFHelpBookFolder = null;
|
||||
|
||||
// Help Book name, optional
|
||||
private String mCFHelpBookName = null;
|
||||
|
||||
// Explicit default: false
|
||||
private boolean mCFBundleAllowMixedLocalizations = false;
|
||||
|
||||
// Explicit default: JavaApplicationStub
|
||||
private String mCFBundleExecutable = "JavaApplicationStub";
|
||||
|
||||
// Explicit default: English
|
||||
private String mCFBundleDevelopmentRegion = "English";
|
||||
|
||||
// Explicit default: APPL
|
||||
private final String mCFBundlePackageType = "APPL";
|
||||
|
||||
// Explicit default: ????
|
||||
private String mCFBundleSignature = "????";
|
||||
|
||||
// Explicit default: 1.3+
|
||||
private String mJVMVersion = "1.3+";
|
||||
|
||||
// Explicit default: 6.0
|
||||
private final String mCFBundleInfoDictionaryVersion = "6.0";
|
||||
|
||||
// Optional keys, with no defaults.
|
||||
|
||||
private String mCFBundleIconFile = null;
|
||||
private String mCFBundleIdentifier = null;
|
||||
private String mVMOptions = null; // Java VM options
|
||||
private String mWorkingDirectory = null; // Java Working Dir
|
||||
private String mArguments = null; // Java command line arguments
|
||||
|
||||
// Class path and extra class path elements
|
||||
private List mClassPath = new ArrayList();
|
||||
private List mExtraClassPath = new ArrayList();
|
||||
|
||||
// Java properties
|
||||
private Hashtable mJavaProperties = new Hashtable();
|
||||
|
||||
// Document types
|
||||
private List mDocumentTypes = new LinkedList();
|
||||
|
||||
// Services
|
||||
private List mServices = new LinkedList();
|
||||
|
||||
// ================================================================================
|
||||
|
||||
/**
|
||||
* Add a Java runtime property to the properties hashtable.
|
||||
*/
|
||||
|
||||
public void addJavaProperty(String prop, String val) {
|
||||
mJavaProperties.put(prop, val);
|
||||
}
|
||||
|
||||
public Hashtable getJavaProperties() {
|
||||
return mJavaProperties;
|
||||
}
|
||||
|
||||
public void addToClassPath(String s) {
|
||||
mClassPath.add("$JAVAROOT/" + s);
|
||||
}
|
||||
|
||||
public void addToExtraClassPath(String s) {
|
||||
mExtraClassPath.add(s);
|
||||
}
|
||||
|
||||
public List getExtraClassPath() {
|
||||
return mExtraClassPath;
|
||||
}
|
||||
|
||||
public DocumentType createDocumentType() {
|
||||
return new DocumentType();
|
||||
}
|
||||
|
||||
public List getDocumentTypes() {
|
||||
return mDocumentTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a document type to the document type list.
|
||||
*/
|
||||
public void addDocumentType(DocumentType documentType) {
|
||||
mDocumentTypes.add(documentType);
|
||||
}
|
||||
|
||||
public Service createService() {
|
||||
return new Service();
|
||||
}
|
||||
|
||||
public List getServices() {
|
||||
return mServices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a service to the services list.
|
||||
*/
|
||||
public void addService(Service service) {
|
||||
mServices.add(service);
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
|
||||
public void setApplicationName(String s) {
|
||||
mApplicationName = s;
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
return mApplicationName;
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
//
|
||||
// Bundle setters and getters
|
||||
//
|
||||
|
||||
public void setCFBundleName(String s) {
|
||||
|
||||
if (s.length() > 16)
|
||||
System.err
|
||||
.println("WARNING: 'shortname' is recommeded to be no more than 16 "
|
||||
+ "charaters long. See usage notes.");
|
||||
mCFBundleName = s;
|
||||
}
|
||||
|
||||
public String getCFBundleName() {
|
||||
if (mCFBundleName == null)
|
||||
return getApplicationName();
|
||||
|
||||
return mCFBundleName;
|
||||
}
|
||||
|
||||
public void setCFBundleVersion(String s) {
|
||||
mCFBundleVersion = s;
|
||||
}
|
||||
|
||||
public String getCFBundleVersion() {
|
||||
return mCFBundleVersion;
|
||||
}
|
||||
|
||||
public void setCFBundleInfoDictionaryVersion(String s) {
|
||||
// mCFBundleInfoDictionaryVersion = s;
|
||||
}
|
||||
|
||||
public String getCFBundleInfoDictionaryVersion() {
|
||||
return mCFBundleInfoDictionaryVersion;
|
||||
}
|
||||
|
||||
public void setCFBundleIdentifier(String s) {
|
||||
mCFBundleIdentifier = s;
|
||||
}
|
||||
|
||||
public String getCFBundleIdentifier() {
|
||||
return mCFBundleIdentifier;
|
||||
}
|
||||
|
||||
public void setCFBundleGetInfoString(String s) {
|
||||
mCFBundleGetInfoString = s;
|
||||
}
|
||||
|
||||
public String getCFBundleGetInfoString() {
|
||||
if (mCFBundleGetInfoString == null)
|
||||
return getCFBundleShortVersionString();
|
||||
|
||||
return mCFBundleGetInfoString;
|
||||
}
|
||||
|
||||
public void setCFBundleShortVersionString(String s) {
|
||||
mCFBundleShortVersionString = s;
|
||||
}
|
||||
|
||||
public String getCFBundleShortVersionString() {
|
||||
return mCFBundleShortVersionString;
|
||||
}
|
||||
|
||||
public void setCFBundleIconFile(String s) {
|
||||
mCFBundleIconFile = s;
|
||||
}
|
||||
|
||||
public String getCFBundleIconFile() {
|
||||
return mCFBundleIconFile;
|
||||
}
|
||||
|
||||
public void setCFBundleAllowMixedLocalizations(boolean b) {
|
||||
mCFBundleAllowMixedLocalizations = b;
|
||||
}
|
||||
|
||||
public boolean getCFBundleAllowMixedLocalizations() {
|
||||
return mCFBundleAllowMixedLocalizations;
|
||||
}
|
||||
|
||||
public void setCFBundleExecutable(String s) {
|
||||
mCFBundleExecutable = s;
|
||||
}
|
||||
|
||||
public String getCFBundleExecutable() {
|
||||
return mCFBundleExecutable;
|
||||
}
|
||||
|
||||
public void setCFBundleDevelopmentRegion(String s) {
|
||||
mCFBundleDevelopmentRegion = s;
|
||||
}
|
||||
|
||||
public String getCFBundleDevelopmentRegion() {
|
||||
return mCFBundleDevelopmentRegion;
|
||||
}
|
||||
|
||||
public void setCFBundlePackageType(String s) {
|
||||
// mCFBundlePackageType = s;
|
||||
}
|
||||
|
||||
public String getCFBundlePackageType() {
|
||||
return mCFBundlePackageType;
|
||||
}
|
||||
|
||||
public void setCFBundleSignature(String s) {
|
||||
mCFBundleSignature = s;
|
||||
}
|
||||
|
||||
public String getCFBundleSignature() {
|
||||
return mCFBundleSignature;
|
||||
}
|
||||
|
||||
public void setCFBundleHelpBookFolder(String s) {
|
||||
mCFHelpBookFolder = s;
|
||||
}
|
||||
|
||||
public String getCFBundleHelpBookFolder() {
|
||||
return mCFHelpBookFolder;
|
||||
}
|
||||
|
||||
public void setCFBundleHelpBookName(String s) {
|
||||
mCFHelpBookName = s;
|
||||
}
|
||||
|
||||
public String getCFBundleHelpBookName() {
|
||||
return mCFHelpBookName;
|
||||
}
|
||||
|
||||
public void setMainClass(String s) {
|
||||
mMainClass = s;
|
||||
}
|
||||
|
||||
public String getMainClass() {
|
||||
return mMainClass;
|
||||
}
|
||||
|
||||
public void setJVMVersion(String s) {
|
||||
mJVMVersion = s;
|
||||
}
|
||||
|
||||
public String getJVMVersion() {
|
||||
return mJVMVersion;
|
||||
}
|
||||
|
||||
public void setVMOptions(String s) {
|
||||
mVMOptions = s;
|
||||
}
|
||||
|
||||
public String getVMOptions() {
|
||||
return mVMOptions;
|
||||
}
|
||||
|
||||
public void setWorkingDirectory(String s) {
|
||||
mWorkingDirectory = s;
|
||||
}
|
||||
|
||||
public String getWorkingDirectory() {
|
||||
return mWorkingDirectory;
|
||||
}
|
||||
|
||||
public void setArguments(String s) {
|
||||
mArguments = s;
|
||||
}
|
||||
|
||||
public String getArguments() {
|
||||
return mArguments;
|
||||
}
|
||||
|
||||
public List getClassPath() {
|
||||
return mClassPath;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,215 +0,0 @@
|
||||
package net.sourceforge.jarbundler;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Represents an Info.plist DocumentType used for associating a document with
|
||||
* the application
|
||||
*
|
||||
* The Document Types allows you to specify which documents your finished
|
||||
* product can handle. You should list the application's primary document type
|
||||
* first because the document controller uses that type by default when the user
|
||||
* requests a new document.
|
||||
*
|
||||
* Name - The name of the document type.
|
||||
*
|
||||
* UTI - A list of Uniform Type Identifier (UTI) strings for the document. UTIs
|
||||
* are strings that uniquely identify abstract types. They can be used to
|
||||
* describe a file format or data type but can also be used to describe type
|
||||
* information for other sorts of entities, such as directories, volumes, or
|
||||
* packages. For more information on UTIs, see the header file UTType.h,
|
||||
* available as part of LaunchServices.framework in Mac OS X v10.3 and later.
|
||||
*
|
||||
*
|
||||
* Extensions - A list of the filename extensions for this document type. Don't
|
||||
* include the period in the extension.
|
||||
*
|
||||
*
|
||||
* OS Types - A list of four-letter codes for the document. These codes are
|
||||
* stored in the document's resources or information property list files.
|
||||
*
|
||||
*
|
||||
* MIME Types - A list of the Multipurpose Internet Mail Extensions (MIME) types
|
||||
* for the document. MIME types identify content types for Internet
|
||||
* applications.
|
||||
*
|
||||
*
|
||||
* Icon File - The name of the file that contains the document type's icon.
|
||||
*
|
||||
*
|
||||
* Role - A description of how the application uses the documents of this type.
|
||||
*
|
||||
* Editor - The application can display, edit, and save documents of this type.
|
||||
*
|
||||
* Viewer - The application can display, but not edit, documents of this type.
|
||||
*
|
||||
* Shell - The application provides runtime services for other processes for
|
||||
* example, a Java applet viewer.
|
||||
*
|
||||
* None - The application can neither display nor edit documents of this type
|
||||
* but instead uses them in some other way. For example, Sketch uses this role
|
||||
* to declare types it can export but not read.
|
||||
*
|
||||
*
|
||||
* Bundle - Specifies whether the document is a single file or a file bundle,
|
||||
* that is, a directory that is treated as a single document by certain
|
||||
* applications, such as the Finder.
|
||||
*
|
||||
*
|
||||
* <documenttype> name="Scan Project" extensions="scansort scanproj"
|
||||
* ostypes="fold disk fdrp" iconfile="document.icns" mimetypes="text/html
|
||||
* image/jpeg" role="editor" bundle="true" />
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
public class DocumentType {
|
||||
|
||||
private static final List EMPTYLIST = new ArrayList(0);
|
||||
|
||||
/** Name. The name of the document type. */
|
||||
public String name = null;
|
||||
|
||||
/**
|
||||
* Extensions. A list of the filename extensions for this document type.
|
||||
* Don't include the period in the extension.
|
||||
*/
|
||||
|
||||
public String[] extensions = null;
|
||||
/**
|
||||
* OS Types. A list of four-letter codes for the document. These codes are
|
||||
* stored in the document's resources or information property list files.
|
||||
*/
|
||||
|
||||
public String[] osTypes = null;
|
||||
/**
|
||||
* MIME Types. A list of the Multipurpose Internet Mail Extensions (MIME)
|
||||
* types for the document. MIME types identify content types for Internet
|
||||
* applications.
|
||||
*/
|
||||
|
||||
public String[] mimeTypes = null;
|
||||
|
||||
/**
|
||||
* UTI. A list of Uniform Type Identifier (UTI) strings for the document.
|
||||
* UTIs are strings that uniquely identify abstract types. They can be used
|
||||
* to describe a file format or data type but can also be used to describe
|
||||
* type information for other sorts of entities, such as directories,
|
||||
* volumes, or packages. For more information on UTIs, see the header file
|
||||
* UTType.h, available as part of LaunchServices.framework in Mac OS X v10.3
|
||||
* and later.
|
||||
*/
|
||||
public String[] UTIs = null;
|
||||
|
||||
/**
|
||||
* Icon File. The name of the file that contains the document types icon.
|
||||
*/
|
||||
|
||||
public File iconFile = null;
|
||||
/**
|
||||
* Role. A description of how the application uses the documents of this
|
||||
* type. You can choose from four values:
|
||||
* <p>
|
||||
* Editor. The application can display, edit, and save documents of this
|
||||
* type.
|
||||
* <p>
|
||||
* Viewer. The application can display, but not edit, documents of this
|
||||
* type.
|
||||
* <p>
|
||||
* Shell. The application provides runtime services for other processesfor
|
||||
* example, a Java applet viewer.
|
||||
* <p>
|
||||
* None. The application can neither display nor edit documents of this type
|
||||
* but instead uses them in some other way. For example, Sketch uses this
|
||||
* role to declare types it can export but not read.
|
||||
*/
|
||||
|
||||
public String role = null;
|
||||
|
||||
/**
|
||||
* Bundle. Specifies whether the document is a single file document or a
|
||||
* document bundle, that is, a directory that is treated as a single
|
||||
* document by certain applications, such as the Finder.
|
||||
*/
|
||||
|
||||
public boolean isBundle = false;
|
||||
|
||||
// Document type name
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
// Extensions
|
||||
public void setExtensions(String extensions) {
|
||||
this.extensions = extensions.split("[\\s,]");
|
||||
}
|
||||
|
||||
public List getExtensions() {
|
||||
return (extensions == null) ? EMPTYLIST : Arrays.asList(extensions);
|
||||
}
|
||||
|
||||
// OS Types
|
||||
public void setOSTypes(String osTypes) {
|
||||
this.osTypes = osTypes.split("[\\s,]");
|
||||
}
|
||||
|
||||
public List getOSTypes() {
|
||||
return (osTypes == null) ? EMPTYLIST : Arrays.asList(osTypes);
|
||||
}
|
||||
|
||||
// mime-types
|
||||
public void setMimeTypes(String mimeTypes) {
|
||||
this.mimeTypes = mimeTypes.split("[\\s,]");
|
||||
}
|
||||
|
||||
public List getMimeTypes() {
|
||||
return (mimeTypes == null) ? EMPTYLIST : Arrays.asList(this.mimeTypes);
|
||||
}
|
||||
|
||||
// Uniform Type Identifiers
|
||||
public void setUTIs(String UTIs) {
|
||||
this.UTIs = UTIs.split("[\\s,]");
|
||||
}
|
||||
|
||||
public List getUTIs() {
|
||||
return this.UTIs == null ? EMPTYLIST : Arrays.asList(this.UTIs);
|
||||
}
|
||||
|
||||
// Document icon file
|
||||
public void setIconFile(File iconFile) {
|
||||
this.iconFile = iconFile;
|
||||
}
|
||||
|
||||
public File getIconFile() {
|
||||
return iconFile;
|
||||
}
|
||||
|
||||
// Document role
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
// Is this document represented as a bundle
|
||||
public void setBundle(boolean isBundle) {
|
||||
this.isBundle = isBundle;
|
||||
}
|
||||
|
||||
public boolean isBundle() {
|
||||
return isBundle;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package net.sourceforge.jarbundler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.MatchingTask;
|
||||
import org.apache.tools.ant.types.FileList;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
|
||||
import java.lang.String;
|
||||
|
||||
|
||||
|
||||
public class HelpBook extends MatchingTask {
|
||||
|
||||
private String folderName = null;
|
||||
private String name = null;
|
||||
private String locale = null;
|
||||
|
||||
private final List fileLists = new ArrayList();
|
||||
private final List fileSets = new ArrayList();
|
||||
|
||||
|
||||
// Help Book name
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
// Help Book folder name
|
||||
public void setFolderName(String folderName) {
|
||||
this.folderName = folderName;
|
||||
}
|
||||
|
||||
public String getFolderName() {
|
||||
return folderName;
|
||||
}
|
||||
|
||||
|
||||
// Help Book locale
|
||||
public void setLocale(String locale) {
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
public String getLocale() {
|
||||
return locale;
|
||||
}
|
||||
|
||||
// Help Book files as a ANT FileList
|
||||
public void addFileList(FileList fileList) {
|
||||
fileLists.add(fileList);
|
||||
}
|
||||
|
||||
public List getFileLists() {
|
||||
return fileLists;
|
||||
}
|
||||
|
||||
// Help Book files as a ANT FileSet
|
||||
public void addFileSet(FileSet fileSet) {
|
||||
fileSets.add(fileSet);
|
||||
}
|
||||
|
||||
public List getFileSets() {
|
||||
return fileSets;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
||||
package net.sourceforge.jarbundler;
|
||||
|
||||
public class JavaProperty {
|
||||
|
||||
/** The JavaProperties' name and value */
|
||||
|
||||
private String name = null;
|
||||
private String value = null;
|
||||
|
||||
/**
|
||||
* Construct an empty JavaProperty
|
||||
*/
|
||||
|
||||
public JavaProperty() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the JavaProperties's name; required
|
||||
*
|
||||
* @param name
|
||||
* the JavaProperties' name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaProperties' name
|
||||
*
|
||||
* @return the JavaProperties' name.
|
||||
*/
|
||||
public String getName() {
|
||||
|
||||
if (this.name == null)
|
||||
return null;
|
||||
|
||||
return this.name.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the JavaProperties' value; required
|
||||
*
|
||||
* @param value
|
||||
* the JavaProperties' value
|
||||
*/
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the JavaProperties' value.
|
||||
*
|
||||
* @return the JavaProperties' value.
|
||||
*/
|
||||
public String getValue() {
|
||||
|
||||
if (this.value == null)
|
||||
return null;
|
||||
|
||||
return this.value.trim();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,430 +0,0 @@
|
||||
/*
|
||||
* Write the application bundle file: Info.plist
|
||||
*
|
||||
* Copyright (c) 2006, William A. Gilbert <gilbert@informagen.com> All rights reserved.
|
||||
*
|
||||
* 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 2 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, write to the Free Software Foundation, Inc., 59 Temple
|
||||
* Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
package net.sourceforge.jarbundler;
|
||||
|
||||
// This package's imports
|
||||
import net.sourceforge.jarbundler.AppBundleProperties;
|
||||
|
||||
// Java I/O
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
// Java Utility
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
// Java language imports
|
||||
import java.lang.Boolean;
|
||||
import java.lang.ClassCastException;
|
||||
import java.lang.Double;
|
||||
import java.lang.String;
|
||||
import java.lang.System;
|
||||
|
||||
// Apache Ant
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.util.FileUtils;
|
||||
|
||||
// Java XML DOM creation
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
// W3C DOM
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Attr;
|
||||
|
||||
/**
|
||||
* Write out a Java application bundle property list file. For descriptions of
|
||||
* the property list keys, see <a
|
||||
* href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html"
|
||||
* >Apple docs</a>.
|
||||
*/
|
||||
public class PropertyListWriter {
|
||||
|
||||
|
||||
// Our application bundle properties
|
||||
private AppBundleProperties bundleProperties;
|
||||
|
||||
private double version = 1.3;
|
||||
|
||||
// DOM version of Info.plist file
|
||||
private Document document = null;
|
||||
|
||||
|
||||
private FileUtils fileUtils = FileUtils.getFileUtils();
|
||||
|
||||
/**
|
||||
* Create a new Property List writer.
|
||||
*/
|
||||
public PropertyListWriter(AppBundleProperties bundleProperties) {
|
||||
this.bundleProperties = bundleProperties;
|
||||
setJavaVersion(bundleProperties.getJVMVersion());
|
||||
}
|
||||
|
||||
private void setJavaVersion(String version) {
|
||||
|
||||
if (version == null)
|
||||
return;
|
||||
|
||||
this.version = Double.valueOf(version.substring(0, 3)).doubleValue();
|
||||
}
|
||||
|
||||
|
||||
public void writeFile(File fileName) throws BuildException {
|
||||
|
||||
Writer writer = null;
|
||||
|
||||
try {
|
||||
|
||||
this.document = createDOM();
|
||||
buildDOM();
|
||||
|
||||
Transformer transformer = TransformerFactory.newInstance().newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
|
||||
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
transformer.transform(new DOMSource(this.document), new StreamResult(fileName));
|
||||
|
||||
} catch (Exception pce) {
|
||||
throw new BuildException(pce);
|
||||
}
|
||||
}
|
||||
|
||||
private Document createDOM() throws ParserConfigurationException {
|
||||
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder documentBuilder = factory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = documentBuilder.getDOMImplementation();
|
||||
|
||||
// We needed to reference using the full class name here because we already have
|
||||
// a class named "DocumentType"
|
||||
|
||||
org.w3c.dom.DocumentType doctype = domImpl.createDocumentType(
|
||||
"plist",
|
||||
"-//Apple Computer//DTD PLIST 1.0//EN",
|
||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd");
|
||||
|
||||
return domImpl.createDocument(null, "plist", doctype);
|
||||
}
|
||||
|
||||
|
||||
private void buildDOM() {
|
||||
|
||||
Element plist = this.document.getDocumentElement();
|
||||
plist.setAttribute("version","1.0");
|
||||
|
||||
// Open the top level dictionary, <dict>
|
||||
|
||||
Node dict = createNode("dict", plist);
|
||||
|
||||
// Application short name i.e. About menu name
|
||||
writeKeyStringPair("CFBundleName", bundleProperties.getCFBundleName(), dict);
|
||||
|
||||
// Finder 'Version' label, defaults to "1.0"
|
||||
writeKeyStringPair("CFBundleShortVersionString", bundleProperties.getCFBundleShortVersionString(), dict);
|
||||
|
||||
// Finder 'Get Info'
|
||||
writeKeyStringPair("CFBundleGetInfoString", bundleProperties.getCFBundleGetInfoString(), dict);
|
||||
|
||||
// Mac OS X required key, defaults to "false"
|
||||
writeKeyStringPair("CFBundleAllowMixedLocalizations",
|
||||
(bundleProperties.getCFBundleAllowMixedLocalizations() ? "true" : "false"),
|
||||
dict);
|
||||
|
||||
// Mac OS X required, defaults to "6.0"
|
||||
writeKeyStringPair("CFBundleInfoDictionaryVersion",
|
||||
bundleProperties.getCFBundleInfoDictionaryVersion(), dict);
|
||||
|
||||
// Bundle Executable name, required, defaults to "JavaApplicationStub"
|
||||
writeKeyStringPair("CFBundleExecutable", bundleProperties.getCFBundleExecutable(), dict);
|
||||
|
||||
// Bundle Development Region, required, defaults to "English"
|
||||
writeKeyStringPair("CFBundleDevelopmentRegion", bundleProperties.getCFBundleDevelopmentRegion(), dict);
|
||||
|
||||
// Bundle Package Type, required, defaults tp "APPL"
|
||||
writeKeyStringPair("CFBundlePackageType", bundleProperties.getCFBundlePackageType(), dict);
|
||||
|
||||
// Bundle Signature, required, defaults tp "????"
|
||||
writeKeyStringPair("CFBundleSignature", bundleProperties.getCFBundleSignature(), dict);
|
||||
|
||||
// Application build number, optional
|
||||
if (bundleProperties.getCFBundleVersion() != null)
|
||||
writeKeyStringPair("CFBundleVersion", bundleProperties.getCFBundleVersion(), dict);
|
||||
|
||||
// Application Icon file, optional
|
||||
if (bundleProperties.getCFBundleIconFile() != null)
|
||||
writeKeyStringPair("CFBundleIconFile", bundleProperties.getCFBundleIconFile(), dict);
|
||||
|
||||
// Bundle Identifier, optional
|
||||
if (bundleProperties.getCFBundleIdentifier() != null)
|
||||
writeKeyStringPair("CFBundleIdentifier", bundleProperties.getCFBundleIdentifier(), dict);
|
||||
|
||||
// Help Book Folder, optional
|
||||
if (bundleProperties.getCFBundleHelpBookFolder() != null)
|
||||
writeKeyStringPair("CFBundleHelpBookFolder", bundleProperties.getCFBundleHelpBookFolder(), dict);
|
||||
|
||||
// Help Book Name, optional
|
||||
if (bundleProperties.getCFBundleHelpBookName() != null)
|
||||
writeKeyStringPair("CFBundleHelpBookName", bundleProperties.getCFBundleHelpBookName(), dict);
|
||||
|
||||
// Document Types, optional
|
||||
List documentTypes = bundleProperties.getDocumentTypes();
|
||||
|
||||
if (documentTypes.size() > 0)
|
||||
writeDocumentTypes(documentTypes, dict);
|
||||
|
||||
// Java entry in the plist dictionary
|
||||
writeKey("Java", dict);
|
||||
Node javaDict = createNode("dict", dict);
|
||||
|
||||
// Main class, required
|
||||
writeKeyStringPair("MainClass", bundleProperties.getMainClass(), javaDict);
|
||||
|
||||
// Target JVM version, optional but recommended
|
||||
if (bundleProperties.getJVMVersion() != null)
|
||||
writeKeyStringPair("JVMVersion", bundleProperties.getJVMVersion(), javaDict);
|
||||
|
||||
|
||||
// Classpath is composed of two types, required
|
||||
// 1: Jars bundled into the JAVA_ROOT of the application
|
||||
// 2: External directories or files with an absolute path
|
||||
|
||||
List classPath = bundleProperties.getClassPath();
|
||||
List extraClassPath = bundleProperties.getExtraClassPath();
|
||||
|
||||
if ((classPath.size() > 0) || (extraClassPath.size() > 0))
|
||||
writeClasspath(classPath, extraClassPath, javaDict);
|
||||
|
||||
|
||||
// JVM options, optional
|
||||
if (bundleProperties.getVMOptions() != null)
|
||||
writeKeyStringPair("VMOptions", bundleProperties.getVMOptions(), javaDict);
|
||||
|
||||
// Working directory, optional
|
||||
if (bundleProperties.getWorkingDirectory() != null)
|
||||
writeKeyStringPair("WorkingDirectory", bundleProperties.getWorkingDirectory(), javaDict);
|
||||
|
||||
// Main class arguments, optional
|
||||
if (bundleProperties.getArguments() != null)
|
||||
writeKeyStringPair("Arguments", bundleProperties.getArguments(), javaDict);
|
||||
|
||||
// Java properties, optional
|
||||
Hashtable javaProperties = bundleProperties.getJavaProperties();
|
||||
|
||||
if (javaProperties.isEmpty() == false)
|
||||
writeJavaProperties(javaProperties, javaDict);
|
||||
|
||||
|
||||
// Services, optional
|
||||
List services = bundleProperties.getServices();
|
||||
if (services.size() > 0)
|
||||
writeServices(services,dict);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void writeDocumentTypes(List documentTypes, Node appendTo) {
|
||||
|
||||
writeKey("CFBundleDocumentTypes", appendTo);
|
||||
|
||||
Node array = createNode("array", appendTo);
|
||||
|
||||
Iterator itor = documentTypes.iterator();
|
||||
|
||||
while (itor.hasNext()) {
|
||||
|
||||
DocumentType documentType = (DocumentType) itor.next();
|
||||
|
||||
Node documentDict = createNode("dict", array);
|
||||
|
||||
writeKeyStringPair("CFBundleTypeName", documentType.getName(), documentDict);
|
||||
writeKeyStringPair("CFBundleTypeRole", documentType.getRole(), documentDict);
|
||||
|
||||
File iconFile = documentType.getIconFile();
|
||||
|
||||
if (iconFile != null)
|
||||
writeKeyStringPair("CFBundleTypeIconFile", iconFile.getName(), documentDict);
|
||||
|
||||
|
||||
List extensions = documentType.getExtensions();
|
||||
|
||||
if (extensions.isEmpty() == false) {
|
||||
writeKey("CFBundleTypeExtensions", documentDict);
|
||||
writeArray(extensions, documentDict);
|
||||
}
|
||||
|
||||
List osTypes = documentType.getOSTypes();
|
||||
|
||||
if (osTypes.isEmpty() == false) {
|
||||
writeKey("CFBundleTypeOSTypes", documentDict);
|
||||
writeArray(osTypes, documentDict);
|
||||
}
|
||||
|
||||
|
||||
List mimeTypes = documentType.getMimeTypes();
|
||||
|
||||
if (mimeTypes.isEmpty() == false) {
|
||||
writeKey("CFBundleTypeMIMETypes", documentDict);
|
||||
writeArray(mimeTypes, documentDict);
|
||||
}
|
||||
|
||||
List UTIs = documentType.getUTIs();
|
||||
|
||||
if (UTIs.isEmpty() == false) {
|
||||
writeKey("LSItemContentTypes", documentDict);
|
||||
writeArray(UTIs, documentDict);
|
||||
}
|
||||
|
||||
// Only write this key if true
|
||||
if (documentType.isBundle())
|
||||
writeKeyStringPair("LSTypeIsPackage", "true", documentDict);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeServices(List services, Node appendTo) {
|
||||
|
||||
writeKey("NSServices",appendTo);
|
||||
Node array = createNode("array",appendTo);
|
||||
Iterator itor = services.iterator();
|
||||
|
||||
while (itor.hasNext()) {
|
||||
Service service = (Service)itor.next();
|
||||
Node serviceDict = createNode("dict",array);
|
||||
|
||||
String portName = service.getPortName();
|
||||
if (portName == null)
|
||||
portName = bundleProperties.getCFBundleName();
|
||||
|
||||
writeKeyStringPair("NSPortName", portName, serviceDict);
|
||||
writeKeyStringPair("NSMessage",service.getMessage(),serviceDict);
|
||||
|
||||
List sendTypes = service.getSendTypes();
|
||||
if (!sendTypes.isEmpty()) {
|
||||
writeKey("NSSendTypes",serviceDict);
|
||||
writeArray(sendTypes,serviceDict);
|
||||
}
|
||||
|
||||
List returnTypes = service.getReturnTypes();
|
||||
if (!returnTypes.isEmpty()) {
|
||||
writeKey("NSReturnTypes",serviceDict);
|
||||
writeArray(returnTypes,serviceDict);
|
||||
}
|
||||
|
||||
writeKey("NSMenuItem",serviceDict);
|
||||
Node menuItemDict = createNode("dict",serviceDict);
|
||||
writeKeyStringPair("default",service.getMenuItem(),menuItemDict);
|
||||
|
||||
String keyEquivalent = service.getKeyEquivalent();
|
||||
if (null != keyEquivalent) {
|
||||
writeKey("NSKeyEquivalent",serviceDict);
|
||||
Node keyEquivalentDict = createNode("dict",serviceDict);
|
||||
writeKeyStringPair("default",keyEquivalent,keyEquivalentDict);
|
||||
}
|
||||
|
||||
String userData = service.getUserData();
|
||||
if (null != userData)
|
||||
writeKeyStringPair("NSUserData", userData, serviceDict);
|
||||
|
||||
String timeout = service.getTimeout();
|
||||
if (null != timeout)
|
||||
writeKeyStringPair("NSTimeout",timeout,serviceDict);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeClasspath(List classpath, List extraClasspath, Node appendTo) {
|
||||
writeKey("ClassPath", appendTo);
|
||||
classpath.addAll(extraClasspath);
|
||||
writeArray(classpath, appendTo);
|
||||
}
|
||||
|
||||
|
||||
private void writeJavaProperties(Hashtable javaProperties, Node appendTo) {
|
||||
|
||||
writeKey("Properties", appendTo);
|
||||
|
||||
Node propertiesDict = createNode("dict", appendTo);
|
||||
|
||||
for (Iterator i = javaProperties.keySet().iterator(); i.hasNext();) {
|
||||
String key = (String) i.next();
|
||||
|
||||
if (key.startsWith("com.apple.") && (version >= 1.4)) {
|
||||
System.out.println("Deprecated as of 1.4: " + key);
|
||||
continue;
|
||||
}
|
||||
|
||||
writeKeyStringPair(key, (String)javaProperties.get(key), propertiesDict);
|
||||
}
|
||||
}
|
||||
|
||||
private Node createNode(String tag, Node appendTo) {
|
||||
Node node = this.document.createElement(tag);
|
||||
appendTo.appendChild(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
private void writeKeyStringPair(String key, String string, Node appendTo) {
|
||||
|
||||
if (string == null)
|
||||
return;
|
||||
|
||||
writeKey(key, appendTo);
|
||||
writeString(string, appendTo);
|
||||
}
|
||||
|
||||
|
||||
private void writeKey(String key, Node appendTo) {
|
||||
Element keyNode = this.document.createElement("key");
|
||||
appendTo.appendChild(keyNode);
|
||||
keyNode.appendChild(this.document.createTextNode(key));
|
||||
}
|
||||
|
||||
|
||||
private void writeString(String string, Node appendTo) {
|
||||
Element stringNode = this.document.createElement("string");
|
||||
stringNode.appendChild(this.document.createTextNode(string));
|
||||
appendTo.appendChild(stringNode);
|
||||
}
|
||||
|
||||
private void writeArray(List stringList, Node appendTo) {
|
||||
|
||||
Node arrayNode = createNode("array", appendTo);
|
||||
|
||||
for (Iterator it = stringList.iterator(); it.hasNext();)
|
||||
writeString((String)it.next(), arrayNode);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,204 +0,0 @@
|
||||
package net.sourceforge.jarbundler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Represents an Info.plist Service specifying a service provided by the application.
|
||||
*
|
||||
* Port Name - The name of the port the application monitors for incoming service requests.
|
||||
*
|
||||
|
||||
* Message - The name of the instance method to invoke for the service.
|
||||
* In Objective-C, the instance method must be of the form messageName:userData:error:.
|
||||
* In Java, the instance method must be of the form messageName(NSPasteBoard,String).
|
||||
*
|
||||
*
|
||||
* Menu Item - The text to add to the Services menu. The value must be unique.
|
||||
* You can use a slash character "/" to specify a submenu. For example, Mail/Send
|
||||
* would appear in the Services Menu as a menu named Mail with an item named Send.
|
||||
*
|
||||
*
|
||||
* Send Types - A list of the data type names that can be read by the service.
|
||||
* The NSPasteboard class description lists several common data types.
|
||||
*
|
||||
*
|
||||
* Return Types - A list of the data type names that can be returned by the service.
|
||||
* The NSPasteboard class description lists several common data types.
|
||||
* You must specify either Return Types, Send Types or both.
|
||||
*
|
||||
* You must specify either Send Types, Return Types or both.
|
||||
*
|
||||
*
|
||||
* Key Equivalent - This attribute is optional. The keyboard equivalent used to invoke
|
||||
* the service menu command. The value has to be a single character. Users invoke this
|
||||
* keyboard equivalent by pressing the Command and Shift key modifiers along with the character.
|
||||
*
|
||||
*
|
||||
* User Data - This attribute is optional. The value is free choosable and is passed
|
||||
* to the method as second parameter.
|
||||
*
|
||||
*
|
||||
* Timeout - This attribute is optional. It indicates the number of milliseconds
|
||||
* Services should wait for a response from the application providing
|
||||
* a service when a respond is required.
|
||||
*
|
||||
*
|
||||
* <service portname="jarBundler"
|
||||
* message="processRequest"
|
||||
* menuitem="JarBundler/Process Request"
|
||||
* sendtypes="NSStringPboardType,NSFilenamesPboardType"
|
||||
* returntypes="NSStringPboardType"
|
||||
* keyequivalent="p"
|
||||
* userdata="a string passed to the method"
|
||||
* timeout="5000" />
|
||||
*/
|
||||
public class Service {
|
||||
private static final List EMPTYLIST = new ArrayList(0);
|
||||
|
||||
|
||||
/** The name of the port the application monitors for incoming service requests. */
|
||||
private String portName = null;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* The name of the instance method to invoke for the service.
|
||||
* In Objective-C, the instance method must be of the form messageName:userData:error:.
|
||||
|
||||
* In Java, the instance method must be of the form messageName(NSPasteBoard,String).
|
||||
*/
|
||||
private String message = null;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* The text to add to the Services menu. The value must be unique.
|
||||
|
||||
* You can use a slash character "/" to specify a submenu. For example, Mail/Send
|
||||
|
||||
* would appear in the Services Menu as a menu named Mail with an item named Send.
|
||||
*/
|
||||
private String menuItem = null;
|
||||
|
||||
/**
|
||||
* A list of the data type names that can be read by the service.
|
||||
|
||||
* The NSPasteboard class description lists several common data types.
|
||||
|
||||
* You must specify either Send Types, Return Types or both.
|
||||
*/
|
||||
private String[] sendTypes = null;
|
||||
|
||||
|
||||
/**
|
||||
* A list of the data type names that can be returned by the service.
|
||||
|
||||
* The NSPasteboard class description lists several common data types.
|
||||
|
||||
* You must specify either Return Types, Send Types or both.
|
||||
*/
|
||||
private String[] returnTypes = null;
|
||||
|
||||
|
||||
/**
|
||||
* This attribute is optional. The keyboard equivalent used to invoke
|
||||
|
||||
* the service menu command. The value has to be a single character. Users invoke this
|
||||
|
||||
* keyboard equivalent by pressing the Command and Shift key modifiers along with the character.
|
||||
|
||||
*/
|
||||
private String keyEquivalent = null;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This attribute is optional. The value is free choosable and is passed
|
||||
|
||||
* to the method as second parameter.
|
||||
|
||||
*/
|
||||
private String userData = null;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
* This attribute is optional. It indicates the number of milliseconds
|
||||
|
||||
* Services should wait for a response from the application providing
|
||||
|
||||
* a service when a respond is required.
|
||||
|
||||
*/
|
||||
private String timeout = null;
|
||||
|
||||
|
||||
public void setPortName(String portName) {
|
||||
this.portName = portName;
|
||||
}
|
||||
|
||||
public String getPortName() {
|
||||
return portName;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMenuItem(String menuItem) {
|
||||
this.menuItem = menuItem;
|
||||
|
||||
}
|
||||
|
||||
public String getMenuItem() {
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
public void setSendTypes(String sendTypes) {
|
||||
this.sendTypes = sendTypes.split("[\\s,]");
|
||||
}
|
||||
|
||||
public List getSendTypes() {
|
||||
return (sendTypes == null) ? EMPTYLIST : Arrays.asList(sendTypes);
|
||||
}
|
||||
|
||||
public void setReturnTypes(String returnTypes) {
|
||||
this.returnTypes = returnTypes.split("[\\s,]");
|
||||
}
|
||||
|
||||
public List getReturnTypes() {
|
||||
return (returnTypes == null) ? EMPTYLIST : Arrays.asList(returnTypes);
|
||||
}
|
||||
|
||||
public void setKeyEquivalent(String keyEquivalent) {
|
||||
this.keyEquivalent = keyEquivalent;
|
||||
}
|
||||
|
||||
public String getKeyEquivalent() {
|
||||
return keyEquivalent;
|
||||
}
|
||||
|
||||
public void setUserData(String userData) {
|
||||
this.userData = userData;
|
||||
}
|
||||
|
||||
public String getUserData() {
|
||||
return userData;
|
||||
}
|
||||
|
||||
public void setTimeout(String timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
||||
public String getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user