diff options
Diffstat (limited to 'doc/user/java.xml')
-rw-r--r-- | doc/user/java.xml | 431 |
1 files changed, 339 insertions, 92 deletions
diff --git a/doc/user/java.xml b/doc/user/java.xml index 5827eec..95b20d2 100644 --- a/doc/user/java.xml +++ b/doc/user/java.xml @@ -1,6 +1,27 @@ +<?xml version='1.0'?> +<!DOCTYPE sconsdoc [ + <!ENTITY % scons SYSTEM "../scons.mod"> + %scons; + + <!ENTITY % builders-mod SYSTEM "../generated/builders.mod"> + %builders-mod; + <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> + %functions-mod; + <!ENTITY % tools-mod SYSTEM "../generated/tools.mod"> + %tools-mod; + <!ENTITY % variables-mod SYSTEM "../generated/variables.mod"> + %variables-mod; +]> + +<chapter id="chap-java" + xmlns="http://www.scons.org/dbxsd/v1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd scons.xsd"> +<title>Java Builds</title> + <!-- - Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation + Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -57,9 +78,38 @@ </para> - <programlisting> - Java('classes', 'src') - </programlisting> + <scons_example name="java_java"> + <file name="SConstruct" printme="1"> +Java('classes', 'src') + </file> + <file name="src/Example1.java"> +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="src/Example2.java"> +public class Example2 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="src/Example3.java"> +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + </scons_example> <para> @@ -69,10 +119,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java - </screen> + <scons_output example="java_java" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> <para> @@ -104,9 +153,54 @@ </para> - <programlisting> - Java('classes', 'src') - </programlisting> + <scons_example name="java_java-classes"> + <file name="SConstruct" printme="1"> +Java('classes', 'src') + </file> + <file name="src/Example1.java"> +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} +public class AdditionalClass1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="src/Example2.java"> +public class Example2 +{ + class Inner2 { + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } + } +} + </file> + <file name="src/Example3.java"> +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} +public class AdditionalClass3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + </scons_example> <para> @@ -117,12 +211,10 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java - % <userinput>scons -Q classes</userinput> - scons: `classes' is up to date. - </screen> + <scons_output example="java_java-classes" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + <scons_output_command>scons -Q classes</scons_output_command> + </scons_output> <para> @@ -143,17 +235,10 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java - % <userinput>scons -Q -c classes</userinput> - Removed classes/Example1.class - Removed classes/AdditionalClass1.class - Removed classes/Example2$Inner2.class - Removed classes/Example2.class - Removed classes/Example3.class - Removed classes/AdditionalClass3.class - </screen> + <scons_output example="java_java-classes" suffix="2"> + <scons_output_command>scons -Q</scons_output_command> + <scons_output_command>scons -Q -c classes</scons_output_command> + </scons_output> <para> @@ -167,9 +252,9 @@ </para> - <programlisting> - Java('classes', 'src', JAVAVERSION='1.6') - </programlisting> + <sconstruct> +Java('classes', 'src', JAVAVERSION='1.6') + </sconstruct> <para> See <varname>JAVAVERSION</varname> in the man page for more information. @@ -193,10 +278,39 @@ </para> - <programlisting> - Java(target = 'classes', source = 'src') - Jar(target = 'test.jar', source = 'classes') - </programlisting> + <scons_example name="java_jar1"> + <file name="SConstruct" printme="1"> +Java(target = 'classes', source = 'src') +Jar(target = 'test.jar', source = 'classes') + </file> + <file name="src/Example1.java"> +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="src/Example2.java"> +public class Example2 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="src/Example3.java"> +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + </scons_example> <para> @@ -207,11 +321,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src src/Example1.java src/Example2.java src/Example3.java - jar cf test.jar classes - </screen> + <scons_output example="java_jar1" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> <para> @@ -230,12 +342,50 @@ </para> - <programlisting> - prog1_class_files = Java(target = 'classes', source = 'prog1') - prog2_class_files = Java(target = 'classes', source = 'prog2') - Jar(target = 'prog1.jar', source = prog1_class_files) - Jar(target = 'prog2.jar', source = prog2_class_files) - </programlisting> + <scons_example name="java_jar2"> + <file name="SConstruct" printme="1"> +prog1_class_files = Java(target = 'classes', source = 'prog1') +prog2_class_files = Java(target = 'classes', source = 'prog2') +Jar(target = 'prog1.jar', source = prog1_class_files) +Jar(target = 'prog2.jar', source = prog2_class_files) + </file> + <file name="prog1/Example1.java"> +public class Example1 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="prog1/Example2.java"> +public class Example2 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="prog2/Example3.java"> +public class Example3 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + <file name="prog2/Example4.java"> +public class Example4 +{ + public static void main(String[] args) + { + System.out.println("Hello Java world!\n"); + } +} + </file> + </scons_example> <para> @@ -247,13 +397,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath prog1 prog1/Example1.java prog1/Example2.java - javac -d classes -sourcepath prog2 prog2/Example3.java prog2/Example4.java - jar cf prog1.jar -C classes Example1.class -C classes Example2.class - jar cf prog2.jar -C classes Example3.class -C classes Example4.class - </screen> + <scons_output example="java_jar2" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> </section> @@ -270,10 +416,39 @@ </para> - <programlisting> - classes = Java(target = 'classes', source = 'src/pkg/sub') - JavaH(target = 'native', source = classes) - </programlisting> + <scons_example name="java_javah"> + <file name="SConstruct" printme="1"> +classes = Java(target = 'classes', source = 'src/pkg/sub') +JavaH(target = 'native', source = classes) + </file> + <file name="src/pkg/sub/Example1.java"> +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example2.java"> +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example3.java"> +package pkg.sub; +public class Example3 +{ + public static void main(String[] args) + { + } +} + </file> + </scons_example> <para> @@ -287,11 +462,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java src/pkg/sub/Example3.java - javah -d native -classpath classes pkg.sub.Example1 pkg.sub.Example2 pkg.sub.Example3 - </screen> + <scons_output example="java_javah" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> <para> @@ -327,13 +500,42 @@ </para> - <programlisting> - Java(target = 'classes', source = 'src/pkg/sub') - class_file_list = ['classes/pkg/sub/Example1.class', - 'classes/pkg/sub/Example2.class', - 'classes/pkg/sub/Example3.class'] - JavaH(target = 'native', source = class_file_list, JAVACLASSDIR = 'classes') - </programlisting> + <scons_example name="java_JAVACLASSDIR"> + <file name="SConstruct" printme="1"> +Java(target = 'classes', source = 'src/pkg/sub') +class_file_list = ['classes/pkg/sub/Example1.class', + 'classes/pkg/sub/Example2.class', + 'classes/pkg/sub/Example3.class'] +JavaH(target = 'native', source = class_file_list, JAVACLASSDIR = 'classes') + </file> + <file name="src/pkg/sub/Example1.java"> +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example2.java"> +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example3.java"> +package pkg.sub; +public class Example3 +{ + public static void main(String[] args) + { + } +} + </file> + </scons_example> <para> @@ -343,11 +545,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java src/pkg/sub/Example3.java - javah -d native -classpath classes pkg.sub.Example1 pkg.sub.Example2 pkg.sub.Example3 - </screen> + <scons_output example="java_JAVACLASSDIR" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> <para> @@ -358,10 +558,39 @@ </para> - <programlisting> - classes = Java(target = 'classes', source = 'src/pkg/sub') - JavaH(target = File('native.h'), source = classes) - </programlisting> + <scons_example name="java_javah_file"> + <file name="SConstruct" printme="1"> +classes = Java(target = 'classes', source = 'src/pkg/sub') +JavaH(target = File('native.h'), source = classes) + </file> + <file name="src/pkg/sub/Example1.java"> +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example2.java"> +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example3.java"> +package pkg.sub; +public class Example3 +{ + public static void main(String[] args) + { + } +} + </file> + </scons_example> <para> @@ -376,11 +605,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java src/pkg/sub/Example3.java - javah -o native.h -classpath classes pkg.sub.Example1 pkg.sub.Example2 pkg.sub.Example3 - </screen> + <scons_output example="java_javah_file" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> </section> @@ -400,10 +627,30 @@ </para> - <programlisting> - classes = Java(target = 'classes', source = 'src/pkg/sub') - RMIC(target = 'outdir', source = classes) - </programlisting> + <scons_example name="java_RMIC"> + <file name="SConstruct" printme="1"> +classes = Java(target = 'classes', source = 'src/pkg/sub') +RMIC(target = 'outdir', source = classes) + </file> + <file name="src/pkg/sub/Example1.java"> +package pkg.sub; +public class Example1 +{ + public static void main(String[] args) + { + } +} + </file> + <file name="src/pkg/sub/Example2.java"> +package pkg.sub; +public class Example2 +{ + public static void main(String[] args) + { + } +} + </file> + </scons_example> <para> @@ -414,11 +661,9 @@ </para> - <screen> - % <userinput>scons -Q</userinput> - javac -d classes -sourcepath src/pkg/sub src/pkg/sub/Example1.java src/pkg/sub/Example2.java - rmic -d outdir -classpath classes pkg.sub.Example1 pkg.sub.Example2 - </screen> + <scons_output example="java_RMIC" suffix="1"> + <scons_output_command>scons -Q</scons_output_command> + </scons_output> <para> @@ -431,3 +676,5 @@ </para> </section> + +</chapter> |