diff --git a/.idea/bld.iml b/.idea/bld.iml index e63e11e..914a6d0 100644 --- a/.idea/bld.iml +++ b/.idea/bld.iml @@ -4,6 +4,9 @@ + + + diff --git a/core b/core index 840b862..0d07c48 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 840b862d35c193c4b4dc5c82c2f9cebbbd50bf04 +Subproject commit 0d07c4856946555154afdd26e54d6a855fe3724f diff --git a/lib/bld/bld-wrapper.jar b/lib/bld/bld-wrapper.jar index b8d38e6..41b25fc 100644 Binary files a/lib/bld/bld-wrapper.jar and b/lib/bld/bld-wrapper.jar differ diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index e6f077d..083483d 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -5,4 +5,5 @@ bld.extension-archive=com.uwyn.rife2:bld-archive:0.4.0-SNAPSHOT bld.extension-tests=com.uwyn.rife2:bld-tests-badge:1.4.0-SNAPSHOT bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES,RIFE2_SNAPSHOTS bld.downloadLocation= +bld.sourceDirectories=core/src/bld/java bld.version=1.7.0-SNAPSHOT diff --git a/src/bld/java/rife/BldBuild.java b/src/bld/java/rife/BldBuild.java index 26a2435..ac14214 100644 --- a/src/bld/java/rife/BldBuild.java +++ b/src/bld/java/rife/BldBuild.java @@ -5,17 +5,13 @@ package rife; import rife.bld.BuildCommand; -import rife.bld.Project; import rife.bld.dependencies.VersionNumber; -import rife.bld.extension.Antlr4Operation; -import rife.bld.extension.TestsBadgeOperation; import rife.bld.extension.ZipOperation; import rife.bld.operations.*; import rife.bld.publish.*; import rife.bld.wrapper.Wrapper; import rife.tools.DirBuilder; import rife.tools.FileUtils; -import rife.tools.StringUtils; import java.io.File; import java.nio.file.Files; @@ -25,44 +21,20 @@ import java.util.regex.Pattern; import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Scope.*; -import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; import static rife.bld.operations.TemplateType.*; import static rife.tools.FileUtils.path; -public class BldBuild extends Project { +public class BldBuild extends AbstractRife2Build { public BldBuild() throws Exception { - pkg = "rife"; name = "bld"; mainClass = "rife.bld.Cli"; version = version(FileUtils.readString(new File(srcMainResourcesDirectory(), "BLD_VERSION"))); - javaRelease = 17; - downloadSources = true; - autoDownloadPurge = true; - repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES); scope(test) - .include(dependency("org.slf4j", "slf4j-simple", version(2,0,7))) - .include(dependency("net.imagej", "ij", version("1.54d"))) - .include(dependency("org.junit.jupiter", "junit-jupiter", version(5,9,3))) - .include(dependency("org.junit.platform", "junit-platform-console-standalone", version(1,9,3))) - .include(dependency("com.h2database", "h2", version(2,1,214))) - .include(dependency("net.sourceforge.htmlunit", "htmlunit", version(2,70,0))) - .include(dependency("org.postgresql", "postgresql", version(42,6,0))) - .include(dependency("com.mysql", "mysql-connector-j", version(8,0,33))) - .include(dependency("org.mariadb.jdbc", "mariadb-java-client", version(3,1,4))) - .include(dependency("org.hsqldb", "hsqldb", version(2,7,1))) - .include(dependency("org.apache.derby", "derby", version("10.16.1.1"))) - .include(dependency("org.apache.derby", "derbytools", version("10.16.1.1"))) - .include(dependency("com.oracle.database.jdbc", "ojdbc11", version("23.2.0.0"))) .include(dependency("org.json", "json", version(20230227))); - cleanOperation() - .directories( - new File(workDirectory(), "embedded_dbs"), - new File(workDirectory(), "logs")); - 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"); @@ -75,9 +47,7 @@ public class BldBuild extends Project { antlr4Operation .sourceDirectories(List.of(new File(core_src_main_directory, "antlr"))) - .outputDirectory(new File(buildDirectory(), "generated/rife/template/antlr")) - .visitor() - .longMessages(); + .outputDirectory(new File(buildDirectory(), "generated/rife/template/antlr")); precompileOperation() .sourceDirectories(core_src_main_resources_templates_directory) @@ -101,35 +71,11 @@ public class BldBuild extends Project { testsBadgeOperation .classpath(core_src_main_resources_directory.getAbsolutePath()) .classpath(core_src_test_resources_directory.getAbsolutePath()); - propagateJavaProperties(testsBadgeOperation.javaOptions(), - "test.postgres", - "test.mysql", - "test.mariadb", - "test.oracle", - "test.oracle-free", - "test.derby", - "test.hsqldb", - "test.h2"); javadocOperation() .sourceFiles(FileUtils.getJavaFileList(core_src_main_java_directory)) - .excluded( - "rife/antlr/", - "rife/asm/", - "rife/.*/databasedrivers/", - "rife/.*/imagestoredrivers/", - "rife/.*/rawstoredrivers/", - "rife/.*/textstoredrivers/", - "rife/database/capabilities/" - ) .javadocOptions() .docTitle("bld " + version()) - .docLint(NO_MISSING) - .keywords() - .splitIndex() - .tag("apiNote", "a", "API Note:") - .link("https://jakarta.ee/specifications/servlet/5.0/apidocs/") - .link("https://jsoup.org/apidocs/") .overview(new File(srcMainJavaDirectory(), "overview.html")); publishOperation() @@ -159,35 +105,6 @@ public class BldBuild extends Project { new PublishArtifact(zipBldOperation.destinationFile(), "", "zip")); } - void propagateJavaProperties(JavaOptions options, String... names) { - for (var name : names) { - if (properties().contains(name)) { - options.property(name, properties().getValueString(name)); - } - } - } - - final Antlr4Operation antlr4Operation = new Antlr4Operation() { - @Override - public void execute() - throws Exception { - super.execute(); - // replace the package name so that it becomes part of RIFE2 - FileUtils.transformFiles(outputDirectory(), FileUtils.JAVA_FILE_PATTERN, null, s -> - StringUtils.replace(s, "org.antlr.v4.runtime", "rife.antlr.v4.runtime")); - } - }; - @BuildCommand(summary = "Generates the grammar Java sources") - public void generateGrammar() - throws Exception { - antlr4Operation.executeOnce(); - } - - public void compile() - throws Exception { - generateGrammar(); - super.compile(); - } final ZipOperation zipBldOperation = new ZipOperation(); @BuildCommand(value = "zip-bld", summary = "Creates the bld zip archive") @@ -224,15 +141,6 @@ public class BldBuild extends Project { } } - private final TestsBadgeOperation testsBadgeOperation = new TestsBadgeOperation(); - public void test() - throws Exception { - testsBadgeOperation.executeOnce(() -> testsBadgeOperation - .url(property("testsBadgeUrl")) - .apiKey(property("testsBadgeApiKey")) - .fromProject(this)); - } - @BuildCommand(summary = "Creates all the distribution artifacts") public void all() throws Exception { diff --git a/src/main/java/rife/bld/wrapper/Wrapper.java b/src/main/java/rife/bld/wrapper/Wrapper.java index 15d30d2..4a0fb46 100644 --- a/src/main/java/rife/bld/wrapper/Wrapper.java +++ b/src/main/java/rife/bld/wrapper/Wrapper.java @@ -49,6 +49,7 @@ public class Wrapper { static final String PROPERTY_EXTENSIONS = "bld.extensions"; static final String PROPERTY_DOWNLOAD_EXTENSION_SOURCES = "bld.downloadExtensionSources"; static final String PROPERTY_DOWNLOAD_EXTENSION_JAVADOC = "bld.downloadExtensionJavadoc"; + static final String PROPERTY_SOURCE_DIRECTORIES = "bld.sourceDirectories"; static final File BLD_USER_DIR = new File(System.getProperty("user.home"), ".bld"); static final File DISTRIBUTIONS_DIR = new File(BLD_USER_DIR, "dist"); static final Pattern META_DATA_SNAPSHOT_VERSION = Pattern.compile(".*?([^<]+)", Pattern.DOTALL | Pattern.CASE_INSENSITIVE); @@ -164,6 +165,7 @@ public class Wrapper { bld.extensions= bld.repositories=MAVEN_CENTRAL,RIFE2 bld.downloadLocation= + bld.sourceDirectories= bld.version=${version} """ .replace("${version}", version); @@ -513,7 +515,7 @@ public class Wrapper { } private int launchMainBuild(File jarFile, List arguments) - throws FileUtilsErrorException, IOException, InterruptedException { + throws IOException, InterruptedException { resolveExtensions(); arguments.remove(0); @@ -582,9 +584,26 @@ public class Wrapper { } public List bldSourceFiles() { + var source_directories = new ArrayList(); + source_directories.add(srcBldJavaDirectory().getAbsoluteFile()); + + // extract wrapper source directories specifications + if (wrapperProperties_.containsKey(PROPERTY_SOURCE_DIRECTORIES)) { + var source_directories_property = wrapperProperties_.get(PROPERTY_SOURCE_DIRECTORIES).toString(); + for (var source_directory : source_directories_property.split(",")) { + source_directory = source_directory.trim(); + if (!source_directory.isBlank()) { + source_directories.add(new File(source_directory).getAbsoluteFile()); + } + } + } + // get all the bld java sources - var src_main_java_dir_abs = srcBldJavaDirectory().getAbsoluteFile(); - return FileUtils.getFileList(src_main_java_dir_abs, JAVA_FILE_PATTERN, null) - .stream().map(file -> new File(src_main_java_dir_abs, file)).toList(); + var source_files = new ArrayList(); + for (var source_directory : source_directories) { + source_files.addAll(FileUtils.getFileList(source_directory, JAVA_FILE_PATTERN, null) + .stream().map(file -> new File(source_directory, file)).toList()); + } + return source_files; } }