Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin authored Oct 1, 2023
2 parents f00418b + e7c7144 commit 7ceb6e3
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 70 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/bld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: bld-ci
on: [push, pull_request, workflow_dispatch]

jobs:
build-bld-project:
build-linux:
runs-on: ubuntu-latest

services:
Expand Down Expand Up @@ -91,20 +91,48 @@ jobs:

steps:
- name: Checkout source repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
clean: true
submodules: 'true'
fetch-depth: 0

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: 'temurin'
distribution: 'corretto'
java-version: ${{ matrix.java-version }}
check-latest: true

- name: Run tests
run: >-
./bld download compile 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 }}
build-macos:
runs-on: macos-latest

strategy:
matrix:
java-version: [ 17, 20 ]

steps:
- name: Checkout source repository
uses: actions/checkout@v4
with:
clean: true
submodules: 'true'
fetch-depth: 0

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: ${{ matrix.java-version }}
check-latest: true

- name: Run tests
run: >-
./bld clean download compile test
11 changes: 6 additions & 5 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,30 @@ jobs:

steps:
- name: Checkout source repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
clean: true
submodules: 'true'
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
distribution: 'corretto'
java-version: 17

- name: Build Javadocs
run: ./bld download clean compile javadoc
run: ./bld clean download clean compile javadoc

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
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@v1
uses: actions/deploy-pages@v2
3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core
Submodule core updated 114 files
3 changes: 2 additions & 1 deletion src/bld/java/rife/BldBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public BldBuild()
.mainSourceDirectories(antlr4Operation.outputDirectory(), core_src_main_java_directory)
.testSourceDirectories(core_src_test_java_directory)
.compileOptions()
.debuggingInfo(JavacOptions.DebuggingInfo.ALL);
.debuggingInfo(JavacOptions.DebuggingInfo.ALL)
.addAll(List.of("-encoding", "UTF-8"));

jarOperation()
.sourceDirectories(core_src_main_resources_directory)
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/rife/bld/dependencies/Repository.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import rife.ioc.HierarchicalProperties;
import rife.tools.StringEncryptor;

import java.io.File;
import java.nio.file.Path;
import java.security.NoSuchAlgorithmException;
import java.util.regex.Pattern;

/**
* Contains the information required to locate a Maven-compatible repository.
Expand Down Expand Up @@ -106,6 +108,12 @@ public Repository(String location) {
this(location, null, null);
}

private final static Pattern WINDOWS_ABSOLUTE_PATH = Pattern.compile("^\\p{L}:\\\\");

private boolean isWindowsLocation() {
return WINDOWS_ABSOLUTE_PATH.matcher(location()).find();
}

/**
* Indicates whether this repository is local.
*
Expand All @@ -114,7 +122,7 @@ public Repository(String location) {
* @since 1.5.10
*/
public boolean isLocal() {
return location().startsWith("/") || location().startsWith("file:");
return location().startsWith("/") || location().startsWith("file:") || isWindowsLocation();
}

