Compare commits

..

2 commits

5 changed files with 21 additions and 16 deletions

View file

@ -44,12 +44,13 @@ for all available configuration options.
Please make sure the Kotlin compiler is [installed](https://kotlinlang.org/docs/command-line.html#install-the-compiler). Please make sure the Kotlin compiler is [installed](https://kotlinlang.org/docs/command-line.html#install-the-compiler).
The plugin will look in common locations such as: The extension will look in common locations such as:
- `KOTLIN_HOME` - `KOTLIN_HOME`
- `PATH` - `PATH`
- SDKMAN! - [SDKMAN!](https://sdkman.io/)
- Homebrew - [Homebrew](https://brew.sh/)
- JetBrains Toolbox (IntelliJ IDEA, Android Studio) - [JetBrains Toolbox](https://www.jetbrains.com/toolbox-app/) (IntelliJ IDEA, Android Studio)
- etc. - etc.
You can also manually configure the Kotlin home location as follows: You can also manually configure the Kotlin home location as follows:

View file

@ -1,7 +1,7 @@
bld.downloadExtensionJavadoc=false bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true bld.downloadExtensionSources=true
bld.downloadLocation= bld.downloadLocation=
bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.0.5-SNAPSHOT bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.sourceDirectories= bld.sourceDirectories=
bld.version=2.2.1 bld.version=2.2.1

View file

@ -33,7 +33,7 @@ public class CompileKotlinOperationBuild extends Project {
public CompileKotlinOperationBuild() { public CompileKotlinOperationBuild() {
pkg = "rife.bld.extension"; pkg = "rife.bld.extension";
name = "bld-kotlin"; name = "bld-kotlin";
version = version(1, 0, 5, "SNAPSHOT"); version = version(1, 1, 0, "SNAPSHOT");
javaRelease = 17; javaRelease = 17;

View file

@ -79,6 +79,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
* Locates the Kotlin compiler (kotlinc) executable. * Locates the Kotlin compiler (kotlinc) executable.
* *
* @return The path to the kotlinc executable, or {@code kotlinc}/{@code kotlinc.bat} if not found. * @return The path to the kotlinc executable, or {@code kotlinc}/{@code kotlinc.bat} if not found.
* @since 1.1.0
*/ */
public static String findKotlincPath() { public static String findKotlincPath() {
String kotlincPath; String kotlincPath;
@ -108,10 +109,6 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
List<String> commonPaths = new ArrayList<>(); List<String> commonPaths = new ArrayList<>();
if (isLinux()) { if (isLinux()) {
commonPaths.add("/usr/bin");
commonPaths.add("/usr/local/bin");
commonPaths.add("/usr/local/kotlin/bin");
commonPaths.add("/opt/kotlin/bin");
var userHome = System.getProperty("user.home"); var userHome = System.getProperty("user.home");
if (userHome != null) { if (userHome != null) {
commonPaths.add(userHome + "/.sdkman/candidates/kotlin/current/bin"); // SDKMAN! commonPaths.add(userHome + "/.sdkman/candidates/kotlin/current/bin"); // SDKMAN!
@ -119,6 +116,10 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
commonPaths.add(userHome + "/.local/share/JetBrains/Toolbox/apps/intellij-idea-community-edition/plugins/Kotlin/bin"); // Toolbox IDEA CE commonPaths.add(userHome + "/.local/share/JetBrains/Toolbox/apps/intellij-idea-community-edition/plugins/Kotlin/bin"); // Toolbox IDEA CE
commonPaths.add(userHome + "/.local/share/JetBrains/Toolbox/apps/android-studio/plugins/Kotlin/bin"); // Toolbox Android Studio commonPaths.add(userHome + "/.local/share/JetBrains/Toolbox/apps/android-studio/plugins/Kotlin/bin"); // Toolbox Android Studio
} }
commonPaths.add("/usr/bin");
commonPaths.add("/usr/local/bin");
commonPaths.add("/usr/local/kotlin/bin");
commonPaths.add("/opt/kotlin/bin");
} else if (isWindows()) { } else if (isWindows()) {
var localAppData = System.getenv("LOCALAPPDATA"); var localAppData = System.getenv("LOCALAPPDATA");
if (localAppData != null) { if (localAppData != null) {
@ -131,8 +132,6 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
commonPaths.add(programFiles + File.separator + "Kotlin"); commonPaths.add(programFiles + File.separator + "Kotlin");
} }
} else if (isMacOS()) { } else if (isMacOS()) {
commonPaths.add("/usr/local/bin"); // Homebrew
commonPaths.add("/opt/homebrew/bin"); // Homebrew
var userHome = System.getProperty("user.home"); var userHome = System.getProperty("user.home");
if (userHome != null) { if (userHome != null) {
commonPaths.add(userHome + "/.sdkman/candidates/kotlin/current/bin"); // SDKMAN! commonPaths.add(userHome + "/.sdkman/candidates/kotlin/current/bin"); // SDKMAN!
@ -140,6 +139,8 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
commonPaths.add("/Applications/IntelliJ IDEA Ultimate.app/Contents/plugins/Kotlin/bin"); //IntelliJ IDEA Ultimate commonPaths.add("/Applications/IntelliJ IDEA Ultimate.app/Contents/plugins/Kotlin/bin"); //IntelliJ IDEA Ultimate
commonPaths.add("/Applications/IntelliJ IDEA.app/Contents/plugins/Kotlin/bin"); //IntelliJ IDEA commonPaths.add("/Applications/IntelliJ IDEA.app/Contents/plugins/Kotlin/bin"); //IntelliJ IDEA
commonPaths.add("/Applications/Android Studio.app/Contents/plugins/Kotlin/bin"); //Android Studio commonPaths.add("/Applications/Android Studio.app/Contents/plugins/Kotlin/bin"); //Android Studio
commonPaths.add("/usr/local/bin"); // Homebrew
commonPaths.add("/opt/homebrew/bin"); // Homebrew
} }
for (var location : commonPaths) { for (var location : commonPaths) {
@ -181,6 +182,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
* Determines if the operating system is Linux. * Determines if the operating system is Linux.
* *
* @return true if the operating system is Linux, false otherwise. * @return true if the operating system is Linux, false otherwise.
* @since 1.1.0
*/ */
public static boolean isLinux() { public static boolean isLinux() {
return OS_NAME != null && (OS_NAME.contains("linux") || OS_NAME.contains("unix")); // Consider Unix-like systems as well. return OS_NAME != null && (OS_NAME.contains("linux") || OS_NAME.contains("unix")); // Consider Unix-like systems as well.
@ -190,6 +192,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
* Determines if the current operating system is macOS. * Determines if the current operating system is macOS.
* *
* @return true if the OS is macOS, false otherwise. * @return true if the OS is macOS, false otherwise.
* @since 1.1.0
*/ */
public static boolean isMacOS() { public static boolean isMacOS() {
return OS_NAME != null && (OS_NAME.contains("mac") || OS_NAME.contains("darwin")); return OS_NAME != null && (OS_NAME.contains("mac") || OS_NAME.contains("darwin"));
@ -209,6 +212,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
* Determines if the current operating system is Windows. * Determines if the current operating system is Windows.
* *
* @return true if the operating system is Windows, false otherwise. * @return true if the operating system is Windows, false otherwise.
* @since 1.1.0
*/ */
public static boolean isWindows() { public static boolean isWindows() {
return OS_NAME != null && OS_NAME.contains("win"); return OS_NAME != null && OS_NAME.contains("win");

View file

@ -27,7 +27,7 @@ import java.util.List;
* Java Virtual Machine options. * Java Virtual Machine options.
* *
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a> * @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 1.0.5 * @since 1.1.0
*/ */
@SuppressWarnings("PMD.LooseCoupling") @SuppressWarnings("PMD.LooseCoupling")
public class JvmOptions extends ArrayList<String> { public class JvmOptions extends ArrayList<String> {