Compare commits

...

3 commits

4 changed files with 44 additions and 39 deletions

View file

@ -1,43 +1,13 @@
name: bld-ci name: bld-ci
on: [push, pull_request, workflow_dispatch] on: [ push, pull_request, workflow_dispatch ]
jobs: jobs:
build-bld-project: build-bld-project:
strategy: strategy:
matrix: matrix:
java-version: [17, 21, 24] java-version: [ 17, 21, 24 ]
kotlin-version: [1.9.25, 2.0.21, 2.1.20] kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ]
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: ${{ matrix.java-version }}
- name: Download dependencies [examples]
working-directory: examples
run: ./bld download
- name: Download dependencies
run: ./bld download
- name: Run tests
run: ./bld compile test
build-bld-examples:
strategy:
matrix:
java-version: [17, 21, 24]
kotlin-version: [1.9.25, 2.0.21, 2.1.20]
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -61,3 +31,9 @@ jobs:
- name: Run tests [examples] - name: Run tests [examples]
working-directory: examples working-directory: examples
run: ./bld compile test run: ./bld compile test
- name: Download dependencies
run: ./bld download
- name: Run tests
run: ./bld compile test

View file

@ -23,6 +23,7 @@ import rife.bld.publish.PublishLicense;
import rife.bld.publish.PublishScm; import rife.bld.publish.PublishScm;
import java.util.List; import java.util.List;
import java.util.Locale;
import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile; import static rife.bld.dependencies.Scope.compile;
@ -97,10 +98,13 @@ public class CompileKotlinOperationBuild extends Project {
@Override @Override
public void test() throws Exception { public void test() throws Exception {
var os = System.getProperty("os.name");
if (os != null && os.toLowerCase(Locale.US).contains("linux")) {
new ExecOperation() new ExecOperation()
.fromProject(this) .fromProject(this)
.command("scripts/cliargs.sh") .command("scripts/cliargs.sh")
.execute(); .execute();
}
super.test(); super.test();
} }
} }

View file

@ -42,7 +42,7 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
private static final Logger LOGGER = Logger.getLogger(CompileKotlinOperation.class.getName()); private static final Logger LOGGER = Logger.getLogger(CompileKotlinOperation.class.getName());
private static final String OS_NAME = private static final String OS_NAME =
System.getProperty("os.name") != null ? System.getProperty("os.name").toLowerCase(Locale.US) : null; System.getProperty("os.name") != null ? System.getProperty("os.name").toLowerCase(Locale.US) : null;
private static final String KOTLINC_EXECUTABLE = "kotlinc" + (isWindows() ? ".bat" : ""); private static final String KOTLINC_EXECUTABLE = "kotlinc" + (isWindows() && !isCygwin() && !isMinGW() ? ".bat" : "");
private final Collection<String> compileMainClasspath_ = new ArrayList<>(); private final Collection<String> compileMainClasspath_ = new ArrayList<>();
private final Collection<String> compileTestClasspath_ = new ArrayList<>(); private final Collection<String> compileTestClasspath_ = new ArrayList<>();
private final JvmOptions jvmOptions_ = new JvmOptions(); private final JvmOptions jvmOptions_ = new JvmOptions();
@ -191,6 +191,17 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
return KOTLINC_EXECUTABLE; return KOTLINC_EXECUTABLE;
} }
/**
* Determines if the current runtime environment is Cygwin.
*
* @return {@code true} if the current runtime environment is Cygwin, {@code false} otherwise.
* @since 1.1.0
*/
public static boolean isCygwin() {
var path = System.getenv("ORIGINAL_PATH");
return path != null && path.contains("/cygdrive/");
}
private static boolean isExecutable(File file) { private static boolean isExecutable(File file) {
return file != null && file.exists() && file.isFile() && file.canExecute(); return file != null && file.exists() && file.isFile() && file.canExecute();
} }
@ -212,7 +223,18 @@ public class CompileKotlinOperation extends AbstractOperation<CompileKotlinOpera
* @since 1.1.0 * @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") || OS_NAME.contains("osx"));
}
/**
* Determines if the current runtime environment is MinGW.
*
* @return {@code true} if the current runtime environment is MinGW, {@code false} otherwise.
* @since 1.1.0
*/
public static boolean isMinGW() {
var msys = System.getenv("MSYSTEM");
return msys != null && (msys.startsWith("MINGW") || msys.startsWith("MSYS"));
} }
/** /**

View file

@ -18,6 +18,8 @@ package rife.bld.extension.kotlin;
import org.assertj.core.api.AutoCloseableSoftAssertions; import org.assertj.core.api.AutoCloseableSoftAssertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -199,6 +201,7 @@ class CompileOptionsTest {
} }
@Test @Test
@EnabledOnOs(OS.LINUX)
void testCheckAllParams() throws IOException { void testCheckAllParams() throws IOException {
var args = Files.readAllLines(Paths.get("src", "test", "resources", "kotlinc-args.txt")); var args = Files.readAllLines(Paths.get("src", "test", "resources", "kotlinc-args.txt"));