mac build fixes

move update and variants file to core project and integrate into Jar
This commit is contained in:
bancika
2020-03-21 23:58:43 +01:00
parent 85a37a2fd7
commit 7477c606f4
9 changed files with 7286 additions and 60 deletions
+13 -13
View File
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/> <classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/> <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/junit-4.7.jar"/> <classpathentry kind="lib" path="lib/junit-4.7.jar"/>
<classpathentry kind="lib" path="lib/app-framework.jar"/> <classpathentry kind="lib" path="lib/app-framework.jar"/>
<classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/> <classpathentry kind="lib" path="lib/jettison-1.0.1.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/> <classpathentry kind="lib" path="lib/xstream-1.3.1.jar"/>
<classpathentry kind="lib" path="lib/java-http-proxy.jar"/> <classpathentry kind="lib" path="lib/java-http-proxy.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
@@ -33,6 +33,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@@ -98,48 +99,54 @@ public class Presenter implements IPlugInPort {
private static final Logger LOG = Logger.getLogger(Presenter.class); private static final Logger LOG = Logger.getLogger(Presenter.class);
public static VersionNumber CURRENT_VERSION = new VersionNumber(3, 0, 0); public static VersionNumber CURRENT_VERSION = new VersionNumber(4, 0, 0);
public static List<Version> RECENT_VERSIONS = null; public static List<Version> RECENT_VERSIONS = null;
// Read the latest version from the local update.xml file // Read the latest version from the local update.xml file
static { static {
try { try {
BufferedInputStream in = new BufferedInputStream(new FileInputStream("update.xml")); URL resource = Presenter.class.getClassLoader().getResource("org/diylc/presenter/update.xml");
XStream xStream = new XStream(new DomDriver()); if (resource != null) {
@SuppressWarnings("unchecked") BufferedInputStream in = new BufferedInputStream(resource.openStream());
List<Version> allVersions = (List<Version>) xStream.fromXML(in); XStream xStream = new XStream(new DomDriver());
CURRENT_VERSION = allVersions.get(allVersions.size() - 1).getVersionNumber(); @SuppressWarnings("unchecked")
LOG.info("Current DIYLC version: " + CURRENT_VERSION); List<Version> allVersions = (List<Version>) xStream.fromXML(in);
RECENT_VERSIONS = allVersions.subList(allVersions.size() - 10, allVersions.size()); CURRENT_VERSION = allVersions.get(allVersions.size() - 1).getVersionNumber();
Collections.sort(RECENT_VERSIONS, new Comparator<Version>() { LOG.info("Current DIYLC version: " + CURRENT_VERSION);
RECENT_VERSIONS = allVersions.subList(allVersions.size() - 10, allVersions.size());
Collections.sort(RECENT_VERSIONS, new Comparator<Version>() {
@Override @Override
public int compare(Version o1, Version o2) { public int compare(Version o1, Version o2) {
return -o1.getVersionNumber().compareTo(o2.getVersionNumber()); return -o1.getVersionNumber().compareTo(o2.getVersionNumber());
} }
}); });
in.close(); in.close();
} catch (IOException e) { }
LOG.error("Could not find version number, using default", e); } catch (IOException e) {
} LOG.error("Could not find version number, using default", e);
} }
}
public static final String DEFAULTS_KEY_PREFIX = "default."; public static final String DEFAULTS_KEY_PREFIX = "default.";
private static Map<String, List<Template>> defaultVariantMap = null; private static Map<String, List<Template>> defaultVariantMap = null;
static { static {
try { try {
BufferedInputStream in = new BufferedInputStream(new FileInputStream("variants.xml")); URL resource = Presenter.class.getClassLoader().getResource("org/diylc/presenter/variants.xml");
XStream xStream = new XStream(new DomDriver()); if (resource != null) {
@SuppressWarnings("unchecked") BufferedInputStream in = new BufferedInputStream(resource.openStream());
Map<String, List<Template>> map = (Map<String, List<Template>>) xStream.fromXML(in); XStream xStream = new XStream(new DomDriver());
defaultVariantMap = new TreeMap<String, List<Template>>(String.CASE_INSENSITIVE_ORDER); @SuppressWarnings("unchecked")
defaultVariantMap.putAll(map); Map<String, List<Template>> map = (Map<String, List<Template>>) xStream.fromXML(in);
in.close(); defaultVariantMap = new TreeMap<String, List<Template>>(String.CASE_INSENSITIVE_ORDER);
LOG.info(String.format("Loaded default variants for %d components", defaultVariantMap == null ? 0 defaultVariantMap.putAll(map);
: defaultVariantMap.size())); in.close();
} catch (IOException e) { LOG.info(String.format("Loaded default variants for %d components",
LOG.error("Could not load default variants", e); defaultVariantMap == null ? 0 : defaultVariantMap.size()));
} }
} } catch (IOException e) {
LOG.error("Could not load default variants", e);
}
}
public static final List<IDIYComponent<?>> EMPTY_SELECTION = Collections.emptyList(); public static final List<IDIYComponent<?>> EMPTY_SELECTION = Collections.emptyList();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
+4 -7
View File
@@ -72,6 +72,7 @@
<attribute name="Class-Path" value="${manifest.class.path}" /> <attribute name="Class-Path" value="${manifest.class.path}" />
<attribute name="SplashScreen-Image" value="splash.png" /> <attribute name="SplashScreen-Image" value="splash.png" />
</manifest> </manifest>
<zipfileset dir="." includes="config.properties" />
</jar> </jar>
</target> </target>
@@ -96,7 +97,6 @@
<arg value="-nosign"/> <arg value="-nosign"/>
<arg value="-v"/> <arg value="-v"/>
</exec>--> </exec>-->
<mkdir dir="${jar.dir}\DIYLC.app" />
<bundleapp <bundleapp
outputdirectory="${build.dir}" outputdirectory="${build.dir}"
name="DIYLC" name="DIYLC"
@@ -125,7 +125,7 @@
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/> <option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
</bundleapp> </bundleapp>
<zip destfile="${build.dir}/diylc-${diylc.version}-osx.zip"> <zip destfile="${build.dir}/diylc-${diylc.version}-osx.zip">
<zipfileset filemode="755" dir="${jar.dir}/DIYLC.app" prefix="DIYLC.app" /> <zipfileset filemode="755" dir="${build.dir}/DIYLC.app" prefix="DIYLC.app" />
</zip> </zip>
</target> </target>
@@ -142,13 +142,10 @@
<zipfileset dir="templates" prefix="templates" /> <zipfileset dir="templates" prefix="templates" />
<zipfileset dir="themes" prefix="themes" /> <zipfileset dir="themes" prefix="themes" />
<zipfileset dir="fonts" prefix="fonts" /> <zipfileset dir="fonts" prefix="fonts" />
<zipfileset dir="." includes="update.xml" /> <zipfileset dir="." includes="splash.png" />
<zipfileset dir="." includes="config.properties" />
<zipfileset dir="." includes="variants.xml" />
<zipfileset dir="." includes="run.sh" /> <zipfileset dir="." includes="run.sh" />
<zipfileset dir="." includes="diylc.l4j.ini" /> <zipfileset dir="." includes="diylc.l4j.ini" />
<zipfileset dir="." includes="diylc.exe" /> <zipfileset dir="." includes="diylc.exe" />
<zipfileset dir="." includes="splash.png" />
</zip> </zip>
</target> </target>
Binary file not shown.
Binary file not shown.
@@ -148,9 +148,9 @@ public class DIYLCStarter {
properties = new Properties(); properties = new Properties();
try { try {
LOG.info("Injecting default properties."); LOG.info("Injecting default properties.");
File f = new File("config.properties"); URL resource = Presenter.class.getClassLoader().getResource("config.properties");
if (f.exists()) { if (resource != null) {
properties.load(new FileInputStream(f)); properties.load(resource.openStream());
PropertyInjector.injectProperties(properties); PropertyInjector.injectProperties(properties);
} }
} catch (Exception e) { } catch (Exception e) {