From 7dd725456e316b213b10283b06c80f85ff59e7d0 Mon Sep 17 00:00:00 2001 From: Christian Pierre MOMON Date: Mon, 5 Sep 2016 12:33:29 +0200 Subject: [PATCH] Added full build process. --- .gitignore | 2 + build.num | 3 + build.properties | 3 + build.xml | 233 +++++++++++------- buildandgit.xml | 29 +++ lib/jar-in-jar-loader.zip | Bin 0 -> 7269 bytes scripts/log4j.properties | 11 + scripts/siba.bat | 3 + scripts/siba.command | 7 + scripts/siba.sh | 7 + src/org/dclermonte/siba/cli/SibaCLI.java | 2 + src/org/dclermonte/siba/gui/SibaGUI.java | 3 +- .../siba/util/BuildInformation.java | 175 +++++++++++++ 13 files changed, 386 insertions(+), 92 deletions(-) create mode 100644 build.num create mode 100644 build.properties create mode 100644 buildandgit.xml create mode 100644 lib/jar-in-jar-loader.zip create mode 100644 scripts/log4j.properties create mode 100644 scripts/siba.bat create mode 100644 scripts/siba.command create mode 100644 scripts/siba.sh create mode 100644 src/org/dclermonte/siba/util/BuildInformation.java diff --git a/.gitignore b/.gitignore index fa5143f..ee21036 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /bin/ /test-output/ /javaDoc/ +/build/ +/dist/ diff --git a/build.num b/build.num new file mode 100644 index 0000000..c26a073 --- /dev/null +++ b/build.num @@ -0,0 +1,3 @@ +#Build Number for ANT. Do not edit! +#Mon Sep 05 12:43:48 CEST 2016 +build.number=1 diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..f539b5d --- /dev/null +++ b/build.properties @@ -0,0 +1,3 @@ +product.name=siba +product.revision.major=0 +product.revision.minor=0 diff --git a/build.xml b/build.xml index 9f6b1a4..9fea018 100644 --- a/build.xml +++ b/build.xml @@ -1,93 +1,144 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + Done. + + + + + Type ant -p + + + + + ======================================================================= + + + + + + ======================================================================= + + + classpath=${toString:project.libs} + + + + + + ======================================================================= + + + + + + + + ======================================================================= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildandgit.xml b/buildandgit.xml new file mode 100644 index 0000000..763a794 --- /dev/null +++ b/buildandgit.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/jar-in-jar-loader.zip b/lib/jar-in-jar-loader.zip new file mode 100644 index 0000000000000000000000000000000000000000..6ee121769d728118e8ecf376bf62fe982acf93d1 GIT binary patch literal 7269 zcmbtZ1yEe+vc?97;LP9>Jh)2;8r)q23=(7pcS&&f1ef6M8c1*_1cD_v4DJ#%B=F#7 z@7=q3cen1o*Hd-QKULlRol~c~|Ng&LRX{{Shr5?CFAL#+EPlHn-QDe-tk_lmR0H!j z4GXZHwS%+8Uufd|qG@C9@)z2m|DbIRb+K@Qn%ez^8RK7>*_b+6L+>tj_NL|*PXF?P z`j6MvJ>CqULx6)DM}&hD`Ws&4<>V#pq0TO*P#0%5u$`&1b7sOEbV3X#q4GWSn7K@}ji6;$*G_Zz> zXB<(5D-3X#t6W;KeG>sj_L;!2@k4wytV;`N=Hw^hc?WAVD$Sn>kjv>9L|6#7OsWC- z8kXXm)zeL=xf*b~$~k)#Zn!9Q^O;LJ zigFpFT%f(s1W<@R{J_z zJg<|{V1o~tynwkxyEu4+2$KOV()neq_`(=Ke)0_YnfX6blxg-$3LL%@j<$a=+^HwB>LVek z*RCWVI78ZQZp-j|{|)fZjQSaTH*6=yCh%}@Lw5lv`*(uR)Jfgh39R^!fPScC3bnSh zaCVV{TH5~%#R^p=6$DNkUx2xV9-z~noq|Uke<6_}8ikVtvlzF#S3?iorOr*MDdnNM5O=XML-U z<&^dCDGh`OMPw%~lqZ|O*^*Ii!20W9q1>eB{u2-NC&A~5T#}~d%K=ZjmK#^&v3pYM zwf(*?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H+qhG z+b=I5+Opc3XqD%U;<`8erto)*EukMk8 z4-BZo$DLOdC(t#OoenUk;y6);NpU+Oe0G$iyFsPQj{A{0JV+!zvt~lh{~&%~$2Gr5 z$WMYzqhHr4H^w`3Ye-%}TaRLz(>H9le*hx?155Nt7x9cxTls2W*;YJ;^96-q}S+?83H>;3CX3hslo`dJYy+xetitqlrdWR z7j+HR6@w%*GSK<}Ru)WEL;tyaWJU!wZWfC+`wh|`(|O8)n}YLhd-T0ybmjh^>HO3b z>|*ca`5RH8X=INlPVgATvYxo3jd^2lmb^Ofw1Yr?(TnMe;>-Qef==|j${qu(&5`1s*0VmNR1l>-t?Hft` zKPu1a7x0zysYg`9?0s?doXtSBG5y_RF?vA0Jtk$aO)?fPzevV^sq;(SbFeFZyhN z3O%DkL;hBczJZ(I(|o^Xso@VE&ACLY9rEp>PBEd}?NV%_oAG!_K!ni{zuXc69?zC5 zT)q0Y`ciM^@C{oRn?8z{#_xO78_wZb4$YQ$(~<{>zdS`3CNSu561Eg72elKh2oT>s{&Vg00NPC`c<7Q-t~dC(Wy7T;V( zQw$5Tu@v=md>eeNNwXc{(?p;eW$dtAnflO#`sw94e9n`MPI;B;ae;@F!4|!o7k+nb z8$1F5;-8Nj?t=49aNzdE@9#f{4}WfPKYsWr_ZBpF%YP@`{tD}U9Pv}`Efw#U|8Dtn zIPvGW_v4A5a&PT*xBS)mUu553J;eRE;-}oZskvMJsheLo!{5FB=kdiq{pR~${0*=F zdzkSn&aX`M?>H`Z-NJwS^nYMH{{wIRE9$Sz>hGvRcm4kV3H4|B`W5KcW5n-3joAM^ z(4QPCeg*rr$NC)%`Hn&UZ{O-Su>a6;{fhVNCh$An6yg65?+;sossaG{-ZjSE4|W$6 J5a9j4{{i?dVgdjF literal 0 HcmV?d00001 diff --git a/scripts/log4j.properties b/scripts/log4j.properties new file mode 100644 index 0000000..d29fc63 --- /dev/null +++ b/scripts/log4j.properties @@ -0,0 +1,11 @@ +# Log information (priority setting : DEBUG < INFO < WARN < ERROR) +# ################ +log4j.rootLogger = CONSOLE + +log4j.logger.org.dclermonte.siba = WARN + + +#-- +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - SIBA [%-5p] %34.34c.%25M - %m%n diff --git a/scripts/siba.bat b/scripts/siba.bat new file mode 100644 index 0000000..ac5277c --- /dev/null +++ b/scripts/siba.bat @@ -0,0 +1,3 @@ +ECHO OFF + +java -Xms368m -Xmx1024m -jar siba.jar %1 %2 %3 %4 %5 %6 %7 diff --git a/scripts/siba.command b/scripts/siba.command new file mode 100644 index 0000000..f2ffc0b --- /dev/null +++ b/scripts/siba.command @@ -0,0 +1,7 @@ +#!/bin/sh + +# Set the current directory with the Siba directory. +cd "`dirname "$0"`" + +# +java -Xms368m -Xmx1024m -jar siba.jar $@ diff --git a/scripts/siba.sh b/scripts/siba.sh new file mode 100644 index 0000000..f2ffc0b --- /dev/null +++ b/scripts/siba.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Set the current directory with the Siba directory. +cd "`dirname "$0"`" + +# +java -Xms368m -Xmx1024m -jar siba.jar $@ diff --git a/src/org/dclermonte/siba/cli/SibaCLI.java b/src/org/dclermonte/siba/cli/SibaCLI.java index fe9694b..b6df450 100644 --- a/src/org/dclermonte/siba/cli/SibaCLI.java +++ b/src/org/dclermonte/siba/cli/SibaCLI.java @@ -25,6 +25,7 @@ import java.util.ResourceBundle; import org.apache.commons.lang3.StringUtils; import org.dclermonte.siba.SibaException; import org.dclermonte.siba.model.SibaManager; +import org.dclermonte.siba.util.BuildInformation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,6 +111,7 @@ public final class SibaCLI { StringList message = new StringList(); + message.append("Siba version ").appendln(new BuildInformation().version()); message.appendln("Usage:"); message.appendln(" siba [ -h | -help | --help ]"); message.appendln(" siba backup directoryToSave [ target ]"); diff --git a/src/org/dclermonte/siba/gui/SibaGUI.java b/src/org/dclermonte/siba/gui/SibaGUI.java index f2a35cd..fc8e948 100644 --- a/src/org/dclermonte/siba/gui/SibaGUI.java +++ b/src/org/dclermonte/siba/gui/SibaGUI.java @@ -52,6 +52,7 @@ import javax.swing.UnsupportedLookAndFeelException; import org.apache.commons.lang3.StringUtils; import org.dclermonte.siba.SibaException; import org.dclermonte.siba.gui.utils.GUIToolBox; +import org.dclermonte.siba.util.BuildInformation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -180,7 +181,7 @@ public final class SibaGUI this.frmSimpleBackup.setFont(new Font("DejaVu Sans", Font.BOLD, 12)); this.frmSimpleBackup.setForeground(new Color(0, 100, 0)); this.frmSimpleBackup.setBackground(new Color(102, 205, 170)); - this.frmSimpleBackup.setTitle("Simple Backup"); + this.frmSimpleBackup.setTitle(String.format("Simple Backup - v%s", new BuildInformation().version())); this.frmSimpleBackup.setBounds(100, 100, 450, 300); this.frmSimpleBackup.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/src/org/dclermonte/siba/util/BuildInformation.java b/src/org/dclermonte/siba/util/BuildInformation.java new file mode 100644 index 0000000..3ea6bb2 --- /dev/null +++ b/src/org/dclermonte/siba/util/BuildInformation.java @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2016 Didier Clermonté + * Copyright (C) 2016 Christian Pierre Momon + * + * This file is part of Siba. + * + * Siba is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.dclermonte.siba.util; + +import java.io.IOException; +import java.net.URL; +import java.util.Properties; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Christian Pierre MOMON (christian.momon@devinsy.fr) + */ +public class BuildInformation +{ + private static final Logger logger = LoggerFactory.getLogger(BuildInformation.class); + + private static String BUILD_INFORMATION_FILE = "/build_information.properties"; + + private String productName; + private String majorRevision; + private String minorRevision; + private String buildNumber; + private String buildDate; + private String generator; + private String author; + + /** + * + */ + public BuildInformation() + { + Properties build = new Properties(); + + try + { + // + URL buildInformationFile = BuildInformation.class.getResource(BUILD_INFORMATION_FILE); + + if (buildInformationFile != null) + { + build.load(BuildInformation.class.getResource(BUILD_INFORMATION_FILE).openStream()); + } + + // + this.productName = build.getProperty("product.name", "PuckInstaller"); + this.majorRevision = build.getProperty("product.revision.major", "d"); + this.minorRevision = build.getProperty("product.revision.minor", "e"); + this.buildNumber = build.getProperty("product.revision.build", "v"); + this.buildDate = build.getProperty("product.revision.date", "today"); + this.generator = build.getProperty("product.revision.generator", "n/a"); + this.author = build.getProperty("product.revision.author", "n/a"); + + } + catch (IOException exception) + { + // + logger.error("Error loading the build.properties file: " + exception.getMessage()); + logger.error(ExceptionUtils.getStackTrace(exception)); + + // + this.productName = "n/a"; + this.majorRevision = "n/a"; + this.minorRevision = "n/a"; + this.buildNumber = "n/a"; + this.buildDate = "n/a"; + this.generator = "n/a"; + this.author = "n/a"; + } + } + + public String author() + { + return this.author; + } + + public String buildDate() + { + return this.buildDate; + } + + public String buildNumber() + { + return this.buildNumber; + } + + public String generator() + { + return this.generator; + } + + public String majorRevision() + { + return this.majorRevision; + } + + public String minorRevision() + { + return this.minorRevision; + } + + public String productName() + { + return this.productName; + } + + /** + * + */ + @Override + public String toString() + { + String result; + + result = String.format("%s %s.%s.%s built on %s by %s", this.productName, this.majorRevision, + this.minorRevision, this.buildNumber, this.buildDate, this.author); + + // + return result; + } + + /** + * + * @return + */ + public String version() + { + String result; + + result = String.format("%s.%s.%s", this.majorRevision, this.minorRevision, this.buildNumber); + + // + return result; + } + + /** + * + */ + public static boolean isDefined() + { + boolean result; + + if (BuildInformation.class.getResource(BUILD_INFORMATION_FILE) == null) + { + result = false; + } + else + { + result = true; + } + + // + return result; + } +}