Compare commits

..

No commits in common. "main" and "2.0.1" have entirely different histories.
main ... 2.0.1

129 changed files with 2106 additions and 13918 deletions

View file

@ -2,9 +2,6 @@ name: bld-ci
on: [push, pull_request, workflow_dispatch]
env:
REPORTS_DIR: "build/test-results/test/"
jobs:
build-linux:
runs-on: ubuntu-latest
@ -90,7 +87,7 @@ jobs:
strategy:
matrix:
java-version: [ 17, 20, 21, 22, 23, 24, 25 ]
java-version: [ 17, 20, 21, 22 ]
steps:
- name: Checkout source repository
@ -101,37 +98,25 @@ jobs:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{ matrix.java-version }}
check-latest: true
- name: Download dependencies
run: ./bld clean download
- name: Compile source
run: ./bld compile
- name: Run tests
id: tests
run: >-
./bld test
./bld clean download compile test
-Dtest.postgres=true -Dtest.mysql=true -Dtest.mariadb=true -Dtest.oracle=true -Dtest.oracle-free=true
-DtestsBadgeUrl=https://rife2.com/tests-badge/update/com.uwyn.rife2/bld
-DtestsBadgeApiKey=${{ secrets.TESTS_BADGE_API_KEY }}
--reports-dir=${{ env.REPORTS_DIR }}
- name: Run reporter
if: always() && steps.tests.outcome == 'failure'
run: ./bld reporter --all
build-macos:
runs-on: macos-latest
strategy:
matrix:
java-version: [ 17, 20, 21, 22, 23, 24, 25 ]
java-version: [ 17, 20, 21, 22 ]
steps:
- name: Checkout source repository
@ -142,32 +127,22 @@ jobs:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{ matrix.java-version }}
check-latest: true
- name: Download dependencies
run: ./bld clean download
- name: Compile source
run: ./bld compile
- name: Run tests
id: tests
run: ./bld test --reports-dir=${{ env.REPORTS_DIR }}
- name: Run reporter
if: always() && steps.tests.outcome == 'failure'
run: ./bld reporter --all
run: >-
./bld clean download compile test
build-windows:
runs-on: windows-latest
strategy:
matrix:
java-version: [ 17, 20, 21, 22, 23, 24, 25 ]
java-version: [ 17, 20, 21, 22 ]
steps:
- name: Configure git line endings
@ -181,22 +156,12 @@ jobs:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{ matrix.java-version }}
check-latest: true
- name: Download dependencies
run: .\bld.bat clean download
- name: Compile source
run: .\bld.bat compile
- name: Run tests
id: tests
run: .\bld.bat test --reports-dir=${{ env.REPORTS_DIR }}
- name: Run reporter
if: always() && steps.tests.outcome == 'failure'
run: .\bld.bat reporter --all
run: >-
.\bld.bat clean download compile test

View file

@ -37,7 +37,7 @@ jobs:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
@ -46,14 +46,14 @@ jobs:
run: ./bld clean download clean compile javadoc
- name: Setup Pages
uses: actions/configure-pages@v5
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v2
with:
# Upload generated Javadocs repository
path: 'build/javadoc/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v2

View file

@ -27,5 +27,6 @@
<orderEntry type="library" name="compile" level="project" />
<orderEntry type="library" scope="RUNTIME" name="runtime" level="project" />
<orderEntry type="library" scope="TEST" name="test" level="project" />
<orderEntry type="module" module-name="bld" />
</component>
</module>

View file

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="OctalLiteral" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View file

@ -2,12 +2,12 @@
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.3.0.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.3.0-sources.jar!/" />
<root url="jar://$USER_HOME$/.bld/dist/bld-2.0.1-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />

View file

@ -9,9 +9,9 @@
<root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -3,13 +3,12 @@
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
<root url="file://$PROJECT_DIR$/src/main/resources" />
<root url="file://$PROJECT_DIR$/core/src/main/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -11,9 +11,9 @@
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -1,26 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0">
<entry_point TYPE="field" FQNAME="rife.bld.operations.JpackageOptions.PackageType APP_IMAGE" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JpackageOptions.PackageType DMG" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JpackageOptions.PackageType MSI" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JpackageOptions.PackageType PKG" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JpackageOptions.PackageType RPM" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JlinkOptions.CompressionLevel CONSTANT_STRING_SHARING" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JlinkOptions.CompressionLevel NO_COMPRESSION" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JlinkOptions.Endian LITTLE" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JmodOperation.OperationMode EXTRACT" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JmodOperation.OperationMode HASH" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JmodOptions.ResolvedReason DEPRECATED_FOR_REMOVAL" />
<entry_point TYPE="field" FQNAME="rife.bld.operations.JmodOptions.ResolvedReason INCUBATING" />
</entry_points>
<pattern value="rife.bld.operations.JpackageOptions.PackageType" />
<pattern value="rife.bld.operations.JlinkOptions.CompressionLevel" />
<pattern value="rife.bld.operations.JlinkOptions.Endian" />
<pattern value="rife.bld.operations.JmodOperation.OperationMode" />
<pattern value="rife.bld.operations.JmodOptions.ResolvedReason" />
</component>
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>

View file

@ -1,7 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run all tests" type="JUnit" factoryName="JUnit">
<configuration default="false" name="Run Tests" type="JUnit" factoryName="JUnit">
<module name="app" />
<useClassPathOnly />
<option name="PACKAGE_NAME" value="rife" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />

View file

@ -1,20 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run bld tests" type="JUnit" factoryName="JUnit">
<module name="app" />
<useClassPathOnly />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="rife.bld.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="PACKAGE_NAME" value="rife.bld" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" />
<dir value="$PROJECT_DIR$/src/test/java" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ScalaCompilerConfiguration">
<option name="separateProdTestSources" value="false" />
</component>
</project>

View file

