mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
mac build fixes
move update and variants file to core project and integrate into Jar
This commit is contained in:
+13
-13
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
||||
<classpathentry kind="lib" path="lib/app-framework.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/java-http-proxy.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
|
||||
<classpathentry kind="lib" path="lib/junit-4.7.jar"/>
|
||||
<classpathentry kind="lib" path="lib/app-framework.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/java-http-proxy.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -98,48 +99,54 @@ public class Presenter implements IPlugInPort {
|
||||
|
||||
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;
|
||||
// Read the latest version from the local update.xml file
|
||||
static {
|
||||
try {
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream("update.xml"));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Version> allVersions = (List<Version>) xStream.fromXML(in);
|
||||
CURRENT_VERSION = allVersions.get(allVersions.size() - 1).getVersionNumber();
|
||||
LOG.info("Current DIYLC version: " + CURRENT_VERSION);
|
||||
RECENT_VERSIONS = allVersions.subList(allVersions.size() - 10, allVersions.size());
|
||||
Collections.sort(RECENT_VERSIONS, new Comparator<Version>() {
|
||||
static {
|
||||
try {
|
||||
URL resource = Presenter.class.getClassLoader().getResource("org/diylc/presenter/update.xml");
|
||||
if (resource != null) {
|
||||
BufferedInputStream in = new BufferedInputStream(resource.openStream());
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Version> allVersions = (List<Version>) xStream.fromXML(in);
|
||||
CURRENT_VERSION = allVersions.get(allVersions.size() - 1).getVersionNumber();
|
||||
LOG.info("Current DIYLC version: " + CURRENT_VERSION);
|
||||
RECENT_VERSIONS = allVersions.subList(allVersions.size() - 10, allVersions.size());
|
||||
Collections.sort(RECENT_VERSIONS, new Comparator<Version>() {
|
||||
|
||||
@Override
|
||||
public int compare(Version o1, Version o2) {
|
||||
return -o1.getVersionNumber().compareTo(o2.getVersionNumber());
|
||||
}
|
||||
});
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not find version number, using default", e);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int compare(Version o1, Version o2) {
|
||||
return -o1.getVersionNumber().compareTo(o2.getVersionNumber());
|
||||
}
|
||||
});
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not find version number, using default", e);
|
||||
}
|
||||
}
|
||||
public static final String DEFAULTS_KEY_PREFIX = "default.";
|
||||
|
||||
private static Map<String, List<Template>> defaultVariantMap = null;
|
||||
static {
|
||||
try {
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream("variants.xml"));
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, List<Template>> map = (Map<String, List<Template>>) xStream.fromXML(in);
|
||||
defaultVariantMap = new TreeMap<String, List<Template>>(String.CASE_INSENSITIVE_ORDER);
|
||||
defaultVariantMap.putAll(map);
|
||||
in.close();
|
||||
LOG.info(String.format("Loaded default variants for %d components", defaultVariantMap == null ? 0
|
||||
: defaultVariantMap.size()));
|
||||
} catch (IOException e) {
|
||||
LOG.error("Could not load default variants", e);
|
||||
}
|
||||
}
|
||||
private static Map<String, List<Template>> defaultVariantMap = null;
|
||||
static {
|
||||
try {
|
||||
URL resource = Presenter.class.getClassLoader().getResource("org/diylc/presenter/variants.xml");
|
||||
if (resource != null) {
|
||||
BufferedInputStream in = new BufferedInputStream(resource.openStream());
|
||||
XStream xStream = new XStream(new DomDriver());
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, List<Template>> map = (Map<String, List<Template>>) xStream.fromXML(in);
|
||||
defaultVariantMap = new TreeMap<String, List<Template>>(String.CASE_INSENSITIVE_ORDER);
|
||||
defaultVariantMap.putAll(map);
|
||||
in.close();
|
||||
LOG.info(String.format("Loaded default variants for %d components",
|
||||
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();
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -72,6 +72,7 @@
|
||||
<attribute name="Class-Path" value="${manifest.class.path}" />
|
||||
<attribute name="SplashScreen-Image" value="splash.png" />
|
||||
</manifest>
|
||||
<zipfileset dir="." includes="config.properties" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
@@ -96,7 +97,6 @@
|
||||
<arg value="-nosign"/>
|
||||
<arg value="-v"/>
|
||||
</exec>-->
|
||||
<mkdir dir="${jar.dir}\DIYLC.app" />
|
||||
<bundleapp
|
||||
outputdirectory="${build.dir}"
|
||||
name="DIYLC"
|
||||
@@ -125,7 +125,7 @@
|
||||
<option value="-Xdock:icon=Contents/Resources/diylc.icns"/>
|
||||
</bundleapp>
|
||||
<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>
|
||||
</target>
|
||||
|
||||
@@ -142,13 +142,10 @@
|
||||
<zipfileset dir="templates" prefix="templates" />
|
||||
<zipfileset dir="themes" prefix="themes" />
|
||||
<zipfileset dir="fonts" prefix="fonts" />
|
||||
<zipfileset dir="." includes="update.xml" />
|
||||
<zipfileset dir="." includes="config.properties" />
|
||||
<zipfileset dir="." includes="variants.xml" />
|
||||
<zipfileset dir="." includes="splash.png" />
|
||||
<zipfileset dir="." includes="run.sh" />
|
||||
<zipfileset dir="." includes="diylc.l4j.ini" />
|
||||
<zipfileset dir="." includes="diylc.exe" />
|
||||
<zipfileset dir="." includes="splash.png" />
|
||||
<zipfileset dir="." includes="diylc.exe" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -148,9 +148,9 @@ public class DIYLCStarter {
|
||||
properties = new Properties();
|
||||
try {
|
||||
LOG.info("Injecting default properties.");
|
||||
File f = new File("config.properties");
|
||||
if (f.exists()) {
|
||||
properties.load(new FileInputStream(f));
|
||||
URL resource = Presenter.class.getClassLoader().getResource("config.properties");
|
||||
if (resource != null) {
|
||||
properties.load(resource.openStream());
|
||||
PropertyInjector.injectProperties(properties);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user