Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Cleanup - Using static classpaths rather than dynamic ones. #349

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
32 changes: 19 additions & 13 deletions Anathema/build.gradle
@@ -1,27 +1,33 @@
archivesBaseName= 'anathema'
dependencies {
compile project(':Platform_Swing')

//For development, all projects need to be on the classpath at runtime.
parent.subprojects.each { p ->
if (!p.name.equals("Anathema") &&
!p.name.equals("Integrationtest")) { // exceptions, don't need to be on the classpath
runtime project(":${p.name}")
}
}
}

apply plugin:'application'
mainClassName = "net.sf.anathema.AnathemaBootLoader"
mainClassName = "net.sf.anathema.Anathema"

jar {
manifest {
attributes(
'Built-By': System.getProperty("user.name"),
'Main-Class': 'net.sf.anathema.AnathemaBootLoader',
'Main-Class': 'net.sf.anathema.Anathema',
'SplashScreen-Image': 'icons/core/AnathemaSplashNew.png'
)
}
}

dependencies {
//For development, all projects need to be on the classpath at runtime.
project.parent.subprojects.each {
if (isRelevant(it)){
runtime project(":${it.name}")
}
// Delays the building of the runtime classpath until after all build tasks have been run.
project.gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(jar)) {
// defines the runtime classpath of Anathema, inside the :Anathema:jar manifest file.
def libs = "lib/" + parent.subprojects.collectMany{ it.configurations.runtime.files.name }.unique().sort().join( " lib/" )
jar.manifest.attributes('Class-Path' : libs )
}
}

private boolean isRelevant(project) {
return project.name != "Anathema" && project.name != "Integrationtest"
}
Expand Up @@ -15,9 +15,11 @@

public class Anathema {

/*Called by the boot loader using reflection.*/
@SuppressWarnings("UnusedDeclaration")
public void startApplication() throws Exception {
public static void main( String [] args ) {
Anathema app = new Anathema();
}

public Anathema() {
Logger.getLogger(Anathema.class).info("Launching Anathema");
IInitializationPreferences initializationPreferences = loadPreferences();
prepareEnvironment(initializationPreferences);
Expand All @@ -29,11 +31,15 @@ private IInitializationPreferences loadPreferences() {
return InitializationPreferences.getDefaultPreferences();
}

private void prepareEnvironment(IInitializationPreferences initializationPreferences) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
private void prepareEnvironment(IInitializationPreferences initializationPreferences) {
displayStatus("Preparing Environment...");
LocaleEnvironment.initLocale(initializationPreferences);
SwingEnvironment.initLookAndFeel(initializationPreferences);
SwingEnvironment.initTooltipManager(initializationPreferences);
try {
LocaleEnvironment.initLocale(initializationPreferences);
SwingEnvironment.initLookAndFeel(initializationPreferences);
SwingEnvironment.initTooltipManager(initializationPreferences);
} catch( ClassNotFoundException | InstantiationException | IllegalAccessException e ) {
Logger.getLogger(Anathema.class).error( "Could not prepare environment. ", e);
}
}

private void showMainFrame(final IInitializationPreferences initializationPreferences) {
Expand All @@ -60,4 +66,5 @@ private ApplicationFrame createView(IInitializationPreferences initializationPre
private void displayStatus(String message) {
ProxySplashscreen.getInstance().displayStatusMessage(message);
}

}
84 changes: 0 additions & 84 deletions Anathema/src/main/java/net/sf/anathema/AnathemaBootLoader.java

This file was deleted.

This file was deleted.

57 changes: 0 additions & 57 deletions Anathema/src/main/java/net/sf/anathema/EasyLoader.java

This file was deleted.

13 changes: 0 additions & 13 deletions Anathema/src/main/java/net/sf/anathema/FilesOnly.java

This file was deleted.

64 changes: 0 additions & 64 deletions Anathema/src/main/java/net/sf/anathema/PropertiesLoader.java

This file was deleted.

1 change: 0 additions & 1 deletion Anathema/src/main/resources/anathema.properties

This file was deleted.

10 changes: 4 additions & 6 deletions Development_Distribution/Windows/NSIS/anathema.nsi
Expand Up @@ -90,16 +90,14 @@ ShowUninstDetails show
# Installer sections
Section -Anathema SEC0000
RMDir /r $INSTDIR\lib
RMDir /r $INSTDIR\plugins
SetOutPath $INSTDIR\lib
SetOverwrite on
File /r ..\..\..\build\dependencies\*
File /r ..\..\..\build\plugins\*
SetOutPath $INSTDIR\jre
File /r ..\..\..\${JRE_PATH}\*
SetOutPath $INSTDIR
File ..\..\..\Anathema\build\libs\Anathema.jar
File ..\..\..\build\launcher\anathema.exe
File ..\..\..\build\launcher\Anathema.exe
File ..\..\..\Development_Documentation\Distribution\English\license.txt
File /oname=release_notes.txt ..\..\..\Development_Documentation\Distribution\English\versions.md
WriteRegStr HKLM "${REGKEY}\Components" Anathema 1
Expand All @@ -114,7 +112,7 @@ Section -post SEC0001
WriteUninstaller $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory $SMPROGRAMS\$StartMenuGroup
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\anathema.exe
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\Anathema.exe
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
Expand Down Expand Up @@ -145,8 +143,8 @@ Section /o -un.Anathema UNSEC0000
RmDir /r /REBOOTOK $PROFILE\.anathema
RmDir /r /REBOOTOK $INSTDIR\lib
RmDir /r /REBOOTOK $INSTDIR\jre
Delete /REBOOTOK $INSTDIR\anathema.jar
Delete /REBOOTOK $INSTDIR\anathema.exe
Delete /REBOOTOK $INSTDIR\Anathema.jar
Delete /REBOOTOK $INSTDIR\Anathema.exe
Delete /REBOOTOK $INSTDIR\license.txt
Delete /REBOOTOK $INSTDIR\release_notes.txt
Delete /REBOOTOK $INSTDIR\anathema.properties
Expand Down
Expand Up @@ -97,17 +97,5 @@ private static class ConfigureAnathema extends ProgressReportAdapter {
public ConfigureAnathema(UpdateSystem updateSystem) {
this.updateSystem = updateSystem;
}

@Override
public void finishedInstallation() {
try {
File folderForVersionToRun = updateSystem.getFolderForVersionToRun();
Properties properties = new Properties();
properties.setProperty("library.folder", FilenameUtils.separatorsToUnix(folderForVersionToRun.getAbsolutePath()));
new PropertiesSaver("anathema.properties").save(properties);
} catch (IOException e) {
//handle exception
}
}
}
}