Add bld example

This commit is contained in:
Erik C. Thauvin 2023-08-18 23:52:02 -07:00
parent 0ec7a6ee13
commit 11a47e7e0b
64 changed files with 425 additions and 54 deletions

55
examples/java/bld/.gitignore vendored Normal file
View file

@ -0,0 +1,55 @@
.gradle
.DS_Store
build
lib/bld/**
!lib/bld/bld-wrapper.jar
!lib/bld/bld-wrapper.properties
lib/compile/
lib/runtime/
lib/standalone/
lib/test/
# IDEA ignores
# User-specific
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Editor-based Rest Client
.idea/httpRequests

3
examples/java/bld/.idea/.gitignore generated vendored Normal file
View file

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

29
examples/java/bld/.idea/app.iml generated Normal file
View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/main" />
<output-test url="file://$MODULE_DIR$/build/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/src/main/resources/templates" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" scope="RUNTIME">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/src/main/resources/templates" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<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" />
</component>
</module>

14
examples/java/bld/.idea/bld.iml generated Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build/bld" />
<output-test url="file://$MODULE_DIR$/build/bld" />
<exclude-output />
<content url="file://$MODULE_DIR$/src/bld">
<sourceFolder url="file://$MODULE_DIR$/src/bld/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="bld" level="project" />
</component>
</module>

View file

@ -0,0 +1,8 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="created" />
</inspection_tool>
</profile>
</component>

View file

@ -0,0 +1,17 @@
<component name="libraryTable">
<library name="bld">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/bld" />
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.1-sources.jar!/" />
</SOURCES>
<excluded>
<root url="jar://$PROJECT_DIR$/lib/bld/bld-wrapper.jar!/" />
</excluded>
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/bld" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="compile">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/compile" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/compile" recursive="false" type="SOURCES" />
</library>
</component>

View file

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="runtime">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
<root url="file://$PROJECT_DIR$/src/main/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/runtime" />
</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

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="test">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/test" />
<root url="file://$PROJECT_DIR$/src/test/resources" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$PROJECT_DIR$/lib/test" />
</SOURCES>
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/test" recursive="false" type="SOURCES" />
</library>
</component>

9
examples/java/bld/.idea/misc.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PDMPlugin">
<option name="skipTestSources" value="false" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>

9
examples/java/bld/.idea/modules.xml generated Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/app.iml" filepath="$PROJECT_DIR$/.idea/app.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/bld.iml" filepath="$PROJECT_DIR$/.idea/bld.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Tests" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="com.example.ExampleTest" />
<module name="app" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

6
examples/java/bld/.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

11
examples/java/bld/.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Run Tests",
"request": "launch",
"mainClass": "com.example.ExampleTest"
}
]
}

15
examples/java/bld/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,15 @@
{
"java.project.sourcePaths": [
"src/main/java",
"src/main/resources",
"src/test/java",
"src/bld/java"
],
"java.configuration.updateBuildConfiguration": "automatic",
"java.project.referencedLibraries": [
"${HOME}/.bld/dist/bld-1.7.1.jar",
"lib/compile/*.jar",
"lib/runtime/*.jar",
"lib/test/*.jar"
]
}

2
examples/java/bld/bld Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build com.example.ExampleBuild "$@"

View file

@ -0,0 +1,4 @@
@echo off
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
java -jar "%DIRNAME%/lib/bld/bld-wrapper.jar" "%0" --build com.example.ExampleBuild %*

Binary file not shown.

View file

@ -0,0 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extensions=
bld.repositories=MAVEN_CENTRAL,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
bld.version=1.7.1

View file

@ -0,0 +1,36 @@
package com.example;
import rife.bld.BuildCommand;
import rife.bld.Project;
import java.util.List;
import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile;
public class ExampleBuild extends Project {
public ExampleBuild() {
pkg = "com.example";
name = "Example";
version = version(0, 1, 0);
mainClass = "com.example.App";
testOperation().mainClass("com.example.ExampleTest");
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
scope(compile)
.include(dependency("net.thauvin.erik", "semver",
version(1, 2, 1, "SNAPSHOT")));
}
@BuildCommand(summary = "Run the example")
public void runExample() throws Exception {
runOperation().executeOnce(() -> runOperation().fromProject(this).mainClass("com.example.Example"));
}
public static void main(String[] args) {
new ExampleBuild().start(args);
}
}

View file

@ -0,0 +1,21 @@
package com.example;
import net.thauvin.erik.semver.Version;
import java.text.SimpleDateFormat;
import java.util.Locale;
@Version(properties = "example.properties", template = "example.mustache", className = "ExampleVersion",
keysPrefix = "example.")
public class Example {
public static void main(final String... args) {
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
System.out.println("-- From Example -------------------------------------");
System.out.println(" " + ExampleVersion.PROJECT + ' ' + ExampleVersion.VERSION
+ " (" + sdf.format(ExampleVersion.BUILDDATE) + ')');
System.out.println("-----------------------------------------------------");
}
}

View file

@ -0,0 +1,4 @@
package com.example;
public class ExampleTest {
}

View file

@ -1,7 +1,7 @@
plugins { plugins {
id 'java' id 'java'
id 'application' id 'application'
id 'com.github.ben-manes.versions' version '0.46.0' id 'com.github.ben-manes.versions' version '0.47.0'
} }
// ./gradlew run // ./gradlew run
@ -11,8 +11,8 @@ defaultTasks 'run'
final def semverProcessor = 'net.thauvin.erik:semver:1.2.1-SNAPSHOT' final def semverProcessor = 'net.thauvin.erik:semver:1.2.1-SNAPSHOT'
sourceCompatibility = 1.8 sourceCompatibility = 17
targetCompatibility = 1.8 targetCompatibility = 17
mainClassName = 'com.example.App' mainClassName = 'com.example.App'

View file

@ -0,0 +1,21 @@
/*
* This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED!
*/
package {{packageName}};
import java.util.Date;
public final class {{className}} {
public static final String PROJECT = "{{project}}";
public static final Date BUILDDATE = new Date({{epoch}}L);
public static final String VERSION = "{{version}}";
/**
* Disables the default constructor.
*/
private {{className}}() {
throw new UnsupportedOperationException("Illegal constructor call.");
}
}

