Skip to content

Commit

Permalink
Added WEB-INF/lib-provided support
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed Jan 7, 2024
1 parent a805b35 commit 17de9a8
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .idea/libraries/bld.xml

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

7 changes: 7 additions & 0 deletions examples/.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 examples/lib/bld/bld-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ bld.extensions=com.uwyn.rife2:bld-spring-boot:0.9.0-SNAPSHOT
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.5
bld.version=1.8.0-SNAPSHOT
2 changes: 1 addition & 1 deletion lib/bld/bld-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.4
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.5
bld.version=1.8.0-SNAPSHOT
8 changes: 4 additions & 4 deletions src/bld/java/rife/bld/extension/SpringBootBuild.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,14 +39,14 @@ public SpringBootBuild() {
downloadSources = true;
autoDownloadPurge = true;

repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES);
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS);

scope(compile)
.include(dependency("com.uwyn.rife2", "bld", version(1, 7, 5)));
.include(dependency("com.uwyn.rife2", "bld", version(1, 8, 0, "SNAPSHOT")));
scope(test)
.include(dependency("org.junit.jupiter", "junit-jupiter", version(5, 10, 1)))
.include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1, 10, 1)))
.include(dependency("org.assertj", "assertj-core", version(3, 24, 2)));
.include(dependency("org.assertj", "assertj-core", version(3, 25, 1)));

javadocOperation()
.javadocOptions()
Expand Down
22 changes: 20 additions & 2 deletions src/main/java/rife/bld/extension/BootJarOperation.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,7 @@
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -76,6 +77,23 @@ protected File executeCreateBootInfDirectory(File stagingDirectory) throws IOExc

/**
* Configures the operation from a {@link Project}.
* <p>
* Sets the following:
* <ul>
* <li>The {@link #destinationFileName(String) destination file name} to
* {@link Project#archiveBaseName() archiveBaseName} and {@link Project#version() version}</li>
* <li>The {@link #infLibs(File...) INF libs} to {@link Project#compileClasspathJars() compileClasspathJars}
* and {@link Project#runtimeClasspathJars() runtimeClasspathJars}</li>
* <li>The {@link #launcherClass(String) launcher class} to {@code JarLauncher}</li>
* <li>The {@link #launcherLibs(Collection) launcher libs} to
* {@link Project#standaloneClasspathJars() standaloneClasspathJars}</li>
* <li>The {@link #mainClass(String) main class} to {@link Project#mainClass() mainClass}</li>
* <li>The {@code Manifest-Version}, {@code Main-Class} and {@code Start-Class}
* {@link #manifestAttributes(Collection) manifest attributes}</li>
* <li>The {@link #sourceDirectories(File...) source directories} to
* {@link Project#buildMainDirectory() buildMainDirectory} and
* {@link Project#srcMainResourcesDirectory() srcMainResourcesDirectory}</li>
* </ul>
*
* @param project the project
* @return this operation instance
Expand All @@ -96,4 +114,4 @@ public BootJarOperation fromProject(Project project) throws IOException {
))
.sourceDirectories(project.buildMainDirectory(), project.srcMainResourcesDirectory());
}
}
}
26 changes: 21 additions & 5 deletions src/main/java/rife/bld/extension/BootWarOperation.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,6 +99,24 @@ protected File executeCreateWebInfDirectory(File stagingDirectory) throws IOExce

/**
* Configures the operation from a {@link Project}.
* <p>
* Sets the following:
* <ul>
* <li>The {@link #destinationFileName(String) destination file name} to
* {@link Project#archiveBaseName() archiveBaseName} and {@link Project#version() version}</li>
* <li>The {@link #infLibs(File...) INF libs} to {@link Project#compileClasspathJars() compileClasspathJars},
* {@link Project#runtimeClasspathJars() runtimeClasspathJars} and
* {@link Project#buildDistDirectory() buildDistDirectory}</li>
* <li>The {@link #launcherClass(String) launcher class} to {@code WarLauncher}</li>
* <li>The {@link #launcherLibs(Collection) launcher libs} to
* {@link Project#standaloneClasspathJars() standaloneClasspathJars}</li>
* <li>The {@link #mainClass(String) main class} to {@link Project#mainClass() mainClass}</li>
* <li>The {@code Manifest-Version}, {@code Main-Class} and {@code Start-Class}
* {@link #manifestAttributes(Collection) manifest attributes}</li>
* <li>The {@link #sourceDirectories(File...) source directories} to
* {@link Project#buildMainDirectory() buildMainDirectory} and
* {@link Project#srcMainResourcesDirectory() srcMainResourcesDirectory}</li>
* </ul>
*
* @param project the project
* @return this operation instance
Expand All @@ -118,11 +136,9 @@ public BootWarOperation fromProject(Project project) throws IOException {
new BootManifestAttribute("Main-Class", launcherClass()),
new BootManifestAttribute("Start-Class", mainClass())
))
// TODO enable when bld 1.7.6 is available
// .providedLibs(project.providedClasspathJars())
.providedLibs(project.providedClasspathJars())
.sourceDirectories(project.buildMainDirectory(), project.srcMainResourcesDirectory());
}

/**
* Provides libraries that will be used for the WAR creation in {@code /WEB-INF/lib-provided}.
*
Expand All @@ -144,4 +160,4 @@ public BootWarOperation providedLibs(File... jars) {
providedLibs_.addAll(List.of(jars));
return this;
}
}
}
6 changes: 3 additions & 3 deletions src/test/java/rife/bld/extension/BootJarOperationTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 the original author or authors.
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@
import static org.assertj.core.api.Assertions.assertThatCode;

class BootJarOperationTest {
private static final String BLD = "bld-1.7.5.jar";
private static final String BLD = "bld-1.8.0-20240107.042858-1.jar";
private static final String EXAMPLES_LIB_COMPILE = "examples/lib/compile/";
private static final String EXAMPLES_LIB_RUNTIME = "examples/lib/runtime/";
private static final String EXAMPLES_LIB_STANDALONE = "examples/lib/standalone/";
Expand Down Expand Up @@ -343,4 +343,4 @@ static class CustomProject extends Project {
mainClass = MAIN_CLASS;
}
}
}
}

0 comments on commit 17de9a8

Please sign in to comment.