Skip to content

Commit

Permalink
Added back ant tasks for the generation of Javadoc for the common cla…
Browse files Browse the repository at this point in the history
…sses, and changed where they get bundled to, to be inside the greenfoot directory.
  • Loading branch information
neilccbrown committed Oct 19, 2023
1 parent 7cda778 commit 81e13f5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 38 deletions.
43 changes: 35 additions & 8 deletions bluej/package/greenfoot-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
<fileset dir="${bluej_home}">
<patternset refid="bluej.libfiles" />
<patternset refid="bluej.libdirs" />
<patternset refid="gfapidoc.files" />
</fileset>
<fileset dir="${greenfoot_home}/build/resources/main" >
<patternset refid="bluej.libfiles" />
Expand All @@ -100,11 +101,6 @@
<fileset dir="${greenfoot_home}" includes="common/**">
</fileset>
</copy>
<copy todir="install_tmp/greenfoot" preservelastmodified="true">
<fileset dir="${bluej_home}">
<patternset refid="gfapidoc.files" />
</fileset>
</copy>
<copy todir="install_tmp/doc" preservelastmodified="true">
<fileset dir="${greenfoot_home}/doc">
<patternset refid="greenfoot.license.files" />
Expand All @@ -126,6 +122,34 @@
</fileset>
</delete>

<!-- Include the classes from the common directory -->
<javadoc destdir="${greenfoot_home}/common"
Version="yes" notree="yes" noindex="yes" nohelp="yes" nonavbar="yes"
classpath="${greenfoot_home}/build/classes/java/main:${threadchecker.build}"
encoding="UTF-8"
executable="${build_java_home}/bin/javadoc"
additionalparam="-Xdoclint:none"
>
<fileset dir="${greenfoot_home}/common/"/>
</javadoc>

<copy todir="install_tmp/greenfoot" preservelastmodified="true">
<fileset dir="${greenfoot_home}">
<patternset>
<include name="common/*.java" />
<include name="common/*.stride" />
<!-- <include name="common/${common.class}.class" /> -->
<include name="common/*.html" />
<include name="common/*.png" />
<include name="common/*.jpg" />
<include name="common/*.jpeg" />
<include name="common/inherit.gif" />
<include name="common/*.js" />
<include name="common/*.css" />
</patternset>
</fileset>
</copy>

<!-- jar the entire distribution into one jar file -->
<!-- (use zip instead of jar to avoid generation of manifest) -->
<zip zipfile="greenfoot-dist.jar"
Expand Down Expand Up @@ -245,17 +269,20 @@
<fileset dir="install_tmp">
<patternset refid="bluej.libfiles" />
<patternset refid="bluej.libdirs" />
<patternset refid="gfapidoc.files" />
</fileset>
<fileset dir="${bluej_home}/build/resources/main" >
<patternset refid="bluej.libfiles"/>
</fileset>
</copy>
<copy todir="Greenfoot.app/Contents/Java/greenfoot">
<fileset dir="install_tmp/greenfoot">
<patternset refid="gfapidoc.files" />
</fileset>
<fileset dir="${greenfoot_home}" includes="common/**"/>
</copy>
<copy todir="Greenfoot.app/Contents/Java/doc">
<fileset dir="install_tmp/doc">
<patternset refid="greenfoot.license.files" />
</fileset>
</copy>

<move todir="Greenfoot.app/Contents/Java">
<fileset dir="Greenfoot.app/Contents/Java/lib" />
Expand Down
22 changes: 1 addition & 21 deletions bluej/src/main/java/bluej/utility/Utility.java
Original file line number Diff line number Diff line change
Expand Up @@ -1019,26 +1019,6 @@ public static <T> List<T> nonNulls(List<T> orig)
return orig.stream().filter(x -> x != null).collect(Collectors.toList());
}

/**
* Tries to locate the top level greenfoot dir. This method takes the
* different platforms into account. Specifically the Mac has a different
* structure.
*
* @throws IOException If it can't read the greenfoot dir.
*
*/
public static File getGreenfootDir()
throws IOException
{
File libDir = Config.getBlueJLibDir();
// The parent dir of the lib dir is the top level dir of greenfoot
File greenfootDir = libDir.getParentFile();
if (greenfootDir == null || !(greenfootDir.isDirectory() && greenfootDir.canRead())) {
throw new IOException("Could not read from greenfoot directory: " + greenfootDir);
}
return greenfootDir;
}

public static String getGreenfootApiDocURL(String page) throws IOException,
MalformedURLException
{
Expand All @@ -1051,7 +1031,7 @@ public static String getGreenfootApiDocURL(String page) throws IOException,
}
else
{
File greenfootDir = getGreenfootDir();
File greenfootDir = Config.getGreenfootLibDir();
File location = new File(greenfootDir, "/doc/API/" + page);
if (location.canRead()) {
customUrl = location.toURI().toURL().toString();
Expand Down
14 changes: 5 additions & 9 deletions greenfoot/src/main/java/greenfoot/export/Exporter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
This file is part of the Greenfoot program.
Copyright (C) 2005-2009,2010,2011,2012,2013,2015,2018,2022 Poul Henriksen and Michael Kolling
Copyright (C) 2005-2009,2010,2011,2012,2013,2015,2018,2022,2023 Poul Henriksen and Michael Kolling
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -360,14 +360,10 @@ private void makeApplication()
}

// Add text file with license information
try {
File license = new File(Utility.getGreenfootDir(), "GREENFOOT_LICENSES.txt");
if(license.exists()) {
jarCreator.addFile(license);
}
}
catch (IOException e) {
// Ignore exceptions with license file since it is not a crucial thing to include.
File license = new File(Config.getGreenfootLibDir(), "GREENFOOT_LICENSES.txt");
if (license.exists())
{
jarCreator.addFile(license);
}

jarCreator.create();
Expand Down

0 comments on commit 81e13f5

Please sign in to comment.