2010-11-15 20:35:36 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2023-02-22 18:43:48 +00:00
|
|
|
* (C) Copyright 2009-2024, Arnaud Roques
|
2010-11-15 20:35:36 +00:00
|
|
|
*
|
2023-02-22 18:43:48 +00:00
|
|
|
* Project Info: https://plantuml.com
|
2022-08-17 17:34:24 +00:00
|
|
|
*
|
2017-03-15 19:13:31 +00:00
|
|
|
* If you like this project or if you find it useful, you can support us at:
|
2022-08-17 17:34:24 +00:00
|
|
|
*
|
2023-02-22 18:43:48 +00:00
|
|
|
* https://plantuml.com/patreon (only 1$ per month!)
|
|
|
|
* https://plantuml.com/paypal
|
2022-08-17 17:34:24 +00:00
|
|
|
*
|
2010-11-15 20:35:36 +00:00
|
|
|
* This file is part of PlantUML.
|
|
|
|
*
|
|
|
|
* PlantUML is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PlantUML distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
2013-12-10 19:36:50 +00:00
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
2010-11-15 20:35:36 +00:00
|
|
|
* License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Original Author: Arnaud Roques
|
2022-08-17 17:34:24 +00:00
|
|
|
*
|
2010-11-15 20:35:36 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
package net.sourceforge.plantuml.version;
|
|
|
|
|
2015-04-07 18:18:37 +00:00
|
|
|
import java.util.Date;
|
|
|
|
|
2022-08-17 17:34:24 +00:00
|
|
|
import net.sourceforge.plantuml.log.Logme;
|
2020-05-30 15:20:23 +00:00
|
|
|
import net.sourceforge.plantuml.security.SURL;
|
2023-05-17 19:34:24 +00:00
|
|
|
import net.sourceforge.plantuml.utils.SignatureUtils;
|
2020-05-30 15:20:23 +00:00
|
|
|
|
2010-11-15 20:35:36 +00:00
|
|
|
public class Version {
|
2023-05-17 19:34:24 +00:00
|
|
|
// ::remove folder when __HAXE__
|
2010-11-15 20:35:36 +00:00
|
|
|
|
2023-05-17 19:34:24 +00:00
|
|
|
private static final String version = "1.2023.8beta2";
|
2023-04-04 21:13:35 +00:00
|
|
|
|
2023-04-05 07:15:43 +00:00
|
|
|
public static String versionString() {
|
2023-05-17 19:34:24 +00:00
|
|
|
return version;
|
2017-03-21 21:37:59 +00:00
|
|
|
}
|
2020-02-18 21:24:31 +00:00
|
|
|
|
2019-07-14 20:09:26 +00:00
|
|
|
public static String fullDescription() {
|
|
|
|
return "PlantUML version " + Version.versionString() + " (" + Version.compileTimeString() + ")";
|
|
|
|
}
|
|
|
|
|
2015-05-03 15:36:36 +00:00
|
|
|
public static String versionString(int size) {
|
|
|
|
final StringBuilder sb = new StringBuilder(versionString());
|
2023-05-17 19:34:24 +00:00
|
|
|
while (sb.length() < size)
|
2015-05-03 15:36:36 +00:00
|
|
|
sb.append(' ');
|
2023-05-17 19:34:24 +00:00
|
|
|
|
2023-04-04 21:13:35 +00:00
|
|
|
return sb.toString();
|
2015-04-07 18:18:37 +00:00
|
|
|
}
|
|
|
|
|
2023-04-05 07:15:43 +00:00
|
|
|
public static int beta() {
|
2023-05-17 19:34:24 +00:00
|
|
|
final int x = version.indexOf("beta");
|
|
|
|
if (x == -1)
|
|
|
|
return 0;
|
|
|
|
return Integer.parseInt(version.substring(x + "beta".length()));
|
2023-04-05 07:15:43 +00:00
|
|
|
}
|
2023-04-04 21:13:35 +00:00
|
|
|
|
2023-04-05 07:15:43 +00:00
|
|
|
public static String etag() {
|
2023-05-17 19:34:24 +00:00
|
|
|
return SignatureUtils.getMD5Hex(version);
|
2016-06-19 14:16:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static String turningId() {
|
2017-03-21 21:37:59 +00:00
|
|
|
return etag();
|
2016-06-19 14:16:41 +00:00
|
|
|
}
|
|
|
|
|
2023-04-05 07:15:43 +00:00
|
|
|
public static long compileTime() {
|
2023-05-12 17:28:51 +00:00
|
|
|
return 1683912222767L;
|
2023-04-05 07:15:43 +00:00
|
|
|
}
|
|
|
|
|
2015-04-07 18:18:37 +00:00
|
|
|
public static String compileTimeString() {
|
2023-05-17 19:34:24 +00:00
|
|
|
if (version.contains("beta"))
|
2023-04-05 07:15:43 +00:00
|
|
|
return "Unknown compile time";
|
2023-05-17 19:34:24 +00:00
|
|
|
|
2015-04-07 18:18:37 +00:00
|
|
|
return new Date(Version.compileTime()).toString();
|
2010-11-15 20:35:36 +00:00
|
|
|
}
|
|
|
|
|
2023-02-28 21:22:51 +00:00
|
|
|
// ::comment when __CORE__
|
2015-05-31 18:56:03 +00:00
|
|
|
public static String getJarPath() {
|
|
|
|
try {
|
|
|
|
final ClassLoader loader = Version.class.getClassLoader();
|
2023-04-05 07:15:43 +00:00
|
|
|
if (loader == null) {
|
2015-05-31 18:56:03 +00:00
|
|
|
return "No ClassLoader?";
|
2023-04-05 07:15:43 +00:00
|
|
|
}
|
2020-05-30 15:20:23 +00:00
|
|
|
final SURL url = SURL.create(loader.getResource("net/sourceforge/plantuml/version/Version.class"));
|
2023-04-05 07:15:43 +00:00
|
|
|
if (url == null) {
|
2022-08-17 17:34:24 +00:00
|
|
|
return "No URL?";
|
2023-04-05 07:15:43 +00:00
|
|
|
}
|
2015-05-31 18:56:03 +00:00
|
|
|
String fullpath = url.toString();
|
|
|
|
fullpath = fullpath.replaceAll("net/sourceforge/plantuml/version/Version\\.class", "");
|
|
|
|
return fullpath;
|
|
|
|
} catch (Throwable t) {
|
2022-08-17 17:34:24 +00:00
|
|
|
Logme.error(t);
|
2015-05-31 18:56:03 +00:00
|
|
|
return t.toString();
|
|
|
|
}
|
|
|
|
}
|
2023-02-02 17:59:43 +00:00
|
|
|
// ::done
|
2015-05-31 18:56:03 +00:00
|
|
|
|
2010-11-15 20:35:36 +00:00
|
|
|
}
|