소스 검색

added design docs to build

removed manifest task - now uses built in ant manifest task (under jar)


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194607 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_20_4-doc
Keiron Liddle 22 년 전
부모
커밋
3d1be63b36
2개의 변경된 파일18개의 추가작업 그리고 239개의 파일을 삭제
  1. 18
    8
      build.xml
  2. 0
    231
      src/org/apache/fop/tools/anttasks/Manifest.java

+ 18
- 8
build.xml 파일 보기

@@ -274,7 +274,6 @@ Sometimes ant gives out this warnings, but the build is finished without any pro

<taskdef name="serHyph" classname="org.apache.fop.tools.anttasks.SerializeHyphPattern"/>
<taskdef name="xslt" classname="org.apache.fop.tools.anttasks.Xslt"/>
<taskdef name="manifest" classname="org.apache.fop.tools.anttasks.Manifest"/>
<taskdef name="runTest" classname="org.apache.fop.tools.anttasks.RunTest"/>

<property name="main.class" value="org.apache.fop.apps.Fop"/>
@@ -494,14 +493,21 @@ Sometimes ant gives out this warnings, but the build is finished without any pro
<!-- =================================================================== -->
<target name="package" depends="compile,hyphenation">
<echo message="Creating the jar file ${build.dir}/${name}.jar"/>
<manifest file="${build.dir}/Manifest.txt" overwrite="yes"
mainclass="${main.class}"
classpath="${runtime.classpath}"
impltitle="${Name}" implversion="${version}"
implvendor="Apache Software Foundation (http://xml.apache.org/fop/)"/>
<jar jarfile="${build.dir}/${name}.jar" manifest="${build.dir}/Manifest.txt"
<tstamp>
<format property="ts" pattern="yyyyMMdd-HHmmss-z"/>
</tstamp>
<jar jarfile="${build.dir}/${name}.jar"
basedir="${build.dest}"
includes="org/**,conf/**,hyph/**"/>
includes="org/**,conf/**,hyph/**">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${runtime.classpath}"/>
<attribute name="Implementation-Title" value="${Name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation (http://xml.apache.org/fop/)"/>
<attribute name="Build-Id" value="${ts} (${user.name} [${os.name} ${os.version} ${os.arch}])"/>
</manifest>
</jar>
</target>

<target name="test" depends="package">
@@ -562,6 +568,10 @@ Sometimes ant gives out this warnings, but the build is finished without any pro
<classpath refid="libs-build-classpath"/>
<arg line="targetDirectory=${docs} ${xdocs}/book.xml ${skins}"/>
</java>
<java classname="${doc.generator}" fork="yes">
<classpath refid="libs-build-classpath"/>
<arg line="targetDirectory=${docs}/design/ docs/design/book.xml ${skins}"/>
</java>
</target>

<target name="pdfdoc" depends="package">

+ 0
- 231
src/org/apache/fop/tools/anttasks/Manifest.java 파일 보기

@@ -1,231 +0,0 @@
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/

package org.apache.fop.tools.anttasks;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;

import java.io.*;
import java.text.SimpleDateFormat;
import java.net.InetAddress;
import java.util.Date;
import java.util.Properties;



/**
* Creates a manifest file for packing into a jar.
* <P>
* Attributes are as follows:
* <dl>
* <dt>file</dt> <dd>the manifest file to write out to (required)</dd>
* <dt>overwrite</dt> <dd>if set to yes or true, overwrite the given
* manifest file. Default is no</dd>
* <dt>version</dt> <dd>manifest version. Defaults to "1.0"</dd>
* <dt>spectitle</dt> <dd>the specification title</dd>
* <dt>specversion</dt> <dd>the specification version</dd>
* <dt>specvendor</dt> <dd>the specification vendor</dd>
* <dt>impltitle</dt> <dd>the implementation title</dd>
* <dt>implversion</dt> <dd>the implementation version.</dd>
* <dt>implvendor</dt> <dd>the implementation vendor</dd>
* <dt>mainclass</dt> <dd>the class to run when java -jar is invoked</dd>
* <dt>classpath</dt> <dd>the classpath to use when java -jar is invoked</dd>
* <dt>createdby</dt> <dd>the string to set the Created-By field to</dd>
* <dt>buildid</dt> <dd>A build identifier. Defaults to a build identifier
* containing <tt>date + " ("+username+"@"+hostname+" ["+os+" "+version+" "+arch+"]</tt> </dd>
* </dl>
*
* @author Kelly A. Campbell
*/

