Differences between revisions 3 and 4
Revision 3 as of 2018-08-05 07:00:26
Size: 2825
Editor: ?MarkusKoschany
Comment:
Revision 4 as of 2018-08-05 07:14:42
Size: 3134
Editor: ?MarkusKoschany
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
Ant does not have formal conventions which means that source code can be found in different directories depending on the upstream project. It is very common that upstream developers include all build-dependencies in their source packages, so you have to be careful to make sure that all jar or class files are removed before you upload your package. Ant does not have formal conventions which means that source code can be found in different directories depending on the upstream project. It is very common that upstream developers include all build-dependencies in their source packages, so you have to be careful and make sure that all prebuilt jar or class files are removed before you upload your package.
Line 10: Line 10:
Ant is procedural, that means you have to provide information in your build.xml how to build a package. Often the only way to influence the build process is to patch build.xml. In contrast to Maven Ant is mainly a build tool instead of a project management tool. Ant is procedural, that means you have to provide information in your build.xml how to build a package. Often the only way to influence the build process is to patch build.xml. In contrast to Maven Ant is mainly a build tool instead of a project management tool. Ant is a convenient build tool for smaller projects.
Line 37: Line 37:
Using javahelper together with an exported CLASSPATH will automatically modify the default MANIFEST file of the resulting jar file. A Class-Path entry is inserted into the MANIFEST, so that Electric properly detects all runtime dependencies.

Translation(s): English

Ant build system

Ant does not have formal conventions which means that source code can be found in different directories depending on the upstream project. It is very common that upstream developers include all build-dependencies in their source packages, so you have to be careful and make sure that all prebuilt jar or class files are removed before you upload your package.

Ant is procedural, that means you have to provide information in your build.xml how to build a package. Often the only way to influence the build process is to patch build.xml. In contrast to Maven Ant is mainly a build tool instead of a project management tool. Ant is a convenient build tool for smaller projects.

Electric

Electric is a electrical CAD system. The application uses Ant to build the sources. Add ant to Build-Depends and if you use dh sequencer everything else will work automatically.

debian/control:

Build-Depends:
 ant,
 bsh,
 debhelper (>= 11),
 default-jdk,
 javahelper,
 jython,
 libjava3d-java,
 libslf4j-java

debian/rules:

export CLASSPATH=/usr/share/java/bsh.jar:/usr/share/java/j3dcore.jar:/usr/share/java/j3dutils.jar:/usr/share/java/vecmath.jar:/usr/share/java/slf4j-simple.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/jython.jar

%:
    dh $@ --with javahelper

Using javahelper together with an exported CLASSPATH will automatically modify the default MANIFEST file of the resulting jar file. A Class-Path entry is inserted into the MANIFEST, so that Electric properly detects all runtime dependencies.

In order to comply with the DFSG system libraries have to be used to compile the package. Since all prebuilt jar files were removed one way to achieve that is to patch build.xml.

<javac encoding="UTF-8" debug="true" includeantruntime="false" destdir="${antBuild}" srcdir="com"
   fork="true" memoryMaximumSize="1024m" source="1.7" target="1.7">
   <classpath>
                <pathelement location="/usr/share/java/bsh.jar" />
                <pathelement location="/usr/share/java/vecmath.jar" />
                <pathelement location="/usr/share/java/j3dcore.jar" />
                <pathelement location="/usr/share/java/j3dutils.jar" />
                <pathelement location="/usr/share/java/slf4j-api.jar" />
                <pathelement location="/usr/share/java/scala-library.jar" />
                <pathelement location="/usr/share/java/jython.jar" />
 </classpath>
</javac>

As you can see the compilation is executed within a javac task block in build.xml. You can pass different options to the javac compiler similar to how it would be done on the command-line (e.g. changing the encoding and source/target values). The classpath is a nested element which contains further pathelement locations. These point to the system libraries in /usr/share/java now. The javac task is explained in more detail in the official documentation.