@ -1,20 +0,0 @@
# Contributing
If you want to contribute to `bld` or customize it, all you have to do is clone the GitHub
repository and update the [RIFE2/core](https://github.com/rife2/rife2-core) submodule:
```console
git clone git@github.com:rife2/bld.git
cd bld
git submodule init
git submodule update
```
Then use `bld` to build itself:
```console
./bld compile
```
The project has an IntelliJ IDEA project structure. You can just open it after all
the dependencies were downloaded and peruse the code.

View file

@ -1,9 +1,9 @@
[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Java](https://img.shields.io/badge/java-17%2B-blue)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[![bld](https://img.shields.io/badge/2.3.0-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![bld](https://img.shields.io/badge/2.0.0-FA9052?label=bld&labelColor=2392FF)](https://rife2.com/bld)
[![Release](https://img.shields.io/github/release/rife2/bld.svg)](https://github.com/rife2/bld/releases/latest)
[![Maven Central](https://img.shields.io/maven-central/v/com.uwyn.rife2/bld)](https://central.sonatype.com/artifact/com.uwyn.rife2/bld)
[![GitHub Snapshot](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fcentral.sonatype.com%2Frepository%2Fmaven-snapshots%2Fcom%2Fuwyn%2Frife2%2Fbld%2Fmaven-metadata.xml)](https://github.com/rife2/bld/packages/2214741/versions)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.uwyn.rife2/bld/badge.svg?color=blue)](https://maven-badges.herokuapp.com/maven-central/com.uwyn.rife2/bld)
[![Nexus Snapshot](https://img.shields.io/nexus/s/com.uwyn.rife2/bld?server=https%3A%2F%2Fs01.oss.sonatype.org%2F)](https://s01.oss.sonatype.org/content/repositories/snapshots/com/uwyn/rife2/bld/)
[![gradle-ci](https://github.com/rife2/bld/actions/workflows/bld.yml/badge.svg)](https://github.com/rife2/bld/actions/workflows/bld.yml)
[![Tests](https://rife2.com/tests-badge/badge/com.uwyn.rife2/bld)](https://github.com/rife2/rife2/actions/workflows/bld.yml)
@ -48,29 +48,33 @@ import java.util.List;
import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.*;
public class MyAppBuild extends Project {
public MyAppBuild() {
public class MyappBuild extends Project {
public MyappBuild() {
pkg = "com.example";
name = "my-app";
mainClass = "com.example.MyApp";
name = "Myapp";
mainClass = "com.example.MyappMain";
version = version(0,1,0);
downloadSources = true;
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,11,4)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,11,4)));
.include(dependency("org.junit.jupiter",
"junit-jupiter",
version(5,10,3)))
.include(dependency("org.junit.platform",
"junit-platform-console-standalone",
version(1,10,3)));
}
public static void main(String[] args) {
new MyAppBuild().start(args);
new MyappBuild().start(args);
}
}
```
> **NOTE:** `bld` supports different ways to describe dependencies,
> `dependency("org.junit.jupiter", "junit-jupiter", version(5,11,4))` can for instance also
> be written as `dependency("org.junit.jupiter:junit-jupiter:5.11.4")`. Which format you use,
> `dependency("org.junit.jupiter", "junit-jupiter", version(5,10,3))` can for instance also
> be written as `dependency("org.junit.jupiter:junit-jupiter:5.10.3")`. Which format you use,
> is a matter of personal taste.
# Where does `bld` fit?
@ -91,27 +95,6 @@ significantly reduces the cognitive load, and taking actions immediately
without having to mentally construct a described plan, makes it easier to
reason about your build.
# IDE support
<img src="https://rife2.com/images/bld-idea.png" style="width: 100%">
Since version 2.0, bld comes with its own [IntelliJ IDEA plugin](https://github.com/rife2/bld-idea):
* detect `bld` projects and find their main Java class
* quick access to open and edit the main Java class and wrapper properties of `bld` projects
* list all the commands in `bld` projects in a side panel
* execute one or multiple commands in the order they were selected
* reload the commands in the `bld` project
* terminate currently running `bld` commands
* `bld` console panel for command output with source code hyperlinking
* display the `bld` dependency tree
* toggle to run `bld` in offline or online mode
* auto-save all open files before executing a `bld` command
* convenient `bld` one-click cache invalidation
* set `bld` commands to run before or after IDEA compilation
* create custom `bld` command run configuration with options, JVM arguments, and before launch tasks
* assign keyboard shortcuts to `bld` commands
# Find out more
`bld` lets your build logic get out of the way so that you can focus on writing
@ -131,7 +114,23 @@ to post on the [forums](https://forum.uwyn.com) or to join us on [Discord](http
Read more in the [full documentation](https://github.com/rife2/bld/wiki) and [bld Javadocs](https://rife2.github.io/bld/).
# Contributing
# Building `bld`
See [CONTIBUTING.md](https://github.com/rife2/bld?tab=contributing-ov-file#readme) for information about
contributing to this project.
If you want to contribute to `bld` or customize it, all you have to do is clone the GitHub
repository and update the [RIFE2/core](https://github.com/rife2/rife2-core) submodule:
```console
git clone git@github.com:rife2/bld.git
cd bld
git submodule init
git submodule update
```
Then use `bld` to build itself:
```console
./bld compile
```
The project has an IntelliJ IDEA project structure. You can just open it after all
the dependencies were downloaded and peruse the code.

2
core

@ -1 +1 @@
Subproject commit fa567721c00d99626ed439db4f0340eadff0ec03
Subproject commit a45001aa3926f57d9d457e7c12800b264010b5dd

Binary file not shown.

View file

@ -1,12 +1,11 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.downloadLocation=
bld.extension-antlr=com.uwyn.rife2:bld-antlr4:1.4.3
bld.extension-archive=com.uwyn.rife2:bld-archive:0.6.3
bld.extension-reporter=com.uwyn.rife2:bld-junit-reporter:0.9.2
bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.6.3
bld.extension-antlr=com.uwyn.rife2:bld-antlr4:1.3.0
bld.extension-archive=com.uwyn.rife2:bld-archive:0.5.0
bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.5.0
bld.javaOptions=
bld.javacOptions=
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES
bld.sourceDirectories=core/src/bld/java
bld.version=2.3.0
bld.version=2.0.1

View file

@ -7,7 +7,6 @@ package rife;
import rife.bld.BuildCommand;
import rife.bld.Cli;
import rife.bld.dependencies.VersionNumber;
import rife.bld.extension.JUnitReporterOperation;
import rife.bld.extension.ZipOperation;
import rife.bld.operations.*;
import rife.bld.publish.*;
@ -34,38 +33,36 @@ public class BldBuild extends AbstractRife2Build {
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);
scope(test)
.include(dependency("org.json", "json", version(20250517)));
.include(dependency("org.json", "json", version(20240303)));
var core_dir = new File(workDirectory(), "core");
var core_src_dir = new File(core_dir, "src");
var core_src_main_dir = new File(core_src_dir, "main");
var core_directory = new File(workDirectory(), "core");
var core_src_directory = new File(core_directory, "src");
var core_src_main_directory = new File(core_src_directory, "main");
var core_src_main_java_directory = new File(core_src_main_directory, "java");
var core_src_main_resources_directory = new File(core_src_main_directory, "resources");
var core_src_test_directory = new File(core_src_directory, "test");
var core_src_test_java_directory = new File(core_src_test_directory, "java");
var core_src_test_resources_directory = new File(core_src_test_directory, "resources");
var core_src_main_resources_templates_directory = new File(core_src_main_resources_directory, "templates");
antlr4Operation
.sourceDirectories(List.of(new File(core_src_main_dir, "antlr")));
var core_src_test_dir = new File(core_src_dir, "test");
var core_src_test_java_dir = new File(core_src_test_dir, "java");
var core_src_main_java_dir = new File(core_src_main_dir, "java");
compileOperation()
.mainSourceDirectories(antlr4Operation.outputDirectory(), core_src_main_java_dir)
.testSourceDirectories(core_src_test_java_dir)
.compileOptions()
.debuggingInfo(JavacOptions.DebuggingInfo.ALL)
.addAll(List.of("-encoding", "UTF-8"));
var core_src_main_resources_dir = new File(core_src_main_dir, "resources");
var core_src_main_resources_templates_dir = new File(core_src_main_resources_dir, "templates");
.sourceDirectories(List.of(new File(core_src_main_directory, "antlr")))
.outputDirectory(new File(buildDirectory(), "generated/rife/template/antlr"));
precompileOperation()
.sourceDirectories(core_src_main_resources_templates_dir)
.sourceDirectories(core_src_main_resources_templates_directory)
.templateTypes(HTML, XML, SQL, TXT, JSON);
var core_src_test_resources_dir = new File(core_src_test_dir, "resources");
compileOperation()
.mainSourceDirectories(antlr4Operation.outputDirectory(), core_src_main_java_directory)
.testSourceDirectories(core_src_test_java_directory)
.compileOptions()
.debuggingInfo(JavacOptions.DebuggingInfo.ALL)
.addAll(List.of("-encoding", "UTF-8"));
jarOperation()
.sourceDirectories(core_src_main_resources_dir)
.excluded(Pattern.compile("^\\Q" + core_src_main_resources_templates_dir.getAbsolutePath() + "\\E.*"))
.sourceDirectories(core_src_main_resources_directory)
.excluded(Pattern.compile("^\\Q" + core_src_main_resources_templates_directory.getAbsolutePath() + "\\E.*"))
.manifestAttribute(Attributes.Name.MAIN_CLASS, mainClass());
zipBldOperation
@ -73,21 +70,18 @@ public class BldBuild extends AbstractRife2Build {
.destinationFileName("bld-" + version() + ".zip");
testsBadgeOperation
.classpath(core_src_main_resources_dir.getAbsolutePath())
.classpath(core_src_test_resources_dir.getAbsolutePath());
.classpath(core_src_main_resources_directory.getAbsolutePath())
.classpath(core_src_test_resources_directory.getAbsolutePath());
javadocOperation()
.sourceFiles(FileUtils.getJavaFileList(core_src_main_java_dir))
.sourceFiles(FileUtils.getJavaFileList(core_src_main_java_directory))
.javadocOptions()
.docTitle("<a href=\"https://rife2.com/bld\">bld</a> " + version())
.overview(new File(srcMainJavaDirectory(), "overview.html"))
.addAll(List.of("--allow-script-in-comments",
"-group", "bld", "rife.bld*",
"-group", "RIFE2/core", "rife:rife.cmf*:rife.config*:rife.database*:rife.datastructures*:rife.engine*:rife.forms*:rife.instrument*:rife.ioc*:rife.resources*:rife.selector*:rife.template*:rife.tools*:rife.validation*:rife.xml*"));
.overview(new File(srcMainJavaDirectory(), "overview.html"));
publishOperation()
.repository(version.isSnapshot() ? repository("rife2-snapshots") : repository("rife2-releases"))
.repository(version.isSnapshot() ? repository("central-snapshots") : repository("central-releases"))
.repository(version.isSnapshot() ? repository("sonatype-snapshots") : repository("sonatype-releases"))
.repository(repository("github"))
.info(new PublishInfo()
.groupId("com.uwyn.rife2")
@ -140,9 +134,11 @@ public class BldBuild extends AbstractRife2Build {
f.perms(0755);
});
});
b.dir("lib", l -> l.file("bld-wrapper.jar", f -> f.move(path(tmp, "lib", "bld", "bld-wrapper.jar"))));
b.dir("lib", l -> {
l.file("bld-wrapper.jar", f -> f.move(path(tmp, "lib", "bld", "bld-wrapper.jar")));
});
});
t.dir("lib", DirBuilder::delete);
t.dir("lib", l -> l.delete());
});
zipBldOperation
@ -162,14 +158,6 @@ public class BldBuild extends AbstractRife2Build {
zipBld();
}
@BuildCommand(summary = "Runs the JUnit reporter")
public void reporter() throws Exception {
new JUnitReporterOperation()
.fromProject(this)
.failOnSummary(true)
.execute();
}
public void publish()
throws Exception {
all();

View file

@ -1,58 +0,0 @@
/**
* bld is a new build system that allows you to write your build logic in pure Java.
* <p>
* More information can be found on the <a href="https://rife2.com/bld"><code>bld</code> website</a>.
* <p>
* Note that bld builds on top of the foundation that RIFE2 provides and includes the features
* of <a href="https://github.com/rife2/rife2-core">RIFE2/core</a>.
*
* @since 2.1.0
*/
module rife.bld {
requires java.compiler;
requires java.desktop;
requires java.logging;
requires java.net.http;
requires java.prefs;
requires static java.sql;
requires java.xml;
exports rife.bld;
exports rife.bld.blueprints;
exports rife.bld.dependencies;
exports rife.bld.dependencies.exceptions;
exports rife.bld.help;
exports rife.bld.instrument;
exports rife.bld.operations;
exports rife.bld.operations.exceptions;
exports rife.bld.publish;
exports rife;
exports rife.cmf;
exports rife.cmf.transform;
exports rife.config;
exports rife.config.exceptions;
exports rife.database;
exports rife.database.exceptions;
exports rife.database.queries;
exports rife.database.querymanagers.generic;
exports rife.database.querymanagers.generic.exceptions;
exports rife.database.types;
exports rife.datastructures;
exports rife.engine;
exports rife.forms;
exports rife.ioc;
exports rife.ioc.exceptions;
exports rife.resources;
exports rife.resources.exceptions;
exports rife.selector;
exports rife.template;
exports rife.template.exceptions;
exports rife.tools;
exports rife.tools.exceptions;
exports rife.validation;
exports rife.validation.annotations;
exports rife.validation.exceptions;
exports rife.xml;
exports rife.xml.exceptions;
}

View file

@ -1,24 +0,0 @@
<html>
<body>
<p><code>bld</code> is a new build system that allows you to write your build logic in pure Java.</p>
<p><code>bld</code>'s website is <a href="https://rife2.com/bld">https://rife2.com/bld</a>.</p>
<p>The GitHub project is at <a href="https://github.com/rife2/bld">https://github.com/rife2/bld</a></p>
<p>The documentation is available at <a href="https://github.com/rife2/bld/wiki">https://github.com/rife2/bld/wiki</a></p>
<p>Note that bld builds on top of the foundation that RIFE2 provides and includes the features of
<a href="https://github.com/rife2/rife2-core">RIFE2/core</a>.</p>
<script type="text/javascript">
window.onload = function () {
show('all-packages-table', 'all-packages-table-tab1', 2);
};
</script>
<style>
#all-packages-table-tab0 {
display: none;
}
</style>
</body>
</html>

View file

@ -5,7 +5,6 @@
package rife.bld;
import rife.bld.dependencies.*;
import rife.bld.dependencies.Module;
import rife.bld.help.*;
import rife.bld.operations.*;
import rife.tools.FileUtils;
@ -55,19 +54,12 @@ public class BaseProject extends BuildExecutor {
*/
protected VersionNumber version = null;
/**
* The project's main class to execute.
* The project's main class.
*
* @see #mainClass()
* @since 1.5
*/
protected String mainClass = null;
/**
* The project's module to execute.
*
* @see #module()
* @since 2.1
*/
protected String module = null;
/**
* The project's repositories for dependency resolution.
@ -253,13 +245,6 @@ public class BaseProject extends BuildExecutor {
* @since 1.5
*/
protected File libCompileDirectory = null;
/**
* The modules compile scope lib directory.
*
* @see #libCompileModulesDirectory()
* @since 2.1
*/
protected File libCompileModulesDirectory = null;
/**
* The provided scope lib directory.
*
@ -267,13 +252,6 @@ public class BaseProject extends BuildExecutor {
* @since 1.8
*/
protected File libProvidedDirectory = null;
/**
* The modules provided scope lib directory.
*
* @see #libProvidedModulesDirectory()
* @since 2.1
*/
protected File libProvidedModulesDirectory = null;
/**
* The runtime scope lib directory.
*
@ -281,13 +259,6 @@ public class BaseProject extends BuildExecutor {
* @since 1.5
*/
protected File libRuntimeDirectory = null;
/**
* The modules runtime scope lib directory.
*
* @see #libRuntimeModulesDirectory()
* @since 2.1
*/
protected File libRuntimeModulesDirectory = null;
/**
* The standalone scope lib directory.
*
@ -296,26 +267,12 @@ public class BaseProject extends BuildExecutor {
*/
protected File libStandaloneDirectory = null;
/**
* The modules standalone scope lib directory.
*
* @see #libStandaloneModulesDirectory()
* @since 2.1
*/
protected File libStandaloneModulesDirectory = null;
/**
* The test scope lib directory.
* The standalone scope lib directory.
*
* @see #libTestDirectory()
* @since 1.5
*/
protected File libTestDirectory = null;
/**
* The modules test scope lib directory.
*
* @see #libTestModulesDirectory()
* @since 2.1
*/
protected File libTestModulesDirectory = null;
/**
* The build directory.
*
@ -903,101 +860,6 @@ public class BaseProject extends BuildExecutor {
return new LocalDependency(path);
}
/**
* Creates a new module instance.
*
* @param groupId the module group identifier
* @param artifactId the module artifact identifier
* @return a newly created {@code Module} instance
* @since 2.1
*/
public Module module(String groupId, String artifactId) {
return new Module(groupId, artifactId);
}
/**
* Creates a new module instance.
*
* @param groupId the module group identifier
* @param artifactId the module artifact identifier
* @param version the module version
* @return a newly created {@code Module} instance
* @since 2.1
*/
public Module module(String groupId, String artifactId, String version) {
return new Module(groupId, artifactId, version(version));
}
/**
* Creates a new module instance.
*
* @param groupId the module group identifier
* @param artifactId the module artifact identifier
* @param version the module version
* @param classifier the module classifier
* @return a newly created {@code Module} instance
* @since 2.1
*/
public Module module(String groupId, String artifactId, String version, String classifier) {
return new Module(groupId, artifactId, version(version), classifier);
}
/**
* Creates a new module instance.
*
* @param groupId the module group identifier
* @param artifactId the module artifact identifier
* @param version the module version
* @return a newly created {@code Module} instance
* @since 2.1
*/
public Module module(String groupId, String artifactId, Version version) {
return new Module(groupId, artifactId, version);
}
/**
* Creates a new module instance.
*
* @param groupId the module group identifier
* @param artifactId the module artifact identifier
* @param version the module version
* @param classifier the module classifier
* @return a newly created {@code Module} instance
* @since 2.1
*/
public Module module(String groupId, String artifactId, Version version, String classifier) {
return new Module(groupId, artifactId, version, classifier);
}
/**
* Creates a new module instance from a string representation.
* The format is {@code groupId:artifactId:version:classifier}.
* The {@code version} and {@code classifier} are optional.
* <p>
* If the string can't be successfully parsed, {@code null} will be returned.
*
* @param description the module string to parse
* @return a parsed instance of {@code Module}; or
* {@code null} when the string couldn't be parsed
* @since 2.1
*/
public Module module(String description) {
return Module.parse(description);
}
/**
* Creates a local module instance.
* <p>
* If the local module points to a directory, it will be scanned for jar files.
*
* @param path the file system path of the local module
* @since 2.1
*/
public LocalModule localModule(String path) {
return new LocalModule(path);
}
/*
* Project directories
*/
@ -1150,16 +1012,6 @@ public class BaseProject extends BuildExecutor {
return Objects.requireNonNullElseGet(libCompileDirectory, () -> new File(libDirectory(), "compile"));
}
/**
* Returns the project modules compile scope lib directory.
* Defaults to {@code "modules"} relative to {@link #libCompileDirectory()}.
*
* @since 2.1
*/
public File libCompileModulesDirectory() {
return Objects.requireNonNullElseGet(libCompileModulesDirectory, () -> new File(libCompileDirectory(), "modules"));
}
/**
* Returns the project provided scope lib directory.
* Defaults to {@code "provided"} relative to {@link #libDirectory()}.
@ -1170,16 +1022,6 @@ public class BaseProject extends BuildExecutor {
return Objects.requireNonNullElseGet(libProvidedDirectory, () -> new File(libDirectory(), "provided"));
}
/**
* Returns the project modules provided scope lib directory.
* Defaults to {@code "modules"} relative to {@link #libProvidedDirectory()}.
*
* @since 2.1
*/
public File libProvidedModulesDirectory() {
return Objects.requireNonNullElseGet(libProvidedModulesDirectory, () -> new File(libProvidedDirectory(), "modules"));
}
/**
* Returns the project runtime scope lib directory.
* Defaults to {@code "runtime"} relative to {@link #libDirectory()}.
@ -1190,16 +1032,6 @@ public class BaseProject extends BuildExecutor {
return Objects.requireNonNullElseGet(libRuntimeDirectory, () -> new File(libDirectory(), "runtime"));
}
/**
* Returns the project modules runtime scope lib directory.
* Defaults to {@code "modules"} relative to {@link #libRuntimeDirectory()}.
*
* @since 1.5
*/
public File libRuntimeModulesDirectory() {
return Objects.requireNonNullElseGet(libRuntimeModulesDirectory, () -> new File(libRuntimeDirectory(), "modules"));
}
/**
* Returns the project standalone scope lib directory.
* Defaults to {@code null}.
@ -1207,17 +1039,7 @@ public class BaseProject extends BuildExecutor {
* @since 1.5
*/
public File libStandaloneDirectory() {
return libStandaloneDirectory;
}
/**
* Returns the project standalone scope lib directory.
* Defaults to {@code null}.
*
* @since 2.1
*/
public File libStandaloneModulesDirectory() {
return libStandaloneModulesDirectory;
return null;
}
/**
@ -1230,16 +1052,6 @@ public class BaseProject extends BuildExecutor {
return Objects.requireNonNullElseGet(libTestDirectory, () -> new File(libDirectory(), "test"));
}
/**
* Returns the project modules test scope lib directory.
* Defaults to {@code "modules"} relative to {@link #libTestDirectory()}.
*
* @since 2.1
*/
public File libTestModulesDirectory() {
return Objects.requireNonNullElseGet(libTestModulesDirectory, () -> new File(libTestDirectory(), "modules"));
}
/**
* Returns the project build directory.
* Defaults to {@code "build"} relative to {@link #workDirectory()}.
@ -1330,19 +1142,12 @@ public class BaseProject extends BuildExecutor {
libDirectory().mkdirs();
libBldDirectory().mkdirs();
libCompileDirectory().mkdirs();
libCompileModulesDirectory().mkdirs();
libProvidedDirectory().mkdirs();
libProvidedModulesDirectory().mkdirs();
libRuntimeDirectory().mkdirs();
libRuntimeModulesDirectory().mkdirs();
if (libStandaloneDirectory() != null) {
libStandaloneDirectory().mkdirs();
}
if (libStandaloneModulesDirectory() != null) {
libStandaloneModulesDirectory().mkdirs();
}
libTestDirectory().mkdirs();
libTestModulesDirectory().mkdirs();
}
/**
@ -1376,17 +1181,6 @@ public class BaseProject extends BuildExecutor {
return pkg;
}
/**
* Returns whether this project's package was set.
*
* @return {@code true} if the package was set; or
* {@code false} otherwise
* @since 2.2.1
*/
public boolean hasPkg() {
return pkg != null;
}
/**
* Returns the project's name.
*
@ -1399,17 +1193,6 @@ public class BaseProject extends BuildExecutor {
return name;
}
/**
* Returns whether this project's name was set.
*
* @return {@code true} if the name was set; or
* {@code false} otherwise
* @since 2.2.1
*/
public boolean hasName() {
return name != null;
}
/**
* Returns the project's version.
*
@ -1423,34 +1206,17 @@ public class BaseProject extends BuildExecutor {
}
/**
* Returns whether this project's version was set.
*
* @return {@code true} if the version was set; or
* {@code false} otherwise
* @since 2.2.1
*/
public boolean hasVersion() {
return version != null;
}
/**
* Returns the project's main class to execute.
* Returns the project's main class.
*
* @since 1.5
*/
public String mainClass() {
if (mainClass == null) {
throw new IllegalStateException("The mainClass variable has to be set.");
}
return mainClass;
}
/**
* Returns the project's module to execute.
*
* @since 2.1
*/
public String module() {
return module;
}
/**
* Returns the list of repositories for this project.
* <p>
@ -1566,14 +1332,7 @@ public class BaseProject extends BuildExecutor {
* @since 1.5
*/
public String uberJarMainClass() {
if (uberJarMainClass != null) {
return uberJarMainClass;
}
if (mainClass() != null) {
return mainClass();
}
throw new IllegalStateException("The mainClass variable has to be set.");
return Objects.requireNonNullElseGet(uberJarMainClass, this::mainClass);
}
/**
@ -1656,25 +1415,6 @@ public class BaseProject extends BuildExecutor {
return classpath;
}
/**
* Returns all the jar files that are in the compile scope module path.
* <p>
* By default, this collects all the jar files in the {@link #libCompileModulesDirectory()}
* and adds all the jar files from the compile scope local modules.
*
* @since 2.1
*/
public List<File> compileModulePathJars() {
// detect the jar files in the modules compile lib directory
var dir_abs = libCompileModulesDirectory().getAbsoluteFile();
var jar_files = FileUtils.getFileList(dir_abs, INCLUDED_JARS, EXCLUDED_JARS);
// build the compilation module path
var module_path = new ArrayList<>(jar_files.stream().map(file -> new File(dir_abs, file)).toList());
addLocalModules(module_path, Scope.compile);
return module_path;
}
/**
* Returns all the jar files that are in the provided scope classpath.
* <p>
@ -1694,25 +1434,6 @@ public class BaseProject extends BuildExecutor {
return classpath;
}
/**
* Returns all the jar files that are in the provided scope module path.
* <p>
* By default, this collects all the jar files in the {@link #libProvidedModulesDirectory()}
* and adds all the jar files from the provided scope local modules.
*
* @since 2.1
*/
public List<File> providedModulePathJars() {
// detect the jar files in the modules provided lib directory
var dir_abs = libProvidedModulesDirectory().getAbsoluteFile();
var jar_files = FileUtils.getFileList(dir_abs, INCLUDED_JARS, EXCLUDED_JARS);
// build the provided module path
var module_path = new ArrayList<>(jar_files.stream().map(file -> new File(dir_abs, file)).toList());
addLocalModules(module_path, Scope.provided);
return module_path;
}
/**
* Returns all the jar files that are in the runtime scope classpath.
* <p>
@ -1732,25 +1453,6 @@ public class BaseProject extends BuildExecutor {
return classpath;
}
/**
* Returns all the jar files that are in the runtime scope module path.
* <p>
* By default, this collects all the jar files in the {@link #libRuntimeModulesDirectory()}
* and adds all the jar files from the runtime scope local modules.
*
* @since 2.1
*/
public List<File> runtimeModulePathJars() {
// detect the jar files in the modules runtime lib directory
var dir_abs = libRuntimeModulesDirectory().getAbsoluteFile();
var jar_files = FileUtils.getFileList(dir_abs, INCLUDED_JARS, EXCLUDED_JARS);
// build the runtime module path
var module_path = new ArrayList<>(jar_files.stream().map(file -> new File(dir_abs, file)).toList());
addLocalModules(module_path, Scope.runtime);
return module_path;
}
/**
* Returns all the jar files that are in the standalone scope classpath.
* <p>
@ -1775,30 +1477,6 @@ public class BaseProject extends BuildExecutor {
return classpath;
}
/**
* Returns all the jar files that are in the standalone scope module path.
* <p>
* By default, this collects all the jar files in the {@link #libStandaloneModulesDirectory()}
* and adds all the jar files from the standalone scope local modules.
*
* @since 2.1
*/
public List<File> standaloneModulePathJars() {
// build the standalone classpath
List<File> module_path;
if (libStandaloneModulesDirectory() == null) {
module_path = new ArrayList<>();
} else {
// detect the jar files in the modules standalone lib directory
var dir_abs = libStandaloneModulesDirectory().getAbsoluteFile();
var jar_files = FileUtils.getFileList(dir_abs, INCLUDED_JARS, EXCLUDED_JARS);
module_path = new ArrayList<>(jar_files.stream().map(file -> new File(dir_abs, file)).toList());
}
addLocalModules(module_path, Scope.standalone);
return module_path;
}
/**
* Returns all the jar files that are in the test scope classpath.
* <p>
@ -1818,51 +1496,20 @@ public class BaseProject extends BuildExecutor {
return classpath;
}
/**
* Returns all the jar files that are in the test scope module path.
* <p>
* By default, this collects all the jar files in the {@link #libTestModulesDirectory()}
* and adds all the jar files from the test scope local modules.
*
* @since 2.1
*/
public List<File> testModulePathJars() {
// detect the jar files in the test lib directory
var dir_abs = libTestModulesDirectory().getAbsoluteFile();
var jar_files = FileUtils.getFileList(dir_abs, INCLUDED_JARS, EXCLUDED_JARS);
// build the test module path
var module_path = new ArrayList<>(jar_files.stream().map(file -> new File(dir_abs, file)).toList());
addLocalModules(module_path, Scope.test);
return module_path;
}
private void addLocalDependencies(List<File> classpath, Scope scope) {
if (dependencies.get(scope) == null) {
return;
}
for (var dependency : dependencies.get(scope).localDependencies()) {
addLocalJars(classpath, dependency.path());
}
}
private void addLocalModules(List<File> classpath, Scope scope) {
if (dependencies.get(scope) == null) {
return;
}
for (var module : dependencies.get(scope).localModules()) {
addLocalJars(classpath, module.path());
}
}
private void addLocalJars(List<File> jars, String path) {
var local_file = new File(workDirectory(), path);
if (local_file.exists()) {
if (local_file.isDirectory()) {
var local_jar_files = FileUtils.getFileList(local_file.getAbsoluteFile(), INCLUDED_JARS, EXCLUDED_JARS);
jars.addAll(new ArrayList<>(local_jar_files.stream().map(file -> new File(local_file, file)).toList()));
} else {
jars.add(local_file);
var local_file = new File(workDirectory(), dependency.path());
if (local_file.exists()) {
if (local_file.isDirectory()) {
var local_jar_files = FileUtils.getFileList(local_file.getAbsoluteFile(), INCLUDED_JARS, EXCLUDED_JARS);
classpath.addAll(new ArrayList<>(local_jar_files.stream().map(file -> new File(local_file, file)).toList()));
} else {
classpath.add(local_file);
}
}
}
}
@ -1870,7 +1517,7 @@ public class BaseProject extends BuildExecutor {
/**
* Returns all the classpath entries for compiling the main sources.
* <p>
* By default, this converts the files from {@link #compileClasspathJars()} and {@link #providedClasspathJars()} to absolute paths.
* By default, this converts the files from {@link #compileClasspathJars()} to absolute paths.
*
* @since 1.5
*/
@ -1878,21 +1525,10 @@ public class BaseProject extends BuildExecutor {
return FileUtils.combineToAbsolutePaths(compileClasspathJars(), providedClasspathJars());
}
/**
* Returns all the module path entries for compiling the main sources.
* <p>
* By default, this converts the files from {@link #compileModulePathJars()} and {@link #providedModulePathJars()} to absolute paths.
*
* @since 2.1
*/
public List<String> compileMainModulePath() {
return FileUtils.combineToAbsolutePaths(compileModulePathJars(), providedModulePathJars());
}
/**
* Returns all the classpath entries for compiling the test sources.
* <p>
* By default, this converts the files from {@link #compileClasspathJars()}, {@link #providedClasspathJars()} and
* By default, this converts the files from {@link #compileClasspathJars()} and
* {@link #testClasspathJars()} to absolute paths, as well as the {@link #buildMainDirectory()}
*
* @since 1.5
@ -1904,18 +1540,6 @@ public class BaseProject extends BuildExecutor {
return paths;
}
/**
* Returns all the module path entries for compiling the test sources.
* <p>
* By default, this converts the files from {@link #compileModulePathJars()}, {@link #providedModulePathJars()} and
* {@link #testModulePathJars()} to absolute paths.
*
* @since 2.1
*/
public List<String> compileTestModulePath() {
return FileUtils.combineToAbsolutePaths(compileModulePathJars(), providedModulePathJars(), testModulePathJars());
}
/**
* Returns all the classpath entries for running the application.
* <p>
@ -1933,22 +1557,10 @@ public class BaseProject extends BuildExecutor {
return paths;
}
/**
* Returns all the module path entries for running the application.
* <p>
* By default, this converts the files from {@link #compileModulePathJars()},
* {@link #runtimeModulePathJars()} and {@link #standaloneModulePathJars()} to absolute paths.
*
* @since 2.1
*/
public List<String> runModulePath() {
return FileUtils.combineToAbsolutePaths(compileModulePathJars(), runtimeModulePathJars(), standaloneModulePathJars());
}
/**
* Returns all the classpath entries for testing the application.
* <p>
* By default, this converts the files from {@link #compileClasspathJars()}, {@link #providedClasspathJars()},
* By default, this converts the files from {@link #compileClasspathJars()},
* {@link #runtimeClasspathJars()} and {@link #testClasspathJars()}
* to absolute paths, as well as the {@link #srcMainResourcesDirectory()},
* {@link #buildMainDirectory()} and {@link #buildTestDirectory()}
@ -1965,19 +1577,6 @@ public class BaseProject extends BuildExecutor {
return paths;
}
/**
* Returns all the module path entries for testing the application.
* <p>
* By default, this converts the files from {@link #compileModulePathJars()}, {@link #providedModulePathJars()},
* {@link #runtimeModulePathJars()} and {@link #testModulePathJars()}
* to absolute paths.
*
* @since 2.1
*/
public List<String> testModulePath() {
return FileUtils.combineToAbsolutePaths(compileModulePathJars(), providedModulePathJars(), runtimeModulePathJars(), standaloneModulePathJars(), testModulePathJars());
}
/**
* Executes download and purge commands automatically when the
* {@code autoDownloadPurge} flag is set and changes have been detected.

View file

@ -108,11 +108,6 @@ public class WebProject extends Project {
return Objects.requireNonNullElseGet(libStandaloneDirectory, () -> new File(libDirectory(), "standalone"));
}
@Override
public File libStandaloneModulesDirectory() {
return Objects.requireNonNullElseGet(libStandaloneModulesDirectory, () -> new File(libStandaloneDirectory(), "modules"));
}
/**
* Returns the project main webapp directory.
* Defaults to {@code "webapp"} relative to {@link #srcMainDirectory()}.

View file

@ -22,22 +22,22 @@ import static rife.bld.dependencies.Scope.test;
* @since 1.9
*/
public class AppProjectBlueprint extends Project {
public AppProjectBlueprint(File work, String packageName, String projectName, String baseName) {
this(work, packageName, projectName, baseName, new VersionNumber(0,0,1));
public AppProjectBlueprint(File work, String packageName, String projectName) {
this(work, packageName, projectName, new VersionNumber(0,0,1));
}
public AppProjectBlueprint(File work, String packageName, String projectName, String baseName, VersionNumber versionNumber) {
public AppProjectBlueprint(File work, String packageName, String projectName, VersionNumber versionNumber) {
workDirectory = work;
pkg = packageName;
name = projectName;
mainClass = packageName + "." + baseName;
mainClass = packageName + "." + StringUtils.capitalize(projectName) + "Main";
version = versionNumber;
downloadSources = true;
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,11,4)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,11,4)));
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,3)));
}
}

View file

@ -21,16 +21,16 @@ import static rife.bld.dependencies.Repository.SONATYPE_SNAPSHOTS;
* @since 1.5.20
*/
public class BaseProjectBlueprint extends Project {
public BaseProjectBlueprint(File work, String packageName, String projectName, String baseName) {
this(work, packageName, projectName, baseName, new VersionNumber(0,0,1));
public BaseProjectBlueprint(File work, String packageName, String projectName) {
this(work, packageName, projectName, new VersionNumber(0,0,1));
}
public BaseProjectBlueprint(File work, String packageName, String projectName, String baseName, VersionNumber versionNumber) {
public BaseProjectBlueprint(File work, String packageName, String projectName, VersionNumber versionNumber) {
workDirectory = work;
pkg = packageName;
name = projectName;
mainClass = packageName + "." + baseName;
mainClass = packageName + "." + StringUtils.capitalize(projectName) + "Main";
version = versionNumber;
downloadSources = true;

View file

@ -22,22 +22,22 @@ import static rife.bld.dependencies.Scope.test;
* @since 1.6
*/
public class LibProjectBlueprint extends Project {
public LibProjectBlueprint(File work, String packageName, String projectName, String baseName) {
this(work, packageName, projectName, baseName, new VersionNumber(0,0,1));
public LibProjectBlueprint(File work, String packageName, String projectName) {
this(work, packageName, projectName, new VersionNumber(0,0,1));
}
public LibProjectBlueprint(File work, String packageName, String projectName, String baseName, VersionNumber versionNumber) {
public LibProjectBlueprint(File work, String packageName, String projectName, VersionNumber versionNumber) {
workDirectory = work;
pkg = packageName;
name = projectName;
mainClass = packageName + "." + baseName;
mainClass = packageName + "." + StringUtils.capitalize(projectName) + "Lib";
version = versionNumber;
downloadSources = true;
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,11,4)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,11,4)));
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,3)));
}
}

View file

@ -23,31 +23,31 @@ import static rife.bld.dependencies.Scope.*;
* @since 1.5
*/
public class Rife2ProjectBlueprint extends WebProject {
public Rife2ProjectBlueprint(File work, String packageName, String projectName, String baseName) {
this(work, packageName, projectName, baseName, new VersionNumber(0,0,1));
public Rife2ProjectBlueprint(File work, String packageName, String projectName) {
this(work, packageName, projectName, new VersionNumber(0,0,1));
}
public Rife2ProjectBlueprint(File work, String packageName, String projectName, String baseName, VersionNumber versionNumber) {
public Rife2ProjectBlueprint(File work, String packageName, String projectName, VersionNumber versionNumber) {
workDirectory = work;
pkg = packageName;
name = projectName;
mainClass = packageName + "." + baseName + "Site";
mainClass = packageName + "." + StringUtils.capitalize(projectName) + "Site";
uberJarMainClass = mainClass + "Uber";
version = versionNumber;
downloadSources = true;
repositories = List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS);
scope(compile)
.include(dependency("com.uwyn.rife2", "rife2", version(1,9,1)));
.include(dependency("com.uwyn.rife2", "rife2", version(1,8,0)));
scope(test)
.include(dependency("org.jsoup", "jsoup", version(1,18,3)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,11,4)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,11,4)));
.include(dependency("org.jsoup", "jsoup", version(1,18,1)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5,10,3)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,10,3)));
scope(standalone)
.include(dependency("org.eclipse.jetty.ee10", "jetty-ee10", version(12,0,16)))
.include(dependency("org.eclipse.jetty.ee10", "jetty-ee10-servlet", version(12,0,16)))
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,16)));
.include(dependency("org.eclipse.jetty.ee10", "jetty-ee10", version(12,0,11)))
.include(dependency("org.eclipse.jetty.ee10", "jetty-ee10-servlet", version(12,0,11)))
.include(dependency("org.slf4j", "slf4j-simple", version(2,0,13)));
precompileOperation().templateTypes(TemplateType.HTML);
}

View file

@ -4,51 +4,26 @@
*/
package rife.bld.dependencies;
import java.util.HashSet;
import java.util.Objects;
import java.util.regex.Pattern;
/**
* Contains the information required to describe a dependency in the build system.
* Contains the information required to describe an url dependency in the build system.
*
* @param groupId the dependency group identifier
* @param artifactId the dependency url identifier
* @param version the dependency version
* @param classifier the dependency classier
* @param type the dependency type
* @param exclusions the dependency exclusions for transitive resolution
* @param parent the parent dependency that created this dependency (only for information purposes)
* @author Geert Bevin (gbevin[remove] at uwyn dot com)
* @since 1.5
*/
public class Dependency {
public record Dependency(String groupId, String artifactId, Version version, String classifier, String type, ExclusionSet exclusions, Dependency parent) {
public static final String CLASSIFIER_SOURCES = "sources";
public static final String CLASSIFIER_JAVADOC = "javadoc";
/**
* The dependency type name for a JAR file that can be placed either on the class-path or on the module-path.
*
* @since 2.1
*/
public static final String TYPE_JAR = "jar";
/**
* The dependency type name for a JAR file to unconditionally place on the class-path.
*
* @since 2.1
*/
public static final String TYPE_CLASSPATH_JAR = "classpath-jar";
/**
* The dependency type name for a JAR file to unconditionally place on the module-path.
*
* @since 2.1
*/
// see https://github.com/apache/maven/blob/maven-4.0.0-beta-3/api/maven-api-core/src/main/java/org/apache/maven/api/Type.java
public static final String TYPE_MODULAR_JAR = "modular-jar";
private final String groupId_;
private final String artifactId_;
private final Version version_;
private final String classifier_;
private final String type_;
private final ExclusionSet exclusions_;
private final Dependency parent_;
private final HashSet<String> excludedClassifiers_;
public Dependency(String groupId, String artifactId) {
this(groupId, artifactId, null, null, null);
}
@ -70,21 +45,13 @@ public class Dependency {
}
public Dependency(String groupId, String artifactId, Version version, String classifier, String type, ExclusionSet exclusions, Dependency parent) {
if (type == null) {
type = TYPE_JAR;
}
if (parent != null && parent.isModularJar() && TYPE_JAR.equals(type)) {
type = TYPE_MODULAR_JAR;
}
this.groupId_ = groupId;
this.artifactId_ = artifactId;
this.version_ = (version == null ? VersionNumber.UNKNOWN : version);
this.classifier_ = (classifier == null ? "" : classifier);
this.type_ = type;
this.exclusions_ = (exclusions == null ? new ExclusionSet() : exclusions);
this.parent_ = parent;
this.excludedClassifiers_ = new HashSet<>();
this.groupId = groupId;
this.artifactId = artifactId;
this.version = (version == null ? VersionNumber.UNKNOWN : version);
this.classifier = (classifier == null ? "" : classifier);
this.type = (type == null ? "jar" : type);
this.exclusions = (exclusions == null ? new ExclusionSet() : exclusions);
this.parent = parent;
}
private static final Pattern DEPENDENCY_PATTERN = Pattern.compile("^(?<groupId>[^:@]+):(?<artifactId>[^:@]+)(?::(?<version>[^:@]+)(?::(?<classifier>[^:@]+))?)?(?:@(?<type>[^:@]+))?$");
@ -128,7 +95,7 @@ public class Dependency {
* @since 1.5
*/
public Dependency baseDependency() {
return new Dependency(groupId_, artifactId_, VersionNumber.UNKNOWN, classifier_, type_);
return new Dependency(groupId, artifactId, VersionNumber.UNKNOWN, classifier, type);
}
/**
@ -140,7 +107,7 @@ public class Dependency {
* @since 1.5
*/
public Dependency exclude(String groupId, String artifactId) {
exclusions_.add(new DependencyExclusion(groupId, artifactId));
exclusions.add(new DependencyExclusion(groupId, artifactId));
return this;
}
@ -152,29 +119,7 @@ public class Dependency {
* @since 1.5.6
*/
public Dependency withClassifier(String classifier) {
return new Dependency(groupId_, artifactId_, version_, classifier, type_);
}
/**
* Exclude the sources artifact from download operations.
*
* @return this dependency instance
* @since 2.1
*/
public Dependency excludeSources() {
excludedClassifiers_.add(CLASSIFIER_SOURCES);
return this;
}
/**
* Exclude the javadoc artifact from download operations.
*
* @return this dependency instance
* @since 2.1
*/
public Dependency excludeJavadoc() {
excludedClassifiers_.add(CLASSIFIER_JAVADOC);
return this;
return new Dependency(groupId, artifactId, version, classifier, type);
}
/**
@ -201,134 +146,34 @@ public class Dependency {
* @since 2.0
*/
public String toArtifactString() {
return groupId_ + ':' + artifactId_;
return groupId + ':' + artifactId;
}
public String toString() {
var result = new StringBuilder(groupId_).append(':').append(artifactId_);
if (!version_.equals(VersionNumber.UNKNOWN)) {
result.append(':').append(version_);
var result = new StringBuilder(groupId).append(':').append(artifactId);
if (!version.equals(VersionNumber.UNKNOWN)) {
result.append(':').append(version);
}
if (!classifier_.isEmpty()) {
result.append(':').append(classifier_);
if (!classifier.isEmpty()) {
result.append(':').append(classifier);
}
if (!type_.isEmpty() && !TYPE_JAR.equals(type_)) {
result.append('@').append(type_);
if (!type.isEmpty() && !"jar".equals(type)) {
result.append('@').append(type);
}
return result.toString();
}
/**
* Returns this dependency's {@code groupId}.
*
* @return the {@code groupId} of this dependency
* @since 1.5
*/
public String groupId() {
return groupId_;
}
/**
* Returns this dependency's {@code artifactId}.
*
* @return the {@code artifactId} of this dependency
* @since 1.5
*/
public String artifactId() {
return artifactId_;
}
/**
* Returns this dependency's {@code version}.
*
* @return the {@code version} of this dependency
* @since 1.5
*/
public Version version() {
return version_;
}
/**
* Returns this dependency's {@code classifier}.
*
* @return the {@code classifier} of this dependency
* @since 1.5
*/
public String classifier() {
return classifier_;
}
/**
* Returns this dependency's {@code type}.
*
* @return the {@code type} of this dependency
* @since 1.5
*/
public String type() {
return type_;
}
/**
* Returns this dependency's {@code exclusions} for transitive resolution.
*
* @return the {@code exclusions} of this dependency
* @since 1.5
*/
public ExclusionSet exclusions() {
return exclusions_;
}
public HashSet<String> excludedClassifiers() {
return excludedClassifiers_;
}
/**
* Returns this dependency's {@code parent} dependency that created this
* dependency (only for information purposes).
*
* @return the {@code parent} of this dependency
* @since 1.5
*/
public Dependency parent() {
return parent_;
}
/**
* Indicates whether this dependency specifically is a classpath jar or not.
*
* @return {@code true} when this dependency specifically is a classpath jar; or {@code false} otherwise
* @since 2.1
*/
public boolean isClasspathJar() {
return Module.TYPE_CLASSPATH_JAR.equals(type_);
}
/**
* Indicates whether this dependency is a modular jar or not.
*
* @return {@code true} when this dependency is a modular jar; or {@code false} otherwise
* @since 2.1
*/
public boolean isModularJar() {
return Module.TYPE_MODULAR_JAR.equals(type_);
}
private static String normalizedJarType(String type) {
if (TYPE_JAR.equals(type) || TYPE_MODULAR_JAR.equals(type) || TYPE_CLASSPATH_JAR.equals(type)) {
return TYPE_JAR;
}
return type;
}
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Dependency that)) return false;
return groupId_.equals(that.groupId_) &&
artifactId_.equals(that.artifactId_) &&
classifier_.equals(that.classifier_) &&
normalizedJarType(type_).equals(normalizedJarType(that.type_));
if (o == null || getClass() != o.getClass()) return false;
var that = (Dependency) o;
return groupId.equals(that.groupId) &&
artifactId.equals(that.artifactId) &&
classifier.equals(that.classifier) &&
type.equals(that.type);
}
public int hashCode() {
return Objects.hash(groupId_, artifactId_, classifier_, normalizedJarType(type_));
return Objects.hash(groupId, artifactId, classifier, type);
}
}

View file

@ -11,8 +11,6 @@ import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
import static rife.bld.dependencies.Dependency.*;
/**
* Resolves a dependency within a list of Maven-compatible repositories.
*
@ -335,7 +333,7 @@ public class DependencyResolver {
result.append('-').append(dependency_.classifier());
}
var type = dependency_.type();
if (type == null || TYPE_JAR.equals(type) || TYPE_MODULAR_JAR.equals(type) || TYPE_CLASSPATH_JAR.equals(type)) {
if (type == null) {
type = "jar";
}
result.append('.').append(type);

View file

@ -23,7 +23,6 @@ import java.util.*;
public class DependencySet extends AbstractSet<Dependency> implements Set<Dependency> {
private final Map<Dependency, Dependency> dependencies_ = new LinkedHashMap<>();
private final Set<LocalDependency> localDependencies_ = new LinkedHashSet<>();
private final Set<LocalModule> localModules_ = new LinkedHashSet<>();
/**
* Creates an empty dependency set.
@ -80,94 +79,50 @@ public class DependencySet extends AbstractSet<Dependency> implements Set<Depend
return localDependencies_;
}
/**
* Includes a local module into the dependency set.
* <p>
* Local modules aren't resolved and point to a location on
* the file system.
*
* @param module the module to include
* @return this dependency set instance
* @since 2.1
*/
public DependencySet include(LocalModule module) {
localModules_.add(module);
return this;
}
/**
* Retrieves the local modules.
*
* @return the set of local modules
* @since 2.1
*/
public Set<LocalModule> localModules() {
return localModules_;
}
/**
* Transfers the artifacts for the dependencies into the provided directory.
* <p>
* The destination directory must exist and be writable.
*
* @param resolution the version resolution state that can be cached
* @param retriever the retriever to use to get artifacts
* @param repositories the repositories to use for the transfer
* @param directory the directory to transfer the artifacts into
* @param modulesDirectory the directory to download the modules into
* @param resolution the version resolution state that can be cached
* @param retriever the retriever to use to get artifacts
* @param repositories the repositories to use for the transfer
* @param directory the directory to transfer the artifacts into
* @return the list of artifacts that were transferred successfully
* @throws DependencyTransferException when an error occurred during the transfer
* @since 2.1
* @since 2.0
*/
public List<RepositoryArtifact> transferIntoDirectory(VersionResolution resolution, ArtifactRetriever retriever, List<Repository> repositories, File directory, File modulesDirectory) {
return transferIntoDirectory(resolution, retriever, repositories, directory, modulesDirectory, (String[]) null);
public List<RepositoryArtifact> transferIntoDirectory(VersionResolution resolution, ArtifactRetriever retriever, List<Repository> repositories, File directory) {
return transferIntoDirectory(resolution, retriever, repositories, directory, (String[]) null);
}
/**
* Transfers the artifacts for the dependencies into the provided directories,
* Transfers the artifacts for the dependencies into the provided directory,
* including other classifiers.
* <p>
* The destination directory must exist and be writable.
*
* @param resolution the version resolution state that can be cached
* @param retriever the retriever to use to get artifacts
* @param repositories the repositories to use for the download
* @param directory the directory to download the artifacts into
* @param modulesDirectory the directory to download the modules into
* @param classifiers the additional classifiers to transfer
* @param resolution the version resolution state that can be cached
* @param retriever the retriever to use to get artifacts
* @param repositories the repositories to use for the download
* @param directory the directory to download the artifacts into
* @param classifiers the additional classifiers to transfer
* @return the list of artifacts that were transferred successfully
* @throws DependencyTransferException when an error occurred during the transfer
* @since 2.1
* @since 2.0
*/
public List<RepositoryArtifact> transferIntoDirectory(VersionResolution resolution, ArtifactRetriever retriever, List<Repository> repositories, File directory, File modulesDirectory, String... classifiers) {
public List<RepositoryArtifact> transferIntoDirectory(VersionResolution resolution, ArtifactRetriever retriever, List<Repository> repositories, File directory, String... classifiers) {
var result = new ArrayList<RepositoryArtifact>();
for (var dependency : this) {
var transfer_directory = directory;
if (dependency.isModularJar()) {
if (modulesDirectory == null) {
throw new DependencyTransferException(dependency, "modules directory is not provided");
}
transfer_directory = modulesDirectory;
}
else if (directory == null) {
throw new DependencyTransferException(dependency, "artifacts directory is not provided");
}
if (!transfer_directory.exists()) {
if (!transfer_directory.mkdirs()) {
throw new DependencyTransferException(dependency, transfer_directory, "couldn't create directory");
}
}
var artifact = new DependencyResolver(resolution, retriever, repositories, dependency).transferIntoDirectory(transfer_directory);
var artifact = new DependencyResolver(resolution, retriever, repositories, dependency).transferIntoDirectory(directory);
if (artifact != null) {
result.add(artifact);
}
if (classifiers != null) {
for (var classifier : classifiers) {
if (classifier != null && !dependency.excludedClassifiers().contains(classifier)) {
var classifier_artifact = new DependencyResolver(resolution, retriever, repositories, dependency.withClassifier(classifier)).transferIntoDirectory(transfer_directory);
if (classifier != null) {
var classifier_artifact = new DependencyResolver(resolution, retriever, repositories, dependency.withClassifier(classifier)).transferIntoDirectory(directory);
if (classifier_artifact != null) {
result.add(classifier_artifact);
}

View file

@ -1,17 +0,0 @@
/*
* Copyright 2001-2024 Geert Bevin (gbevin[remove] at uwyn dot com)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.dependencies;
/**
* Contains the information required to describe a local module for the build system.
* <p>
* If the local module points to a directory, it will be scanned for jar files.
*
* @param path the file system path of the local module
* @author Geert Bevin (gbevin[remove] at uwyn dot com)
* @since 2.1
*/
public record LocalModule(String path) {
}

View file

@ -1,67 +0,0 @@
/*
* Copyright 2001-2024 Geert Bevin (gbevin[remove] at uwyn dot com)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.dependencies;
import java.util.regex.Pattern;
/**
* Contains the information required to describe a Java module dependency in the build system.
*
* @author Geert Bevin (gbevin[remove] at uwyn dot com)
* @since 2.1
*/
public class Module extends Dependency {
public Module(String groupId, String artifactId) {
this(groupId, artifactId, null, null, null, null);
}
public Module(String groupId, String artifactId, Version version) {
this(groupId, artifactId, version, null, null, null);
}
public Module(String groupId, String artifactId, Version version, String classifier) {
this(groupId, artifactId, version, classifier, null, null);
}
public Module(String groupId, String artifactId, Version version, String classifier, ExclusionSet exclusions) {
this(groupId, artifactId, version, classifier, exclusions, null);
}
public Module(String groupId, String artifactId, Version version, String classifier, ExclusionSet exclusions, Dependency parent) {
super(groupId, artifactId, version, classifier, TYPE_MODULAR_JAR, exclusions, parent);
}
private static final Pattern MODULE_PATTERN = Pattern.compile("^(?<groupId>[^:@]+):(?<artifactId>[^:@]+)(?::(?<version>[^:@]+)(?::(?<classifier>[^:@]+))?)?(?:@modular-jar)?$");
/**
* Parses a module from a string representation.
* The format is {@code groupId:artifactId:version:classifier}.
* The {@code version} and {@code classifier} are optional.
* <p>
* If the string can't be successfully parsed, {@code null} will be returned.
*
* @param module the module string to parse
* @return a parsed instance of {@code Module}; or
* {@code null} when the string couldn't be parsed
* @since 2.1
*/
public static Module parse(String module) {
if (module == null || module.isEmpty()) {
return null;
}
var matcher = MODULE_PATTERN.matcher(module);
if (!matcher.matches()) {
return null;
}
var groupId = matcher.group("groupId");
var artifactId = matcher.group("artifactId");
var version = Version.parse(matcher.group("version"));
var classifier = matcher.group("classifier");
return new Module(groupId, artifactId, version, classifier);
}
}

View file

@ -32,9 +32,6 @@ public record Repository(String location, String username, String password) {
public static final Repository SONATYPE_RELEASES_LEGACY = new Repository("https://oss.sonatype.org/service/local/staging/deploy/maven2/");
public static final Repository SONATYPE_SNAPSHOTS = new Repository("https://s01.oss.sonatype.org/content/repositories/snapshots/");
public static final Repository SONATYPE_SNAPSHOTS_LEGACY = new Repository("https://oss.sonatype.org/content/repositories/snapshots/");
public static final String OSSRH_STAGING_API_DOMAIN = "ossrh-staging-api.central.sonatype.com";
public static final Repository CENTRAL_RELEASES = new Repository("https://" + OSSRH_STAGING_API_DOMAIN + "/service/local/staging/deploy/maven2/");
public static final Repository CENTRAL_SNAPSHOTS = new Repository("https://central.sonatype.com/repository/maven-snapshots/");
public static final Repository RIFE2_RELEASES = new Repository("https://repo.rife2.com/releases/");
public static final Repository RIFE2_SNAPSHOTS = new Repository("https://repo.rife2.com/snapshots/");
@ -101,8 +98,6 @@ public record Repository(String location, String username, String password) {
case "SONATYPE_RELEASES_LEGACY" -> Repository.SONATYPE_RELEASES_LEGACY;
case "SONATYPE_SNAPSHOTS" -> Repository.SONATYPE_SNAPSHOTS;
case "SONATYPE_SNAPSHOTS_LEGACY" -> Repository.SONATYPE_SNAPSHOTS_LEGACY;
case "CENTRAL_RELEASES" -> Repository.CENTRAL_RELEASES;
case "CENTRAL_SNAPSHOTS" -> Repository.CENTRAL_SNAPSHOTS;
default -> new Repository(locationOrName);
};
}

View file

@ -10,8 +10,6 @@ import rife.xml.Xml2Data;
import java.util.*;
import java.util.regex.Pattern;
import static rife.bld.dependencies.Dependency.TYPE_JAR;
/**
* Parses an XML document to retrieve POM information, this is an internal class.
*
@ -105,7 +103,7 @@ class Xml2MavenPom extends Xml2Data {
"false",
exclusions,
dependency.parent());
if (resolved_dependency.type() == null || TYPE_JAR.equals(resolved_dependency.type())) {
if (resolved_dependency.type() == null || resolved_dependency.type().equals("jar")) {
var scope = Scope.valueOf(resolved_dependency.scope());
if (scopes_list.contains(scope)) {
var resolved_dependency_set = resolved_dependencies.computeIfAbsent(scope, k -> new LinkedHashSet<>());
@ -250,9 +248,6 @@ class Xml2MavenPom extends Xml2Data {
if (isChildOfProject()) {
addProjectProperty(qName);
} else if (isChildOfParent() || isChildOfDependency()) {
if (isChildOfProjectParent()) {
addProjectParentProperty(qName);
}
lastGroupId_ = getCharacterData();
} else if (collectExclusions_ && isChildOfExclusion()) {
lastExclusionGroupId_ = getCharacterData();
@ -262,9 +257,6 @@ class Xml2MavenPom extends Xml2Data {
if (isChildOfProject()) {
addProjectProperty(qName);
} else if (isChildOfParent() || isChildOfDependency()) {
if (isChildOfProjectParent()) {
addProjectParentProperty(qName);
}
lastArtifactId_ = getCharacterData();
} else if (collectExclusions_ && isChildOfExclusion()) {
lastExclusionArtifactId_ = getCharacterData();
@ -275,9 +267,6 @@ class Xml2MavenPom extends Xml2Data {
addProjectProperty(qName);
} else if (isChildOfParent() || isChildOfDependency()) {
lastVersion_ = getCharacterData();
if (isChildOfProjectParent()) {
addProjectParentProperty(qName);
}
}
}
case "type" -> {
@ -315,13 +304,6 @@ class Xml2MavenPom extends Xml2Data {
return "project".equals(elementStack_.peek());
}
private boolean isChildOfProjectParent() {
if (elementStack_.size() < 2) {
return false;
}
return "parent".equals(elementStack_.peek()) && "project".equals(elementStack_.elementAt(elementStack_.size() - 2));
}
private boolean isChildOfParent() {
return "parent".equals(elementStack_.peek());
}
@ -338,10 +320,6 @@ class Xml2MavenPom extends Xml2Data {
mavenProperties_.put("project." + name, getCharacterData());
}
private void addProjectParentProperty(String name) {
mavenProperties_.put("project.parent." + name, getCharacterData());
}
private String getCharacterData() {
if (characterData_ == null) {
return null;

View file

@ -24,22 +24,6 @@ public class DependencyTransferException extends DependencyException {
destination_ = destination;
}
public DependencyTransferException(Dependency dependency, File destination, String message) {
super("Unable to transfer dependency '" + dependency + "' into '" + destination + "': " + message);
dependency_ = dependency;
location_ = null;
destination_ = destination;
}
public DependencyTransferException(Dependency dependency, String message) {
super("Unable to transfer dependency '" + dependency + "': " + message);
dependency_ = dependency;
location_ = null;
destination_ = null;
}
public Dependency getDependency() {
return dependency_;
}

View file

@ -21,10 +21,9 @@ public class CreateAppHelp implements CommandHelp {
public String getDescription(String topic) {
return StringUtils.replace("""
Creates a new Java application project.
Usage : ${topic} <package> <name> <base>
Usage : ${topic} <package> <name>
package The package of the project to create
name The name of the project to create
base The base name for generated project classes""", "${topic}", topic);
name The name of the project to create""", "${topic}", topic);
}
}

View file

@ -21,10 +21,9 @@ public class CreateBaseHelp implements CommandHelp {
public String getDescription(String topic) {
return StringUtils.replace("""
Creates a new Java baseline project.
Usage : ${topic} <package> <name> <base>
Usage : ${topic} <package> <name>
package The package of the project to create
name The name of the project to create
base The base name for generated project classes""", "${topic}", topic);
name The name of the project to create""", "${topic}", topic);
}
}

View file

@ -21,11 +21,10 @@ public class CreateHelp implements CommandHelp {
public String getDescription(String topic) {
return StringUtils.replace("""
Creates a new project from multiple choice.
Usage : ${topic} <type> <package> <name> <base>
Usage : ${topic} <type> <package> <name>
type The type of project to create (app, base, lib, rife2)
package The package of the project to create
name The name of the project to create
base The base name for generated project classes""", "${topic}", topic);
name The name of the project to create""", "${topic}", topic);
}
}

View file

@ -21,10 +21,9 @@ public class CreateLibHelp implements CommandHelp {
public String getDescription(String topic) {
return StringUtils.replace("""
Creates a new Java library project.
Usage : ${topic} <package> <name> <base>
Usage : ${topic} <package> <name>
package The package of the project to create
name The name of the project to create
base The base name for generated project classes""", "${topic}", topic);
name The name of the project to create""", "${topic}", topic);
}
}

View file

@ -21,10 +21,9 @@ public class CreateRife2Help implements CommandHelp {
public String getDescription(String topic) {
return StringUtils.replace("""
Creates a new RIFE2 web application project.
Usage : ${topic} <package> <name> <base>
Usage : ${topic} <package> <name>
package The package of the project to create
name The name of the project to create
base The base name for generated project classes""", "${topic}", topic);
name The name of the project to create""", "${topic}", topic);
}
}

View file

@ -1,44 +0,0 @@
/*
* Copyright 2001-2024 Geert Bevin (gbevin[remove] at uwyn dot com)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.instrument;
import rife.asm.*;
/**
* This utility class will modify a Java module {@code module-info.class} to add
* a module main class to its attributes.
*
* @author Geert Bevin (gbevin[remove] at uwyn dot com)
* @since 2.1
*/
public class ModuleMainClassAdapter extends ClassVisitor implements Opcodes {
private final String mainClass_;
/**
* Performs the actual modification of the module info class's bytecode.
*
* @param origBytes the bytes of the module class that should be modified
* @param mainClass the main class of the module
* @return the modified bytes
* @since 2.1
*/
public static byte[] addModuleMainClassToBytes(byte[] origBytes, String mainClass) {
var cw = new ClassWriter(0);
new ClassReader(origBytes).accept(new ModuleMainClassAdapter(mainClass, cw), 0);
return cw.toByteArray();
}
private ModuleMainClassAdapter(String mainClass, ClassVisitor writer) {
super(ASM9, writer);
mainClass_ = mainClass.replace('.', '/');
}
@Override
public ModuleVisitor visitModule(String name, int access, String version) {
var module_visitor = super.visitModule(name, access, version);
module_visitor.visitMainClass(mainClass_);
return module_visitor;
}
}

View file

@ -1,10 +0,0 @@
/*
* Copyright 2001-2024 Geert Bevin (gbevin[remove] at uwyn dot com)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
/**
* Provides functionalities for bytecode instrumentation.
* @since 2.1
*/
package rife.bld.instrument;

View file

@ -26,17 +26,16 @@ import java.util.List;
* @since 1.5
*/
public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<T, P>, P extends Project> extends AbstractOperation<AbstractCreateOperation<T, P>> {
private String packageName_;
private String projectName_;
private String baseName_;
final String templateBase_;
File workDirectory_ = new File(System.getProperty("user.dir"));
String packageName_;
String projectName_;
boolean downloadDependencies_;
P project_;
String projectClassName_;
String projectBuildName_;
String projectMainName_;
String projectMainUberName_;
@ -98,11 +97,11 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
project_ = createProjectBlueprint();
// standard names
var base_name = baseName();
projectBuildName_ = projectBuildClassName(base_name);
projectMainName_ = projectMainClassName(base_name);
projectMainUberName_ = projectMainUberClassName(base_name);
projectTestName_ = projectTestClassName(base_name);
projectClassName_ = StringUtils.capitalize(project_.name());
projectBuildName_ = projectBuildClassName(projectClassName_);
projectMainName_ = projectMainClassName(projectClassName_);
projectMainUberName_ = projectMainUberClassName(projectClassName_);
projectTestName_ = projectTestClassName(projectClassName_);
// create the main project structure
ideaDirectory_ = new File(project_.workDirectory(), ".idea");
@ -133,7 +132,7 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
* @since 1.6
*/
protected String projectMainClassName(String projectClassName) {
return projectClassName;
return projectClassName + "Main";
}
/**
@ -143,7 +142,7 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
* @since 1.6
*/
protected String projectMainUberClassName(String projectClassName) {
return projectClassName;
return projectClassName + "Main";
}
/**
@ -200,7 +199,7 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
test_template.setValue("projectTest", projectTestName_);
test_template.setValue("projectMain", projectMainName_);
if (test_template.hasValueId("project")) {
test_template.setValue("project", project_.name());
test_template.setValue("project", projectClassName_);
}
var project_test_file = new File(testPackageDirectory_, projectTestName_ + ".java");
FileUtils.writeString(test_template.getContent(), project_test_file);
@ -212,7 +211,7 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
build_template.setValue("package", project_.pkg());
}
if (build_template.hasValueId("project")) {
build_template.setValue("project", project_.name());
build_template.setValue("project", projectClassName_);
}
if (build_template.hasValueId("projectMain")) {
build_template.setValue("projectMain", projectMainName_);
@ -376,62 +375,32 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
public T fromArguments(List<String> arguments) {
String package_name = null;
String project_name = null;
String base_name = null;
if (!arguments.isEmpty()) {
package_name = arguments.remove(0);
}
if (!arguments.isEmpty()) {
project_name = arguments.remove(0);
}
if (!arguments.isEmpty()) {
base_name = arguments.remove(0);
}
if ((package_name == null || project_name == null || base_name == null) && System.console() == null) {
throw new OperationOptionException("ERROR: Expecting the package, project and base names as the arguments.");
if ((package_name == null || project_name == null) && System.console() == null) {
throw new OperationOptionException("ERROR: Expecting the package and project names as the arguments.");
}
if (package_name == null || package_name.isBlank()) {
if (package_name == null || package_name.isEmpty()) {
System.out.println("Please enter a package name (for instance: com.example):");
package_name = System.console().readLine();
if (package_name == null || package_name.isBlank()) {
throw new OperationOptionException("ERROR: package name is required.");
}
} else {
System.out.println("Using package name: " + package_name);
}
if (!ValidityChecks.checkJavaPackage(package_name)) {
throw new OperationOptionException("ERROR: package name is invalid.");
}
if (project_name == null || project_name.isBlank()) {
System.out.println("Please enter a project name (for instance: my-app):");
if (project_name == null || project_name.isEmpty()) {
System.out.println("Please enter a project name (for instance: myapp):");
project_name = System.console().readLine();
if (project_name == null || project_name.isBlank()) {
throw new OperationOptionException("ERROR: project name is required.");
}
} else {
System.out.println("Using project name: " + project_name);
}
if (base_name == null || base_name.isBlank()) {
var default_base_name = generateBaseName(project_name);
System.out.println("Please enter the base name for generated project classes (default: " + default_base_name + "):");
base_name = System.console().readLine();
if (base_name == null || base_name.isBlank()) {
base_name = default_base_name;
System.out.println("Using base name: " + base_name);
}
} else {
System.out.println("Using base name: " + base_name);
}
if (!ValidityChecks.checkJavaIdentifier(base_name)) {
throw new OperationOptionException("ERROR: base name is invalid.");
}
return workDirectory(new File(System.getProperty("user.dir")))
.packageName(package_name)
.projectName(project_name)
.baseName(base_name)
.downloadDependencies(true);
}
@ -476,6 +445,7 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
throw new OperationOptionException("ERROR: The package name is invalid.");
}
packageName_ = name;
return (T) this;
}
@ -492,26 +462,10 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
throw new OperationOptionException("ERROR: The project name should not be blank.");
}
return (T) this;
}
/**
* Provides the base name for the project classes to generate.
*
* @param name the base name
* @return this operation instance
* @since 2.2
*/
public T baseName(String name) {
baseName_ = StringUtils.trim(name);
if (baseName_.isEmpty()) {
throw new OperationOptionException("ERROR: The base name should not be blank.");
if (!ValidityChecks.checkJavaIdentifier(projectName_)) {
throw new OperationOptionException("ERROR: The project name is invalid.");
}
if (!ValidityChecks.checkJavaIdentifier(baseName_)) {
throw new OperationOptionException("ERROR: The base name is invalid.");
}
projectName_ = name;
return (T) this;
}
@ -559,30 +513,6 @@ public abstract class AbstractCreateOperation<T extends AbstractCreateOperation<
return projectName_;
}
static String generateBaseName(String projectName) {
if (projectName != null) {
return StringUtils.filterAsIdentifier(projectName.trim(), true);
}
return null;
}
/**
* Retrieves the base name for the project classes to generate.
* <p>
* If no base name was provided, one will be generated from the project name.
*
* @return the base name
* @since 2.2
*/
public String baseName() {
if (baseName_ == null || baseName_.isEmpty()) {
return generateBaseName(projectName());
}
return baseName_;
}
/**
* Retrieves whether dependencies will be downloaded at project creation.
*

View file

@ -10,7 +10,8 @@ import rife.bld.operations.exceptions.OperationOptionException;
import rife.tools.exceptions.FileUtilsErrorException;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
/**
@ -23,13 +24,10 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
public static final String DEFAULT_JAVA_TOOL = "java";
protected File workDirectory_ = new File(System.getProperty("user.dir"));
protected final Map<String, String> environment_ = new HashMap<>();
protected String javaTool_ = DEFAULT_JAVA_TOOL;
protected final JavaOptions javaOptions_ = new JavaOptions();
protected final List<String> classpath_ = new ArrayList<>();
protected final List<String> modulePath_ = new ArrayList<>();
protected String mainClass_;
protected String module_;
protected Function<String, Boolean> outputProcessor_;
protected Function<String, Boolean> errorProcessor_;
protected Process process_;
@ -87,10 +85,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
var builder = new ProcessBuilder(executeConstructProcessCommandList());
builder.directory(workDirectory());
if (!environment_.isEmpty()) {
builder.environment().putAll(environment_);
}
builder.redirectInput(ProcessBuilder.Redirect.INHERIT);
final var output_processor = outputProcessor();
@ -167,31 +161,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides an environment variable to use for the operation.
*
* @param name the name of the environment variable
* @param value the value of the environment variable
* @return this operation instance
* @since 2.2.1
*/
public T environment(String name, String value) {
environment_.put(name, value);
return (T) this;
}
/**
* Provides environment variable entries to use for the operation.
*
* @param environment environment entries for the operation
* @return this operation instance
* @since 2.2.1
*/
public T environment(Map<String, String> environment) {
environment_.putAll(environment);
return (T) this;
}
/**
* Provides the name of the tool to use for {@code java} execution.
* <p>
@ -230,18 +199,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides classpath entries to use for the operation.
*
* @param classpath classpath entries for the operation
* @return this operation instance
* @since 2.3.1
*
*/
public T classpath(File... classpath) {
return classpath(List.of(classpath));
}
/**
* Provides a list of classpath entries to use for the operation.
* <p>
@ -256,71 +213,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides a list of classpath entries to use for the operation.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param classpath a list of classpath entries for the operation
* @return this operation instance
* @since 2.3.1
*/
public T classpath(Collection<File> classpath) {
classpath_.addAll(classpath.stream().map(File::getAbsolutePath).toList());
return (T) this;
}
/**
* Provides module path entries to use for the operation.
*
* @param modulePath module path entries for the operation
* @return this operation instance
* @since 2.1
*/
public T modulePath(String... modulePath) {
modulePath_.addAll(List.of(modulePath));
return (T) this;
}
/**
* Provides module path entries to use for the operation.
*
* @param modulePath module path entries for the operation
* @return this operation instance
* @since 2.3.1
*/
public T modulePath(File... modulePath) {
return modulePath(List.of(modulePath));
}
/**
* Provides a list of module path entries to use for the operation.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param modulePath a list of module path entries for the operation
* @return this operation instance
* @since 2.1
*/
public T modulePath(List<String> modulePath) {
modulePath_.addAll(modulePath);
return (T) this;
}
/**
* Provides a list of module path entries to use for the operation.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param modulePath a list of module path entries for the operation
* @return this operation instance
* @since 2.3.1
*/
public T modulePath(Collection<File> modulePath) {
modulePath_.addAll(modulePath.stream().map(File::getAbsolutePath).toList());
return (T) this;
}
/**
* Provides the main class to launch with the java tool.
*
@ -333,18 +225,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return (T) this;
}
/**
* Provides the module to launch with the java tool.
*
* @param name the module to launch
* @return this operation instance
* @since 2.1
*/
public T module(String name) {
module_ = name;
return (T) this;
}
/**
* Provides the processor that will be used to handle the process output.
* <p>
@ -383,18 +263,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return workDirectory_;
}
/**
* Retrieves the environment to use for the operation.
* <p>
* This is a modifiable map that can be retrieved and changed.
*
* @return the operation's environment
* @since 2.2.1
*/
public Map<String, String> environment() {
return environment_;
}
/**
* retrieves the name of the tool to use for {@code java} execution.
*
@ -429,18 +297,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return classpath_;
}
/**
* Retrieves the module path to use for the operation.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the operation's module path
* @since 2.1
*/
public List<String> modulePath() {
return modulePath_;
}
/**
* Retrieves the main class to launch with the java tool.
*
@ -451,16 +307,6 @@ public abstract class AbstractProcessOperation<T extends AbstractProcessOperatio
return mainClass_;
}
/**
* Retrieves the module to launch with the java tool.
*
* @return the module to launch
* @since 2.1
*/
public String module() {
return module_;
}
/**
* Retrieves the processor that is used to handle the process output.
*

View file

@ -1,283 +0,0 @@
/*
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
import rife.bld.operations.exceptions.ExitStatusException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.spi.ToolProvider;
/**
* Provides common features for tool providers.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public abstract class AbstractToolProviderOperation<T extends AbstractToolProviderOperation<T>>
extends AbstractOperation<AbstractToolProviderOperation<T>> {
private final List<String> cmdFiles_ = new ArrayList<>();
private final List<String> toolArgs_ = new ArrayList<>();
private final String toolName_;
/**
* Provides the name of the tool.
*
* @param toolName the tool name
*/
public AbstractToolProviderOperation(String toolName) {
toolName_ = toolName;
}
/**
* Read options and/or mode from file(s).
*
* @param files one or more files
* @return this operation instance
*/
public T cmdFiles(String... files) {
return cmdFilesStrings(List.of(files));
}
/**
* Read options and/or mode from file(s).
*
* @param files one or more files
* @return this operation instance
*/
@SuppressWarnings({"unchecked"})
public T cmdFiles(List<File> files) {
cmdFiles_.addAll(files.stream().map(File::getAbsolutePath).toList());
return (T) this;
}
/**
* Read options and/or mode from file(s).
*
* @param files one or more files
* @return this operation instance
*/
public T cmdFiles(File... files) {
return cmdFiles(List.of(files));
}
/**
* Read options and/or mode from file(s).
*
* @param files one or more files
* @return this operation instance
*/
public T cmdFiles(Path... files) {
return cmdFilesPaths(List.of(files));
}
/**
* Retrieves the list of files containing options or mode.
*
* @return the list of files
*/
public List<String> cmdFiles() {
return cmdFiles_;
}
/**
* Read options and/or mode from file(s).
*
* @param files one or more files
* @return this operation instance
*/
public T cmdFilesPaths(List<Path> files) {
return cmdFilesStrings(files.stream().map(Path::toFile).map(File::getAbsolutePath).toList());
}
/**
* Read options and/or mode from file(s).
*
* @param files one or more files
* @return this operation instance
*/
@SuppressWarnings({"unchecked"})
public T cmdFilesStrings(List<String> files) {
cmdFiles_.addAll(files);
return (T) this;
}
/**
* Runs an instance of the tool.
* <p>
* On success, command line arguments are automatically cleared.
*
* @throws Exception if an error occurred
*/
@Override
public void execute() throws Exception {
if (toolArgs_.isEmpty()) {
System.err.println("No " + toolName_ + " command line arguments specified.");
throw new ExitStatusException(ExitStatusException.EXIT_FAILURE);
}
var tool = ToolProvider.findFirst(toolName_).orElseThrow(() ->
new IllegalStateException("No " + toolName_ + " tool found."));
var status = tool.run(System.out, System.err, toolArgs_.toArray(new String[0]));
if (status != 0) {
System.out.println(tool.name() + ' ' + String.join(" ", toolArgs_));
}
ExitStatusException.throwOnFailure(status);
toolArgs_.clear();
}
/**
* Adds arguments to pass to the tool.
*
* @param args tbe list of arguments
* @return this operation
*/
@SuppressWarnings({"unchecked"})
public T toolArgs(List<String> args) {
toolArgs_.addAll(args);
return (T) this;
}
/**
* Adds arguments to pass to the tool.
*
* @param args one or more arguments
* @return this operation
*/
public T toolArgs(String... args) {
return toolArgs(List.of(args));
}
/**
* Returns the tool's arguments.
*
* @return the arguments
*/
public List<String> toolArgs() {
return toolArgs_;
}
/**
* Parses arguments to pass to the tool from the {@link #cmdFiles() command files}.
*
* @throws FileNotFoundException if a file cannot be found
*/
protected void toolArgsFromFiles() throws IOException {
for (var file : cmdFiles_) {
try (var reader = Files.newBufferedReader(Paths.get(file), Charset.defaultCharset())) {
var tokenizer = new CommandLineTokenizer(reader);
String token;
while ((token = tokenizer.nextToken()) != null) {
toolArgs_.add(token);
}
}
}
}
/**
* Adds arguments to pass to the tool.
*
* @param args the argument-value pairs to add
* @return this operation
*/
@SuppressWarnings({"unchecked", "UnusedReturnValue"})
protected T toolArgs(Map<String, String> args) {
args.forEach((k, v) -> {
toolArgs_.add(k);
if (v != null && !v.isEmpty()) {
toolArgs_.add(v);
}
});
return (T) this;
}
/**
* Tokenize command line arguments.
*
* <ul>
* <li>Arguments containing spaces should be quoted</li>
* <li>Escape sequences and comments are supported</li>
* </ul>
*/
public static class CommandLineTokenizer {
private final StringBuilder buf_ = new StringBuilder();
private final Reader input_;
private int ch_;
public CommandLineTokenizer(Reader input) throws IOException {
input_ = input;
ch_ = input.read();
}
public String nextToken() throws IOException {
trimWhitespaceOrComments();
if (ch_ == -1) {
return null;
}
buf_.setLength(0); // reset buffer
char quote = 0;
while (ch_ != -1) {
if (ch_ == '\'' || ch_ == '"') { // quotes
if (quote == 0) { // begin quote
quote = (char) ch_;
} else if (quote == ch_) { // end quote
quote = 0;
} else {
buf_.append((char) ch_);
}
} else if (ch_ == '\\') { // escaped
ch_ = input_.read();
buf_.append(handleEscapeSequence());
} else if (quote == 0 && Character.isWhitespace(ch_)) { // whitespaces
break;
} else {
buf_.append((char) ch_);
}
ch_ = input_.read();
}
return buf_.toString();
}
private char handleEscapeSequence() {
return switch (ch_) {
case -1 -> '\\';
case 'n' -> '\n';
case 'r' -> '\r';
case 't' -> '\t';
case 'f' -> '\f';
default -> (char) ch_;
};
}
private void trimWhitespaceOrComments() throws IOException {
while (ch_ != -1) {
if (Character.isWhitespace(ch_)) { // Skip whitespaces
ch_ = input_.read();
} else if (ch_ == '#') {
// Skip the entire comment until a new line or end of input
do {
ch_ = input_.read();
} while (ch_ != -1 && ch_ != '\n' && ch_ != '\r');
} else {
break;
}
}
}
}
}

View file

@ -5,7 +5,6 @@
package rife.bld.operations;
import rife.bld.BaseProject;
import rife.bld.instrument.ModuleMainClassAdapter;
import rife.bld.operations.exceptions.ExitStatusException;
import rife.tools.FileUtils;
@ -23,26 +22,16 @@ import java.util.List;
* @since 1.5
*/
public class CompileOperation extends AbstractOperation<CompileOperation> {
static final String COMPILE_OPTION_D = "-d";
static final String COMPILE_OPTION_CP = "-cp";
static final String COMPILE_OPTION_CLASS_PATH = "--class-path";
static final String COMPILE_OPTION_CLASSPATH = "--classpath";
static final String COMPILE_OPTION_P = "-p";
static final String COMPILE_OPTION_MODULE_PATH = "--module-path";
private File buildMainDirectory_;
private File buildTestDirectory_;
private final List<String> compileMainClasspath_ = new ArrayList<>();
private final List<String> compileTestClasspath_ = new ArrayList<>();
private final List<String> compileMainModulePath_ = new ArrayList<>();
private final List<String> compileTestModulePath_ = new ArrayList<>();
private final List<File> mainSourceFiles_ = new ArrayList<>();
private final List<File> testSourceFiles_ = new ArrayList<>();
private final List<File> mainSourceDirectories_ = new ArrayList<>();
private final List<File> testSourceDirectories_ = new ArrayList<>();
private final JavacOptions compileOptions_ = new JavacOptions();
private final List<Diagnostic<? extends JavaFileObject>> diagnostics_ = new ArrayList<>();
private String moduleMainClass_;
/**
* Performs the compile operation.
@ -87,18 +76,10 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
for (var directory : mainSourceDirectories()) {
sources.addAll(FileUtils.getJavaFileList(directory));
}
if (sources.isEmpty()) {
if (!silent()) {
System.err.println("No main source files found.");
}
} else {
executeBuildSources(
compileMainClasspath(),
compileMainModulePath(),
sources,
buildMainDirectory());
}
executeBuildSources(
compileMainClasspath(),
sources,
buildMainDirectory());
}
/**
@ -112,30 +93,21 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
for (var directory : testSourceDirectories()) {
sources.addAll(FileUtils.getJavaFileList(directory));
}
if (sources.isEmpty()) {
if (!silent()) {
System.err.println("No test source files found.");
}
} else {
executeBuildSources(
compileTestClasspath(),
compileTestModulePath(),
sources,
buildTestDirectory());
}
executeBuildSources(
compileTestClasspath(),
sources,
buildTestDirectory());
}
/**
* Part of the {@link #execute} operation, build sources to a destination.
*
* @param classpath the classpath list used for the compilation
* @param modulePath the module path list used for the compilation
* @param sources the source files to compile
* @param destination the destination directory
* @since 2.1
* @since 1.5
*/
protected void executeBuildSources(List<String> classpath, List<String> modulePath, List<File> sources, File destination)
protected void executeBuildSources(List<String> classpath, List<File> sources, File destination)
throws IOException {
if (sources.isEmpty() || destination == null) {
return;
@ -145,52 +117,16 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
try (var file_manager = compiler.getStandardFileManager(null, null, null)) {
var compilation_units = file_manager.getJavaFileObjectsFromFiles(sources);
var diagnostics = new DiagnosticCollector<JavaFileObject>();
var options = new ArrayList<>(List.of(COMPILE_OPTION_D, destination.getAbsolutePath()));
if (!classpath.isEmpty()) {
var class_path = FileUtils.joinPaths(classpath);
class_path = removeAndAppendCompileOptionPath(class_path, COMPILE_OPTION_CP);
class_path = removeAndAppendCompileOptionPath(class_path, COMPILE_OPTION_CLASS_PATH);
class_path = removeAndAppendCompileOptionPath(class_path, COMPILE_OPTION_CLASSPATH);
options.addAll(List.of(COMPILE_OPTION_CP, class_path));
}
if (!modulePath.isEmpty()) {
var module_path = FileUtils.joinPaths(modulePath);
module_path = removeAndAppendCompileOptionPath(module_path, COMPILE_OPTION_P);
module_path = removeAndAppendCompileOptionPath(module_path, COMPILE_OPTION_MODULE_PATH);
options.addAll(List.of(COMPILE_OPTION_P, module_path));
}
var options = new ArrayList<>(List.of("-d", destination.getAbsolutePath(), "-cp", FileUtils.joinPaths(classpath)));
options.addAll(compileOptions());
var compilation_task = compiler.getTask(null, file_manager, diagnostics, options, null, compilation_units);
if (!compilation_task.call()) {
diagnostics_.addAll(diagnostics.getDiagnostics());
executeProcessDiagnostics(diagnostics);
}
var module_info_class = new File(destination, "module-info.class");
if (module_info_class.exists() && moduleMainClass() != null) {
var orig_bytes = FileUtils.readBytes(module_info_class);
var transformed_bytes = ModuleMainClassAdapter.addModuleMainClassToBytes(orig_bytes, moduleMainClass());
FileUtils.writeBytes(transformed_bytes, module_info_class);
}
}
}
private String removeAndAppendCompileOptionPath(String basePath, String option) {
var index = compileOptions_.indexOf(option);
if (index != -1 && index + 1 < compileOptions_.size() - 1) {
compileOptions_.remove(index);
return basePath + File.pathSeparator + compileOptions_.remove(index);
}
return basePath;
}
/**
* Part of the {@link #execute} operation, processes the compilation diagnostics.
*
@ -225,11 +161,8 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
.buildTestDirectory(project.buildTestDirectory())
.compileMainClasspath(project.compileMainClasspath())
.compileTestClasspath(project.compileTestClasspath())
.compileMainModulePath(project.compileMainModulePath())
.compileTestModulePath(project.compileTestModulePath())
.mainSourceFiles(project.mainSourceFiles())
.testSourceFiles(project.testSourceFiles())
.moduleMainClass(project.mainClass());
.testSourceFiles(project.testSourceFiles());
if (project.javaRelease() != null && !compileOptions().containsRelease()) {
compileOptions().release(project.javaRelease());
}
@ -312,58 +245,6 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
return this;
}
/**
* Provides entries for the main compilation module path.
*
* @param modulePath module path entries
* @return this operation instance
* @since 2.1
*/
public CompileOperation compileMainModulePath(String... modulePath) {
compileMainModulePath_.addAll(Arrays.asList(modulePath));
return this;
}
/**
* Provides a list of entries for the main compilation module path.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param modulePath a list of module path entries
* @return this operation instance
* @since 2.1
*/
public CompileOperation compileMainModulePath(List<String> modulePath) {
compileMainModulePath_.addAll(modulePath);
return this;
}
/**
* Provides entries for the test compilation module path.
*
* @param modulePath module path entries
* @return this operation instance
* @since 2.1
*/
public CompileOperation compileTestModulePath(String... modulePath) {
compileTestModulePath_.addAll(Arrays.asList(modulePath));
return this;
}
/**
* Provides a list of entries for the test compilation module path.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param modulePath a list of module path entries
* @return this operation instance
* @since 2.1
*/
public CompileOperation compileTestModulePath(List<String> modulePath) {
compileTestModulePath_.addAll(modulePath);
return this;
}
/**
* Provides main files that should be compiled.
*
@ -482,18 +363,6 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
return this;
}
/**
* Provides the main class to use if this compilation includes @{code module-info.java}.
*
* @param name the main class of the module
* @return this operation instance
* @since 2.1
*/
public CompileOperation moduleMainClass(String name) {
moduleMainClass_ = name;
return this;
}
/**
* Retrieves the main build destination directory.
*
@ -538,30 +407,6 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
return compileTestClasspath_;
}
/**
* Retrieves the list of entries for the main compilation module path.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the main compilation module path list
* @since 2.1
*/
public List<String> compileMainModulePath() {
return compileMainModulePath_;
}
/**
* Retrieves the list of entries for the test compilation module path.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the test compilation module path list
* @since 2.1
*/
public List<String> compileTestModulePath() {
return compileTestModulePath_;
}
/**
* Retrieves the list of main files that should be compiled.
* <p>
@ -631,15 +476,4 @@ public class CompileOperation extends AbstractOperation<CompileOperation> {
public List<Diagnostic<? extends JavaFileObject>> diagnostics() {
return diagnostics_;
}
/**
* Retrieves the main class to use if this compilation includes @{code module-info.java}.
*
* @return the main class to use for the module
* @since 2.1
*/
public String moduleMainClass() {
return moduleMainClass_;
}
}

View file

@ -21,6 +21,6 @@ public class CreateAppOperation extends AbstractCreateOperation<CreateAppOperati
}
protected Project createProjectBlueprint() {
return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), baseName());
return new AppProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName());
}
}

View file

@ -21,6 +21,6 @@ public class CreateBaseOperation extends AbstractCreateOperation<CreateBaseOpera
}
protected Project createProjectBlueprint() {
return new BaseProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), baseName());
return new BaseProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName());
}
}

View file

@ -21,7 +21,11 @@ public class CreateLibOperation extends AbstractCreateOperation<CreateLibOperati
}
protected Project createProjectBlueprint() {
return new LibProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), baseName());
return new LibProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName());
}
protected String projectMainClassName(String projectClassName) {
return projectClassName + "Lib";
}
protected boolean createIdeaRunMain() {

View file

@ -7,7 +7,6 @@ package rife.bld.operations;
import rife.bld.operations.exceptions.OperationOptionException;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
@ -34,29 +33,20 @@ public class CreateOperation {
String type = null;
String package_name = null;
String project_name = null;
String base_name = null;
if (!arguments.isEmpty()) {
type = arguments.remove(0);
}
var create_operation_args = new ArrayList<String>();
if (!arguments.isEmpty()) {
package_name = arguments.remove(0);
create_operation_args.add(package_name);
}
if (!arguments.isEmpty()) {
project_name = arguments.remove(0);
create_operation_args.add(project_name);
}
if (!arguments.isEmpty()) {
base_name = arguments.remove(0);
create_operation_args.add(base_name);
}
if ((package_name == null || project_name == null || base_name == null) && System.console() == null) {
throw new OperationOptionException("ERROR: Expecting the package, project and base names as the arguments.");
if ((type == null || package_name == null || project_name == null) && System.console() == null) {
throw new OperationOptionException("ERROR: Expecting the type, package and project names as the arguments.");
}
if (type == null || type.isBlank()) {
if (type == null || type.isEmpty()) {
System.out.println("Please enter a number for the project type:");
System.out.printf(" 1: %s (Java baseline project)%n", BASE);
System.out.printf(" 2: %s (Java application project)%n", APP);
@ -87,6 +77,31 @@ public class CreateOperation {
throw new OperationOptionException("ERROR: Unsupported project type.");
}
return create_operation.fromArguments(create_operation_args);
if (package_name == null || package_name.isEmpty()) {
System.out.println("Please enter a package name (for instance: com.example):");
package_name = System.console().readLine();
} else {
System.out.println("Using package name: " + package_name);
}
if (project_name == null || project_name.isEmpty()) {
String name_example;
if (LIB.equals(type)) {
name_example = "mylib";
} else if (RIFE2.equals(type)) {
name_example = "mywebapp";
} else {
name_example = "myapp";
}
System.out.printf("Please enter a project name (for instance: %s):%n", name_example);
project_name = System.console().readLine();
} else {
System.out.println("Using project name: " + project_name);
}
return create_operation.workDirectory(new File(System.getProperty("user.dir")))
.packageName(package_name)
.projectName(project_name)
.downloadDependencies(true);
}
}

View file

@ -7,7 +7,6 @@ package rife.bld.operations;
import rife.bld.blueprints.Rife2ProjectBlueprint;
import rife.template.TemplateFactory;
import rife.tools.FileUtils;
import rife.tools.StringUtils;
import rife.tools.exceptions.FileUtilsErrorException;
import java.io.File;
@ -28,14 +27,14 @@ public class CreateRife2Operation extends AbstractCreateOperation<CreateRife2Ope
}
protected Rife2ProjectBlueprint createProjectBlueprint() {
return new Rife2ProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName(), baseName());
return new Rife2ProjectBlueprint(new File(workDirectory(), projectName()), packageName(), projectName());
}
@Override
protected void executeConfigure() {
super.executeConfigure();
projectMainName_ = baseName() + "Site";
projectMainName_ = projectClassName_ + "Site";
projectMainUberName_ = projectMainName_ + "Uber";
srcMainWebappCssDirectory_ = new File(project_.srcMainWebappDirectory(), "css");
srcMainWebappWebInfDirectory_ = new File(project_.srcMainWebappDirectory(), "WEB-INF");
@ -64,7 +63,7 @@ public class CreateRife2Operation extends AbstractCreateOperation<CreateRife2Ope
// project template
var template_template = TemplateFactory.HTML.get(templateBase_ + "project_template");
template_template.setValue("project", project_.name());
template_template.setValue("project", projectClassName_);
var project_template_file = new File(project_.srcMainResourcesTemplatesDirectory(), "hello.html");
FileUtils.writeString(template_template.getContent(), project_template_file);

View file

@ -31,15 +31,10 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
private final List<Repository> repositories_ = new ArrayList<>();
private final DependencyScopes dependencies_ = new DependencyScopes();
private File libCompileDirectory_;
private File libCompileModulesDirectory_;
private File libProvidedDirectory_;
private File libProvidedModulesDirectory_;
private File libRuntimeDirectory_;
private File libRuntimeModulesDirectory_;
private File libStandaloneDirectory_;
private File libStandaloneModulesDirectory_;
private File libTestDirectory_;
private File libTestModulesDirectory_;
private boolean downloadSources_ = false;
private boolean downloadJavadoc_ = false;
@ -70,7 +65,7 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
* @since 1.5
*/
protected void executeDownloadCompileDependencies() {
executeDownloadDependencies(libCompileDirectory(), libCompileModulesDirectory(), dependencies().resolveCompileDependencies(properties(), artifactRetriever(), repositories()));
executeDownloadDependencies(libCompileDirectory(), dependencies().resolveCompileDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -79,7 +74,7 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
* @since 1.8
*/
protected void executeDownloadProvidedDependencies() {
executeDownloadDependencies(libProvidedDirectory(), libProvidedModulesDirectory(), dependencies().resolveProvidedDependencies(properties(), artifactRetriever(), repositories()));
executeDownloadDependencies(libProvidedDirectory(), dependencies().resolveProvidedDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -88,7 +83,7 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
* @since 1.5
*/
protected void executeDownloadRuntimeDependencies() {
executeDownloadDependencies(libRuntimeDirectory(), libRuntimeModulesDirectory(), dependencies().resolveRuntimeDependencies(properties(), artifactRetriever(), repositories()));
executeDownloadDependencies(libRuntimeDirectory(), dependencies().resolveRuntimeDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -97,7 +92,7 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
* @since 1.5
*/
protected void executeDownloadStandaloneDependencies() {
executeDownloadDependencies(libStandaloneDirectory(), libStandaloneModulesDirectory(), dependencies().resolveStandaloneDependencies(properties(), artifactRetriever(), repositories()));
executeDownloadDependencies(libStandaloneDirectory(), dependencies().resolveStandaloneDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -106,18 +101,23 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
* @since 1.5
*/
protected void executeDownloadTestDependencies() {
executeDownloadDependencies(libTestDirectory(), libTestModulesDirectory(), dependencies().resolveTestDependencies(properties(), artifactRetriever(), repositories()));
executeDownloadDependencies(libTestDirectory(), dependencies().resolveTestDependencies(properties(), artifactRetriever(), repositories()));
}
/**
* Part of the {@link #execute} operation, download the artifacts for a particular dependency scope.
*
* @param destinationDirectory the directory in which the artifacts should be downloaded
* @param modulesDirectory the directory in which the modules should be downloaded
* @param dependencies the dependencies to download
* @since 2.1
* @since 1.6
*/
protected void executeDownloadDependencies(File destinationDirectory, File modulesDirectory, DependencySet dependencies) {
protected void executeDownloadDependencies(File destinationDirectory, DependencySet dependencies) {
if (destinationDirectory == null) {
return;
}
destinationDirectory.mkdirs();
var additional_classifiers = new String[0];
if (downloadSources_ || downloadJavadoc_) {
@ -128,7 +128,7 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
additional_classifiers = classifiers.toArray(new String[0]);
}
dependencies.transferIntoDirectory(new VersionResolution(properties()), artifactRetriever(), repositories(), destinationDirectory, modulesDirectory, additional_classifiers);
dependencies.transferIntoDirectory(new VersionResolution(properties()), artifactRetriever(), repositories(), destinationDirectory, additional_classifiers);
}
/**
@ -145,15 +145,10 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
.repositories(project.repositories())
.dependencies(project.dependencies())
.libCompileDirectory(project.libCompileDirectory())
.libCompileModulesDirectory(project.libCompileModulesDirectory())
.libProvidedDirectory(project.libProvidedDirectory())
.libProvidedModulesDirectory(project.libProvidedModulesDirectory())
.libRuntimeDirectory(project.libRuntimeDirectory())
.libRuntimeModulesDirectory(project.libRuntimeModulesDirectory())
.libStandaloneDirectory(project.libStandaloneDirectory())
.libStandaloneModulesDirectory(project.libStandaloneModulesDirectory())
.libTestDirectory(project.libTestDirectory())
.libTestModulesDirectory(project.libTestModulesDirectory())
.downloadSources(project.downloadSources())
.downloadJavadoc(project.downloadJavadoc());
}
@ -232,18 +227,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return this;
}
/**
* Provides the {@code compile} scope modules download directory.
*
* @param directory the directory to download the {@code compile} scope modules into
* @return this operation instance
* @since 2.1
*/
public DownloadOperation libCompileModulesDirectory(File directory) {
libCompileModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code provided} scope download directory.
*
@ -256,18 +239,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return this;
}
/**
* Provides the {@code provided} scope modules download directory.
*
* @param directory the directory to download the {@code provided} scope modules into
* @return this operation instance
* @since 2.1
*/
public DownloadOperation libProvidedModulesDirectory(File directory) {
libProvidedModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code runtime} scope download directory.
*
@ -280,18 +251,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return this;
}
/**
* Provides the {@code runtime} scope modules download directory.
*
* @param directory the directory to download the {@code runtime} scope modules into
* @return this operation instance
* @since 2.1
*/
public DownloadOperation libRuntimeModulesDirectory(File directory) {
libRuntimeModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code standalone} scope download directory.
*
@ -304,18 +263,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return this;
}
/**
* Provides the {@code standalone} scope modules download directory.
*
* @param directory the directory to download the {@code standalone} scope modules into
* @return this operation instance
* @since 2.1
*/
public DownloadOperation libStandaloneModulesDirectory(File directory) {
libStandaloneModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code test} scope download directory.
*
@ -328,18 +275,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return this;
}
/**
* Provides the {@code test} scope modules download directory.
*
* @param directory the directory to download the {@code test} scope modules into
* @return this operation instance
* @since 2.1
*/
public DownloadOperation libTestModulesDirectory(File directory) {
libTestModulesDirectory_ = directory;
return this;
}
/**
* Indicates whether the sources classifier should also be downloaded.
*
@ -424,16 +359,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return libCompileDirectory_;
}
/**
* Retrieves the {@code compile} scope modules download directory.
*
* @return the {@code compile} scope modules download directory
* @since 2.1
*/
public File libCompileModulesDirectory() {
return libCompileModulesDirectory_;
}
/**
* Retrieves the {@code provided} scope download directory.
*
@ -444,16 +369,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return libProvidedDirectory_;
}
/**
* Retrieves the {@code provided} scope modules download directory.
*
* @return the {@code provided} scope modules download directory
* @since 2.1
*/
public File libProvidedModulesDirectory() {
return libProvidedModulesDirectory_;
}
/**
* Retrieves the {@code runtime} scope download directory.
*
@ -464,16 +379,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return libRuntimeDirectory_;
}
/**
* Retrieves the {@code runtime} scope modules download directory.
*
* @return the {@code runtime} scope modules download directory
* @since 2.1
*/
public File libRuntimeModulesDirectory() {
return libRuntimeModulesDirectory_;
}
/**
* Retrieves the {@code standalone} scope download directory.
*
@ -484,16 +389,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return libStandaloneDirectory_;
}
/**
* Retrieves the {@code standalone} scope modules download directory.
*
* @return the {@code standalone} scope modules download directory
* @since 2.1
*/
public File libStandaloneModulesDirectory() {
return libStandaloneModulesDirectory_;
}
/**
* Retrieves the {@code test} scope download directory.
*
@ -504,16 +399,6 @@ public class DownloadOperation extends AbstractOperation<DownloadOperation> {
return libTestDirectory_;
}
/**
* Retrieves the {@code test} scope modules download directory.
*
* @return the {@code test} scope modules download directory
* @since 2.1
*/
public File libTestModulesDirectory() {
return libTestModulesDirectory_;
}
/**
* Retrieves whether the sources classifier should also be downloaded.
*

View file

@ -4,11 +4,9 @@
*/
package rife.bld.operations;
import rife.tools.FileUtils;
import rife.tools.StringUtils;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
@ -40,8 +38,8 @@ public class JavaOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.18
*/
public JavaOptions modulePath(File... paths) {
return modulePath(List.of(paths));
public JavaOptions modulePath(File... modules) {
return modulePath(List.of(modules));
}
/**
@ -50,49 +48,9 @@ public class JavaOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.18
*/
public JavaOptions modulePath(List<File> paths) {
return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
}
/**
* A list of directories, each directory is a directory of modules.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions modulePath(Path... paths) {
return modulePathPaths(List.of(paths));
}
/**
* A list of directories, each directory is a directory of modules.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions modulePathPaths(List<Path> paths) {
return modulePath(paths.stream().map(Path::toFile).toList());
}
/**
* A list of directories, each directory is a directory of modules.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions modulePath(String... paths) {
return modulePathStrings(List.of(paths));
}
/**
* A list of directories, each directory is a directory of modules.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions modulePathStrings(List<String> paths) {
public JavaOptions modulePath(List<File> modules) {
add("--module-path");
add(FileUtils.joinPaths(paths));
add(StringUtils.join(modules, ":"));
return this;
}
@ -103,8 +61,8 @@ public class JavaOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.18
*/
public JavaOptions upgradeModulePath(File... paths) {
return upgradeModulePath(List.of(paths));
public JavaOptions upgradeModulePath(File... modulePath) {
return upgradeModulePath(List.of(modulePath));
}
/**
@ -114,53 +72,9 @@ public class JavaOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.18
*/
public JavaOptions upgradeModulePath(List<File> paths) {
return upgradeModulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
}
/**
* List of directories, each directory is a directory of modules
* that replace upgradeable modules in the runtime image
*
* @return this list of options
* @since 2.1
*/
public JavaOptions upgradeModulePath(Path... paths) {
return upgradeModulePathPaths(List.of(paths));
}
/**
* List of directories, each directory is a directory of modules
* that replace upgradeable modules in the runtime image
*
* @return this list of options
* @since 2.1
*/
public JavaOptions upgradeModulePathPaths(List<Path> paths) {
return upgradeModulePath(paths.stream().map(Path::toFile).toList());
}
/**
* List of directories, each directory is a directory of modules
* that replace upgradeable modules in the runtime image
*
* @return this list of options
* @since 2.1
*/
public JavaOptions upgradeModulePath(String... paths) {
return upgradeModulePathStrings(List.of(paths));
}
/**
* List of directories, each directory is a directory of modules
* that replace upgradeable modules in the runtime image
*
* @return this list of options
* @since 2.1
*/
public JavaOptions upgradeModulePathStrings(List<String> paths) {
public JavaOptions upgradeModulePath(List<File> modulePath) {
add("--upgrade-module-path");
add(FileUtils.joinPaths(paths));
add(StringUtils.join(modulePath, ":"));
return this;
}
@ -342,7 +256,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
public JavaOptions agentPath(File pathName) {
return agentPath(pathName.getAbsolutePath(), (String)null);
return agentPath(pathName, (String)null);
}
/**
@ -352,7 +266,8 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
public JavaOptions agentPath(File pathName, String options) {
return agentPath(pathName.getAbsolutePath(), options);
add("-agentpath:" + pathName + (options == null ? "" : "=" + options));
return this;
}
/**
@ -362,7 +277,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.7.1
*/
public JavaOptions agentPath(File pathName, String... options) {
return agentPath(pathName.getAbsolutePath(), List.of(options));
return agentPath(pathName, List.of(options));
}
/**
@ -372,87 +287,6 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.7.1
*/
public JavaOptions agentPath(File pathName, List<String> options) {
return agentPath(pathName.getAbsolutePath(), options);
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(Path pathName) {
return agentPath(pathName.toFile(), (String)null);
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(Path pathName, String options) {
return agentPath(pathName.toFile(), options);
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(Path pathName, String... options) {
return agentPath(pathName.toFile(), List.of(options));
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(Path pathName, List<String> options) {
return agentPath(pathName.toFile(), options);
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(String pathName) {
return agentPath(pathName, (String)null);
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(String pathName, String options) {
add("-agentpath:" + pathName + (options == null ? "" : "=" + options));
return this;
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(String pathName, String... options) {
return agentPath(pathName, List.of(options));
}
/**
* Load native agent library by full pathname.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions agentPath(String pathName, List<String> options) {
add("-agentpath:" + pathName + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
return this;
}
@ -464,7 +298,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
public JavaOptions javaAgent(File jarPath) {
return javaAgent(jarPath.getAbsolutePath(), (String)null);
return javaAgent(jarPath, (String)null);
}
/**
@ -474,7 +308,8 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.5.18
*/
public JavaOptions javaAgent(File jarPath, String options) {
return javaAgent(jarPath.getAbsolutePath(), options);
add("-javaagent:" + jarPath + (options == null ? "" : "=" + options));
return this;
}
/**
@ -484,7 +319,7 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.7.1
*/
public JavaOptions javaAgent(File jarPath, String... options) {
return javaAgent(jarPath.getAbsolutePath(), List.of(options));
return javaAgent(jarPath, List.of(options));
}
/**
@ -494,87 +329,6 @@ public class JavaOptions extends ArrayList<String> {
* @since 1.7.1
*/
public JavaOptions javaAgent(File jarPath, List<String> options) {
return javaAgent(jarPath.getAbsolutePath(), options);
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(Path jarPath) {
return javaAgent(jarPath.toFile(), (String)null);
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(Path jarPath, String options) {
return javaAgent(jarPath.toFile(), options);
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(Path jarPath, String... options) {
return javaAgent(jarPath.toFile(), List.of(options));
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(Path jarPath, List<String> options) {
return javaAgent(jarPath.toFile(), options);
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(String jarPath) {
return javaAgent(jarPath, (String)null);
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(String jarPath, String options) {
add("-javaagent:" + jarPath + (options == null ? "" : "=" + options));
return this;
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(String jarPath, String... options) {
return javaAgent(jarPath, List.of(options));
}
/**
* Load Java programming language agent.
*
* @return this list of options
* @since 2.1
*/
public JavaOptions javaAgent(String jarPath, List<String> options) {
add("-javaagent:" + jarPath + (options == null || options.isEmpty() ? "" : "=" + StringUtils.join(options, ",")));
return this;
}

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,6 @@ import java.util.regex.Pattern;
public class JavadocOperation extends AbstractOperation<JavadocOperation> {
private File buildDirectory_;
private final List<String> classpath_ = new ArrayList<>();
private final List<String> modulePath_ = new ArrayList<>();
private final List<File> sourceFiles_ = new ArrayList<>();
private final List<File> sourceDirectories_ = new ArrayList<>();
private final JavadocOptions javadocOptions_ = new JavadocOptions();
@ -75,7 +74,6 @@ public class JavadocOperation extends AbstractOperation<JavadocOperation> {
}
executeBuildSources(
classpath(),
modulePath(),
sources,
buildDirectory());
}
@ -83,13 +81,12 @@ public class JavadocOperation extends AbstractOperation<JavadocOperation> {
/**
* Part of the {@link #execute} operation, build sources to a destination.
*
* @param classpath the classpath list used for the javadoc generation
* @param modulePath the module path list used for the javadoc generation
* @param classpath the classpath list used for the compilation
* @param sources the source files to compile
* @param destination the destination directory
* @since 2.1
* @since 1.5.10
*/
protected void executeBuildSources(List<String> classpath, List<String> modulePath, List<File> sources, File destination)
protected void executeBuildSources(List<String> classpath, List<File> sources, File destination)
throws IOException {
if (sources.isEmpty() || destination == null) {
return;
@ -106,13 +103,7 @@ public class JavadocOperation extends AbstractOperation<JavadocOperation> {
try (var file_manager = documentation.getStandardFileManager(null, null, null)) {
var compilation_units = file_manager.getJavaFileObjectsFromFiles(filtered_sources);
var diagnostics = new DiagnosticCollector<JavaFileObject>();
var options = new ArrayList<>(List.of("-d", destination.getAbsolutePath()));
if (!classpath.isEmpty()) {
options.addAll(List.of("-cp", FileUtils.joinPaths(classpath)));
}
if (!modulePath.isEmpty()) {
options.addAll(List.of("-p", FileUtils.joinPaths(modulePath)));
}
var options = new ArrayList<>(List.of("-d", destination.getAbsolutePath(), "-cp", FileUtils.joinPaths(classpath)));
options.addAll(javadocOptions());
var documentation_task = documentation.getTask(null, file_manager, diagnostics, null, options, compilation_units);
if (!documentation_task.call()) {
@ -155,7 +146,6 @@ public class JavadocOperation extends AbstractOperation<JavadocOperation> {
var operation = buildDirectory(project.buildJavadocDirectory())
.classpath(project.compileMainClasspath())
.classpath(project.buildMainDirectory().getAbsolutePath())
.modulePath(project.compileMainModulePath())
.sourceFiles(project.mainSourceFiles());
if (project.javaRelease() != null && !javadocOptions().containsRelease()) {
javadocOptions().release(project.javaRelease());
@ -201,32 +191,6 @@ public class JavadocOperation extends AbstractOperation<JavadocOperation> {
return this;
}
/**
* Provides entries for the javadoc module path.
*
* @param modulePath module path entries
* @return this operation instance
* @since 2.1
*/
public JavadocOperation modulePath(String... modulePath) {
modulePath_.addAll(Arrays.asList(modulePath));
return this;
}
/**
* Provides a list of entries for the javadoc moduel path.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param modulePath a list of module path entries
* @return this operation instance
* @since 2.1
*/
public JavadocOperation modulePath(List<String> modulePath) {
modulePath_.addAll(modulePath);
return this;
}
/**
* Provides files for which documentation should be generated.
*
@ -397,18 +361,6 @@ public class JavadocOperation extends AbstractOperation<JavadocOperation> {
return classpath_;
}
/**
* Retrieves the list of entries for the javadoc module path.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the javadoc module path list
* @since 2.1
*/
public List<String> modulePath() {
return modulePath_;
}
/**
* Retrieves the list of files for which documentation should be generation.
* <p>

View file

@ -9,10 +9,10 @@ import rife.tools.FileUtils;
import rife.tools.StringUtils;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* Options for the standard javadoc tool.
@ -178,48 +178,8 @@ public class JavadocOptions extends ArrayList<String> {
* @since 1.5.18
*/
public JavadocOptions extDirs(List<File> dirs) {
return extDirsStrings(dirs.stream().map(File::getAbsolutePath).toList());
}
/**
* Override location of installed extensions
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions extDirs(Path... dirs) {
return extDirsPaths(Arrays.asList(dirs));
}
/**
* Override location of installed extensions
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions extDirsPaths(List<Path> dirs) {
return extDirs(dirs.stream().map(Path::toFile).toList());
}
/**
* Override location of installed extensions
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions extDirs(String... dirs) {
return extDirsStrings(Arrays.asList(dirs));
}
/**
* Override location of installed extensions
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions extDirsStrings(List<String> dirs) {
add("-extdirs");
add(String.join(",", dirs));
add(dirs.stream().map(File::getAbsolutePath).collect(Collectors.joining(",")));
return this;
}
@ -296,48 +256,8 @@ public class JavadocOptions extends ArrayList<String> {
* @since 1.6.3
*/
public JavadocOptions modulePath(List<File> paths) {
return modulePathStrings(paths.stream().map(File::getAbsolutePath).toList());
}
/**
* Specify where to find application modules
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions modulePath(Path... paths) {
return modulePathPaths(Arrays.asList(paths));
}
/**
* Specify where to find application modules
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions modulePathPaths(List<Path> paths) {
return modulePath(paths.stream().map(Path::toFile).toList());
}
/**
* Specify where to find application modules
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions modulePath(String... paths) {
return modulePathStrings(Arrays.asList(paths));
}
/**
* Specify where to find application modules
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions modulePathStrings(List<String> paths) {
add("--module-path");
add(FileUtils.joinPaths(paths));
add(FileUtils.joinPaths(paths.stream().map(File::getAbsolutePath).toList()));
return this;
}
@ -348,28 +268,8 @@ public class JavadocOptions extends ArrayList<String> {
* @since 1.6.3
*/
public JavadocOptions moduleSourcePath(File path) {
return moduleSourcePath(path.getAbsolutePath());
}
/**
* Specify where to find input source files for multiple modules
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions moduleSourcePath(Path path) {
return moduleSourcePath(path.toFile());
}
/**
* Specify where to find input source files for multiple modules
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions moduleSourcePath(String path) {
add("--module-source-path");
add(path);
add(path.getAbsolutePath());
return this;
}
@ -525,29 +425,9 @@ public class JavadocOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.12
*/
public JavadocOptions addScript(File path) {
return addScript(path.getAbsolutePath());
}
/**
* Add a script file to the generated documentation
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions addScript(Path path) {
return addScript(path.toFile());
}
/**
* Add a script file to the generated documentation
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions addScript(String path) {
public JavadocOptions addScript(File file) {
add("--add-script");
add(path);
add(file.getAbsolutePath());
return this;
}
@ -557,29 +437,9 @@ public class JavadocOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.12
*/
public JavadocOptions addStylesheet(File path) {
return addStylesheet(path.getAbsolutePath());
}
/**
* Add a stylesheet file to the generated documentation
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions addStylesheet(Path path) {
return addStylesheet(path.toFile());
}
/**
* Add a stylesheet file to the generated documentation
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions addStylesheet(String path) {
public JavadocOptions addStylesheet(File file) {
add("--add-stylesheet");
add(path);
add(file.getAbsolutePath());
return this;
}
@ -718,29 +578,9 @@ public class JavadocOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.12
*/
public JavadocOptions stylesheet(File path) {
return stylesheet(path.getAbsolutePath());
}
/**
* File to change style of the generated documentation
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions stylesheet(Path path) {
return stylesheet(path.toFile());
}
/**
* File to change style of the generated documentation
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions stylesheet(String path) {
public JavadocOptions stylesheet(File file) {
add("--main-stylesheet");
add(path);
add(file.getAbsolutePath());
return this;
}
@ -895,29 +735,9 @@ public class JavadocOptions extends ArrayList<String> {
* @return this list of options
* @since 1.5.18
*/
public JavadocOptions overview(File path) {
return overview(path.getAbsolutePath());
}
/**
* Read overview documentation from HTML file
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions overview(Path path) {
return overview(path.toFile());
}
/**
* Read overview documentation from HTML file
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions overview(String path) {
public JavadocOptions overview(File htmlFile) {
add("-overview");
add(path);
add(htmlFile.getAbsolutePath());
return this;
}
@ -973,28 +793,8 @@ public class JavadocOptions extends ArrayList<String> {
* @since 1.5.12
*/
public JavadocOptions snippetPath(File path) {
return snippetPath(path.getAbsolutePath());
}
/**
* The path for external snippets
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions snippetPath(Path path) {
return snippetPath(path.toFile());
}
/**
* The path for external snippets
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions snippetPath(String path) {
add("--snippet-path");
add(path);
add(path.getAbsolutePath());
return this;
}
@ -1052,28 +852,8 @@ public class JavadocOptions extends ArrayList<String> {
* @since 1.5.12
*/
public JavadocOptions tagletPath(File path) {
return tagletPath(path.getAbsolutePath());
}
/**
* The path to Taglets
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions tagletPath(Path path) {
return tagletPath(path.toFile());
}
/**
* The path to Taglets
*
* @return this list of options
* @since 2.1
*/
public JavadocOptions tagletPath(String path) {
add("-tagletpath");
add(path);
add(path.getAbsolutePath());
return this;
}

View file

@ -1,77 +0,0 @@
/*
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Create run-time images using the jlink tool.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public class JlinkOperation extends AbstractToolProviderOperation<JlinkOperation> {
private final List<String> disabledPlugins_ = new ArrayList<>();
private final JlinkOptions jlinkOptions_ = new JlinkOptions();
public JlinkOperation() {
super("jlink");
}
/**
* Disable the plugin(s) mentioned.
*
* @param plugins the plugin name(s)
* @return this map of options
*/
public JlinkOperation disablePlugin(List<String> plugins) {
disabledPlugins_.addAll(plugins);
return this;
}
/**
* Disable the plugin(s) mentioned.
*
* @param plugins the plugin name(s)
* @return this map of options
*/
public JlinkOperation disablePlugin(String... plugins) {
return disablePlugin(List.of(plugins));
}
@Override
public void execute() throws Exception {
toolArgsFromFiles();
disabledPlugins_.forEach(plugin -> toolArgs("--disable-plugin", plugin));
toolArgs(jlinkOptions_);
super.execute();
}
/**
* Provides a list of options to provide to the jlink tool.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param options the argument-value pairs
* @return this operation instance
*/
public JlinkOperation jlinkOptions(Map<String, String> options) {
jlinkOptions_.putAll(options);
return this;
}
/**
* Retrieves the list of options for the jlink tool.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the map of jlink options
*/
public JlinkOptions jlinkOptions() {
return jlinkOptions_;
}
}

View file

@ -1,408 +0,0 @@
/*
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
* Options for jlink tool.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public class JlinkOptions extends LinkedHashMap<String, String> {
/**
* All Modules Path.
*/
@SuppressWarnings("unused")
public final static String ALL_MODULE_PATH = "ALL-MODULE-PATH";
/**
* Root modules to resolve in addition to the initial modules.
* <p>
* Module can also be {@link #ALL_MODULE_PATH}
*
* @param modules one or more modules
* @return this map of options
*/
public JlinkOptions addModules(List<String> modules) {
put("--add-modules", String.join(",", modules));
return this;
}
/**
* Root modules to resolve in addition to the initial modules.
* <p>
* Module can also be {@link #ALL_MODULE_PATH}
*
* @param modules one or more modules
* @return this map of options
*/
public JlinkOptions addModules(String... modules) {
return addModules(List.of(modules));
}
/**
* Link in service provider modules and their dependencies.
*
* @param bindServices {@code true} to bind services, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions bindServices(boolean bindServices) {
if (bindServices) {
put("--bind-services");
} else {
remove("--bind-services");
}
return this;
}
/**
* Compression to use in compressing resources.
* <p>
* <b>Requires Java 21 or higher</b>. Use {@link #compress(CompressionLevel)} for lower versions.
* <p>
* Where {@link ZipCompression#ZIP_0 ZIP_0} provides no compression and {@link ZipCompression#ZIP_9 ZIP_9} provides
* the best compression.
* <p>Default is {@link ZipCompression#ZIP_6 ZIP_6}
*
* @param compression the {@link ZipCompression compression} level
* @return this map of options
* @see #compress(ZipCompression)
*/
public JlinkOptions compress(ZipCompression compression) {
put("--compress", compression.level);
return this;
}
/**
* Enable compression of resources.
* <p>
* Use {@link #compress(ZipCompression)} on Java 21 or higher.
*
* @param compression the {@link CompressionLevel compression} level
* @return this map of options
* @see #compress(CompressionLevel)
*/
public JlinkOptions compress(CompressionLevel compression) {
put("--compress", compression.level);
return this;
}
/**
* Byte order of generated jimage.
* <p>
* Default: native
*
* @param endian the byte order
* @return this map of options
*/
public JlinkOptions endian(Endian endian) {
put("--endian", endian.byteOrder);
return this;
}
/**
* Suppress a fatal error when signed modular JARs are linked in the image.
*
* @param ignoreSigningInformation {@code true} to ignore signing information, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions ignoreSigningInformation(boolean ignoreSigningInformation) {
if (ignoreSigningInformation) {
put("--ignore-signing-information");
} else {
remove("--ignore-signing-information");
}
return this;
}
/**
* Add a launcher command of the given name for the module.
*
* @param name the name
* @param module the module
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JlinkOptions launcher(String name, String module) {
put("--launcher", name + "=" + module);
return this;
}
/**
* Add a launcher command of the given name for the module and the main class.
*
* @param name the name
* @param module the module
* @param mainClass the main class
* @return this map of options
*/
public JlinkOptions launcher(String name, String module, String mainClass) {
put("--launcher", name + "=" + module + "/" + mainClass);
return this;
}
/**
* Limit the universe of observable modules.
*
* @param modules one or more modules
* @return this map of options
*/
public JlinkOptions limitModule(List<String> modules) {
put("--limit-modules", String.join(",", modules));
return this;
}
/**
* Limit the universe of observable modules.
*
* @param modules one or more modules
* @return this map of options
*/
public JlinkOptions limitModule(String... modules) {
return limitModule(List.of(modules));
}
/**
* Module path.
* <p>
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
* {@code java.base} module, the JDKs jmods directory will be added, if it exists.
*
* @param path the module path
* @return this map of options
*/
public JlinkOptions modulePath(String path) {
put("--module-path", path);
return this;
}
/**
* Module path.
* <p>
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
* {@code java.base} module, the JDKs jmods directory will be added, if it exists.
*
* @param path the module path
* @return this map of options
*/
public JlinkOptions modulePath(File path) {
return modulePath(path.getAbsolutePath());
}
/**
* Module path.
* <p>
* If not specified, the JDKs jmods directory will be used, if it exists. If specified, but it does not contain the
* {@code java.base} module, the JDKs jmods directory will be added, if it exists.
*
* @param path the module path
* @return this map of options
*/
public JlinkOptions modulePath(Path path) {
return modulePath(path.toFile().getAbsolutePath());
}
/**
* Exclude include header files.
*
* @param noHeaderFiles {@code true} to exclude header files, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions noHeaderFiles(boolean noHeaderFiles) {
if (noHeaderFiles) {
put("--no-header-files");
} else {
remove("--no-header-files");
}
return this;
}
/**
* Exclude man pages.
*
* @param noManPages {@code true} to exclude man pages, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions noManPages(boolean noManPages) {
if (noManPages) {
put("--no-man-pages");
} else {
remove("--no-man-pages");
}
return this;
}
/**
* Location of output path.
*
* @param path the output path
* @return this map of options
*/
public JlinkOptions output(String path) {
put("--output", path);
return this;
}
/**
* Location of output path.
*
* @param path the output path
* @return this map of options
*/
public JlinkOptions output(File path) {
return output(path.getAbsolutePath());
}
/**
* Location of output path.
*
* @param path the output path
* @return this map of options
*/
public JlinkOptions output(Path path) {
return output(path.toFile().getAbsolutePath());
}
/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
*
* @param key key with which the specified value is to be associated
*/
public void put(String key) {
put(key, null);
}
/**
* Suggest providers that implement the given service types from the module path.
*
* @param filename the filename
* @return this map of options
*/
public JlinkOptions saveOpts(String filename) {
put("--save-opts", filename);
return this;
}
/**
* Strip debug information.
*
* @param stripDebug {@code true} to strip debug info, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions stripDebug(boolean stripDebug) {
if (stripDebug) {
put("--strip-debug");
} else {
remove("--strip-debug");
}
return this;
}
/**
* Strip native commands.
*
* @param stripNativeCommands {@code true} to strip, {@code false} otherwise
* @return this map of options
*/
public JlinkOptions stripNativeCommands(boolean stripNativeCommands) {
if (stripNativeCommands) {
put("--strip-native-commands");
} else {
remove("--strip-native-commands");
}
return this;
}
/**
* Suggest providers that implement the given service types from the module path.
*
* @param names one or more provider names
* @return this map of options
*/
public JlinkOptions suggestProviders(List<String> names) {
put("--suggest-providers", String.join(",", names));
return this;
}
/**
* Suggest providers that implement the given service types from the module path.
*
* @param names one or more provider names
* @return this map of options
*/
public JlinkOptions suggestProviders(String... names) {
return suggestProviders(List.of(names));
}
public List<String> toList() {
var list = new ArrayList<String>();
forEach((k, v) -> {
list.add(k);
if (v != null && !v.isEmpty()) {
list.add(v);
}
});
return list;
}
/**
* Enable verbose tracing.
*
* @param verbose {@code true} to enable verbose tracing, {@code false} otherwise.
* @return this map of options
*/
public JlinkOptions verbose(boolean verbose) {
if (verbose) {
put("--verbose");
} else {
remove("--verbose");
}
return this;
}
/**
* The byte orders.
*/
public enum Endian {
BIG("big"), LITTLE("little");
public final String byteOrder;
Endian(String byteOrder) {
this.byteOrder = byteOrder;
}
}
/**
* Resources compression levels.
*/
public enum CompressionLevel {
/**
* Level 0: No compression
*/
NO_COMPRESSION("0"),
/**
* Level 1: Constant string sharing
*/
CONSTANT_STRING_SHARING("1"),
/**
* Level 2: ZIP
*/
ZIP("2");
public final String level;
CompressionLevel(String level) {
this.level = level;
}
}
}

View file

@ -1,156 +0,0 @@
/*
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
import java.io.File;
import java.nio.file.Path;
import java.util.Map;
/**
* Create JMOD files with the jmod tool.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public class JmodOperation extends AbstractToolProviderOperation<JmodOperation> {
private final JmodOptions jmodOptions_ = new JmodOptions();
private String jmodFile_;
private OperationMode operationMode_;
public JmodOperation() {
super("jmod");
}
@Override
public void execute() throws Exception {
if (operationMode_ != null) {
toolArgs(operationMode_.mode);
}
toolArgsFromFiles();
toolArgs(jmodOptions_);
if (jmodFile_ != null) {
toolArgs(jmodFile_);
}
super.execute();
}
/**
* Retrieves the name of the JMOD file to create or from which to retrieve information.
*
* @return the JMOD file
*/
public String jmodFile() {
return jmodFile_;
}
/**
* Specifies name of the JMOD file to create or from which to retrieve information.
* <p>
* The JMOD file is <b>required</b>.
*
* @param file the JMOD file
* @return this operation instance
*/
public JmodOperation jmodFile(String file) {
jmodFile_ = file;
return this;
}
/**
* Specifies name of the JMOD file to create or from which to retrieve information.
* <p>
* The JMOD file is <b>required</b>.
*
* @param file the JMOD file
* @return this operation instance
*/
public JmodOperation jmodFile(File file) {
return jmodFile(file.getAbsolutePath());
}
/**
* Specifies name of the JMOD file to create or from which to retrieve information.
* <p>
* The JMOD file is <b>required</b>.
*
* @param file the JMOD file
* @return this operation instance
*/
public JmodOperation jmodFile(Path file) {
return jmodFile(file.toFile().getAbsolutePath());
}
/**
* Retrieves the list of options for the jmod tool.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the map of jmod options
*/
public JmodOptions jmodOptions() {
return jmodOptions_;
}
/**
* Provides a list of options to provide to the jmod tool.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param options the list of jmod options
* @return this operation instance
*/
public JmodOperation jmodOptions(Map<String, String> options) {
jmodOptions_.putAll(options);
return this;
}
/**
* Provides the {@link OperationMode operation mode}.
* <p>
* The operation mode is <b>required</b>.
*
* @param mode the mode
* @return this operation instance
*/
public JmodOperation operationMode(OperationMode mode) {
operationMode_ = mode;
return this;
}
/**
* The operation modes.
*/
public enum OperationMode {
/**
* Creates a new JMOD archive file.
*/
CREATE("create"),
/**
* Prints the module details.
*/
DESCRIBE("describe"),
/**
* Extracts all the files from the JMOD archive file.
*/
EXTRACT("extract"),
/**
* Determines leaf modules and records the hashes of the dependencies that directly and indirectly require them.
*/
HASH("hash"),
/**
* Prints the names of all the entries.
*/
LIST("list");
final String mode;
OperationMode(String mode) {
this.mode = mode;
}
}
}

View file

@ -1,473 +0,0 @@
/*
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
import java.io.File;
import java.nio.file.Path;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
/**
* Options for jmod tool.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public class JmodOptions extends LinkedHashMap<String, String> {
/**
* Application jar files|dir containing classes.
*
* @param classpath the classpath
* @return this map of options
*/
public JmodOptions classpath(String classpath) {
put("--class-path", classpath);
return this;
}
/**
* Location of native commands.
*
* @param path the location
* @return this map of options
*/
public JmodOptions cmds(String path) {
put("--cmds", path);
return this;
}
/**
* Location of native commands.
*
* @param path the location
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions cmds(File path) {
return cmds(path.getAbsolutePath());
}
/**
* Location of native commands.
*
* @param path the location
* @return this map of options
*/
public JmodOptions cmds(Path path) {
return cmds(path.toFile().getAbsolutePath());
}
/**
* Compression to use when creating the JMOD archive.
* <p>
* <b>Requires Java 20 or higher</b>.
* <p>
* Where {@link ZipCompression#ZIP_0 ZIP_0} provides no compression and {@link ZipCompression#ZIP_9 ZIP_9} provides the
* best compression.
* <p>
* Default is {@link ZipCompression#ZIP_6 ZIP_6}
*
* @param compression the {@link ZipCompression compression} level
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions compress(ZipCompression compression) {
put("--compress", compression.level);
return this;
}
/**
* Location of user-editable config files
*
* @param path the path to the config files
* @return this map of options
*/
public JmodOptions config(String path) {
put("--config", path);
return this;
}
/**
* Location of user-editable config files
*
* @param path the path to the config files
* @return this map of options
*/
public JmodOptions config(File path) {
return config(path.getAbsolutePath());
}
/**
* Location of user-editable config files
*
* @param path the path to the config files
* @return this map of options
*/
public JmodOptions config(Path path) {
return config(path.toFile().getAbsolutePath());
}
/**
* Date and time for the timestamps of entries.
*
* @param date the date
* @return this map of options
*/
public JmodOptions date(ZonedDateTime date) {
put("--date", date.truncatedTo(ChronoUnit.SECONDS).format(DateTimeFormatter.ISO_INSTANT));
return this;
}
/**
* Target directory for extract
*
* @param path the directory path
* @return this map of options
*/
public JmodOptions dir(String path) {
put("--dir", path);
return this;
}
/**
* Target directory for extract
*
* @param path the directory path
* @return this map of options
*/
public JmodOptions dir(File path) {
return dir(path.getAbsolutePath());
}
/**
* Target directory for extract
*
* @param path the directory path
* @return this map of options
*/
public JmodOptions dir(Path path) {
return dir(path.toFile().getAbsolutePath());
}
/**
* Exclude from the default root set of modules.
*
* @param doNotResolveByDefault {@code true} to not resolve, {@code false} otherwise
* @return this map of options
*/
public JmodOptions doNotResolveByDefault(boolean doNotResolveByDefault) {
if (doNotResolveByDefault) {
put("--do-not-resolve-by-default");
} else {
remove("--do-not-resolve-by-default");
}
return this;
}
/**
* Dry run of hash mode.
*
* @param dryRun {@code true} for dry run, {@code false} otherwise
* @return this list of operation
*/
public JmodOptions dryRun(boolean dryRun) {
if (dryRun) {
put("--dry-run");
} else {
remove("--dry-run");
}
return this;
}
/**
* Exclude files matching the supplied pattern list.
*
* @param patterns one or more patterns
* @return the map of options
*/
public JmodOptions exclude(List<FilePattern> patterns) {
var args = new ArrayList<String>();
for (var p : patterns) {
if (p.type == FilePatternType.GLOB) {
args.add("glob:" + p.pattern);
} else if (p.type == FilePatternType.REGEX) {
args.add("regex:" + p.pattern);
}
}
put("--exclude", String.join(",", args));
return this;
}
/**
* Exclude files matching the supplied pattern list.
*
* @param patterns one or more patterns
* @return the map of options
*/
public JmodOptions exclude(FilePattern... patterns) {
return exclude(List.of(patterns));
}
/**
* Compute and record hashes to tie a packaged module with modules matching the given regular expression pattern and
* depending upon it directly or indirectly. The hashes are recorded in the JMOD file being created, or a JMOD file
* or modular JAR on the module path specified the jmod hash command.
*
* @param regexPattern the regular expression pattern
* @return this map of options
*/
public JmodOptions hashModules(String regexPattern) {
put("--hash-modules", regexPattern);
return this;
}
/**
* Location of header files.
*
* @param path the location
* @return this map of options
*/
public JmodOptions headerFiles(String path) {
put("--header-files", path);
return this;
}
/**
* Location of header files.
*
* @param path the location
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions headerFiles(File path) {
return headerFiles(path.getAbsolutePath());
}
/**
* Location of header files.
*
* @param path the location
* @return this map of options
*/
public JmodOptions headerFiles(Path path) {
return headerFiles(path.toFile().getAbsolutePath());
}
/**
* Location of legal notices.
*
* @param path the location
* @return this map of options
*/
public JmodOptions legalNotices(String path) {
put("--legal-notices", path);
return this;
}
/**
* Location of legal notices.
*
* @param path the location
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions legalNotices(File path) {
return legalNotices(path.getAbsolutePath());
}
/**
* Location of legal notices.
*
* @param path the location
* @return this map of options
*/
public JmodOptions legalNotices(Path path) {
return legalNotices(path.toFile().getAbsolutePath());
}
/**
* Location of native libraries.
*
* @param path the location
* @return this map of options
*/
public JmodOptions libs(String path) {
put("--libs", path);
return this;
}
/**
* Location of native libraries.
*
* @param path the location
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions libs(File path) {
return libs(path.getAbsolutePath());
}
/**
* Location of native libraries.
*
* @param path the location
* @return this map of options
*/
public JmodOptions libs(Path path) {
return libs(path.toFile().getAbsolutePath());
}
/**
* Main class.
*
* @param name the class name
* @return this list of operation
*/
public JmodOptions mainClass(String name) {
put("--main-class", name);
return this;
}
/**
* Location of man pages.
*
* @param path the location
* @return this map of options
*/
public JmodOptions manPages(String path) {
put("--man-pages", path);
return this;
}
/**
* Location of man pages.
*
* @param path the location
* @return this map of options
*/
@SuppressWarnings("UnusedReturnValue")
public JmodOptions manPages(File path) {
return manPages(path.getAbsolutePath());
}
/**
* Location of man pages.
*
* @param path the location
* @return this map of options
*/
public JmodOptions manPages(Path path) {
return manPages(path.toFile().getAbsolutePath());
}
/**
* Module path.
*
* @param path the module path
* @return this map of options
*/
public JmodOptions modulePath(String path) {
put("--module-path", path);
return this;
}
/**
* Module path.
*
* @param path the module path
* @return this map of options
*/
public JmodOptions modulePath(File path) {
return modulePath(path.getAbsolutePath());
}
/**
* Module path.
*
* @param path the module path
* @return this map of options
*/
public JmodOptions modulePath(Path path) {
return modulePath(path.toFile().getAbsolutePath());
}
/**
* Module version.
*
* @param version the module version.
* @return this map of options
*/
public JmodOptions moduleVersion(String version) {
put("--module-version", version);
return this;
}
/**
* Associates {@code null} with the specified key in this map. If the map previously contained a mapping for the
* key, the old value is replaced.
*
* @param key key with which the specified value is to be associated
*/
public void put(String key) {
put(key, null);
}
/**
* Target platform.
*
* @param platform the platform
* @return this list of operation
*/
public JmodOptions targetPlatform(String platform) {
put("--target-platform", platform);
return this;
}
/**
* Hint for a tool to issue a warning if the module is resolved.
*
* @param reason the reason
* @return this map of options
*/
public JmodOptions warnIfResolved(ResolvedReason reason) {
put("--warn-if-resolved", reason.reason);
return this;
}
/**
* The resolved reasons.
*/
public enum ResolvedReason {
DEPRECATED("deprecated"),
DEPRECATED_FOR_REMOVAL("deprecated-for-removal"),
INCUBATING("incubating");
final String reason;
ResolvedReason(String reason) {
this.reason = reason;
}
}
/**
* The file pattern types.
*/
public enum FilePatternType {
GLOB, REGEX
}
/**
* Defines a file pattern and pattern type.
*
* @param type the pattern type
* @param pattern the pattern
*/
public record FilePattern(FilePatternType type, String pattern) {
}
}

View file

@ -1,124 +0,0 @@
/*
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Package self-contained Java applications with the jpackage tool.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public class JpackageOperation extends AbstractToolProviderOperation<JpackageOperation> {
private final JpackageOptions jpackageOptions_ = new JpackageOptions();
private final List<Launcher> launchers_ = new ArrayList<>();
public JpackageOperation() {
super("jpackage");
}
/**
* List of application launchers.
* <p>
* The main application launcher will be built from the command line options.
* <p>
* Additional alternative launchers can be built using this option, and this option can be used to build multiple
* additional launchers.
*
* @param launchers one or more {@link Launcher launchers}
* @return this operation instance
*/
public JpackageOperation addLauncher(List<Launcher> launchers) {
launchers_.addAll(launchers);
return this;
}
/**
* List of application launchers.
* <p>
* The main application launcher will be built from the command line options.
* <p>
* Additional alternative launchers can be built using this option, and this option can be used to build multiple
* additional launchers.
*
* @param launchers one or more {@link Launcher launchers}
* @return this operation instance
*/
public JpackageOperation addLauncher(Launcher... launchers) {
return addLauncher(List.of(launchers));
}
@Override
public void execute() throws Exception {
toolArgs(cmdFiles().stream().map(opt -> '@' + opt).toList());
for (var l : launchers_) {
toolArgs("--add-launcher", l.name + '=' + l.path);
}
toolArgs(jpackageOptions_);
super.execute();
}
/**
* Retrieves the list of options for the jpackage tool.
* <p>
* This is a modifiable list that can be retrieved and changed.
*
* @return the map of jpackage options
*/
public JpackageOptions jpackageOptions() {
return jpackageOptions_;
}
/**
* Provides a list of options to provide to the jpackage tool.
* <p>
* A copy will be created to allow this list to be independently modifiable.
*
* @param options the map of jpackage options
* @return this operation instance
*/
public JpackageOperation jpackageOptions(Map<String, String> options) {
jpackageOptions_.putAll(options);
return this;
}
/**
* Retrieves the list of application launchers.
*
* @return the list of launchers
*/
public List<Launcher> launchers() {
return launchers_;
}
/**
* Name of launcher, and a path to a Properties file that contains a list of key, value pairs.
* <p>
* The keys {@code module}, {@code main-jar}, {@code main-class}, {@code description},
* {@code arguments}, {@code java-options}, {@code app-version}, {@code icon},
* {@code launcher-as-service}, {@code win-console}, {@code win-shortcut}, {@code win-menu},
* {@code linux-app-category}, and {@code linux-shortcut} can be used.
* <p>
* These options are added to, or used to overwrite, the original command line options to build an additional
* alternative launcher.
*
* @param name the name
* @param path absolute path or relative to the current directory
*/
public record Launcher(String name, String path) {
public Launcher(String name, File path) {
this(name, path.getAbsolutePath());
}
public Launcher(String name, Path path) {
this(name, path.toFile().getAbsolutePath());
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,6 @@ import rife.bld.BldVersion;
import rife.bld.dependencies.*;
import rife.bld.dependencies.exceptions.DependencyException;
import rife.bld.operations.exceptions.OperationOptionException;
import rife.bld.operations.exceptions.RestApiException;
import rife.bld.operations.exceptions.SignException;
import rife.bld.operations.exceptions.UploadException;
import rife.bld.publish.*;
@ -28,9 +27,7 @@ import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
import static rife.bld.dependencies.Dependency.*;
import static rife.bld.publish.MetadataBuilder.SNAPSHOT_TIMESTAMP_FORMATTER;
import static rife.tools.HttpUtils.*;
import static rife.tools.StringUtils.encodeHexLower;
@ -42,9 +39,6 @@ import static rife.tools.StringUtils.encodeHexLower;
* @since 1.5.7
*/
public class PublishOperation extends AbstractOperation<PublishOperation> {
private static final String OSSRH_STAGING_MANUAL_SEARCH = "https://" + Repository.OSSRH_STAGING_API_DOMAIN + "/manual/search/repositories";
private static final String OSSRH_STAGING_MANUAL_UPLOAD = "https://" + Repository.OSSRH_STAGING_API_DOMAIN + "/manual/upload/repository/";
private boolean offline_ = false;
private HierarchicalProperties properties_ = null;
private ArtifactRetriever retriever_ = null;
@ -92,11 +86,6 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
executePublishArtifacts(repository, actual_version);
executePublishPom(repository, actual_version);
executePublishMetadata(repository, moment);
if (!info().version().isSnapshot() &&
repository.location().contains(Repository.OSSRH_STAGING_API_DOMAIN)) {
executeCloseOSSRHStagingRepository(repository);
}
}
if (!silent()) {
System.out.println("Publishing finished successfully.");
@ -143,18 +132,14 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
var resolution = new VersionResolution(properties());
var resolver = new DependencyResolver(resolution, artifactRetriever(), List.of(repository), new Dependency(info().groupId(), info().artifactId(), info().version()));
var snapshot_meta = resolver.getSnapshotMavenMetadata();
var build_number_meta = snapshot_meta.getSnapshotBuildNumber();
if (build_number_meta == null) {
throw new DependencyException("Snapshot metadata build number doesn't exist.");
}
snapshot_build_number = build_number_meta + 1;
snapshot_build_number = snapshot_meta.getSnapshotBuildNumber() + 1;
} catch (DependencyException e) {
// start the build number from the beginning
System.out.println("Unable to retrieve previous snapshot metadata, using first build number.");
System.out.println("This is expected for a first publication or for publication to a staging repository.");
}
// adapt the actual version used by the artifacts
// adapt the actual version that's use by the artifacts
var snapshot_qualifier = snapshot_timestamp + "-" + snapshot_build_number;
actual_version = info().version().withQualifier(snapshot_qualifier);
@ -175,7 +160,7 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
.info(info())
.updated(moment)
.build(),
info().version() + "/" + repository.getMetadataName(), false);
info().version() + "/" + repository.getMetadataName(), true);
return actual_version;
}
@ -195,8 +180,8 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
artifact_name.append('-').append(artifact.classifier());
}
var type = artifact.type();
if (TYPE_JAR.equals(type) || TYPE_MODULAR_JAR.equals(type) || TYPE_CLASSPATH_JAR.equals(type)) {
type = TYPE_JAR;
if (type == null) {
type = "jar";
}
artifact_name.append('.').append(type);
@ -484,8 +469,12 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
var builder = HttpRequest.newBuilder()
.PUT(body)
.uri(URI.create(url))
.header(HEADER_USER_AGENT, constructBldUserAgent());
applyAuthorization(repository, builder);
.header(HEADER_USER_AGENT, "bld/" + BldVersion.getVersion() +
" (" + System.getProperty("os.name") + "; " + System.getProperty("os.version") + "; " + System.getProperty("os.arch") + ") " +
"(" + System.getProperty("java.vendor") + " " + System.getProperty("java.vm.name") + "; " + System.getProperty("java.version") + "; " + System.getProperty("java.vm.version") + ")");
if (repository.username() != null && repository.password() != null) {
builder.header(HEADER_AUTHORIZATION, basicAuthorizationHeader(repository.username(), repository.password()));
}
var request = builder.build();
HttpResponse<String> response;
@ -511,105 +500,6 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
}
}
private static String constructBldUserAgent() {
return "bld/" + BldVersion.getVersion() +
" (" + System.getProperty("os.name") + "; " + System.getProperty("os.version") + "; " + System.getProperty("os.arch") + ") " +
"(" + System.getProperty("java.vendor") + " " + System.getProperty("java.vm.name") + "; " + System.getProperty("java.version") + "; " + System.getProperty("java.vm.version") + ")";
}
private static void applyAuthorization(Repository repository, HttpRequest.Builder builder) {
if (repository.username() != null && repository.password() != null) {
builder.header(HEADER_AUTHORIZATION, basicAuthorizationHeader(repository.username(), repository.password()));
}
}
/**
* Part of the {@link #execute} operation, closes the OSSRH staging API repository.
*
* @param repository the repository to close a staging repository in
* @since 2.2.2
*/
protected void executeCloseOSSRHStagingRepository(Repository repository) {
var url_search = OSSRH_STAGING_MANUAL_SEARCH;
System.out.print("Finding open staging repositories at: " + url_search + " ... ");
System.out.flush();
try {
var builder_search = HttpRequest.newBuilder()
.GET()
.uri(URI.create(url_search))
.header(HEADER_USER_AGENT, constructBldUserAgent());
applyAuthorization(repository, builder_search);
var request_list = builder_search.build();
HttpResponse<String> response_search;
try {
response_search = client_.send(request_list, HttpResponse.BodyHandlers.ofString());
} catch (IOException e) {
System.out.print("I/O error");
throw new RestApiException(url_search, e);
} catch (InterruptedException e) {
System.out.print("interrupted");
throw new RestApiException(url_search, e);
}
if (response_search.statusCode() >= 200 &&
response_search.statusCode() < 300) {
System.out.println("done");
var pattern_key = Pattern.compile("\\{\\s*\"key\"\\s*:\\s*\"([^\"]+)\"\\s*,\\s*\"state\"\\s*:\\s*\"open\"");
var matcher_key = pattern_key.matcher(response_search.body());
if (matcher_key.find()) {
var key = matcher_key.group(1);
System.out.println("Found open staging repository with key: " + key);
var url_close = OSSRH_STAGING_MANUAL_UPLOAD + key;
System.out.print("Closing the staging repository at: " + url_close + " ... ");
System.out.flush();
var builder_close = HttpRequest.newBuilder()
.POST(BodyPublishers.ofString(""))
.uri(URI.create(url_close))
.header(HEADER_USER_AGENT, constructBldUserAgent());
applyAuthorization(repository, builder_close);
var request_close = builder_close.build();
HttpResponse<String> response_close;
try {
response_close = client_.send(request_close, HttpResponse.BodyHandlers.ofString());
} catch (IOException e) {
System.out.print("I/O error");
throw new RestApiException(url_close, e);
} catch (InterruptedException e) {
System.out.print("interrupted");
throw new RestApiException(url_close, e);
}
if (response_close.statusCode() >= 200 &&
response_close.statusCode() < 300) {
System.out.print("done");
} else {
System.out.println("failed");
var pattern_error = Pattern.compile("\\s*\"error\"\\s*:\\s*\"([^\"]*)\"");
var matcher_error = pattern_error.matcher(response_close.body());
if (matcher_error.find()) {
var error = matcher_error.group(1);
System.out.print(error.translateEscapes());
}
throw new RestApiException(url_close, response_close.statusCode());
}
}
else {
System.out.print("No open staging repository found.");
throw new RestApiException(url_search);
}
} else {
System.out.print("failed");
throw new RestApiException(url_search, response_search.statusCode());
}
} finally {
System.out.println();
}
}
/**
* Configures a publish operation from a {@link BaseProject}.
*
@ -627,9 +517,9 @@ public class PublishOperation extends AbstractOperation<PublishOperation> {
artifactRetriever(project.artifactRetriever());
dependencies().include(project.dependencies());
artifacts(List.of(
new PublishArtifact(new File(project.buildDistDirectory(), project.jarFileName()), "", TYPE_JAR),
new PublishArtifact(new File(project.buildDistDirectory(), project.sourcesJarFileName()), CLASSIFIER_SOURCES, TYPE_JAR),
new PublishArtifact(new File(project.buildDistDirectory(), project.javadocJarFileName()), CLASSIFIER_JAVADOC, TYPE_JAR)));
new PublishArtifact(new File(project.buildDistDirectory(), project.jarFileName()), "", "jar"),
new PublishArtifact(new File(project.buildDistDirectory(), project.sourcesJarFileName()), "sources", "jar"),
new PublishArtifact(new File(project.buildDistDirectory(), project.javadocJarFileName()), "javadoc", "jar")));
if (info().groupId() == null) {
info().groupId(project.pkg());
}

View file

@ -31,15 +31,10 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
private final List<Repository> repositories_ = new ArrayList<>();
private final DependencyScopes dependencies_ = new DependencyScopes();
private File libCompileDirectory_;
private File libCompileModulesDirectory_;
private File libProvidedDirectory_;
private File libProvidedModulesDirectory_;
private File libRuntimeDirectory_;
private File libRuntimeModulesDirectory_;
private File libStandaloneDirectory_;
private File libStandaloneModulesDirectory_;
private File libTestDirectory_;
private File libTestModulesDirectory_;
private boolean preserveSources_ = false;
private boolean preserveJavadoc_ = false;
@ -70,7 +65,7 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
* @since 1.5
*/
protected void executePurgeCompileDependencies() {
executePurgeDependencies(libCompileDirectory(), libCompileModulesDirectory(), dependencies().resolveCompileDependencies(properties(), artifactRetriever(), repositories()));
executePurgeDependencies(libCompileDirectory(), dependencies().resolveCompileDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -79,7 +74,7 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
* @since 1.8
*/
protected void executePurgeProvidedDependencies() {
executePurgeDependencies(libProvidedDirectory(), libProvidedModulesDirectory(), dependencies().resolveProvidedDependencies(properties(), artifactRetriever(), repositories()));
executePurgeDependencies(libProvidedDirectory(), dependencies().resolveProvidedDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -88,7 +83,7 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
* @since 1.5
*/
protected void executePurgeRuntimeDependencies() {
executePurgeDependencies(libRuntimeDirectory(), libRuntimeModulesDirectory(), dependencies().resolveRuntimeDependencies(properties(), artifactRetriever(), repositories()));
executePurgeDependencies(libRuntimeDirectory(), dependencies().resolveRuntimeDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -97,7 +92,7 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
* @since 1.5
*/
protected void executePurgeStandaloneDependencies() {
executePurgeDependencies(libStandaloneDirectory(), libStandaloneModulesDirectory(), dependencies().resolveStandaloneDependencies(properties(), artifactRetriever(), repositories()));
executePurgeDependencies(libStandaloneDirectory(), dependencies().resolveStandaloneDependencies(properties(), artifactRetriever(), repositories()));
}
/**
@ -106,59 +101,40 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
* @since 1.5
*/
protected void executePurgeTestDependencies() {
executePurgeDependencies(libTestDirectory(), libTestModulesDirectory(), dependencies().resolveTestDependencies(properties(), artifactRetriever(), repositories()));
executePurgeDependencies(libTestDirectory(), dependencies().resolveTestDependencies(properties(), artifactRetriever(), repositories()));
}
/**
* Part of the {@link #execute} operation, purge the artifacts for a particular dependency scope.
*
* @param classpathDirectory the directory from which the artifacts should be purged
* @param modulesDirectory the directory from which the modules should be purged
* @param dependencies the dependencies to purge
* @since 2.1
* @param destinationDirectory the directory from which the artifacts should be purged
* @param dependencies the dependencies to purge
* @since 1.6
*/
protected void executePurgeDependencies(File classpathDirectory, File modulesDirectory, DependencySet dependencies) {
if (classpathDirectory == null && modulesDirectory == null) {
protected void executePurgeDependencies(File destinationDirectory, DependencySet dependencies) {
if (destinationDirectory == null) {
return;
}
var classpath_names = new HashSet<String>();
var modules_names = new HashSet<String>();
var filenames = new HashSet<String>();
for (var dependency : dependencies) {
var filenames = classpath_names;
if (dependency.isModularJar()) {
filenames = modules_names;
}
addTransferLocations(filenames, dependency);
if (preserveSources_ && !dependency.excludedClassifiers().contains(CLASSIFIER_SOURCES)) {
if (preserveSources_) {
addTransferLocations(filenames, dependency.withClassifier(CLASSIFIER_SOURCES));
}
if (preserveJavadoc_ && !dependency.excludedClassifiers().contains(CLASSIFIER_JAVADOC)) {
if (preserveJavadoc_) {
addTransferLocations(filenames, dependency.withClassifier(CLASSIFIER_JAVADOC));
}
}
purgeFromDirectory(classpathDirectory, modulesDirectory, classpath_names);
purgeFromDirectory(modulesDirectory, classpathDirectory, modules_names);
}
private static void purgeFromDirectory(File directory, File preserveDirectory, HashSet<String> preservedFileNames) {
if (directory == null) {
return;
}
boolean printed_header = false;
var classpath_files = directory.listFiles();
if (classpath_files != null) {
for (var file : classpath_files) {
if (!preservedFileNames.contains(file.getName()) && !file.equals(preserveDirectory)) {
if (!printed_header) {
printed_header = true;
System.out.println("Deleting from " + directory.getName() + ":");
}
System.out.println(" " + file.getName());
file.delete();
for (var file : destinationDirectory.listFiles()) {
if (!filenames.contains(file.getName())) {
if (!printed_header) {
printed_header = true;
System.out.println("Deleting from " + destinationDirectory.getName() + ":");
}
System.out.println(" " + file.getName());
file.delete();
}
}
}
@ -183,15 +159,10 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
.repositories(project.repositories())
.dependencies(project.dependencies())
.libCompileDirectory(project.libCompileDirectory())
.libCompileModulesDirectory(project.libCompileModulesDirectory())
.libProvidedDirectory(project.libProvidedDirectory())
.libProvidedModulesDirectory(project.libProvidedModulesDirectory())
.libRuntimeDirectory(project.libRuntimeDirectory())
.libRuntimeModulesDirectory(project.libRuntimeModulesDirectory())
.libStandaloneDirectory(project.libStandaloneDirectory())
.libStandaloneModulesDirectory(project.libStandaloneModulesDirectory())
.libTestDirectory(project.libTestDirectory())
.libTestModulesDirectory(project.libTestModulesDirectory())
.preserveSources(project.downloadSources())
.preserveJavadoc(project.downloadJavadoc());
}
@ -296,18 +267,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return this;
}
/**
* Provides the {@code compile} scope modules purge directory.
*
* @param directory the directory to purge the {@code compile} scope modules from
* @return this operation instance
* @since 2.1
*/
public PurgeOperation libCompileModulesDirectory(File directory) {
libCompileModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code provided} scope purge directory.
*
@ -320,18 +279,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return this;
}
/**
* Provides the {@code provided} scope modules purge directory.
*
* @param directory the directory to purge the {@code provided} scope modules from
* @return this operation instance
* @since 2.1
*/
public PurgeOperation libProvidedModulesDirectory(File directory) {
libProvidedModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code runtime} scope purge directory.
*
@ -344,18 +291,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return this;
}
/**
* Provides the {@code runtime} scope modules purge directory.
*
* @param directory the directory to purge the {@code runtime} scope modules from
* @return this operation instance
* @since 2.1
*/
public PurgeOperation libRuntimeModulesDirectory(File directory) {
libRuntimeModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code standalone} scope purge directory.
*
@ -368,18 +303,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return this;
}
/**
* Provides the {@code standalone} scope modules purge directory.
*
* @param directory the directory to purge the {@code standalone} scope modules from
* @return this operation instance
* @since 2.1
*/
public PurgeOperation libStandaloneModulesDirectory(File directory) {
libStandaloneModulesDirectory_ = directory;
return this;
}
/**
* Provides the {@code test} scope purge directory.
*
@ -392,18 +315,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return this;
}
/**
* Provides the {@code test} scope modules purge directory.
*
* @param directory the directory to purge the {@code test} scope modules from
* @return this operation instance
* @since 2.1
*/
public PurgeOperation libTestModulesDirectory(File directory) {
libTestModulesDirectory_ = directory;
return this;
}
/**
* Provides the artifact retriever to use.
*
@ -462,16 +373,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return libCompileDirectory_;
}
/**
* Retrieves the {@code compile} scope modules purge directory.
*
* @return the {@code compile} scope modules purge directory
* @since 2.1
*/
public File libCompileModulesDirectory() {
return libCompileModulesDirectory_;
}
/**
* Retrieves the {@code provided} scope purge directory.
*
@ -482,16 +383,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return libProvidedDirectory_;
}
/**
* Retrieves the {@code provided} scope modules purge directory.
*
* @return the {@code provided} scope modules purge directory
* @since 2.1
*/
public File libProvidedModulesDirectory() {
return libProvidedModulesDirectory_;
}
/**
* Retrieves the {@code runtime} scope purge directory.
*
@ -502,16 +393,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return libRuntimeDirectory_;
}
/**
* Retrieves the {@code runtime} scope modules purge directory.
*
* @return the {@code runtime} scope modules purge directory
* @since 2.1
*/
public File libRuntimeModulesDirectory() {
return libRuntimeModulesDirectory_;
}
/**
* Retrieves the {@code standalone} scope purge directory.
*
@ -522,16 +403,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return libStandaloneDirectory_;
}
/**
* Retrieves the {@code standalone} scope modules purge directory.
*
* @return the {@code standalone} scope modules purge directory
* @since 2.1
*/
public File libStandaloneModulesDirectory() {
return libStandaloneModulesDirectory_;
}
/**
* Retrieves the {@code test} scope purge directory.
*
@ -542,16 +413,6 @@ public class PurgeOperation extends AbstractOperation<PurgeOperation> {
return libTestDirectory_;
}
/**
* Retrieves the {@code test} scope modules purge directory.
*
* @return the {@code test} scope modules purge directory
* @since 2.1
*/
public File libTestModulesDirectory() {
return libTestModulesDirectory_;
}
/**
* Retrieves whether the sources classifier files should be preserved.
*

View file

@ -31,30 +31,12 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
var args = new ArrayList<String>();
args.add(javaTool());
args.addAll(javaOptions());
if (!classpath().isEmpty()) {
args.add("-cp");
args.add(FileUtils.joinPaths(classpath()));
}
if (!modulePath().isEmpty()) {
args.add("-p");
args.add(FileUtils.joinPaths(modulePath()));
}
if (module() != null && !module().isEmpty()) {
args.add("-m");
args.add(module());
}
else if (mainClass() != null && !mainClass().isEmpty()){
args.add(mainClass());
}
else if (!silent()) {
System.err.println("No main class or module specified.");
}
args.add(mainClass());
args.addAll(runOptions());
return args;
}
@ -68,9 +50,7 @@ public class RunOperation extends AbstractProcessOperation<RunOperation> {
var operation = workDirectory(project.workDirectory())
.javaTool(project.javaTool())
.classpath(project.runClasspath())
.modulePath(project.runModulePath())
.mainClass(project.mainClass())
.module(project.module());
.mainClass(project.mainClass());
if (project.usesRife2Agent()) {
operation.javaOptions().javaAgent(project.getRife2AgentFile());
}

View file

@ -51,14 +51,8 @@ public class TestOperation<T extends TestOperation<T, O>, O extends List<String>
var args = new ArrayList<String>();
args.add(javaTool());
args.addAll(javaOptions());
if (!classpath().isEmpty()) {
args.add("-cp");
args.add(FileUtils.joinPaths(classpath()));
}
if (!modulePath().isEmpty()) {
args.add("-p");
args.add(FileUtils.joinPaths(modulePath()));
}
args.add("-cp");
args.add(FileUtils.joinPaths(classpath()));
args.add(mainClass());
args.addAll(testToolOptions());
@ -74,8 +68,7 @@ public class TestOperation<T extends TestOperation<T, O>, O extends List<String>
public T fromProject(BaseProject project) {
var operation = workDirectory(project.workDirectory())
.javaTool(project.javaTool())
.classpath(project.testClasspath())
.modulePath(project.testModulePath());
.classpath(project.testClasspath());
if (project.usesRife2Agent()) {
operation.javaOptions().javaAgent(project.getRife2AgentFile());
}

View file

@ -1,30 +0,0 @@
/**
* Copyright 2024 Erik C. Thauvin (https://erik.thauvin.net/)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations;
/**
* The zip compression levels for jlink and jmod.
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @since 2.1.0
*/
public enum ZipCompression {
ZIP_0("zip-0"),
ZIP_1("zip-1"),
ZIP_2("zip-2"),
ZIP_3("zip-3"),
ZIP_4("zip-4"),
ZIP_5("zip-5"),
ZIP_6("zip-6"),
ZIP_7("zip-7"),
ZIP_8("zip-8"),
ZIP_9("zip-9");
public final String level;
ZipCompression(String level) {
this.level = level;
}
}

View file

@ -1,40 +0,0 @@
/*
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.operations.exceptions;
import rife.tools.HttpUtils;
import java.io.Serial;
/**
* When thrown, indicates that something went wrong during the use of a rest API call.
*
* @author Geert Bevin (gbevin[remove] at uwyn dot com)
* @since 2.2.2
*/
public class RestApiException extends RuntimeException {
@Serial private static final long serialVersionUID = -6753423938407177328L;
private final String url_;
public RestApiException(String url, int status) {
super("An error occurred while using rest API at '" + url + "'\nHTTP status code " + status + " : " + HttpUtils.statusReason(status));
url_ = url;
}
public RestApiException(String url, Throwable cause) {
super("An error occurred while using rest API at '" + url + "'", cause);
url_ = url;
}
public RestApiException(String url) {
super("An error occurred while using rest API at '" + url + "'");
url_ = url;
}
public String getUrl() {
return url_;
}
}

View file

@ -14,8 +14,6 @@ import rife.tools.exceptions.FileUtilsErrorException;
import java.io.File;
import java.util.Objects;
import static rife.bld.dependencies.Dependency.TYPE_JAR;
/**
* Provides the functionalities to build a Maven POM xml file.
*
@ -188,7 +186,7 @@ public class PomBuilder {
t.blankValue("dependency-type");
t.blankValue("dependency-type-tag");
if (!TYPE_JAR.equals(dependency.type())) {
if (!"jar".equals(dependency.type())) {
t.setValueEncoded("dependency-type", dependency.type());
t.setBlock("dependency-type-tag");
}

View file

@ -6,8 +6,6 @@ package rife.bld.publish;
import java.io.File;
import static rife.bld.dependencies.Dependency.TYPE_JAR;
/**
* Contains the information about an artifact that will be published.
*
@ -21,6 +19,6 @@ public record PublishArtifact(File file, String classifier, String type) {
public PublishArtifact(File file, String classifier, String type) {
this.file = file;
this.classifier = (classifier == null ? "" : classifier);
this.type = (type == null ? TYPE_JAR : type);
this.type = (type == null ? "jar" : type);
}
}

View file

@ -45,9 +45,9 @@ public class Wrapper {
public static final String WRAPPER_PROPERTIES = WRAPPER_PREFIX + ".properties";
static final String MAVEN_CENTRAL = "https://repo1.maven.org/maven2/";
static final String CENTRAL_SNAPSHOTS = "https://central.sonatype.com/repository/maven-snapshots/";
static final String SONATYPE_SNAPSHOTS = "https://s01.oss.sonatype.org/content/repositories/snapshots/";
static final String DOWNLOAD_LOCATION = MAVEN_CENTRAL + "com/uwyn/rife2/bld/${version}/";
static final String DOWNLOAD_LOCATION_SNAPSHOT = CENTRAL_SNAPSHOTS + "com/uwyn/rife2/bld/${version}/";
static final String DOWNLOAD_LOCATION_SNAPSHOT = SONATYPE_SNAPSHOTS + "com/uwyn/rife2/bld/${version}/";
static final String BLD_CACHE = "bld.cache";
static final String BLD_FILENAME = "bld-${version}.jar";
static final String BLD_SOURCES_FILENAME = "bld-${version}-sources.jar";
@ -120,10 +120,6 @@ public class Wrapper {
private static final Pattern BLD_JAR_PATTERN = Pattern.compile("/\\.bld/dist/bld-[^\"/!]+(?<!sources)\\.jar");
private static final Pattern BLD_SOURCES_JAR_PATTERN = Pattern.compile("/\\.bld/dist/bld-[^\"/!]+-sources\\.jar");
private static final Pattern BLD_PROPERTY_VERSION_PATTERN = Pattern.compile(".*bld\\.version.*");
private static final Pattern JAR_DIRECTORY_LIB_COMPILE_RECURSIVE_PATTERN = Pattern.compile("<jarDirectory\\s+url=\"file://\\$PROJECT_DIR\\$/lib/compile\"\\s+recursive=\"false\"");
private static final Pattern JAR_DIRECTORY_LIB_PROVIDED_RECURSIVE_PATTERN = Pattern.compile("<jarDirectory\\s+url=\"file://\\$PROJECT_DIR\\$/lib/provided\"\\s+recursive=\"false\"");
private static final Pattern JAR_DIRECTORY_LIB_RUNTIME_RECURSIVE_PATTERN = Pattern.compile("<jarDirectory\\s+url=\"file://\\$PROJECT_DIR\\$/lib/runtime\"\\s+recursive=\"false\"");
private static final Pattern JAR_DIRECTORY_LIB_TEST_RECURSIVE_PATTERN = Pattern.compile("<jarDirectory\\s+url=\"file://\\$PROJECT_DIR\\$/lib/test\"\\s+recursive=\"false\"");
/**
* Upgraded the IDEA bld files that were generated with a previous version.
@ -135,50 +131,15 @@ public class Wrapper {
*/
public void upgradeIdeaBldLibrary(File destinationDirectory, String version)
throws IOException {
var libraries_bld = new File(destinationDirectory, Path.of("libraries", "bld.xml").toString());
if (libraries_bld.exists()) {
var file = new File(destinationDirectory, Path.of("libraries", "bld.xml").toString());
if (file.exists()) {
try {
var content = FileUtils.readString(libraries_bld);
var content = FileUtils.readString(file);
content = BLD_JAR_PATTERN.matcher(content).replaceAll("/.bld/dist/bld-" + version + ".jar");
content = BLD_SOURCES_JAR_PATTERN.matcher(content).replaceAll("/.bld/dist/bld-" + version + "-sources.jar");
content = RIFE2_JAR_PATTERN.matcher(content).replaceAll("/.bld/dist/bld-" + version + ".jar");
content = RIFE2_SOURCES_JAR_PATTERN.matcher(content).replaceAll("/.bld/dist/bld-" + version + "-sources.jar");
FileUtils.writeString(content, libraries_bld);
} catch (FileUtilsErrorException e) {
throw new IOException(e);
}
}
var libraries_compile = new File(destinationDirectory, Path.of("libraries", "compile.xml").toString());
if (libraries_compile.exists()) {
try {
var content = FileUtils.readString(libraries_compile);
content = JAR_DIRECTORY_LIB_COMPILE_RECURSIVE_PATTERN.matcher(content).replaceAll("<jarDirectory url=\"file://\\$PROJECT_DIR\\$/lib/compile\" recursive=\"true\"");
content = JAR_DIRECTORY_LIB_PROVIDED_RECURSIVE_PATTERN.matcher(content).replaceAll("<jarDirectory url=\"file://\\$PROJECT_DIR\\$/lib/provided\" recursive=\"true\"");
FileUtils.writeString(content, libraries_compile);
} catch (FileUtilsErrorException e) {
throw new IOException(e);
}
}
var libraries_runtime = new File(destinationDirectory, Path.of("libraries", "runtime.xml").toString());
if (libraries_runtime.exists()) {
try {
var content = FileUtils.readString(libraries_runtime);
content = JAR_DIRECTORY_LIB_RUNTIME_RECURSIVE_PATTERN.matcher(content).replaceAll("<jarDirectory url=\"file://\\$PROJECT_DIR\\$/lib/runtime\" recursive=\"true\"");
FileUtils.writeString(content, libraries_runtime);
} catch (FileUtilsErrorException e) {
throw new IOException(e);
}
}
var libraries_test = new File(destinationDirectory, Path.of("libraries", "test.xml").toString());
if (libraries_test.exists()) {
try {
var content = FileUtils.readString(libraries_test);
content = JAR_DIRECTORY_LIB_PROVIDED_RECURSIVE_PATTERN.matcher(content).replaceAll("<jarDirectory url=\"file://\\$PROJECT_DIR\\$/lib/provided\" recursive=\"true\"");
content = JAR_DIRECTORY_LIB_TEST_RECURSIVE_PATTERN.matcher(content).replaceAll("<jarDirectory url=\"file://\\$PROJECT_DIR\\$/lib/test\" recursive=\"true\"");
FileUtils.writeString(content, libraries_test);
FileUtils.writeString(content, file);
} catch (FileUtilsErrorException e) {
throw new IOException(e);
}
@ -681,7 +642,7 @@ public class Wrapper {
private int launchMainCli(File jarFile, List<String> arguments)
throws IOException, InterruptedException {
var args = new ArrayList<String>();
args.add(findJavaExecutable());
args.add("java");
includeJvmProperties(arguments, args);
args.add("-cp");
@ -734,7 +695,7 @@ public class Wrapper {
}
var java_args = new ArrayList<String>();
java_args.add(findJavaExecutable());
java_args.add("java");
includeJvmProperties(arguments, java_args);
java_args.add("-cp");
@ -751,15 +712,6 @@ public class Wrapper {
return process.waitFor();
}
private static String findJavaExecutable() {
var executable = System.getProperty("os.name").toLowerCase().contains("win") ? "java.exe" : "java";
var java_home = System.getProperty("java.home");
if (null == java_home) {
return executable;
}
return java_home + File.separator + "bin" + File.separator + executable;
}
private static void includeJvmProperties(List<String> arguments, List<String> javaArgs) {
var i = arguments.iterator();
while (i.hasNext()) {

View file

@ -109,7 +109,7 @@ public class WrapperExtensionResolver {
additional_classifiers = classifiers.toArray(new String[0]);
}
var artifacts = dependencies.transferIntoDirectory(resolution_, retriever_, repositories_, destinationDirectory_, destinationDirectory_, additional_classifiers);
var artifacts = dependencies.transferIntoDirectory(resolution_, retriever_, repositories_, destinationDirectory_, additional_classifiers);
for (var artifact : artifacts) {
var location = artifact.location();

View file

@ -1 +1 @@
2.3.1-SNAPSHOT
2.0.1

View file

@ -9,9 +9,9 @@
<root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -10,9 +10,9 @@
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -9,9 +9,9 @@
<root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -10,9 +10,9 @@
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -9,9 +9,9 @@
<root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -10,9 +10,9 @@
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -9,9 +9,9 @@
<root url="file://$PROJECT_DIR$/lib/compile" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -8,7 +8,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/runtime" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -7,7 +7,7 @@
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/standalone" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/standalone" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/standalone" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/standalone" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/standalone" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -10,9 +10,9 @@
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/lib/provided" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="true" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/provided" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -29,16 +29,13 @@ public class TestProject {
assertTrue(project.workDirectory().exists());
assertTrue(project.workDirectory().isDirectory());
assertNull(project.pkg);
assertFalse(project.hasPkg());
assertThrows(IllegalStateException.class, project::pkg);
assertNull(project.name);
assertFalse(project.hasName());
assertThrows(IllegalStateException.class, project::name);
assertNull(project.version);
assertFalse(project.hasVersion());
assertThrows(IllegalStateException.class, project::version);
assertNull(project.mainClass);
assertNull(project.module);
assertThrows(IllegalStateException.class, project::mainClass);
assertNotNull(project.repositories);
assertTrue(project.repositories.isEmpty());
@ -117,11 +114,6 @@ public class TestProject {
assertNotNull(project.compileTestClasspath());
assertNotNull(project.runClasspath());
assertNotNull(project.testClasspath());
assertNotNull(project.compileMainModulePath());
assertNotNull(project.compileTestModulePath());
assertNotNull(project.runModulePath());
assertNotNull(project.testModulePath());
}
static class CustomProject extends Project {
@ -143,22 +135,6 @@ public class TestProject {
}
}
@Test
void testCustomProject()
throws Exception {
var tmp = Files.createTempDirectory("test").toFile();
try {
var result = new StringBuilder();
var project = new CustomProject(tmp, result);
assertTrue(project.hasPkg());
assertTrue(project.hasName());
assertTrue(project.hasVersion());
} finally {
FileUtils.deleteDirectory(tmp);
}
}
@Test
void testCustomCommand()
throws Exception {
@ -345,6 +321,10 @@ public class TestProject {
.include(dependency("org.jsoup", "jsoup", version(1, 15, 4)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2)));
scope(standalone)
.include(dependency("org.eclipse.jetty", "jetty-server", version(11, 0, 14)))
.include(dependency("org.eclipse.jetty", "jetty-servlet", version(11, 0, 14)))
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 7)));
}
public void enableAutoDownloadPurge() {
@ -384,6 +364,8 @@ public class TestProject {
/lib/bld/bld.cache
/lib/compile
/lib/compile/rife2-1.5.11.jar
/lib/provided
/lib/runtime
/lib/test
/lib/test/apiguardian-api-1.1.2.jar
/lib/test/jsoup-1.15.4.jar
@ -397,6 +379,8 @@ public class TestProject {
/lib/test/opentest4j-1.2.0.jar""", FileUtils.generateDirectoryListing(tmp));
FileUtils.deleteDirectory(new File(tmp, "lib/compile"));
FileUtils.deleteDirectory(new File(tmp, "lib/provided"));
FileUtils.deleteDirectory(new File(tmp, "lib/runtime"));
FileUtils.deleteDirectory(new File(tmp, "lib/test"));
assertEquals("""
/lib
@ -421,6 +405,8 @@ public class TestProject {
/lib/bld/bld.cache
/lib/compile
/lib/compile/rife2-1.5.12.jar
/lib/provided
/lib/runtime
/lib/test
/lib/test/apiguardian-api-1.1.2.jar
/lib/test/jsoup-1.15.4.jar
@ -443,6 +429,8 @@ public class TestProject {
/lib/bld/bld.cache
/lib/compile
/lib/compile/rife2-1.5.15.jar
/lib/provided
/lib/runtime
/lib/test
/lib/test/apiguardian-api-1.1.2.jar
/lib/test/jsoup-1.15.4.jar

View file

@ -8,14 +8,9 @@ import org.junit.jupiter.api.Test;
import rife.bld.dependencies.VersionNumber;
import rife.tools.FileUtils;
import java.io.File;
import java.nio.file.Files;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
import static rife.bld.dependencies.Scope.*;
import static rife.bld.dependencies.Scope.compile;
public class TestWebProject {
@Test
@ -33,7 +28,7 @@ public class TestWebProject {
assertNull(project.version);
assertThrows(IllegalStateException.class, project::version);
assertNull(project.mainClass);
assertNull(project.module);
assertThrows(IllegalStateException.class, project::mainClass);
assertNotNull(project.repositories);
assertTrue(project.repositories.isEmpty());
@ -154,167 +149,4 @@ public class TestWebProject {
FileUtils.deleteDirectory(tmp);
}
}
static class CustomWebProjectAutoPurge extends WebProject {
CustomWebProjectAutoPurge(File tmp) {
workDirectory = tmp;
pkg = "test.pkg";
name = "my_project";
version = new VersionNumber(0, 0, 1);
repositories = List.of(MAVEN_CENTRAL);
scope(compile)
.include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 11)));
scope(test)
.include(dependency("org.jsoup", "jsoup", version(1, 15, 4)))
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 9, 2)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 9, 2)));
scope(standalone)
.include(dependency("org.eclipse.jetty", "jetty-server", version(11, 0, 14)))
.include(dependency("org.eclipse.jetty", "jetty-servlet", version(11, 0, 14)))
.include(dependency("org.slf4j", "slf4j-simple", version(2, 0, 7)));
}
public void enableAutoDownloadPurge() {
autoDownloadPurge = true;
}
public void increaseRife2Version() {
scope(compile).clear();
scope(compile)
.include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 12)));
}
public void increaseRife2VersionMore() {
scope(compile).clear();
scope(compile)
.include(dependency("com.uwyn.rife2", "rife2", version(1, 5, 15)));
}
}
@Test
void testAutoDownloadPurge()
throws Exception {
var tmp = Files.createTempDirectory("test").toFile();
try {
var project = new CustomWebProjectAutoPurge(tmp);
project.execute(new String[]{"version"});
assertEquals("", FileUtils.generateDirectoryListing(tmp));
project = new CustomWebProjectAutoPurge(tmp);
project.enableAutoDownloadPurge();
project.execute(new String[]{"version"});
assertEquals("""
/lib
/lib/bld
/lib/bld/bld.cache
/lib/compile
/lib/compile/rife2-1.5.11.jar
/lib/standalone
/lib/standalone/jetty-http-11.0.14.jar
/lib/standalone/jetty-io-11.0.14.jar
/lib/standalone/jetty-jakarta-servlet-api-5.0.2.jar
/lib/standalone/jetty-security-11.0.14.jar
/lib/standalone/jetty-server-11.0.14.jar
/lib/standalone/jetty-servlet-11.0.14.jar
/lib/standalone/jetty-util-11.0.14.jar
/lib/standalone/slf4j-api-2.0.7.jar
/lib/standalone/slf4j-simple-2.0.7.jar
/lib/test
/lib/test/apiguardian-api-1.1.2.jar
/lib/test/jsoup-1.15.4.jar
/lib/test/junit-jupiter-5.9.2.jar
/lib/test/junit-jupiter-api-5.9.2.jar
/lib/test/junit-jupiter-engine-5.9.2.jar
/lib/test/junit-jupiter-params-5.9.2.jar
/lib/test/junit-platform-commons-1.9.2.jar
/lib/test/junit-platform-console-standalone-1.9.2.jar
/lib/test/junit-platform-engine-1.9.2.jar
/lib/test/opentest4j-1.2.0.jar""", FileUtils.generateDirectoryListing(tmp));
FileUtils.deleteDirectory(new File(tmp, "lib/compile"));
FileUtils.deleteDirectory(new File(tmp, "lib/standalone"));
FileUtils.deleteDirectory(new File(tmp, "lib/test"));
assertEquals("""
/lib
/lib/bld
/lib/bld/bld.cache""", FileUtils.generateDirectoryListing(tmp));
project = new CustomWebProjectAutoPurge(tmp);
project.enableAutoDownloadPurge();
project.execute(new String[]{"version"});
assertEquals("""
/lib
/lib/bld
/lib/bld/bld.cache""", FileUtils.generateDirectoryListing(tmp));
project = new CustomWebProjectAutoPurge(tmp);
project.enableAutoDownloadPurge();
project.increaseRife2Version();
project.execute(new String[]{"version"});
assertEquals("""
/lib
/lib/bld
/lib/bld/bld.cache
/lib/compile
/lib/compile/rife2-1.5.12.jar
/lib/standalone
/lib/standalone/jetty-http-11.0.14.jar
/lib/standalone/jetty-io-11.0.14.jar
/lib/standalone/jetty-jakarta-servlet-api-5.0.2.jar
/lib/standalone/jetty-security-11.0.14.jar
/lib/standalone/jetty-server-11.0.14.jar
/lib/standalone/jetty-servlet-11.0.14.jar
/lib/standalone/jetty-util-11.0.14.jar
/lib/standalone/slf4j-api-2.0.7.jar
/lib/standalone/slf4j-simple-2.0.7.jar
/lib/test
/lib/test/apiguardian-api-1.1.2.jar
/lib/test/jsoup-1.15.4.jar
/lib/test/junit-jupiter-5.9.2.jar
/lib/test/junit-jupiter-api-5.9.2.jar
/lib/test/junit-jupiter-engine-5.9.2.jar
/lib/test/junit-jupiter-params-5.9.2.jar
/lib/test/junit-platform-commons-1.9.2.jar
/lib/test/junit-platform-console-standalone-1.9.2.jar
/lib/test/junit-platform-engine-1.9.2.jar
/lib/test/opentest4j-1.2.0.jar""", FileUtils.generateDirectoryListing(tmp));
project = new CustomWebProjectAutoPurge(tmp);
project.enableAutoDownloadPurge();
project.increaseRife2VersionMore();
project.execute(new String[]{"version"});
assertEquals("""
/lib
/lib/bld
/lib/bld/bld.cache
/lib/compile
/lib/compile/rife2-1.5.15.jar
/lib/standalone
/lib/standalone/jetty-http-11.0.14.jar
/lib/standalone/jetty-io-11.0.14.jar
/lib/standalone/jetty-jakarta-servlet-api-5.0.2.jar
/lib/standalone/jetty-security-11.0.14.jar
/lib/standalone/jetty-server-11.0.14.jar
/lib/standalone/jetty-servlet-11.0.14.jar
/lib/standalone/jetty-util-11.0.14.jar
/lib/standalone/slf4j-api-2.0.7.jar
/lib/standalone/slf4j-simple-2.0.7.jar
/lib/test
/lib/test/apiguardian-api-1.1.2.jar
/lib/test/jsoup-1.15.4.jar
/lib/test/junit-jupiter-5.9.2.jar
/lib/test/junit-jupiter-api-5.9.2.jar
/lib/test/junit-jupiter-engine-5.9.2.jar
/lib/test/junit-jupiter-params-5.9.2.jar
/lib/test/junit-platform-commons-1.9.2.jar
/lib/test/junit-platform-console-standalone-1.9.2.jar
/lib/test/junit-platform-engine-1.9.2.jar
/lib/test/opentest4j-1.2.0.jar""", FileUtils.generateDirectoryListing(tmp));
} finally {
FileUtils.deleteDirectory(tmp);
}
}
}

View file

@ -18,8 +18,6 @@ public class TestDependency {
assertEquals(VersionNumber.UNKNOWN, dependency1.version());
assertEquals("", dependency1.classifier());
assertEquals("jar", dependency1.type());
assertFalse(dependency1.isModularJar());
assertFalse(dependency1.isClasspathJar());
var dependency2 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0));
assertNotNull(dependency2);
@ -28,8 +26,6 @@ public class TestDependency {
assertEquals(new VersionNumber(1, 4, 0), dependency2.version());
assertEquals("", dependency2.classifier());
assertEquals("jar", dependency2.type());
assertFalse(dependency2.isModularJar());
assertFalse(dependency2.isClasspathJar());
var dependency3 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), "agent");
assertNotNull(dependency3);
@ -38,8 +34,6 @@ public class TestDependency {
assertEquals(new VersionNumber(1, 4, 0), dependency3.version());
assertEquals("agent", dependency3.classifier());
assertEquals("jar", dependency3.type());
assertFalse(dependency3.isModularJar());
assertFalse(dependency3.isClasspathJar());
var dependency4 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), "bld", "zip");
assertNotNull(dependency4);
@ -48,65 +42,6 @@ public class TestDependency {
assertEquals(new VersionNumber(1, 4, 0), dependency4.version());
assertEquals("bld", dependency4.classifier());
assertEquals("zip", dependency4.type());
assertFalse(dependency4.isModularJar());
assertFalse(dependency4.isClasspathJar());
var dependency5 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), null, "modular-jar");
assertNotNull(dependency5);
assertEquals("com.uwyn.rife2", dependency5.groupId());
assertEquals("rife2", dependency5.artifactId());
assertEquals(new VersionNumber(1, 4, 0), dependency5.version());
assertEquals("", dependency5.classifier());
assertEquals("modular-jar", dependency5.type());
assertTrue(dependency5.isModularJar());
assertFalse(dependency5.isClasspathJar());
var dependency6 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), null, "classpath-jar");
assertNotNull(dependency6);
assertEquals("com.uwyn.rife2", dependency6.groupId());
assertEquals("rife2", dependency6.artifactId());
assertEquals(new VersionNumber(1, 4, 0), dependency6.version());
assertEquals("", dependency6.classifier());
assertEquals("classpath-jar", dependency6.type());
assertFalse(dependency6.isModularJar());
assertTrue(dependency6.isClasspathJar());
}
@Test
void testParent() {
var parent1 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0));
var parent2 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), null, "modular-jar");
var parent3 = new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), null, "classpath-jar");
var child1a = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, null, null, parent1);
assertFalse(child1a.isModularJar());
assertFalse(child1a.isClasspathJar());
var child1b = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, null, null, parent2);
assertTrue(child1b.isModularJar());
assertFalse(child1b.isClasspathJar());
var child1c = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, null, null, parent3);
assertFalse(child1c.isModularJar());
assertFalse(child1c.isClasspathJar());
var child2a = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, "modular-jar", null, parent1);
assertTrue(child2a.isModularJar());
assertFalse(child2a.isClasspathJar());
var child2b = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, "modular-jar", null, parent2);
assertTrue(child2b.isModularJar());
assertFalse(child2b.isClasspathJar());
var child2c = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, "modular-jar", null, parent3);
assertTrue(child2c.isModularJar());
assertFalse(child2c.isClasspathJar());
var child3a = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, "classpath-jar", null, parent1);
assertFalse(child3a.isModularJar());
assertTrue(child3a.isClasspathJar());
var child3b = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, "classpath-jar", null, parent2);
assertFalse(child3b.isModularJar());
assertTrue(child3b.isClasspathJar());
var child3c = new Dependency("com.uwyn.rife2", "bld", new VersionNumber(1, 5, 0), null, "classpath-jar", null, parent3);
assertFalse(child3c.isModularJar());
assertTrue(child3c.isClasspathJar());
}
@Test
@ -164,7 +99,7 @@ public class TestDependency {
}
@Test
void testParse() {
void testToParse() {
assertEquals("com.uwyn.rife2:rife2", Dependency.parse("com.uwyn.rife2:rife2").toString());
assertEquals("com.uwyn.rife2:rife2:1.4.0", Dependency.parse("com.uwyn.rife2:rife2:1.4.0").toString());
assertEquals("com.uwyn.rife2:rife2:1.4.0:agent", Dependency.parse("com.uwyn.rife2:rife2:1.4.0:agent").toString());
@ -179,102 +114,4 @@ public class TestDependency {
assertEquals(new Dependency("com.uwyn.rife2", "rife2", null, null, "zip").toString(), Dependency.parse("com.uwyn.rife2:rife2@zip").toString());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), null, "zip").toString(), Dependency.parse("com.uwyn.rife2:rife2:1.4.0@zip").toString());
}
@Test
void testEquals() {
assertEquals(new Dependency("com.uwyn.rife2", "rife2"), new Dependency("com.uwyn.rife2", "rife2"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2"), new Dependency("com.uwyn.rife2", "rife1"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2"), new Dependency("com.uwyn.rife1", "rife2"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Dependency("com.uwyn.rife2", "rife2", null));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", null));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", null, null, "jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "modular-jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "modular-jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", null, null, "modular-jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "modular-jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "modular-jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "classpath-jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "classpath-jar"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", null, null, "classpath-jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "classpath-jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "classpath-jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "zip"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "zip"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", null, null, "zip"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "zip"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "zip"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), "agent", "jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), "agent", "jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife2", null, "agent", "jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), "agent", "jar"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), "agent", "jar"));
}
@Test
void testHashcode() {
assertEquals(new Dependency("com.uwyn.rife2", "rife2").hashCode(), new Dependency("com.uwyn.rife2", "rife2").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2").hashCode(), new Dependency("com.uwyn.rife2", "rife1").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2").hashCode(), new Dependency("com.uwyn.rife1", "rife2").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Dependency("com.uwyn.rife2", "rife2", null).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", null).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", null, null, "jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "modular-jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "modular-jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", null, null, "modular-jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "modular-jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "modular-jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "classpath-jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "classpath-jar").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", null, null, "classpath-jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "classpath-jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "classpath-jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "zip").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), null, "zip").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", null, null, "zip").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), null, "zip").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), null, "zip").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), "agent", "jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), "agent", "jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife2", null, "agent", "jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), "agent", "jar").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Dependency("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), "agent", "jar").hashCode());
}
}

View file

@ -359,19 +359,19 @@ public class TestDependencySet {
@Test
void testGenerateDependencyTreeCompileRuntime() {
var dependencies = new DependencySet()
.include(new Dependency("net.thauvin.erik", "bitly-shorten", new VersionNumber(2, 0, 0)));
.include(new Dependency("net.thauvin.erik", "bitly-shorten", new VersionNumber(0, 9, 4, "SNAPSHOT")));
assertEquals(StringUtils.convertLineSeparator("""
net.thauvin.erik:bitly-shorten:2.0.0
org.jetbrains.kotlin:kotlin-stdlib:2.1.10
org.jetbrains:annotations:13.0
org.jetbrains.kotlin:kotlin-stdlib-common:2.1.10
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.1.10
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.10
com.squareup.okhttp3:okhttp:4.12.0
com.squareup.okio:okio:3.6.0
com.squareup.okio:okio-jvm:3.6.0
com.squareup.okhttp3:logging-interceptor:4.12.0
org.json:json:20250107
"""), dependencies.generateTransitiveDependencyTree(VersionResolution.dummy(), ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS), compile, runtime));
net.thauvin.erik:bitly-shorten:0.9.4-SNAPSHOT
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22
org.jetbrains.kotlin:kotlin-stdlib:1.8.22
org.jetbrains.kotlin:kotlin-stdlib-common:1.8.22
org.jetbrains:annotations:13.0
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.22
com.squareup.okhttp3:okhttp:4.11.0
com.squareup.okio:okio:3.2.0
com.squareup.okio:okio-jvm:3.2.0
com.squareup.okhttp3:logging-interceptor:4.11.0
org.json:json:20230618
"""), dependencies.generateTransitiveDependencyTree(VersionResolution.dummy(), ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY), compile, runtime));
}
}

View file

@ -1,111 +0,0 @@
/*
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
* Licensed under the Apache License, Version 2.0 (the "License")
*/
package rife.bld.dependencies;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class TestModule {
@Test
void testModule() {
var module1 = new Module("com.uwyn.rife2", "rife2");
assertNotNull(module1);
assertEquals("com.uwyn.rife2", module1.groupId());
assertEquals("rife2", module1.artifactId());
assertEquals(VersionNumber.UNKNOWN, module1.version());
assertEquals("", module1.classifier());
assertEquals("modular-jar", module1.type());
assertTrue(module1.isModularJar());
assertFalse(module1.isClasspathJar());
var module2 = new Module("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0));
assertNotNull(module2);
assertEquals("com.uwyn.rife2", module2.groupId());
assertEquals("rife2", module2.artifactId());
assertEquals(new VersionNumber(1, 4, 0), module2.version());
assertEquals("", module2.classifier());
assertEquals("modular-jar", module2.type());
assertTrue(module2.isModularJar());
assertFalse(module2.isClasspathJar());
var module3 = new Module("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), "agent");
assertNotNull(module3);
assertEquals("com.uwyn.rife2", module3.groupId());
assertEquals("rife2", module3.artifactId());
assertEquals(new VersionNumber(1, 4, 0), module3.version());
assertEquals("agent", module3.classifier());
assertEquals("modular-jar", module3.type());
assertTrue(module3.isModularJar());
assertFalse(module3.isClasspathJar());
}
@Test
void testParse() {
assertEquals("com.uwyn.rife2:rife2@modular-jar", Module.parse("com.uwyn.rife2:rife2").toString());
assertEquals("com.uwyn.rife2:rife2:1.4.0@modular-jar", Module.parse("com.uwyn.rife2:rife2:1.4.0").toString());
assertEquals("com.uwyn.rife2:rife2:1.4.0:agent@modular-jar", Module.parse("com.uwyn.rife2:rife2:1.4.0:agent").toString());
assertEquals("com.uwyn.rife2:rife2@modular-jar", Module.parse("com.uwyn.rife2:rife2@modular-jar").toString());
assertEquals("com.uwyn.rife2:rife2:1.4.0@modular-jar", Module.parse("com.uwyn.rife2:rife2:1.4.0@modular-jar").toString());
assertEquals("com.uwyn.rife2:rife2:1.4.0:agent@modular-jar", Module.parse("com.uwyn.rife2:rife2:1.4.0:agent@modular-jar").toString());
assertEquals(new Module("com.uwyn.rife2", "rife2").toString(), Module.parse("com.uwyn.rife2:rife2").toString());
assertEquals(new Module("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0)).toString(), Module.parse("com.uwyn.rife2:rife2:1.4.0").toString());
assertEquals(new Module("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), "agent").toString(), Module.parse("com.uwyn.rife2:rife2:1.4.0:agent").toString());
assertEquals(new Module("com.uwyn.rife2", "rife2").toString(), Module.parse("com.uwyn.rife2:rife2@modular-jar").toString());
assertEquals(new Module("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0)).toString(), Module.parse("com.uwyn.rife2:rife2:1.4.0@modular-jar").toString());
assertEquals(new Module("com.uwyn.rife2", "rife2", new VersionNumber(1, 4, 0), "agent").toString(), Module.parse("com.uwyn.rife2:rife2:1.4.0:agent@modular-jar").toString());
}
@Test
void testEquals() {
assertEquals(new Dependency("com.uwyn.rife2", "rife2"), new Module("com.uwyn.rife2", "rife2"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2"), new Module("com.uwyn.rife2", "rife1"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2"), new Module("com.uwyn.rife1", "rife2"));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Module("com.uwyn.rife2", "rife2", null));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Module("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)), new Module("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)));
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife2", null));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), "agent"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), "agent"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife2", null, "agent"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), "agent"));
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar"), new Module("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), "agent"));
}
@Test
void testHashcode() {
assertEquals(new Dependency("com.uwyn.rife2", "rife2").hashCode(), new Module("com.uwyn.rife2", "rife2").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2").hashCode(), new Module("com.uwyn.rife2", "rife1").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2").hashCode(), new Module("com.uwyn.rife1", "rife2").hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Module("com.uwyn.rife2", "rife2", null).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Module("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode(), new Module("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1)).hashCode());
assertEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife2", null).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0)).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0)).hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), "agent").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife2", new VersionNumber(1,4,1), "agent").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife2", null, "agent").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife2", "rife1", new VersionNumber(1,4,0), "agent").hashCode());
assertNotEquals(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,4,0), null, "jar").hashCode(), new Module("com.uwyn.rife1", "rife2", new VersionNumber(1,4,0), "agent").hashCode());
}
}

View file

@ -116,15 +116,10 @@ public class TestCleanOperation {
/lib
/lib/bld
/lib/compile
/lib/compile/modules
/lib/provided
/lib/provided/modules
/lib/runtime
/lib/runtime/modules
/lib/standalone
/lib/standalone/modules
/lib/test
/lib/test/modules
/src
/src/bld
/src/bld/java
@ -145,15 +140,10 @@ public class TestCleanOperation {
/lib
/lib/bld
/lib/compile
/lib/compile/modules
/lib/provided
/lib/provided/modules
/lib/runtime
/lib/runtime/modules
/lib/standalone
/lib/standalone/modules
/lib/test
/lib/test/modules
/src
/src/bld
/src/bld/java

View file

@ -223,7 +223,7 @@ public class TestCompileOperation {
var compile_operation = new CompileOperation()
.fromProject(create_operation.project());
var main_app_class = new File(new File(compile_operation.buildMainDirectory(), "tst"), "App.class");
var main_app_class = new File(new File(compile_operation.buildMainDirectory(), "tst"), "AppMain.class");
var test_app_class = new File(new File(compile_operation.buildTestDirectory(), "tst"), "AppTest.class");
assertFalse(main_app_class.exists());
assertFalse(test_app_class.exists());

View file

@ -65,166 +65,157 @@ public class TestCreateAppOperation {
var create_operation = new CreateAppOperation()
.workDirectory(tmp)
.packageName("com.example")
.projectName("my-app")
.baseName("MyApp")
.projectName("myapp")
.downloadDependencies(true);
create_operation.execute();
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Main\\.xml
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/my-app/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4\\.jar
/my-app/lib/test/modules
/my-app/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/my-app/lib/test/opentest4j-1\\.3\\.0\\.jar
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Main\\.xml
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0\\.jar
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappMain\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var compile_operation = new CompileOperation().fromProject(create_operation.project());
compile_operation.execute();
assertTrue(compile_operation.diagnostics().isEmpty());
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Main\\.xml
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/build
/my-app/build/main
/my-app/build/main/com
/my-app/build/main/com/example
/my-app/build/main/com/example/MyApp\\.class
/my-app/build/test
/my-app/build/test/com
/my-app/build/test/com/example
/my-app/build/test/com/example/MyAppTest\\.class
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/my-app/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4\\.jar
/my-app/lib/test/modules
/my-app/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/my-app/lib/test/opentest4j-1\\.3\\.0\\.jar
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Main\\.xml
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/build
/myapp/build/main
/myapp/build/main/com
/myapp/build/main/com/example
/myapp/build/main/com/example/MyappMain\\.class
/myapp/build/test
/myapp/build/test/com
/myapp/build/test/com/example
/myapp/build/test/com/example/MyappTest\\.class
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0\\.jar
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappMain\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var check_result = new StringBuilder();
new RunOperation()
@ -248,63 +239,58 @@ public class TestCreateAppOperation {
var create_operation = new CreateAppOperation()
.workDirectory(tmp)
.packageName("org.stuff")
.projectName("your-thing")
.baseName("YourThing");
.projectName("yourthing");
create_operation.execute();
assertEquals("""
/your-thing
/your-thing/.gitignore
/your-thing/.idea
/your-thing/.idea/app.iml
/your-thing/.idea/bld.iml
/your-thing/.idea/libraries
/your-thing/.idea/libraries/bld.xml
/your-thing/.idea/libraries/compile.xml
/your-thing/.idea/libraries/runtime.xml
/your-thing/.idea/libraries/test.xml
/your-thing/.idea/misc.xml
/your-thing/.idea/modules.xml
/your-thing/.idea/runConfigurations
/your-thing/.idea/runConfigurations/Run Main.xml
/your-thing/.idea/runConfigurations/Run Tests.xml
/your-thing/.vscode
/your-thing/.vscode/launch.json
/your-thing/.vscode/settings.json
/your-thing/bld
/your-thing/bld.bat
/your-thing/lib
/your-thing/lib/bld
/your-thing/lib/bld/bld-wrapper.jar
/your-thing/lib/bld/bld-wrapper.properties
/your-thing/lib/compile
/your-thing/lib/compile/modules
/your-thing/lib/provided
/your-thing/lib/provided/modules
/your-thing/lib/runtime
/your-thing/lib/runtime/modules
/your-thing/lib/test
/your-thing/lib/test/modules
/your-thing/src
/your-thing/src/bld
/your-thing/src/bld/java
/your-thing/src/bld/java/org
/your-thing/src/bld/java/org/stuff
/your-thing/src/bld/java/org/stuff/YourThingBuild.java
/your-thing/src/bld/resources
/your-thing/src/main
/your-thing/src/main/java
/your-thing/src/main/java/org
/your-thing/src/main/java/org/stuff
/your-thing/src/main/java/org/stuff/YourThing.java
/your-thing/src/main/resources
/your-thing/src/main/resources/templates
/your-thing/src/test
/your-thing/src/test/java
/your-thing/src/test/java/org
/your-thing/src/test/java/org/stuff
/your-thing/src/test/java/org/stuff/YourThingTest.java
/your-thing/src/test/resources""",
/yourthing
/yourthing/.gitignore
/yourthing/.idea
/yourthing/.idea/app.iml
/yourthing/.idea/bld.iml
/yourthing/.idea/libraries
/yourthing/.idea/libraries/bld.xml
/yourthing/.idea/libraries/compile.xml
/yourthing/.idea/libraries/runtime.xml
/yourthing/.idea/libraries/test.xml
/yourthing/.idea/misc.xml
/yourthing/.idea/modules.xml
/yourthing/.idea/runConfigurations
/yourthing/.idea/runConfigurations/Run Main.xml
/yourthing/.idea/runConfigurations/Run Tests.xml
/yourthing/.vscode
/yourthing/.vscode/launch.json
/yourthing/.vscode/settings.json
/yourthing/bld
/yourthing/bld.bat
/yourthing/lib
/yourthing/lib/bld
/yourthing/lib/bld/bld-wrapper.jar
/yourthing/lib/bld/bld-wrapper.properties
/yourthing/lib/compile
/yourthing/lib/provided
/yourthing/lib/runtime
/yourthing/lib/test
/yourthing/src
/yourthing/src/bld
/yourthing/src/bld/java
/yourthing/src/bld/java/org
/yourthing/src/bld/java/org/stuff
/yourthing/src/bld/java/org/stuff/YourthingBuild.java
/yourthing/src/bld/resources
/yourthing/src/main
/yourthing/src/main/java
/yourthing/src/main/java/org
/yourthing/src/main/java/org/stuff
/yourthing/src/main/java/org/stuff/YourthingMain.java
/yourthing/src/main/resources
/yourthing/src/main/resources/templates
/yourthing/src/test
/yourthing/src/test/java
/yourthing/src/test/java/org
/yourthing/src/test/java/org/stuff
/yourthing/src/test/java/org/stuff/YourthingTest.java
/yourthing/src/test/resources""",
FileUtils.generateDirectoryListing(tmp));
var compile_operation = new CompileOperation() {
@ -329,8 +315,7 @@ public class TestCreateAppOperation {
var create_operation = new CreateAppOperation()
.workDirectory(tmp)
.packageName("com.example")
.projectName("my-app")
.baseName("MyApp")
.projectName("myapp")
.downloadDependencies(true);
create_operation.execute();
@ -353,87 +338,84 @@ public class TestCreateAppOperation {
var compile_operation = new CompileOperation().fromProject(create_operation.project());
compile_operation.execute();
assertTrue(compile_operation.diagnostics().isEmpty());
System.out.println(FileUtils.generateDirectoryListing(tmp));
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Main\\.xml
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/build
/my-app/build/main
/my-app/build/main/com
/my-app/build/main/com/example
/my-app/build/main/com/example/MyApp\\.class
/my-app/build/test
/my-app/build/test/com
/my-app/build/test/com/example
/my-app/build/test/com/example/MyAppTest\\.class
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/local
/my-app/lib/local/apiguardian-api-1\\.1\\.2-sources\\.jar
/my-app/lib/local/apiguardian-api-1\\.1\\.2\\.jar
/my-app/lib/local/junit-jupiter-5\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-jupiter-5\\.11\\.4\\.jar
/my-app/lib/local/junit-jupiter-api-5\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-jupiter-api-5\\.11\\.4\\.jar
/my-app/lib/local/junit-jupiter-engine-5\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-jupiter-engine-5\\.11\\.4\\.jar
/my-app/lib/local/junit-jupiter-params-5\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-jupiter-params-5\\.11\\.4\\.jar
/my-app/lib/local/junit-platform-commons-1\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-platform-commons-1\\.11\\.4\\.jar
/my-app/lib/local/junit-platform-console-standalone-1\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-platform-console-standalone-1\\.11\\.4\\.jar
/my-app/lib/local/junit-platform-engine-1\\.11\\.4-sources\\.jar
/my-app/lib/local/junit-platform-engine-1\\.11\\.4\\.jar
/my-app/lib/local/opentest4j-1\\.3\\.0-sources\\.jar
/my-app/lib/local/opentest4j-1\\.3\\.0\\.jar
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/modules
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Main\\.xml
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/build
/myapp/build/main
/myapp/build/main/com
/myapp/build/main/com/example
/myapp/build/main/com/example/MyappMain\\.class
/myapp/build/test
/myapp/build/test/com
/myapp/build/test/com/example
/myapp/build/test/com/example/MyappTest\\.class
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/local
/myapp/lib/local/apiguardian-api-1\\.1\\.2-sources\\.jar
/myapp/lib/local/apiguardian-api-1\\.1\\.2\\.jar
/myapp/lib/local/junit-jupiter-5\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-jupiter-5\\.10\\.3\\.jar
/myapp/lib/local/junit-jupiter-api-5\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-jupiter-api-5\\.10\\.3\\.jar
/myapp/lib/local/junit-jupiter-engine-5\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-jupiter-engine-5\\.10\\.3\\.jar
/myapp/lib/local/junit-jupiter-params-5\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-jupiter-params-5\\.10\\.3\\.jar
/myapp/lib/local/junit-platform-commons-1\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-platform-commons-1\\.10\\.3\\.jar
/myapp/lib/local/junit-platform-console-standalone-1\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-platform-console-standalone-1\\.10\\.3\\.jar
/myapp/lib/local/junit-platform-engine-1\\.10\\.3-sources\\.jar
/myapp/lib/local/junit-platform-engine-1\\.10\\.3\\.jar
/myapp/lib/local/opentest4j-1\\.3\\.0-sources\\.jar
/myapp/lib/local/opentest4j-1\\.3\\.0\\.jar
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappMain\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var check_result = new StringBuilder();
new RunOperation()
@ -457,8 +439,7 @@ public class TestCreateAppOperation {
var create_operation = new CreateAppOperation()
.workDirectory(tmp)
.packageName("com.example")
.projectName("my-app")
.baseName("MyApp")
.projectName("myapp")
.downloadDependencies(true);
create_operation.execute();
@ -480,87 +461,83 @@ public class TestCreateAppOperation {
compile_operation.execute();
assertTrue(compile_operation.diagnostics().isEmpty());
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Main\\.xml
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/build
/my-app/build/main
/my-app/build/main/com
/my-app/build/main/com/example
/my-app/build/main/com/example/MyApp\\.class
/my-app/build/test
/my-app/build/test/com
/my-app/build/test/com/example
/my-app/build/test/com/example/MyAppTest\\.class
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/local_compile
/my-app/lib/local_test
/my-app/lib/local_test/apiguardian-api-1\\.1\\.2-sources\\.jar
/my-app/lib/local_test/apiguardian-api-1\\.1\\.2\\.jar
/my-app/lib/local_test/junit-jupiter-5\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-jupiter-5\\.11\\.4\\.jar
/my-app/lib/local_test/junit-jupiter-api-5\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-jupiter-api-5\\.11\\.4\\.jar
/my-app/lib/local_test/junit-jupiter-engine-5\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-jupiter-engine-5\\.11\\.4\\.jar
/my-app/lib/local_test/junit-jupiter-params-5\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-jupiter-params-5\\.11\\.4\\.jar
/my-app/lib/local_test/junit-platform-commons-1\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-platform-commons-1\\.11\\.4\\.jar
/my-app/lib/local_test/junit-platform-console-standalone-1\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-platform-console-standalone-1\\.11\\.4\\.jar
/my-app/lib/local_test/junit-platform-engine-1\\.11\\.4-sources\\.jar
/my-app/lib/local_test/junit-platform-engine-1\\.11\\.4\\.jar
/my-app/lib/local_test/opentest4j-1\\.3\\.0-sources\\.jar
/my-app/lib/local_test/opentest4j-1\\.3\\.0\\.jar
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/modules
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Main\\.xml
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/build
/myapp/build/main
/myapp/build/main/com
/myapp/build/main/com/example
/myapp/build/main/com/example/MyappMain\\.class
/myapp/build/test
/myapp/build/test/com
/myapp/build/test/com/example
/myapp/build/test/com/example/MyappTest\\.class
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/local_compile
/myapp/lib/local_test
/myapp/lib/local_test/apiguardian-api-1\\.1\\.2-sources\\.jar
/myapp/lib/local_test/apiguardian-api-1\\.1\\.2\\.jar
/myapp/lib/local_test/junit-jupiter-5\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-jupiter-5\\.10\\.3\\.jar
/myapp/lib/local_test/junit-jupiter-api-5\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-jupiter-api-5\\.10\\.3\\.jar
/myapp/lib/local_test/junit-jupiter-engine-5\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-jupiter-engine-5\\.10\\.3\\.jar
/myapp/lib/local_test/junit-jupiter-params-5\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-jupiter-params-5\\.10\\.3\\.jar
/myapp/lib/local_test/junit-platform-commons-1\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-platform-commons-1\\.10\\.3\\.jar
/myapp/lib/local_test/junit-platform-console-standalone-1\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-platform-console-standalone-1\\.10\\.3\\.jar
/myapp/lib/local_test/junit-platform-engine-1\\.10\\.3-sources\\.jar
/myapp/lib/local_test/junit-platform-engine-1\\.10\\.3\\.jar
/myapp/lib/local_test/opentest4j-1\\.3\\.0-sources\\.jar
/myapp/lib/local_test/opentest4j-1\\.3\\.0\\.jar
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappMain\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var check_result = new StringBuilder();
new RunOperation()

View file

@ -58,130 +58,121 @@ public class TestCreateBaseOperation {
var create_operation = new CreateBaseOperation()
.workDirectory(tmp)
.packageName("com.example")
.projectName("my-app")
.baseName("MyApp")
.projectName("myapp")
.downloadDependencies(true);
create_operation.execute();
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Main\\.xml
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/modules
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Main\\.xml
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappMain\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var compile_operation = new CompileOperation().fromProject(create_operation.project());
compile_operation.execute();
assertTrue(compile_operation.diagnostics().isEmpty());
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Main\\.xml
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/build
/my-app/build/main
/my-app/build/main/com
/my-app/build/main/com/example
/my-app/build/main/com/example/MyApp\\.class
/my-app/build/test
/my-app/build/test/com
/my-app/build/test/com/example
/my-app/build/test/com/example/MyAppTest\\.class
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/modules
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Main\\.xml
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/build
/myapp/build/main
/myapp/build/main/com
/myapp/build/main/com/example
/myapp/build/main/com/example/MyappMain\\.class
/myapp/build/test
/myapp/build/test/com
/myapp/build/test/com/example
/myapp/build/test/com/example/MyappTest\\.class
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappMain\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var check_result = new StringBuilder();
new RunOperation()
@ -205,130 +196,121 @@ public class TestCreateBaseOperation {
var create_operation = new CreateBaseOperation()
.workDirectory(tmp)
.packageName("org.stuff")
.projectName("your-thing")
.baseName("YourThing");
.projectName("yourthing");
create_operation.execute();
assertEquals("""
/your-thing
/your-thing/.gitignore
/your-thing/.idea
/your-thing/.idea/app.iml
/your-thing/.idea/bld.iml
/your-thing/.idea/libraries
/your-thing/.idea/libraries/bld.xml
/your-thing/.idea/libraries/compile.xml
/your-thing/.idea/libraries/runtime.xml
/your-thing/.idea/libraries/test.xml
/your-thing/.idea/misc.xml
/your-thing/.idea/modules.xml
/your-thing/.idea/runConfigurations
/your-thing/.idea/runConfigurations/Run Main.xml
/your-thing/.idea/runConfigurations/Run Tests.xml
/your-thing/.vscode
/your-thing/.vscode/launch.json
/your-thing/.vscode/settings.json
/your-thing/bld
/your-thing/bld.bat
/your-thing/lib
/your-thing/lib/bld
/your-thing/lib/bld/bld-wrapper.jar
/your-thing/lib/bld/bld-wrapper.properties
/your-thing/lib/compile
/your-thing/lib/compile/modules
/your-thing/lib/provided
/your-thing/lib/provided/modules
/your-thing/lib/runtime
/your-thing/lib/runtime/modules
/your-thing/lib/test
/your-thing/lib/test/modules
/your-thing/src
/your-thing/src/bld
/your-thing/src/bld/java
/your-thing/src/bld/java/org
/your-thing/src/bld/java/org/stuff
/your-thing/src/bld/java/org/stuff/YourThingBuild.java
/your-thing/src/bld/resources
/your-thing/src/main
/your-thing/src/main/java
/your-thing/src/main/java/org
/your-thing/src/main/java/org/stuff
/your-thing/src/main/java/org/stuff/YourThing.java
/your-thing/src/main/resources
/your-thing/src/main/resources/templates
/your-thing/src/test
/your-thing/src/test/java
/your-thing/src/test/java/org
/your-thing/src/test/java/org/stuff
/your-thing/src/test/java/org/stuff/YourThingTest.java
/your-thing/src/test/resources""",
/yourthing
/yourthing/.gitignore
/yourthing/.idea
/yourthing/.idea/app.iml
/yourthing/.idea/bld.iml
/yourthing/.idea/libraries
/yourthing/.idea/libraries/bld.xml
/yourthing/.idea/libraries/compile.xml
/yourthing/.idea/libraries/runtime.xml
/yourthing/.idea/libraries/test.xml
/yourthing/.idea/misc.xml
/yourthing/.idea/modules.xml
/yourthing/.idea/runConfigurations
/yourthing/.idea/runConfigurations/Run Main.xml
/yourthing/.idea/runConfigurations/Run Tests.xml
/yourthing/.vscode
/yourthing/.vscode/launch.json
/yourthing/.vscode/settings.json
/yourthing/bld
/yourthing/bld.bat
/yourthing/lib
/yourthing/lib/bld
/yourthing/lib/bld/bld-wrapper.jar
/yourthing/lib/bld/bld-wrapper.properties
/yourthing/lib/compile
/yourthing/lib/provided
/yourthing/lib/runtime
/yourthing/lib/test
/yourthing/src
/yourthing/src/bld
/yourthing/src/bld/java
/yourthing/src/bld/java/org
/yourthing/src/bld/java/org/stuff
/yourthing/src/bld/java/org/stuff/YourthingBuild.java
/yourthing/src/bld/resources
/yourthing/src/main
/yourthing/src/main/java
/yourthing/src/main/java/org
/yourthing/src/main/java/org/stuff
/yourthing/src/main/java/org/stuff/YourthingMain.java
/yourthing/src/main/resources
/yourthing/src/main/resources/templates
/yourthing/src/test
/yourthing/src/test/java
/yourthing/src/test/java/org
/yourthing/src/test/java/org/stuff
/yourthing/src/test/java/org/stuff/YourthingTest.java
/yourthing/src/test/resources""",
FileUtils.generateDirectoryListing(tmp));
var compile_operation = new CompileOperation().fromProject(create_operation.project());
compile_operation.execute();
assertTrue(compile_operation.diagnostics().isEmpty());
assertEquals("""
/your-thing
/your-thing/.gitignore
/your-thing/.idea
/your-thing/.idea/app.iml
/your-thing/.idea/bld.iml
/your-thing/.idea/libraries
/your-thing/.idea/libraries/bld.xml
/your-thing/.idea/libraries/compile.xml
/your-thing/.idea/libraries/runtime.xml
/your-thing/.idea/libraries/test.xml
/your-thing/.idea/misc.xml
/your-thing/.idea/modules.xml
/your-thing/.idea/runConfigurations
/your-thing/.idea/runConfigurations/Run Main.xml
/your-thing/.idea/runConfigurations/Run Tests.xml
/your-thing/.vscode
/your-thing/.vscode/launch.json
/your-thing/.vscode/settings.json
/your-thing/bld
/your-thing/bld.bat
/your-thing/build
/your-thing/build/main
/your-thing/build/main/org
/your-thing/build/main/org/stuff
/your-thing/build/main/org/stuff/YourThing.class
/your-thing/build/test
/your-thing/build/test/org
/your-thing/build/test/org/stuff
/your-thing/build/test/org/stuff/YourThingTest.class
/your-thing/lib
/your-thing/lib/bld
/your-thing/lib/bld/bld-wrapper.jar
/your-thing/lib/bld/bld-wrapper.properties
/your-thing/lib/compile
/your-thing/lib/compile/modules
/your-thing/lib/provided
/your-thing/lib/provided/modules
/your-thing/lib/runtime
/your-thing/lib/runtime/modules
/your-thing/lib/test
/your-thing/lib/test/modules
/your-thing/src
/your-thing/src/bld
/your-thing/src/bld/java
/your-thing/src/bld/java/org
/your-thing/src/bld/java/org/stuff
/your-thing/src/bld/java/org/stuff/YourThingBuild.java
/your-thing/src/bld/resources
/your-thing/src/main
/your-thing/src/main/java
/your-thing/src/main/java/org
/your-thing/src/main/java/org/stuff
/your-thing/src/main/java/org/stuff/YourThing.java
/your-thing/src/main/resources
/your-thing/src/main/resources/templates
/your-thing/src/test
/your-thing/src/test/java
/your-thing/src/test/java/org
/your-thing/src/test/java/org/stuff
/your-thing/src/test/java/org/stuff/YourThingTest.java
/your-thing/src/test/resources""",
/yourthing
/yourthing/.gitignore
/yourthing/.idea
/yourthing/.idea/app.iml
/yourthing/.idea/bld.iml
/yourthing/.idea/libraries
/yourthing/.idea/libraries/bld.xml
/yourthing/.idea/libraries/compile.xml
/yourthing/.idea/libraries/runtime.xml
/yourthing/.idea/libraries/test.xml
/yourthing/.idea/misc.xml
/yourthing/.idea/modules.xml
/yourthing/.idea/runConfigurations
/yourthing/.idea/runConfigurations/Run Main.xml
/yourthing/.idea/runConfigurations/Run Tests.xml
/yourthing/.vscode
/yourthing/.vscode/launch.json
/yourthing/.vscode/settings.json
/yourthing/bld
/yourthing/bld.bat
/yourthing/build
/yourthing/build/main
/yourthing/build/main/org
/yourthing/build/main/org/stuff
/yourthing/build/main/org/stuff/YourthingMain.class
/yourthing/build/test
/yourthing/build/test/org
/yourthing/build/test/org/stuff
/yourthing/build/test/org/stuff/YourthingTest.class
/yourthing/lib
/yourthing/lib/bld
/yourthing/lib/bld/bld-wrapper.jar
/yourthing/lib/bld/bld-wrapper.properties
/yourthing/lib/compile
/yourthing/lib/provided
/yourthing/lib/runtime
/yourthing/lib/test
/yourthing/src
/yourthing/src/bld
/yourthing/src/bld/java
/yourthing/src/bld/java/org
/yourthing/src/bld/java/org/stuff
/yourthing/src/bld/java/org/stuff/YourthingBuild.java
/yourthing/src/bld/resources
/yourthing/src/main
/yourthing/src/main/java
/yourthing/src/main/java/org
/yourthing/src/main/java/org/stuff
/yourthing/src/main/java/org/stuff/YourthingMain.java
/yourthing/src/main/resources
/yourthing/src/main/resources/templates
/yourthing/src/test
/yourthing/src/test/java
/yourthing/src/test/java/org
/yourthing/src/test/java/org/stuff
/yourthing/src/test/java/org/stuff/YourthingTest.java
/yourthing/src/test/resources""",
FileUtils.generateDirectoryListing(tmp));
var check_result = new StringBuilder();

View file

@ -58,164 +58,155 @@ public class TestCreateLibOperation {
var create_operation = new CreateLibOperation()
.workDirectory(tmp)
.packageName("com.example")
.projectName("my-app")
.baseName("MyApp")
.projectName("myapp")
.downloadDependencies(true);
create_operation.execute();
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/my-app/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4\\.jar
/my-app/lib/test/modules
/my-app/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/my-app/lib/test/opentest4j-1\\.3\\.0\\.jar
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0\\.jar
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappLib\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var compile_operation = new CompileOperation().fromProject(create_operation.project());
compile_operation.execute();
assertTrue(compile_operation.diagnostics().isEmpty());
assertTrue(Pattern.compile("""
/my-app
/my-app/\\.gitignore
/my-app/\\.idea
/my-app/\\.idea/app\\.iml
/my-app/\\.idea/bld\\.iml
/my-app/\\.idea/libraries
/my-app/\\.idea/libraries/bld\\.xml
/my-app/\\.idea/libraries/compile\\.xml
/my-app/\\.idea/libraries/runtime\\.xml
/my-app/\\.idea/libraries/test\\.xml
/my-app/\\.idea/misc\\.xml
/my-app/\\.idea/modules\\.xml
/my-app/\\.idea/runConfigurations
/my-app/\\.idea/runConfigurations/Run Tests\\.xml
/my-app/\\.vscode
/my-app/\\.vscode/launch\\.json
/my-app/\\.vscode/settings\\.json
/my-app/bld
/my-app/bld\\.bat
/my-app/build
/my-app/build/main
/my-app/build/main/com
/my-app/build/main/com/example
/my-app/build/main/com/example/MyApp\\.class
/my-app/build/test
/my-app/build/test/com
/my-app/build/test/com/example
/my-app/build/test/com/example/MyAppTest\\.class
/my-app/lib
/my-app/lib/bld
/my-app/lib/bld/bld-wrapper\\.jar
/my-app/lib/bld/bld-wrapper\\.properties
/my-app/lib/compile
/my-app/lib/compile/modules
/my-app/lib/provided
/my-app/lib/provided/modules
/my-app/lib/runtime
/my-app/lib/runtime/modules
/my-app/lib/test
/my-app/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/my-app/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-api-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-engine-5\\.11\\.4\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-jupiter-params-5\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-commons-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-console-standalone-1\\.11\\.4\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4-sources\\.jar
/my-app/lib/test/junit-platform-engine-1\\.11\\.4\\.jar
/my-app/lib/test/modules
/my-app/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/my-app/lib/test/opentest4j-1\\.3\\.0\\.jar
/my-app/src
/my-app/src/bld
/my-app/src/bld/java
/my-app/src/bld/java/com
/my-app/src/bld/java/com/example
/my-app/src/bld/java/com/example/MyAppBuild\\.java
/my-app/src/bld/resources
/my-app/src/main
/my-app/src/main/java
/my-app/src/main/java/com
/my-app/src/main/java/com/example
/my-app/src/main/java/com/example/MyApp\\.java
/my-app/src/main/resources
/my-app/src/main/resources/templates
/my-app/src/test
/my-app/src/test/java
/my-app/src/test/java/com
/my-app/src/test/java/com/example
/my-app/src/test/java/com/example/MyAppTest\\.java
/my-app/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
/myapp
/myapp/\\.gitignore
/myapp/\\.idea
/myapp/\\.idea/app\\.iml
/myapp/\\.idea/bld\\.iml
/myapp/\\.idea/libraries
/myapp/\\.idea/libraries/bld\\.xml
/myapp/\\.idea/libraries/compile\\.xml
/myapp/\\.idea/libraries/runtime\\.xml
/myapp/\\.idea/libraries/test\\.xml
/myapp/\\.idea/misc\\.xml
/myapp/\\.idea/modules\\.xml
/myapp/\\.idea/runConfigurations
/myapp/\\.idea/runConfigurations/Run Tests\\.xml
/myapp/\\.vscode
/myapp/\\.vscode/launch\\.json
/myapp/\\.vscode/settings\\.json
/myapp/bld
/myapp/bld\\.bat
/myapp/build
/myapp/build/main
/myapp/build/main/com
/myapp/build/main/com/example
/myapp/build/main/com/example/MyappLib\\.class
/myapp/build/test
/myapp/build/test/com
/myapp/build/test/com/example
/myapp/build/test/com/example/MyappTest\\.class
/myapp/lib
/myapp/lib/bld
/myapp/lib/bld/bld-wrapper\\.jar
/myapp/lib/bld/bld-wrapper\\.properties
/myapp/lib/compile
/myapp/lib/provided
/myapp/lib/runtime
/myapp/lib/test
/myapp/lib/test/apiguardian-api-1\\.1\\.2-sources\\.jar
/myapp/lib/test/apiguardian-api-1\\.1\\.2\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-api-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-engine-5\\.10\\.3\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-jupiter-params-5\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-commons-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-console-standalone-1\\.10\\.3\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3-sources\\.jar
/myapp/lib/test/junit-platform-engine-1\\.10\\.3\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0-sources\\.jar
/myapp/lib/test/opentest4j-1\\.3\\.0\\.jar
/myapp/src
/myapp/src/bld
/myapp/src/bld/java
/myapp/src/bld/java/com
/myapp/src/bld/java/com/example
/myapp/src/bld/java/com/example/MyappBuild\\.java
/myapp/src/bld/resources
/myapp/src/main
/myapp/src/main/java
/myapp/src/main/java/com
/myapp/src/main/java/com/example
/myapp/src/main/java/com/example/MyappLib\\.java
/myapp/src/main/resources
/myapp/src/main/resources/templates
/myapp/src/test
/myapp/src/test/java
/myapp/src/test/java/com
/myapp/src/test/java/com/example
/myapp/src/test/java/com/example/MyappTest\\.java
/myapp/src/test/resources""").matcher(FileUtils.generateDirectoryListing(tmp)).matches());
var check_result = new StringBuilder();
new JUnitOperation()

File diff suppressed because it is too large Load diff

View file

@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test;
import rife.bld.BldVersion;
import rife.bld.WebProject;
import rife.bld.dependencies.*;
import rife.bld.dependencies.Module;
import rife.bld.wrapper.Wrapper;
import rife.tools.FileUtils;
import rife.tools.StringUtils;
@ -73,7 +72,7 @@ public class TestDependencyTreeOperation {
.repositories(List.of(Repository.MAVEN_CENTRAL));
operation.dependencies().scope(Scope.compile)
.include(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,5,20)))
.include(new Module("com.stripe", "stripe-java", new VersionNumber(20,136,0)))
.include(new Dependency("com.stripe", "stripe-java", new VersionNumber(20,136,0)))
.include(new Dependency("org.json", "json", new VersionNumber(20230227)))
.include(new Dependency("com.itextpdf", "itext7-core", new VersionNumber(7,2,5)))
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2,0,7)))
@ -94,7 +93,7 @@ public class TestDependencyTreeOperation {
compile:
com.uwyn.rife2:rife2:1.5.20
com.stripe:stripe-java:20.136.0@modular-jar
com.stripe:stripe-java:20.136.0
org.json:json:20230227
com.itextpdf:itext7-core:7.2.5
com.itextpdf:barcodes:7.2.5
@ -151,12 +150,12 @@ public class TestDependencyTreeOperation {
.include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api"))
.include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-core", new VersionNumber(10,1,12)))
.include(new Dependency("org.apache.tomcat.embed", "tomcat-embed-jasper", new VersionNumber(10,1,12)))
.include(new Module("net.imagej", "ij", Version.parse("1.54d")));
.include(new Dependency("net.imagej", "ij", Version.parse("1.54d")));
operation.dependencies().scope(Scope.test)
.include(new Dependency("org.jsoup", "jsoup", new VersionNumber(1,16,1)))
.include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(5,0,0)))
.include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api"))
.include(new Module("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api"))
.include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api"))
.include(new Dependency("net.imagej", "ij", Version.parse("1.54d")));
operation.execute();
@ -185,7 +184,7 @@ public class TestDependencyTreeOperation {
org.apache.tomcat.embed:tomcat-embed-jasper:10.1.12
org.apache.tomcat.embed:tomcat-embed-el:10.1.12
org.eclipse.jdt:ecj:3.33.0
net.imagej:ij:1.54d@modular-jar
net.imagej:ij:1.54d
runtime:
no dependencies
@ -198,8 +197,8 @@ public class TestDependencyTreeOperation {
org.eclipse.jetty:jetty-util:11.0.15
org.eclipse.jetty:jetty-io:11.0.15
org.slf4j:slf4j-api:2.0.5
org.eclipse.jetty:jetty-servlet:11.0.15@modular-jar
org.eclipse.jetty:jetty-security:11.0.15@modular-jar
org.eclipse.jetty:jetty-servlet:11.0.15
org.eclipse.jetty:jetty-security:11.0.15
net.imagej:ij:1.54d
"""), tree);
@ -391,7 +390,7 @@ public class TestDependencyTreeOperation {
.include(new Dependency("com.uwyn.rife2", "rife2", new VersionNumber(1,5,20)))
.include(new Dependency("com.stripe", "stripe-java", new VersionNumber(20,136,0)))
.include(new Dependency("org.json", "json", new VersionNumber(20230227)))
.include(new Module("com.itextpdf", "itext7-core", new VersionNumber(7,2,5)))
.include(new Dependency("com.itextpdf", "itext7-core", new VersionNumber(7,2,5)))
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2,0,7)))
.include(new Dependency("org.apache.thrift", "libthrift", new VersionNumber(0,17,0)))
.include(new Dependency("commons-codec", "commons-codec", new VersionNumber(1,15)))
@ -412,7 +411,7 @@ public class TestDependencyTreeOperation {
.include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(5,0,0)))
.include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api"))
.include(new Dependency("org.eclipse.jetty", "jetty-servlet", new VersionNumber(11,0,15)).exclude("*", "jetty-jakarta-servlet-api"))
.include(new Module("net.imagej", "ij", Version.parse("1.54d")));
.include(new Dependency("net.imagej", "ij", Version.parse("1.54d")));
var operation = new DependencyTreeOperation()
.fromProject(project);
@ -443,22 +442,22 @@ public class TestDependencyTreeOperation {
com.uwyn.rife2:rife2:1.5.20
com.stripe:stripe-java:20.136.0
org.json:json:20230227
com.itextpdf:itext7-core:7.2.5@modular-jar
com.itextpdf:barcodes:7.2.5@modular-jar
com.itextpdf:font-asian:7.2.5@modular-jar
com.itextpdf:forms:7.2.5@modular-jar
com.itextpdf:hyph:7.2.5@modular-jar
com.itextpdf:io:7.2.5@modular-jar
com.itextpdf:commons:7.2.5@modular-jar
com.itextpdf:kernel:7.2.5@modular-jar
org.bouncycastle:bcpkix-jdk15on:1.70@modular-jar
org.bouncycastle:bcutil-jdk15on:1.70@modular-jar
org.bouncycastle:bcprov-jdk15on:1.70@modular-jar
com.itextpdf:layout:7.2.5@modular-jar
com.itextpdf:pdfa:7.2.5@modular-jar
com.itextpdf:sign:7.2.5@modular-jar
com.itextpdf:styled-xml-parser:7.2.5@modular-jar
com.itextpdf:svg:7.2.5@modular-jar
com.itextpdf:itext7-core:7.2.5
com.itextpdf:barcodes:7.2.5
com.itextpdf:font-asian:7.2.5
com.itextpdf:forms:7.2.5
com.itextpdf:hyph:7.2.5
com.itextpdf:io:7.2.5
com.itextpdf:commons:7.2.5
com.itextpdf:kernel:7.2.5
org.bouncycastle:bcpkix-jdk15on:1.70
org.bouncycastle:bcutil-jdk15on:1.70
org.bouncycastle:bcprov-jdk15on:1.70
com.itextpdf:layout:7.2.5
com.itextpdf:pdfa:7.2.5
com.itextpdf:sign:7.2.5
com.itextpdf:styled-xml-parser:7.2.5
com.itextpdf:svg:7.2.5
org.slf4j:slf4j-simple:2.0.7
org.slf4j:slf4j-api:2.0.7
org.apache.thrift:libthrift:0.17.0
@ -499,7 +498,7 @@ public class TestDependencyTreeOperation {
org.slf4j:slf4j-api:2.0.5
org.eclipse.jetty:jetty-servlet:11.0.15
org.eclipse.jetty:jetty-security:11.0.15
net.imagej:ij:1.54d@modular-jar
net.imagej:ij:1.54d
"""), tree);
} finally {

View file

@ -7,7 +7,6 @@ package rife.bld.operations;
import org.junit.jupiter.api.Test;
import rife.bld.WebProject;
import rife.bld.dependencies.*;
import rife.bld.dependencies.Module;
import rife.tools.FileUtils;
import java.io.File;
@ -24,15 +23,10 @@ public class TestDownloadOperation {
assertTrue(operation.dependencies().isEmpty());
assertTrue(operation.repositories().isEmpty());
assertNull(operation.libCompileDirectory());
assertNull(operation.libCompileModulesDirectory());
assertNull(operation.libProvidedDirectory());
assertNull(operation.libProvidedModulesDirectory());
assertNull(operation.libRuntimeDirectory());
assertNull(operation.libRuntimeModulesDirectory());
assertNull(operation.libStandaloneDirectory());
assertNull(operation.libStandaloneModulesDirectory());
assertNull(operation.libTestDirectory());
assertNull(operation.libTestModulesDirectory());
}
@Test
@ -46,11 +40,6 @@ public class TestDownloadOperation {
var dir3 = new File("dir3");
var dir4 = new File("dir4");
var dir5 = new File("dir5");
var dir6 = new File("dir6");
var dir7 = new File("dir7");
var dir8 = new File("dir8");
var dir9 = new File("dir9");
var dir10 = new File("dir10");
var operation1 = new DownloadOperation()
.repositories(List.of(repository1, repository2))
@ -58,12 +47,7 @@ public class TestDownloadOperation {
.libProvidedDirectory(dir2)
.libRuntimeDirectory(dir3)
.libStandaloneDirectory(dir4)
.libTestDirectory(dir5)
.libCompileModulesDirectory(dir6)
.libProvidedModulesDirectory(dir7)
.libRuntimeModulesDirectory(dir8)
.libStandaloneModulesDirectory(dir9)
.libTestModulesDirectory(dir10);
.libTestDirectory(dir5);
var dependency_scopes = new DependencyScopes();
dependency_scopes.scope(Scope.compile).include(dependency1).include(dependency2);
operation1.dependencies(dependency_scopes);
@ -76,23 +60,13 @@ public class TestDownloadOperation {
assertEquals(dir3, operation1.libRuntimeDirectory());
assertEquals(dir4, operation1.libStandaloneDirectory());
assertEquals(dir5, operation1.libTestDirectory());
assertEquals(dir6, operation1.libCompileModulesDirectory());
assertEquals(dir7, operation1.libProvidedModulesDirectory());
assertEquals(dir8, operation1.libRuntimeModulesDirectory());
assertEquals(dir9, operation1.libStandaloneModulesDirectory());
assertEquals(dir10, operation1.libTestModulesDirectory());
var operation2 = new DownloadOperation()
.libCompileDirectory(dir1)
.libProvidedDirectory(dir2)
.libRuntimeDirectory(dir3)
.libStandaloneDirectory(dir4)
.libTestDirectory(dir5)
.libCompileModulesDirectory(dir6)
.libProvidedModulesDirectory(dir7)
.libRuntimeModulesDirectory(dir8)
.libStandaloneModulesDirectory(dir9)
.libTestModulesDirectory(dir10);
.libTestDirectory(dir5);
operation2.repositories().add(repository1);
operation2.repositories().add(repository2);
operation2.dependencies().scope(Scope.compile).include(dependency1).include(dependency2);
@ -106,11 +80,6 @@ public class TestDownloadOperation {
assertEquals(dir3, operation2.libRuntimeDirectory());
assertEquals(dir4, operation2.libStandaloneDirectory());
assertEquals(dir5, operation2.libTestDirectory());
assertEquals(dir6, operation2.libCompileModulesDirectory());
assertEquals(dir7, operation2.libProvidedModulesDirectory());
assertEquals(dir8, operation2.libRuntimeModulesDirectory());
assertEquals(dir9, operation2.libStandaloneModulesDirectory());
assertEquals(dir10, operation2.libTestModulesDirectory());
var operation3 = new DownloadOperation()
.offline(true)
@ -127,14 +96,14 @@ public class TestDownloadOperation {
try {
var dir1 = new File(tmp, "dir1");
var dir2 = new File(tmp, "dir2");
var dir8 = new File(tmp, "dir8");
var dir3 = new File(dir8, "dir3");
var dir3 = new File(tmp, "dir3");
var dir4 = new File(tmp, "dir4");
var dir5 = new File(tmp, "dir5");
var dir6 = new File(tmp, "dir6");
var dir7 = new File(tmp, "dir7");
var dir9 = new File(dir4, "dir9");
var dir10 = new File(dir5, "dir10");
dir1.mkdirs();
dir2.mkdirs();
dir3.mkdirs();
dir4.mkdirs();
dir5.mkdirs();
var operation = new DownloadOperation()
.repositories(List.of(Repository.MAVEN_CENTRAL))
@ -142,27 +111,17 @@ public class TestDownloadOperation {
.libProvidedDirectory(dir2)
.libRuntimeDirectory(dir3)
.libStandaloneDirectory(dir4)
.libTestDirectory(dir5)
.libCompileModulesDirectory(dir6)
.libProvidedModulesDirectory(dir7)
.libRuntimeModulesDirectory(dir8)
.libStandaloneModulesDirectory(dir9)
.libTestModulesDirectory(dir10);
.libTestDirectory(dir5);
operation.dependencies().scope(Scope.compile)
.include(new Dependency("org.apache.commons", "commons-lang3", new VersionNumber(3,12,0)))
.include(new Module("org.json", "json", new VersionNumber(20240303)));
.include(new Dependency("org.apache.commons", "commons-lang3", new VersionNumber(3, 12, 0)));
operation.dependencies().scope(Scope.provided)
.include(new Dependency("commons-codec", "commons-codec", new VersionNumber(1,17,0)))
.include(new Module("com.google.zxing", "javase", new VersionNumber(3,5,3)));
.include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(6, 0, 0)));
operation.dependencies().scope(Scope.runtime)
.include(new Dependency("org.apache.commons", "commons-collections4", new VersionNumber(4,4)))
.include(new Module("org.postgresql", "postgresql", new VersionNumber(42,7,3)));
.include(new Dependency("org.apache.commons", "commons-collections4", new VersionNumber(4, 4)));
operation.dependencies().scope(Scope.standalone)
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2,0,6)))
.include(new Module("org.eclipse.jetty.ee10", "jetty-ee10-servlet", new VersionNumber(12,0,16)));
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2, 0, 6)));
operation.dependencies().scope(Scope.test)
.include(new Dependency("org.apache.httpcomponents.client5", "httpclient5", new VersionNumber(5,2,1)))
.include(new Module("org.jsoup", "jsoup", new VersionNumber(1,18,1)));
.include(new Dependency("org.apache.httpcomponents.client5", "httpclient5", new VersionNumber(5, 2, 1)));
operation.execute();
@ -170,38 +129,17 @@ public class TestDownloadOperation {
/dir1
/dir1/commons-lang3-3.12.0.jar
/dir2
/dir2/commons-codec-1.17.0.jar
/dir2/jakarta.servlet-api-6.0.0.jar
/dir3
/dir3/commons-collections4-4.4.jar
/dir4
/dir4/dir9
/dir4/dir9/jakarta.servlet-api-6.0.0.jar
/dir4/dir9/jetty-ee10-servlet-12.0.16.jar
/dir4/dir9/jetty-http-12.0.16.jar
/dir4/dir9/jetty-io-12.0.16.jar
/dir4/dir9/jetty-security-12.0.16.jar
/dir4/dir9/jetty-server-12.0.16.jar
/dir4/dir9/jetty-session-12.0.16.jar
/dir4/dir9/jetty-util-12.0.16.jar
/dir4/dir9/slf4j-api-2.0.16.jar
/dir4/slf4j-api-2.0.6.jar
/dir4/slf4j-simple-2.0.6.jar
/dir5
/dir5/dir10
/dir5/dir10/jsoup-1.18.1.jar
/dir5/httpclient5-5.2.1.jar
/dir5/httpcore5-5.2.jar
/dir5/httpcore5-h2-5.2.jar
/dir5/slf4j-api-1.7.36.jar
/dir6
/dir6/json-20240303.jar
/dir7
/dir7/core-3.5.3.jar
/dir7/jai-imageio-core-1.4.0.jar
/dir7/javase-3.5.3.jar
/dir7/jcommander-1.82.jar
/dir8
/dir8/checker-qual-3.42.0.jar
/dir8/dir3
/dir8/dir3/commons-collections4-4.4.jar
/dir8/postgresql-42.7.3.jar""",
/dir5/slf4j-api-1.7.36.jar""",
FileUtils.generateDirectoryListing(tmp));
} finally {
FileUtils.deleteDirectory(tmp);
@ -215,14 +153,14 @@ public class TestDownloadOperation {
try {
var dir1 = new File(tmp, "dir1");
var dir2 = new File(tmp, "dir2");
var dir8 = new File(tmp, "dir8");
var dir3 = new File(dir8, "dir3");
var dir3 = new File(tmp, "dir3");
var dir4 = new File(tmp, "dir4");
var dir5 = new File(tmp, "dir5");
var dir6 = new File(tmp, "dir6");
var dir7 = new File(tmp, "dir7");
var dir9 = new File(dir4, "dir9");
var dir10 = new File(dir5, "dir10");
dir1.mkdirs();
dir2.mkdirs();
dir3.mkdirs();
dir4.mkdirs();
dir5.mkdirs();
var operation = new DownloadOperation()
.repositories(List.of(Repository.MAVEN_CENTRAL))
@ -231,28 +169,18 @@ public class TestDownloadOperation {
.libRuntimeDirectory(dir3)
.libStandaloneDirectory(dir4)
.libTestDirectory(dir5)
.libCompileModulesDirectory(dir6)
.libProvidedModulesDirectory(dir7)
.libRuntimeModulesDirectory(dir8)
.libStandaloneModulesDirectory(dir9)
.libTestModulesDirectory(dir10)
.downloadJavadoc(true)
.downloadSources(true);
operation.dependencies().scope(Scope.compile)
.include(new Dependency("org.apache.commons", "commons-lang3", new VersionNumber(3,12,0)))
.include(new Module("org.json", "json", new VersionNumber(20240303)).excludeSources());
.include(new Dependency("org.apache.commons", "commons-lang3", new VersionNumber(3, 12, 0)));
operation.dependencies().scope(Scope.provided)
.include(new Dependency("commons-codec", "commons-codec", new VersionNumber(1,17,0)))
.include(new Module("com.google.zxing", "javase", new VersionNumber(3,5,3)).excludeJavadoc());
.include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(6, 0, 0)));
operation.dependencies().scope(Scope.runtime)
.include(new Dependency("org.apache.commons", "commons-collections4", new VersionNumber(4,4)))
.include(new Module("org.postgresql", "postgresql", new VersionNumber(42,7,3)));
.include(new Dependency("org.apache.commons", "commons-collections4", new VersionNumber(4, 4)));
operation.dependencies().scope(Scope.standalone)
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2,0,6)))
.include(new Module("org.eclipse.jetty.ee10", "jetty-ee10-servlet", new VersionNumber(12,0,16)));
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2, 0, 6)));
operation.dependencies().scope(Scope.test)
.include(new Dependency("org.apache.httpcomponents.client5", "httpclient5", new VersionNumber(5,2,1)))
.include(new Module("org.jsoup", "jsoup", new VersionNumber(1,18,1)).excludeSources().excludeJavadoc());
.include(new Dependency("org.apache.httpcomponents.client5", "httpclient5", new VersionNumber(5, 2, 1)));
operation.execute();
@ -262,44 +190,21 @@ public class TestDownloadOperation {
/dir1/commons-lang3-3.12.0-sources.jar
/dir1/commons-lang3-3.12.0.jar
/dir2
/dir2/commons-codec-1.17.0-javadoc.jar
/dir2/commons-codec-1.17.0-sources.jar
/dir2/commons-codec-1.17.0.jar
/dir2/jakarta.servlet-api-6.0.0-javadoc.jar
/dir2/jakarta.servlet-api-6.0.0-sources.jar
/dir2/jakarta.servlet-api-6.0.0.jar
/dir3
/dir3/commons-collections4-4.4-javadoc.jar
/dir3/commons-collections4-4.4-sources.jar
/dir3/commons-collections4-4.4.jar
/dir4
/dir4/dir9
/dir4/dir9/jakarta.servlet-api-6.0.0-javadoc.jar
/dir4/dir9/jakarta.servlet-api-6.0.0-sources.jar
/dir4/dir9/jakarta.servlet-api-6.0.0.jar
/dir4/dir9/jetty-ee10-servlet-12.0.16-javadoc.jar
/dir4/dir9/jetty-ee10-servlet-12.0.16-sources.jar
/dir4/dir9/jetty-ee10-servlet-12.0.16.jar
/dir4/dir9/jetty-http-12.0.16-javadoc.jar
/dir4/dir9/jetty-http-12.0.16-sources.jar
/dir4/dir9/jetty-http-12.0.16.jar
/dir4/dir9/jetty-io-12.0.16-javadoc.jar
/dir4/dir9/jetty-io-12.0.16-sources.jar
/dir4/dir9/jetty-io-12.0.16.jar
/dir4/dir9/jetty-security-12.0.16-javadoc.jar
/dir4/dir9/jetty-security-12.0.16-sources.jar
/dir4/dir9/jetty-security-12.0.16.jar
/dir4/dir9/jetty-server-12.0.16-javadoc.jar
/dir4/dir9/jetty-server-12.0.16-sources.jar
/dir4/dir9/jetty-server-12.0.16.jar
/dir4/dir9/jetty-session-12.0.16-javadoc.jar
/dir4/dir9/jetty-session-12.0.16-sources.jar
/dir4/dir9/jetty-session-12.0.16.jar
/dir4/dir9/jetty-util-12.0.16-javadoc.jar
/dir4/dir9/jetty-util-12.0.16-sources.jar
/dir4/dir9/jetty-util-12.0.16.jar
/dir4/dir9/slf4j-api-2.0.16-javadoc.jar
/dir4/dir9/slf4j-api-2.0.16-sources.jar
/dir4/dir9/slf4j-api-2.0.16.jar
/dir4/slf4j-api-2.0.6-javadoc.jar
/dir4/slf4j-api-2.0.6-sources.jar
/dir4/slf4j-api-2.0.6.jar
/dir4/slf4j-simple-2.0.6-javadoc.jar
/dir4/slf4j-simple-2.0.6-sources.jar
/dir4/slf4j-simple-2.0.6.jar
/dir5
/dir5/dir10
/dir5/dir10/jsoup-1.18.1.jar
/dir5/httpclient5-5.2.1-javadoc.jar
/dir5/httpclient5-5.2.1-sources.jar
/dir5/httpclient5-5.2.1.jar
@ -311,33 +216,7 @@ public class TestDownloadOperation {
/dir5/httpcore5-h2-5.2.jar
/dir5/slf4j-api-1.7.36-javadoc.jar
/dir5/slf4j-api-1.7.36-sources.jar
/dir5/slf4j-api-1.7.36.jar
/dir6
/dir6/json-20240303-javadoc.jar
/dir6/json-20240303.jar
/dir7
/dir7/core-3.5.3-javadoc.jar
/dir7/core-3.5.3-sources.jar
/dir7/core-3.5.3.jar
/dir7/jai-imageio-core-1.4.0-javadoc.jar
/dir7/jai-imageio-core-1.4.0-sources.jar
/dir7/jai-imageio-core-1.4.0.jar
/dir7/javase-3.5.3-sources.jar
/dir7/javase-3.5.3.jar
/dir7/jcommander-1.82-javadoc.jar
/dir7/jcommander-1.82-sources.jar
/dir7/jcommander-1.82.jar
/dir8
/dir8/checker-qual-3.42.0-javadoc.jar
/dir8/checker-qual-3.42.0-sources.jar
/dir8/checker-qual-3.42.0.jar
/dir8/dir3
/dir8/dir3/commons-collections4-4.4-javadoc.jar
/dir8/dir3/commons-collections4-4.4-sources.jar
/dir8/dir3/commons-collections4-4.4.jar
/dir8/postgresql-42.7.3-javadoc.jar
/dir8/postgresql-42.7.3-sources.jar
/dir8/postgresql-42.7.3.jar""",
/dir5/slf4j-api-1.7.36.jar""",
FileUtils.generateDirectoryListing(tmp));
} finally {
FileUtils.deleteDirectory(tmp);
@ -361,20 +240,15 @@ public class TestDownloadOperation {
project.createProjectStructure();
project.repositories().add(Repository.MAVEN_CENTRAL);
project.dependencies().scope(Scope.compile)
.include(new Dependency("org.apache.commons", "commons-lang3", new VersionNumber(3,12,0)))
.include(new Module("org.json", "json", new VersionNumber(20240303)).excludeSources());
.include(new Dependency("org.apache.commons", "commons-lang3", new VersionNumber(3, 12, 0)));
project.dependencies().scope(Scope.provided)
.include(new Dependency("commons-codec", "commons-codec", new VersionNumber(1,17,0)))
.include(new Module("com.google.zxing", "javase", new VersionNumber(3,5,3)));
.include(new Dependency("jakarta.servlet", "jakarta.servlet-api", new VersionNumber(6, 0, 0)));
project.dependencies().scope(Scope.runtime)
.include(new Dependency("org.apache.commons", "commons-collections4", new VersionNumber(4,4)))
.include(new Module("org.postgresql", "postgresql", new VersionNumber(42,7,3)));
.include(new Dependency("org.apache.commons", "commons-collections4", new VersionNumber(4, 4)));
project.dependencies().scope(Scope.standalone)
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2,0,6)))
.include(new Module("org.eclipse.jetty.ee10", "jetty-ee10-servlet", new VersionNumber(12,0,16)));
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2, 0, 6)));
project.dependencies().scope(Scope.test)
.include(new Dependency("org.apache.httpcomponents.client5", "httpclient5", new VersionNumber(5,2,1)))
.include(new Module("org.jsoup", "jsoup", new VersionNumber(1,18,1)));
.include(new Dependency("org.apache.httpcomponents.client5", "httpclient5", new VersionNumber(5, 2, 1)));
var operation = new DownloadOperation()
.fromProject(project);
@ -387,48 +261,15 @@ public class TestDownloadOperation {
/lib/compile
/lib/compile/commons-lang3-3.12.0-sources.jar
/lib/compile/commons-lang3-3.12.0.jar
/lib/compile/modules
/lib/compile/modules/json-20240303.jar
/lib/provided
/lib/provided/commons-codec-1.17.0-sources.jar
/lib/provided/commons-codec-1.17.0.jar
/lib/provided/modules
/lib/provided/modules/core-3.5.3-sources.jar
/lib/provided/modules/core-3.5.3.jar
/lib/provided/modules/jai-imageio-core-1.4.0-sources.jar
/lib/provided/modules/jai-imageio-core-1.4.0.jar
/lib/provided/modules/javase-3.5.3-sources.jar
/lib/provided/modules/javase-3.5.3.jar
/lib/provided/modules/jcommander-1.82-sources.jar
/lib/provided/modules/jcommander-1.82.jar
/lib/provided/jakarta.servlet-api-6.0.0-sources.jar
/lib/provided/jakarta.servlet-api-6.0.0.jar
/lib/runtime
/lib/runtime/commons-collections4-4.4-sources.jar
/lib/runtime/commons-collections4-4.4.jar
/lib/runtime/modules
/lib/runtime/modules/checker-qual-3.42.0-sources.jar
/lib/runtime/modules/checker-qual-3.42.0.jar
/lib/runtime/modules/postgresql-42.7.3-sources.jar
/lib/runtime/modules/postgresql-42.7.3.jar
/lib/standalone
/lib/standalone/modules
/lib/standalone/modules/jakarta.servlet-api-6.0.0-sources.jar
/lib/standalone/modules/jakarta.servlet-api-6.0.0.jar
/lib/standalone/modules/jetty-ee10-servlet-12.0.16-sources.jar
/lib/standalone/modules/jetty-ee10-servlet-12.0.16.jar
/lib/standalone/modules/jetty-http-12.0.16-sources.jar
/lib/standalone/modules/jetty-http-12.0.16.jar
/lib/standalone/modules/jetty-io-12.0.16-sources.jar
/lib/standalone/modules/jetty-io-12.0.16.jar
/lib/standalone/modules/jetty-security-12.0.16-sources.jar
/lib/standalone/modules/jetty-security-12.0.16.jar
/lib/standalone/modules/jetty-server-12.0.16-sources.jar
/lib/standalone/modules/jetty-server-12.0.16.jar
/lib/standalone/modules/jetty-session-12.0.16-sources.jar
/lib/standalone/modules/jetty-session-12.0.16.jar
/lib/standalone/modules/jetty-util-12.0.16-sources.jar
/lib/standalone/modules/jetty-util-12.0.16.jar
/lib/standalone/modules/slf4j-api-2.0.16-sources.jar
/lib/standalone/modules/slf4j-api-2.0.16.jar
/lib/standalone/slf4j-api-2.0.6-sources.jar
/lib/standalone/slf4j-api-2.0.6.jar
/lib/standalone/slf4j-simple-2.0.6-sources.jar
/lib/standalone/slf4j-simple-2.0.6.jar
/lib/test
@ -438,9 +279,6 @@ public class TestDownloadOperation {
/lib/test/httpcore5-5.2.jar
/lib/test/httpcore5-h2-5.2-sources.jar
/lib/test/httpcore5-h2-5.2.jar
/lib/test/modules
/lib/test/modules/jsoup-1.18.1-sources.jar
/lib/test/modules/jsoup-1.18.1.jar
/lib/test/slf4j-api-1.7.36-sources.jar
/lib/test/slf4j-api-1.7.36.jar
/src
@ -470,8 +308,6 @@ public class TestDownloadOperation {
project.repositories().add(Repository.MAVEN_CENTRAL);
project.dependencies().scope(Scope.compile)
.include(new Dependency("com.stripe", "stripe-java", new VersionNumber(20,136,0)));
project.dependencies().scope(Scope.runtime)
.include(new Module("org.json", "json", new VersionNumber(20240303)));
var operation = new DownloadOperation()
.fromProject(project);
@ -482,21 +318,14 @@ public class TestDownloadOperation {
/lib
/lib/bld
/lib/compile
/lib/compile/modules
/lib/compile/stripe-java-20.136.0-sources.jar
/lib/compile/stripe-java-20.136.0.jar
/lib/provided
/lib/provided/modules
/lib/runtime
/lib/runtime/gson-2.9.0-sources.jar
/lib/runtime/gson-2.9.0.jar
/lib/runtime/modules
/lib/runtime/modules/json-20240303-sources.jar
/lib/runtime/modules/json-20240303.jar
/lib/standalone
/lib/standalone/modules
/lib/test
/lib/test/modules
/src
/src/bld
/src/bld/java

View file

@ -13,7 +13,6 @@ import rife.tools.StringUtils;
import java.io.File;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import static org.junit.jupiter.api.Assertions.*;
@ -26,7 +25,6 @@ public class TestJUnitOperation {
assertTrue(operation.workDirectory().exists());
assertTrue(operation.workDirectory().isDirectory());
assertTrue(operation.workDirectory().canWrite());
assertTrue(operation.environment().isEmpty());
assertEquals("java", operation.javaTool());
assertTrue(operation.javaOptions().isEmpty());
assertTrue(operation.classpath().isEmpty());
@ -39,8 +37,6 @@ public class TestJUnitOperation {
@Test
void testPopulation()
throws Exception {
var environment = Map.of("env1", "val1", "env2", "val2", "env3", "val3");
var environment_full = Map.of("env1", "val1", "env2", "val2", "env3", "val3", "env4", "val4");
var work_directory = Files.createTempDirectory("test").toFile();
try {
var java_tool = "javatool";
@ -57,8 +53,6 @@ public class TestJUnitOperation {
var operation1 = new JUnitOperation();
operation1
.workDirectory(work_directory)
.environment(environment)
.environment("env4", "val4")
.javaTool(java_tool)
.javaOptions(List.of(test_java_option1, test_java_option2))
.testToolOptions(List.of(test_tool_option1, test_tool_option2))
@ -68,7 +62,6 @@ public class TestJUnitOperation {
.errorProcessor(test_error_consumer);
assertEquals(work_directory, operation1.workDirectory());
assertEquals(environment_full, operation1.environment());
assertEquals(java_tool, operation1.javaTool());
assertTrue(operation1.javaOptions().contains(test_java_option1));
assertTrue(operation1.javaOptions().contains(test_java_option2));
@ -82,8 +75,6 @@ public class TestJUnitOperation {
var operation2 = new JUnitOperation();
operation2.workDirectory(work_directory);
operation2.environment(environment);
operation2.environment("env4", "val4");
operation2.javaTool(java_tool);
operation2.javaOptions().add(test_java_option1);
operation2.javaOptions().add(test_java_option2);
@ -96,7 +87,6 @@ public class TestJUnitOperation {
operation2.errorProcessor(test_error_consumer);
assertEquals(work_directory, operation2.workDirectory());
assertEquals(environment_full, operation2.environment());
assertEquals(java_tool, operation2.javaTool());
assertTrue(operation2.javaOptions().contains(test_java_option1));
assertTrue(operation2.javaOptions().contains(test_java_option2));
@ -134,7 +124,7 @@ public class TestJUnitOperation {
public class Source1 {
public final String name_;
public Source1() {
name_ = System.getenv("execute_name") + System.getenv("execute_number");
name_ = "source1";
}
public static void main(String[] arguments)
@ -166,8 +156,6 @@ public class TestJUnitOperation {
var output = new StringBuilder();
var test_operation = new JUnitOperation()
.environment(Map.of("execute_name", "source"))
.environment("execute_number", "1")
.mainClass("Source2")
.classpath(List.of(build_main.getAbsolutePath(), build_test.getAbsolutePath()))
.outputProcessor(s -> {

Some files were not shown because too many files have changed in this diff Show more