Compare commits
14 commits
Author | SHA1 | Date | |
---|---|---|---|
1979f58cb9 | |||
3efcb61eab | |||
b9a694f99a | |||
62b1eeb595 | |||
07e2daff34 | |||
8ba37725ce | |||
f80f6a8e02 | |||
d974896245 | |||
33650647aa | |||
8644298bd9 | |||
451f4a2cdb | |||
211983dab0 | |||
4c8609a765 | |||
f7d5aed088 |
11 changed files with 69 additions and 30 deletions
8
.github/workflows/bld.yml
vendored
8
.github/workflows/bld.yml
vendored
|
@ -4,11 +4,13 @@ on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bld-project:
|
build-bld-project:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [17, 21, 23]
|
java-version: [ 17, 21, 24 ]
|
||||||
|
kotlin-version: [ 1.9.25, 2.0.21, 2.1.20 ]
|
||||||
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source repository
|
- name: Checkout source repository
|
||||||
|
|
4
.github/workflows/pages.yml
vendored
4
.github/workflows/pages.yml
vendored
|
@ -47,11 +47,11 @@ jobs:
|
||||||
uses: actions/configure-pages@v3
|
uses: actions/configure-pages@v3
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v1
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
# Upload generated Javadocs repository
|
# Upload generated Javadocs repository
|
||||||
path: "build/javadoc/"
|
path: "build/javadoc/"
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v1
|
uses: actions/deploy-pages@v4
|
||||||
|
|
2
.idea/copyright/Apache_License.xml
generated
2
.idea/copyright/Apache_License.xml
generated
|
@ -1,6 +1,6 @@
|
||||||
<component name="CopyrightManager">
|
<component name="CopyrightManager">
|
||||||
<copyright>
|
<copyright>
|
||||||
<option name="notice" value="Copyright 2023-Copyright &#36;today.yearamp;#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
<option name="notice" value="Copyright 2023-&#36;today.year the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." />
|
||||||
<option name="myName" value="Apache License" />
|
<option name="myName" value="Apache License" />
|
||||||
</copyright>
|
</copyright>
|
||||||
</component>
|
</component>
|
4
.idea/libraries/bld.xml
generated
4
.idea/libraries/bld.xml
generated
|
@ -2,12 +2,12 @@
|
||||||
<library name="bld">
|
<library name="bld">
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.0.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES>
|
<SOURCES>
|
||||||
<root url="file://$PROJECT_DIR$/lib/bld" />
|
<root url="file://$PROJECT_DIR$/lib/bld" />
|
||||||
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.0-sources.jar!/" />
|
<root url="jar://$USER_HOME$/.bld/dist/bld-2.2.1-sources.jar!/" />
|
||||||
</SOURCES>
|
</SOURCES>
|
||||||
<excluded>
|
<excluded>
|
||||||
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
|
||||||
|
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -9,7 +9,7 @@
|
||||||
],
|
],
|
||||||
"java.configuration.updateBuildConfiguration": "automatic",
|
"java.configuration.updateBuildConfiguration": "automatic",
|
||||||
"java.project.referencedLibraries": [
|
"java.project.referencedLibraries": [
|
||||||
"${HOME}/.bld/dist/bld-2.2.0.jar",
|
"${HOME}/.bld/dist/bld-2.2.1.jar",
|
||||||
"lib/**/*.jar"
|
"lib/**/*.jar"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
14
README.md
14
README.md
|
@ -2,12 +2,20 @@
|
||||||
|
|
||||||
[](https://opensource.org/licenses/Apache-2.0)
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||||
[](https://rife2.com/bld)
|
[](https://rife2.com/bld)
|
||||||
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-exec)
|
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-exec)
|
||||||
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-exec)
|
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-exec)
|
||||||
[](https://github.com/rife2/bld-exec/actions/workflows/bld.yml)
|
[](https://github.com/rife2/bld-exec/actions/workflows/bld.yml)
|
||||||
|
|
||||||
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
|
To install the latest version, add the following to the `lib/bld/bld-wrapper.properties` file:
|
||||||
|
|
||||||
|
```properties
|
||||||
|
bld.extension-exec=com.uwyn.rife2:bld-exec
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information, please refer to the [extensions](https://github.com/rife2/bld/wiki/Extensions) documentation.
|
||||||
|
|
||||||
|
## Execute a Command
|
||||||
|
|
||||||
To execute a command at the command line, add the following to your build file:
|
To execute a command at the command line, add the following to your build file:
|
||||||
|
|
||||||
|
@ -29,7 +37,7 @@ Use the `failOnExit` function to specify whether a command non-zero exit value (
|
||||||
@BuildCommand
|
@BuildCommand
|
||||||
public void startServer() throws Exception {
|
public void startServer() throws Exception {
|
||||||
final List<String> cmds;
|
final List<String> cmds;
|
||||||
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
|
if (System.getProperty("os.name").toLowerCase().contains("win")) {
|
||||||
cmds = List.of("cmd", "/c", "stop.bat");
|
cmds = List.of("cmd", "/c", "stop.bat");
|
||||||
} else {
|
} else {
|
||||||
cmds = List.of("./stop.sh");
|
cmds = List.of("./stop.sh");
|
||||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
||||||
bld.downloadExtensionJavadoc=false
|
bld.downloadExtensionJavadoc=false
|
||||||
bld.downloadExtensionSources=true
|
bld.downloadExtensionSources=true
|
||||||
bld.downloadLocation=
|
bld.downloadLocation=
|
||||||
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.1.10
|
bld.extension-pmd=com.uwyn.rife2:bld-pmd:1.2.2
|
||||||
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||||
bld.sourceDirectories=
|
bld.sourceDirectories=
|
||||||
bld.version=2.2.0
|
bld.version=2.2.1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-Copyright $today.yearamp;#36;today.year the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -33,7 +33,7 @@ public class ExecOperationBuild extends Project {
|
||||||
public ExecOperationBuild() {
|
public ExecOperationBuild() {
|
||||||
pkg = "rife.bld.extension";
|
pkg = "rife.bld.extension";
|
||||||
name = "ExecOperation";
|
name = "ExecOperation";
|
||||||
version = version(1, 0, 4);
|
version = version(1, 0, 5);
|
||||||
|
|
||||||
javaRelease = 17;
|
javaRelease = 17;
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ public class ExecOperationBuild extends Project {
|
||||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);
|
||||||
|
|
||||||
scope(compile)
|
scope(compile)
|
||||||
.include(dependency("com.uwyn.rife2", "bld", version(2, 2, 0)));
|
.include(dependency("com.uwyn.rife2", "bld", version(2, 2, 1)));
|
||||||
scope(test)
|
scope(test)
|
||||||
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 11, 4)))
|
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 12, 1)))
|
||||||
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 11, 4)))
|
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 12, 1)))
|
||||||
.include(dependency("org.assertj", "assertj-core", version(3, 27, 2)));
|
.include(dependency("org.assertj", "assertj-core", version(3, 27, 3)));
|
||||||
|
|
||||||
javadocOperation()
|
javadocOperation()
|
||||||
.javadocOptions()
|
.javadocOptions()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-Copyright $today.yearamp;#36;today.year the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2023-Copyright $today.yearamp;#36;today.year the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
package rife.bld.extension;
|
package rife.bld.extension;
|
||||||
|
|
||||||
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 rife.bld.BaseProject;
|
import rife.bld.BaseProject;
|
||||||
import rife.bld.Project;
|
import rife.bld.Project;
|
||||||
import rife.bld.WebProject;
|
import rife.bld.WebProject;
|
||||||
|
@ -24,13 +26,15 @@ import rife.bld.operations.exceptions.ExitStatusException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.assertj.core.api.Assertions.assertThatCode;
|
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||||
|
|
||||||
|
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
||||||
class ExecOperationTest {
|
class ExecOperationTest {
|
||||||
private static final String FOO = "foo";
|
private static final String FOO = "foo";
|
||||||
|
private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.US).contains("win");
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCommand() {
|
void testCommand() {
|
||||||
|
@ -50,18 +54,30 @@ class ExecOperationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testExitValue() {
|
void testExitValue() {
|
||||||
|
List<String> cat;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
cat = List.of("cmd", "/c", "type", FOO);
|
||||||
|
} else {
|
||||||
|
cat = List.of("cat", FOO);
|
||||||
|
}
|
||||||
assertThatCode(() ->
|
assertThatCode(() ->
|
||||||
new ExecOperation()
|
new ExecOperation()
|
||||||
.fromProject(new BaseProject())
|
.fromProject(new BaseProject())
|
||||||
.command(List.of("cat", FOO))
|
.command(cat)
|
||||||
.execute()).isInstanceOf(ExitStatusException.class);
|
.execute()).isInstanceOf(ExitStatusException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testFailOnExit() {
|
void testFailOnExit() {
|
||||||
|
List<String> cat;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
cat = List.of("cmd", "/c", "type", FOO);
|
||||||
|
} else {
|
||||||
|
cat = List.of("cat", FOO);
|
||||||
|
}
|
||||||
var op = new ExecOperation()
|
var op = new ExecOperation()
|
||||||
.fromProject(new BaseProject())
|
.fromProject(new BaseProject())
|
||||||
.command(List.of("cat", FOO))
|
.command(cat)
|
||||||
.failOnExit(false);
|
.failOnExit(false);
|
||||||
assertThat(op.isFailOnExit()).isFalse();
|
assertThat(op.isFailOnExit()).isFalse();
|
||||||
assertThatCode(op::execute).doesNotThrowAnyException();
|
assertThatCode(op::execute).doesNotThrowAnyException();
|
||||||
|
@ -72,15 +88,22 @@ class ExecOperationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testTimeout() {
|
void testTimeout() {
|
||||||
|
List<String> sleep;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
sleep = List.of("cmd", "/c", "timeout", "/t", "10");
|
||||||
|
} else {
|
||||||
|
sleep = List.of("sleep", "10");
|
||||||
|
}
|
||||||
var op = new ExecOperation()
|
var op = new ExecOperation()
|
||||||
.fromProject(new BaseProject())
|
.fromProject(new BaseProject())
|
||||||
.timeout(5)
|
.timeout(5)
|
||||||
.command(List.of("sleep", "10"));
|
.command(sleep);
|
||||||
assertThat(op.timeout()).isEqualTo(5);
|
assertThat(op.timeout()).isEqualTo(5);
|
||||||
assertThatCode(op::execute).isInstanceOf(ExitStatusException.class);
|
assertThatCode(op::execute).isInstanceOf(ExitStatusException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@EnabledOnOs({OS.LINUX, OS.MAC})
|
||||||
void testTouch() throws Exception {
|
void testTouch() throws Exception {
|
||||||
var tmpFile = new File("hello.tmp");
|
var tmpFile = new File("hello.tmp");
|
||||||
tmpFile.deleteOnExit();
|
tmpFile.deleteOnExit();
|
||||||
|
@ -95,10 +118,16 @@ class ExecOperationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testWorkDir() {
|
void testWorkDir() {
|
||||||
|
List<String> echo;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
echo = List.of("cmd", "/c", "echo", FOO);
|
||||||
|
} else {
|
||||||
|
echo = List.of("echo", FOO);
|
||||||
|
}
|
||||||
var workDir = new File(System.getProperty("java.io.tmpdir"));
|
var workDir = new File(System.getProperty("java.io.tmpdir"));
|
||||||
var op = new ExecOperation()
|
var op = new ExecOperation()
|
||||||
.fromProject(new BaseProject())
|
.fromProject(new BaseProject())
|
||||||
.command("echo", FOO)
|
.command(echo)
|
||||||
.workDir(workDir);
|
.workDir(workDir);
|
||||||
assertThat(op.workDir()).as("as file").isEqualTo(workDir);
|
assertThat(op.workDir()).as("as file").isEqualTo(workDir);
|
||||||
assertThatCode(op::execute).doesNotThrowAnyException();
|
assertThatCode(op::execute).doesNotThrowAnyException();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue