diff --git a/README.md b/README.md index 51a81e15..36d4e258 100644 --- a/README.md +++ b/README.md @@ -44,22 +44,21 @@ The `generateWindowsStarterExe` task uses a JDK 21 install and `launch4j` as def `gradle.properties`. Note this gradle task runs `jlink` directly and uses `launch4j` rather than using -`jpackage` directly since our app needs loose files and `jpackage` seems to require -all files being wrapped into the generated .exe. This is different than our OS X -app task (discussed below) which uses `jpackage`. +`jpackage` since our app needs loose files and `jpackage` seems to require all files +being wrapped into the generated .exe. This is different than our macOS app task +(discussed below) which uses `jpackage`. After building the installable image, you can create the win32 installer by running the `MakeRTextInstaller.nsi` [NSIS](https://nsis.sourceforge.io/Main_Page) script at the root of the project. -### Building the OS X application +### Building the macOS application -Building the OS X package has just been revamped. To build the .app bundle into -`build/install/RText-.dmg`: +To build the .app bundle into`build/install/RText-.dmg`: ./gradlew clean build generateMacApp The generated `RText-.dmg` can be used to install `RText.app` to the Applications folder. Note that this app currently isn't signed, so Gatekeeper will likely prevent -you from installing. In order to get around this you'll need to tweak your security -policy to allow installing of apps from outside the App Store. +you from installing. To get around this you'll need to tweak your security policy to +allow installing of apps from outside the App Store. diff --git a/build.gradle b/build.gradle index 43161a95..7288cd4d 100644 --- a/build.gradle +++ b/build.gradle @@ -116,7 +116,7 @@ jar { // RText is odd in that we generate multiple jars from a single source tree. //task mainJar(type: Jar) { //} -task consoleJar(type: Jar) { +tasks.register('consoleJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/console/**' archiveFileName = provider { 'plugin-console.jar' } @@ -128,7 +128,7 @@ task consoleJar(type: Jar) { ) } } -task fileSystemTreeJar(type: Jar) { +tasks.register('fileSystemTreeJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/filesystemtree/**' archiveFileName = provider { 'plugin-fileSystemTree.jar' } @@ -140,7 +140,7 @@ task fileSystemTreeJar(type: Jar) { ) } } -task heapIndicatorJar(type: Jar) { +tasks.register('heapIndicatorJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/heapindicator/**' archiveFileName = provider { 'plugin-heapIndicator.jar' } @@ -152,7 +152,7 @@ task heapIndicatorJar(type: Jar) { ) } } -task macroSupportJar(type: Jar) { +tasks.register('macroSupportJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/macros/**' archiveFileName = provider { 'plugin-macros.jar' } @@ -164,7 +164,7 @@ task macroSupportJar(type: Jar) { ) } } -task projectSupportJar(type: Jar) { +tasks.register('projectSupportJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/project/**' archiveFileName = provider { 'plugin-projects.jar' } @@ -176,7 +176,7 @@ task projectSupportJar(type: Jar) { ) } } -task languageSupportJar(type: Jar) { +tasks.register('languageSupportJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/langsupport/**' archiveFileName = provider { 'plugin-languageSupport.jar' } @@ -188,7 +188,7 @@ task languageSupportJar(type: Jar) { ) } } -task sourceBrowserJar(type: Jar) { +tasks.register('sourceBrowserJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/sourcebrowser/**' archiveFileName = provider { 'plugin-sourceBrowser.jar' } @@ -200,7 +200,7 @@ task sourceBrowserJar(type: Jar) { ) } } -task taskListJar(type: Jar) { +tasks.register('taskListJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/tasks/**' archiveFileName = provider { 'plugin-tasks.jar' } @@ -212,7 +212,7 @@ task taskListJar(type: Jar) { ) } } -task tidyJar(type: Jar) { +tasks.register('tidyJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/tidy/**' archiveFileName = provider { 'plugin-tidy.jar' } @@ -224,7 +224,7 @@ task tidyJar(type: Jar) { ) } } -task toolsJar(type: Jar) { +tasks.register('toolsJar', Jar) { from (sourceSets.main.output) { include 'org/fife/rtext/plugins/tools/**' archiveFileName = provider { 'plugin-tools.jar' } @@ -394,7 +394,8 @@ def getWindowsJreDependencyList = { installDistDir -> return retVal } -task generateWindowsJre { +tasks.register('generateWindowsJre') { + dependsOn('build', 'installDist') doLast { def installDistDir = 'build/install/rtext' @@ -410,18 +411,18 @@ task generateWindowsJre { } } } -generateWindowsJre.dependsOn('build', 'installDist') -task generateWindowsStarterExe { +tasks.register('generateWindowsStarterExe') { + dependsOn('generateWindowsJre') doLast { exec { commandLine launch4jExe, 'launch4j.xml' } } } -generateWindowsStarterExe.dependsOn('generateWindowsJre') -task generateMacApp { +tasks.register('generateMacApp') { + dependsOn('build', 'installDist') doLast { def execOps = services.get(org.gradle.process.ExecOperations) execOps.exec { @@ -429,7 +430,6 @@ task generateMacApp { } } } -generateMacApp.dependsOn('build', 'installDist') nexusPublishing { repositories { diff --git a/mac/build-mac-app.sh b/mac/build-mac-app.sh index 8686e1b1..94c1ad74 100755 --- a/mac/build-mac-app.sh +++ b/mac/build-mac-app.sh @@ -3,7 +3,7 @@ # Builds RText.app for OS X. This assumes you've already run # ./gradlew clean build installDist. In fact, you usually don't # run this directly but rather just run -# ./gradlew clean build installDist generateJre generateMacApp +# ./gradlew clean build generateMacApp # # The version of RText you're building. This appears in the generated diff --git a/src/main/java/org/fife/rtext/AbstractMainView.java b/src/main/java/org/fife/rtext/AbstractMainView.java index 7748862b..f6b4cdc9 100644 --- a/src/main/java/org/fife/rtext/AbstractMainView.java +++ b/src/main/java/org/fife/rtext/AbstractMainView.java @@ -20,6 +20,7 @@ import java.beans.PropertyChangeListener; import java.io.*; import java.net.URL; +import java.nio.file.FileSystems; import java.util.*; import java.util.Timer; import javax.imageio.ImageIO; @@ -1103,7 +1104,7 @@ public String getDefaultEncoding() { */ private String getDefaultFileName() { return owner.getWorkingDirectory() + - System.getProperty("file.separator") + owner.getNewFileName(); + FileSystems.getDefault().getSeparator() + owner.getNewFileName(); } @@ -3551,7 +3552,7 @@ public void setLineNumbersEnabled(boolean enabled) { */ public void setLineTerminator(String terminator) { if (terminator!=null && - terminator.equals(System.getProperty("line.separator"))) { + terminator.equals(System.lineSeparator())) { terminator = null; } defaultLineTerminator = terminator; diff --git a/src/main/java/org/fife/rtext/RTextMDIView.java b/src/main/java/org/fife/rtext/RTextMDIView.java index b8834835..1df3d3ad 100644 --- a/src/main/java/org/fife/rtext/RTextMDIView.java +++ b/src/main/java/org/fife/rtext/RTextMDIView.java @@ -196,7 +196,7 @@ protected synchronized boolean closeCurrentDocumentImpl() { // correctly. If there are no open documents, add a new empty one. if (getNumDocuments()>0) { renumberDisplayNames(); - JInternalFrame frame = frames.get(0); + JInternalFrame frame = frames.getFirst(); desktopPane.setSelectedFrame(frame); try { frame.setSelected(true); // Updates currentTextArea. diff --git a/src/main/java/org/fife/rtext/RecentFileManager.java b/src/main/java/org/fife/rtext/RecentFileManager.java index ef7f6ad7..6d299294 100644 --- a/src/main/java/org/fife/rtext/RecentFileManager.java +++ b/src/main/java/org/fife/rtext/RecentFileManager.java @@ -105,7 +105,7 @@ private void addFile(String file) { int index = indexOf(file); if (index > -1) { FileLocation loc = files.remove(index); - files.add(0, loc); + files.addFirst(loc); return; } @@ -123,11 +123,11 @@ private void addFile(String file) { // exist return; } - files.add(0, loc); + files.addFirst(loc); // Too many files? Oust the file in history added least recently. if (files.size() > MAX_FILE_COUNT) { - files.remove(files.size() - 1); + files.removeLast(); } } diff --git a/src/main/java/org/fife/rtext/optionsdialog/GeneralOptionPanel.java b/src/main/java/org/fife/rtext/optionsdialog/GeneralOptionPanel.java index 4bcda694..abf92613 100644 --- a/src/main/java/org/fife/rtext/optionsdialog/GeneralOptionPanel.java +++ b/src/main/java/org/fife/rtext/optionsdialog/GeneralOptionPanel.java @@ -58,7 +58,7 @@ class GeneralOptionPanel extends OptionsDialogPanel private static final String TERM_CR = "\r"; private static final String TERM_LF = "\n"; private static final String TERM_CRLF = "\r\n"; - private static final String TERM_SYSTEM = System.getProperty("line.separator"); + private static final String TERM_SYSTEM = System.lineSeparator(); /** diff --git a/src/main/java/org/fife/rtext/plugins/langsupport/LangSupportUtils.java b/src/main/java/org/fife/rtext/plugins/langsupport/LangSupportUtils.java index 7edcf3e2..e821866a 100644 --- a/src/main/java/org/fife/rtext/plugins/langsupport/LangSupportUtils.java +++ b/src/main/java/org/fife/rtext/plugins/langsupport/LangSupportUtils.java @@ -39,7 +39,7 @@ public static File getClassFileLocation(LibraryInfo li) { return ((JarLibraryInfo)li).getJarFile(); } else if (li instanceof DirLibraryInfo) { - return new File(((DirLibraryInfo)li).getLocationAsString()); + return new File(li.getLocationAsString()); } else if (li instanceof Jdk9LibraryInfo) { return ((Jdk9LibraryInfo)li).getJreHome(); diff --git a/src/main/java/org/fife/rtext/plugins/project/tree/FolderProjectEntryTreeNode.java b/src/main/java/org/fife/rtext/plugins/project/tree/FolderProjectEntryTreeNode.java index 854bee91..cc9d43f1 100644 --- a/src/main/java/org/fife/rtext/plugins/project/tree/FolderProjectEntryTreeNode.java +++ b/src/main/java/org/fife/rtext/plugins/project/tree/FolderProjectEntryTreeNode.java @@ -130,7 +130,7 @@ public List getPopupActions() { Messages.getString("Action.New")); newMenu.add(new NewFileOrFolderAction(this, true)); newMenu.add(new NewFileOrFolderAction(this, false)); - actions.add(0, newMenu); + actions.addFirst(newMenu); actions.add(actions.size()-1, new ConfigureFiltersAction());