public class Manifest extends Task {
public static final String MANIFEST_VERSION = "Manifest-Version: ";
public static final String CREATED_BY = "Created-By: ";
public static final String REQUIRED_VERSION = "Required-Version: ";

public static final String SPECIFICATION_TITLE = "Specification-Title: ";
public static final String SPECIFICATION_VERSION =
"Specification-Version: ";
public static final String SPECIFICATION_VENDOR =
"Specification-Vendor: ";
public static final String IMPL_TITLE = "Implementation-Title: ";
public static final String IMPL_VERSION = "Implementation-Version: ";
public static final String IMPL_VENDOR = "Implementation-Vendor: ";
public static final String BUILD_ID = "Build-ID: ";
public static final String MAIN_CLASS = "Main-Class: ";
public static final String CLASS_PATH = "Class-Path: ";


private String _manifestVersion = "1.0";
private String _spectitle;
private String _specvers;
private String _specvend;
private String _impltitle;
private String _implvers;
private String _implvend;
private String _mainclass;
private String _classpath;
private String _createdby;
private String _buildid;

private String _manifestFilename;
private Boolean _overwrite = Boolean.FALSE;

public void setFile(String s) {
_manifestFilename = s;
}

public void setOverwrite(Boolean b) {
_overwrite = b;
}

public void setSpectitle(String s) {
_spectitle = s;
}

public void setSpecversion(String s) {
_specvers = s;
}

public void setSpecvendor(String s) {
_specvend = s;
}

public void setImpltitle(String s) {
_impltitle = s;
}

public void setImplversion(String s) {
_implvers = s;
}

public void setImplvendor(String s) {
_implvend = s;
}

public void setMainclass(String s) {
_mainclass = s;
}

public void setClasspath(String s) {
_classpath = s;
}

public void setCreatedby(String s) {
_createdby = s;
}

public void setBuildid(String s) {
_buildid = s;
}

/**
* Main task method which runs this task and creates the manifest file.
* @exception BuildException if one of the required attributes isn't set
*/
public void execute() throws BuildException {
// System.out.println("Executing manifest task");

PrintWriter out;
try {
if (_manifestFilename != null) {
// open the file for writing
File f = new File(_manifestFilename);
if (f.exists()) {
if (_overwrite.booleanValue()) {
f.delete();
} else {
throw new BuildException("Will not overwrite existing file: "
+ _manifestFilename
+ ". Use overwrite='yes' if you wish to overwrite the file.");
}
}
System.out.println("creating " + f);

// jdk1.2 -- f.createNewFile();
out = new PrintWriter(new FileOutputStream(f));

} else {
throw new BuildException("Manifest task requires a 'file' attribute");
}
} catch (IOException ex) {
throw new BuildException(ex);
}

// setup the implementation versionn (buildID)
if (_buildid == null || _buildid.trim().equals("")) {
_buildid = createBuildID();
}
if (_createdby == null || _createdby.trim().equals("")) {
_createdby = getCreator();
}

print(out, MANIFEST_VERSION, _manifestVersion);
print(out, CREATED_BY, _createdby);

print(out, SPECIFICATION_TITLE, _spectitle);
print(out, SPECIFICATION_VERSION, _specvers);
print(out, SPECIFICATION_VENDOR, _specvend);
print(out, IMPL_TITLE, _impltitle);
print(out, IMPL_VERSION, _implvers);
print(out, IMPL_VENDOR, _implvend);
print(out, BUILD_ID, _buildid);
print(out, MAIN_CLASS, _mainclass);
print(out, CLASS_PATH, _classpath);

out.flush();
out.close();

}

protected void print(PrintWriter out, String header, String value) {
if (value != null &&!value.trim().equals("")) {
out.println(header + value);
// System.out.println("manifest: "+header+value);
}
}

private static String createBuildID() {
Date d = new Date();
SimpleDateFormat f = new SimpleDateFormat("yyyyMMdd-HHmmss-z");
String date = f.format(d);
String hostname, username, os, version, arch;
try {
hostname = InetAddress.getLocalHost().getHostName();
} catch (Exception ex) {
hostname = "unknown";
}
username = System.getProperty("user.name");
os = System.getProperty("os.name");
version = System.getProperty("os.version");
arch = System.getProperty("os.arch");
String buildid = date + " (" + username + "@" + hostname + " [" + os
+ " " + version + " " + arch + "])";
return buildid;

}

private static String getCreator() {
try {
Properties props = new Properties();
InputStream in =
org.apache.tools.ant.Main.class.getResourceAsStream("/org/apache/tools/ant/version.txt");
if (in != null) {
props.load(in);
in.close();

return "Ant " + props.getProperty("VERSION");
} else {
return null;
}
} catch (IOException ex) {
return null;
}
}

}

Loading…
취소
저장