/**
Expand Down Expand Up @@ -150,9 +158,10 @@ public String getArtifactLocation(Dependency dependency) {
* @since 1.5.10
*/
public String getArtifactLocation(String groupId, String artifactId) {
var group_path = groupId.replace(".", "/");
var separator = "/";
var result = new StringBuilder();
if (isLocal()) {
separator = File.separator;
if (location().startsWith("file://")) {
result.append(location().substring("file://".length()));
} else {
Expand All @@ -161,10 +170,11 @@ public String getArtifactLocation(String groupId, String artifactId) {
} else {
result.append(location());
}
if (!location().endsWith("/")) {
result.append('/');
if (!location().endsWith(separator)) {
result.append(separator);
}
return result.append(group_path).append('/').append(artifactId).append('/').toString();
var group_path = groupId.replace(".", separator);
return result.append(group_path).append(separator).append(artifactId).append(separator).toString();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rife/bld/operations/JavacOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public JavacOptions addModules(List<String> modules) {
*/
public JavacOptions encoding(String name) {
add("-encoding");
add("name");
add(name);
return this;
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/rife/bld/operations/JavadocOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public JavadocOptions breakIterator() {
*/
public JavadocOptions doclet(String className) {
add("-doclet");
add("className");
add(className);
return this;
}

Expand All @@ -112,7 +112,7 @@ public JavadocOptions doclet(String className) {
*/
public JavadocOptions docletPath(String path) {
add("-docletpath");
add("path");
add(path);
return this;
}

Expand All @@ -135,7 +135,7 @@ public JavadocOptions enablePreview() {
*/
public JavadocOptions encoding(String name) {
add("-encoding");
add("name");
add(name);
return this;
}

Expand Down Expand Up @@ -213,7 +213,7 @@ public JavadocOptions limitModules(List<String> modules) {
*/
public JavadocOptions locale(String name) {
add("-locale");
add("name");
add(name);
return this;
}

Expand Down
36 changes: 18 additions & 18 deletions src/test/java/rife/bld/dependencies/TestDependencySet.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,48 +57,48 @@ void testAddAll() {

var set_union1 = new DependencySet(set1);
set_union1.addAll(set2);
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
org.eclipse.jetty:jetty-server:11.0.14
org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2
org.eclipse.jetty:jetty-http:11.0.14
org.eclipse.jetty:jetty-io:11.0.14
org.eclipse.jetty:jetty-util:11.0.14
org.slf4j:slf4j-simple:2.0.6
org.slf4j:slf4j-api:2.0.6""", StringUtils.join(set_union1, "\n"));
org.slf4j:slf4j-api:2.0.6"""), StringUtils.join(set_union1, System.lineSeparator()));

var set_union2 = new DependencySet(set2);
set_union2.addAll(set1);
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
org.slf4j:slf4j-simple:2.0.6
org.slf4j:slf4j-api:2.0.6
org.eclipse.jetty:jetty-server:11.0.14
org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2
org.eclipse.jetty:jetty-http:11.0.14
org.eclipse.jetty:jetty-io:11.0.14
org.eclipse.jetty:jetty-util:11.0.14""", StringUtils.join(set_union2, "\n"));
org.eclipse.jetty:jetty-util:11.0.14"""), StringUtils.join(set_union2, System.lineSeparator()));
}

@Test
void testGenerateDependencyTreeJettySlf4j() {
var dependencies = new DependencySet()
.include(new Dependency("org.eclipse.jetty", "jetty-server", new VersionNumber(11, 0, 14)))
.include(new Dependency("org.slf4j", "slf4j-simple", new VersionNumber(2, 0, 6)));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
├─ org.eclipse.jetty:jetty-server:11.0.14
│ ├─ org.eclipse.jetty.toolchain:jetty-jakarta-servlet-api:5.0.2
│ ├─ org.eclipse.jetty:jetty-http:11.0.14
│ │ └─ org.eclipse.jetty:jetty-util:11.0.14
│ └─ org.eclipse.jetty:jetty-io:11.0.14
└─ org.slf4j:slf4j-simple:2.0.6
└─ org.slf4j:slf4j-api:2.0.6
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}

@Test
void testGenerateDependencyTreeSpringBoot() {
var dependencies = new DependencySet()
.include(new Dependency("org.springframework.boot", "spring-boot-starter", new VersionNumber(3, 0, 4)));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
└─ org.springframework.boot:spring-boot-starter:3.0.4
├─ org.springframework.boot:spring-boot:3.0.4
│ └─ org.springframework:spring-context:6.0.6
Expand All @@ -117,14 +117,14 @@ void testGenerateDependencyTreeSpringBoot() {
├─ org.springframework:spring-core:6.0.6
│ └─ org.springframework:spring-jcl:6.0.6
└─ org.yaml:snakeyaml:1.33
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}

@Test
void testGenerateDependencyTreeMaven() {
var dependencies = new DependencySet()
.include(new Dependency("org.apache.maven", "maven-core", new VersionNumber(3, 9, 0)));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
└─ org.apache.maven:maven-core:3.9.0
├─ org.apache.maven:maven-model:3.9.0
├─ org.apache.maven:maven-settings:3.9.0
Expand Down Expand Up @@ -157,14 +157,14 @@ void testGenerateDependencyTreeMaven() {
├─ org.codehaus.plexus:plexus-component-annotations:2.1.0
├─ org.apache.commons:commons-lang3:3.8.1
└─ org.slf4j:slf4j-api:1.7.36
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}

@Test
void testGenerateDependencyTreePlay() {
var dependencies = new DependencySet()
.include(new Dependency("com.typesafe.play", "play_2.13", new VersionNumber(2, 8, 19)));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
└─ com.typesafe.play:play_2.13:2.8.19
├─ org.scala-lang:scala-library:2.13.10
├─ com.typesafe.play:build-link:2.8.19
Expand Down Expand Up @@ -213,14 +213,14 @@ void testGenerateDependencyTreePlay() {
├─ org.scala-lang.modules:scala-java8-compat_2.13:1.0.2
├─ com.typesafe:ssl-config-core_2.13:0.4.3
└─ org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}

@Test
void testGenerateDependencyTreeVaadin() {
var dependencies = new DependencySet()
.include(new Dependency("com.vaadin", "vaadin", new VersionNumber(23, 3, 7)));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
└─ com.vaadin:vaadin:23.3.7
├─ com.vaadin:vaadin-core:23.3.7
│ ├─ com.vaadin:flow-server:23.3.4
Expand Down Expand Up @@ -309,7 +309,7 @@ void testGenerateDependencyTreeVaadin() {
│ ├─ net.java.dev.jna:jna:5.11.0
│ └─ net.java.dev.jna:jna-platform:5.11.0
└─ com.auth0:java-jwt:3.19.2
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}

@Test
Expand All @@ -324,7 +324,7 @@ void testGenerateDependencyTreeVarious() {
.include(new Dependency("commons-codec", "commons-codec", new VersionNumber(1,15)))
.include(new Dependency("org.apache.httpcomponents", "httpcore", new VersionNumber(4,4,16)))
.include(new Dependency("com.google.zxing", "javase", new VersionNumber(3,5,1)));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
├─ com.uwyn.rife2:rife2:1.5.20
├─ com.stripe:stripe-java:20.136.0
├─ org.json:json:20230227
Expand Down Expand Up @@ -352,14 +352,14 @@ void testGenerateDependencyTreeVarious() {
└─ com.google.zxing:javase:3.5.1
├─ com.google.zxing:core:3.5.1
└─ com.beust:jcommander:1.82
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL), compile));
}

@Test
void testGenerateDependencyTreeCompileRuntime() {
var dependencies = new DependencySet()
.include(new Dependency("net.thauvin.erik", "bitly-shorten", new VersionNumber(0, 9, 4, "SNAPSHOT")));
assertEquals("""
assertEquals(StringUtils.convertLineSeparator("""
└─ 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
Expand All @@ -371,6 +371,6 @@ void testGenerateDependencyTreeCompileRuntime() {
│ └─ com.squareup.okio:okio-jvm:3.2.0
├─ com.squareup.okhttp3:logging-interceptor:4.11.0
└─ org.json:json:20230618
""", dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY), compile, runtime));
"""), dependencies.generateTransitiveDependencyTree(ArtifactRetriever.instance(), List.of(MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY), compile, runtime));
}
}
Loading

0 comments on commit 7ceb6e3

Please sign in to comment.