View file

@ -0,0 +1,9 @@
#Generated by the Semver Plugin for Gradle
#Sat Apr 27 17:04:13 PDT 2019
example.buildmeta=T800
example.major=8
example.minor=4
example.patch=97
example.prerelease=alpha
example.project=Java Example
example.semver=8.4.97-alpha+T800

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -83,7 +83,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

View file

@ -2,14 +2,14 @@
* This file is automatically generated. * This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED! * Do not modify! -- ALL CHANGES WILL BE ERASED!
*/ */
package com.example; package com.example;
import java.util.Date; import java.util.Date;
public final class ExampleVersion { public final class ExampleVersion {
public static final String PROJECT = "Java Example"; public static final String PROJECT = "Java Example";
public static final Date BUILDDATE = new Date(1624066674216L); public static final Date BUILDDATE = new Date(1692423608415L);
public static final String VERSION = "8.4.97-alpha+T800"; public static final String VERSION = "8.4.97-alpha+T800";
/** /**

View file

@ -0,0 +1,34 @@
/*
* This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED!
*/
package com.example;
import java.util.Date;
/**
* Provides semantic version information.
*
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/
public final class GeneratedVersion {
public static final String PROJECT = "Java App";
public static final Date BUILDDATE = new Date(1692423608452L);
public static final int MAJOR = 11;
public static final int MINOR = 11;
public static final int PATCH = 20;
public static final String PRERELEASE = "beta";
public static final String PRERELEASE_PREFIX = "-";
public static final String BUILDMETA = "007";
public static final String BUILDMETA_PREFIX = "+";
public static final String SEPARATOR = ".";
public static final String VERSION = "11.11.20-beta+007";
/**
* Disables the default constructor.
*/
private GeneratedVersion() {
throw new UnsupportedOperationException("Illegal constructor call.");
}
}

View file

@ -0,0 +1,31 @@
package com.example;
import net.thauvin.erik.semver.Version;
import java.text.SimpleDateFormat;
import java.util.Locale;
@Version(properties = "version.properties")
public final class App {
/**
* Command line interface.
*
* @param args The command line parameters.
*/
public static void main(final String... args) {
final SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy 'at' HH:mm:ss z", Locale.US);
System.out.println("-----------------------------------------------------");
System.out.println(" Version: " + GeneratedVersion.PROJECT + ' ' + GeneratedVersion.VERSION);
System.out.println(" Built on: " + sdf.format(GeneratedVersion.BUILDDATE));
System.out.println(" Major: " + GeneratedVersion.MAJOR);
System.out.println(" Minor: " + GeneratedVersion.MINOR);
System.out.println(" Patch: " + GeneratedVersion.PATCH);
System.out.println(" PreRelease: " + GeneratedVersion.PRERELEASE);
System.out.println(" BuildMetaData: " + GeneratedVersion.BUILDMETA);
System.out.println("-----------------------------------------------------");
}
}

View file

@ -0,0 +1,9 @@
#Generated by the Semver Plugin for Gradle
#Sat Apr 27 17:05:34 PDT 2019
version.buildmeta=007
version.major=11
version.minor=11
version.patch=20
version.prerelease=beta
version.project=Java App
version.semver=11.11.20-beta+007

Binary file not shown.

View file

@ -1,34 +0,0 @@
/*
* This file is automatically generated.
* Do not modify! -- ALL CHANGES WILL BE ERASED!
*/
package com.example;
import java.util.Date;
/**
* Provides semantic version information.
*
* @author <a href="https://github.com/ethauvin/semver">Semantic Version Annotation Processor</a>
*/
public final class GeneratedVersion {
public static final String PROJECT = "Java App";
public static final Date BUILDDATE = new Date(1624066674199L);
public static final int MAJOR = 11;
public static final int MINOR = 11;
public static final int PATCH = 20;
public static final String PRERELEASE = "beta";
public static final String PRERELEASE_PREFIX = "-";
public static final String BUILDMETA = "007";
public static final String BUILDMETA_PREFIX = "+";
public static final String SEPARATOR = ".";
public static final String VERSION = "11.11.20-beta+007";
/**
* Disables the default constructor.
*/
private GeneratedVersion() {
throw new UnsupportedOperationException("Illegal constructor call.");
}
}

View file

@ -1,8 +1,8 @@
plugins { plugins {
id("application") id("application")
id("com.github.ben-manes.versions") version "0.46.0" id("com.github.ben-manes.versions") version "0.47.0"
kotlin("jvm") version "1.7.22" kotlin("jvm") version "1.9.0"
kotlin("kapt") version "1.7.22" kotlin("kapt") version "1.9.0"
} }
// ./gradlew // ./gradlew

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -83,7 +83,8 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

View file

@ -2,9 +2,9 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik.semver</groupId> <groupId>net.thauvin.erik</groupId>
<artifactId>semver</artifactId> <artifactId>semver</artifactId>
<version>1.2.1-SNAPSHOT</version> <version>1.2.2-SNAPSHOT</version>
<name>SemVer</name> <name>SemVer</name>
<description>Semantic Version Annotation Processor</description> <description>Semantic Version Annotation Processor</description>
<url>https://github.com/ethauvin/semver</url> <url>https://github.com/ethauvin/semver</url>

View file

@ -45,15 +45,14 @@ import java.nio.file.Path;
import java.util.List; import java.util.List;
import static rife.bld.dependencies.Repository.*; import static rife.bld.dependencies.Repository.*;
import static rife.bld.dependencies.Scope.compile; import static rife.bld.dependencies.Scope.*;
import static rife.bld.dependencies.Scope.test;
import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING; import static rife.bld.operations.JavadocOptions.DocLinkOption.NO_MISSING;
public class SemverBuild extends Project { public class SemverBuild extends Project {
public SemverBuild() { public SemverBuild() {
pkg = "net.thauvin.erik.semver"; pkg = "net.thauvin.erik";
name = "SemVer"; name = "SemVer";
version = version(1, 2, 1, "SNAPSHOT"); version = version(1, 2, 2, "SNAPSHOT");
var description = "Semantic Version Annotation Processor"; var description = "Semantic Version Annotation Processor";
var url = "https://github.com/ethauvin/semver"; var url = "https://github.com/ethauvin/semver";
@ -82,11 +81,11 @@ public class SemverBuild extends Project {
.withCredentials(property("sonatype.user"), property("sonatype.password")) .withCredentials(property("sonatype.user"), property("sonatype.password"))
: repository(SONATYPE_RELEASES.location()) : repository(SONATYPE_RELEASES.location())
.withCredentials(property("sonatype.user"), property("sonatype.password"))) .withCredentials(property("sonatype.user"), property("sonatype.password")))
.repository(MAVEN_LOCAL)
.info(new PublishInfo() .info(new PublishInfo()
.groupId(pkg) .groupId(pkg)
.artifactId(name.toLowerCase()) .artifactId(name.toLowerCase())
.name(name).version(version) .name(name)
.version(version)
.description(description) .description(description)
.url(url) .url(url)
.developer(new PublishDeveloper() .developer(new PublishDeveloper()