Moved from Gradle to bld
This commit is contained in:
parent
22c5d30ace
commit
e99fad47c7
89 changed files with 1087 additions and 907 deletions
55
examples/bld/.gitignore
vendored
Normal file
55
examples/bld/.gitignore
vendored
Normal 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
|
30
examples/bld/.idea/app.iml
generated
Normal file
30
examples/bld/.idea/app.iml
generated
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?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" relativeOutputPath="resources" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
|
||||
</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/bld/.idea/bld.iml
generated
Normal file
14
examples/bld/.idea/bld.iml
generated
Normal 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>
|
8
examples/bld/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
8
examples/bld/.idea/inspectionProfiles/Project_Default.xml
generated
Normal 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>
|
17
examples/bld/.idea/libraries/bld.xml
generated
Normal file
17
examples/bld/.idea/libraries/bld.xml
generated
Normal 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.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$USER_HOME$/.bld/dist/bld-1.7.5-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>
|
13
examples/bld/.idea/libraries/compile.xml
generated
Normal file
13
examples/bld/.idea/libraries/compile.xml
generated
Normal 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>
|
14
examples/bld/.idea/libraries/runtime.xml
generated
Normal file
14
examples/bld/.idea/libraries/runtime.xml
generated
Normal 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>
|
14
examples/bld/.idea/libraries/test.xml
generated
Normal file
14
examples/bld/.idea/libraries/test.xml
generated
Normal 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>
|
13
examples/bld/.idea/misc.xml
generated
Normal file
13
examples/bld/.idea/misc.xml
generated
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<pattern value="com.example.ReadingTimeExampleBuild" />
|
||||
<pattern value="com.example.ReadingTimeExampleBuild" method="runJava" />
|
||||
</component>
|
||||
<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/bld/.idea/modules.xml
generated
Normal file
9
examples/bld/.idea/modules.xml
generated
Normal 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>
|
9
examples/bld/.idea/runConfigurations/Run Tests.xml
generated
Normal file
9
examples/bld/.idea/runConfigurations/Run Tests.xml
generated
Normal 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.ReadingTimeExampleTest" />
|
||||
<module name="app" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
6
examples/bld/.idea/vcs.xml
generated
Normal file
6
examples/bld/.idea/vcs.xml
generated
Normal 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/bld/.vscode/launch.json
vendored
Normal file
11
examples/bld/.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "java",
|
||||
"name": "Run Tests",
|
||||
"request": "launch",
|
||||
"mainClass": "com.example.ReadingTimeExampleTest"
|
||||
}
|
||||
]
|
||||
}
|
15
examples/bld/.vscode/settings.json
vendored
Normal file
15
examples/bld/.vscode/settings.json
vendored
Normal 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.5.jar",
|
||||
"lib/compile/*.jar",
|
||||
"lib/runtime/*.jar",
|
||||
"lib/test/*.jar"
|
||||
]
|
||||
}
|
14
examples/bld/README.md
Normal file
14
examples/bld/README.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
## Kotlin Example
|
||||
To compile & run the Kotlin example:
|
||||
|
||||
```text
|
||||
./bld compile run --args="example.html"
|
||||
```
|
||||
|
||||
## Java Example
|
||||
|
||||
To compile & run the Java example:
|
||||
|
||||
```text
|
||||
./bld compile run-java --args="example.html"
|
||||
```
|
2
examples/bld/bld
Executable file
2
examples/bld/bld
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
java -jar "$(dirname "$0")/lib/bld/bld-wrapper.jar" "$0" --build com.example.ReadingTimeExampleBuild "$@"
|
4
examples/bld/bld.bat
Normal file
4
examples/bld/bld.bat
Normal 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.ReadingTimeExampleBuild %*
|
127
examples/bld/example.html
Normal file
127
examples/bld/example.html
Normal file
|
@ -0,0 +1,127 @@
|
|||
<h1>HTML Ipsum Presents</h1>
|
||||
|
||||
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas.
|
||||
Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas
|
||||
semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien
|
||||
ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi.
|
||||
Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a
|
||||
href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
|
||||
|
||||
<dl>
|
||||
<dt>Definition list</dt>
|
||||
<dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
||||
commodo consequat.</dd>
|
||||
<dt>Lorem ipsum dolor sit amet</dt>
|
||||
<dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
||||
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
|
||||
commodo consequat.</dd>
|
||||
</dl>
|
||||
|
||||
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam,
|
||||
feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies
|
||||
mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat
|
||||
wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros
|
||||
ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.
|
||||
Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam
|
||||
erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
|
||||
|
||||
<h2>Header Level 2</h2>
|
||||
|
||||
<ol>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ol>
|
||||
|
||||
<blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet
|
||||
congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus
|
||||
est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote>
|
||||
|
||||
<h3>Header Level 3</h3>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h4>Header Level 4</h4>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h5>Header Level 5</h5>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<h6>Header Level 6</h6>
|
||||
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
<li><img src="#"></li>
|
||||
</ul>
|
||||
|
||||
<pre><code>
|
||||
#header h1 a {
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
}
|
||||
</code></pre>
|
BIN
examples/bld/lib/bld/bld-wrapper.jar
Normal file
BIN
examples/bld/lib/bld/bld-wrapper.jar
Normal file
Binary file not shown.
7
examples/bld/lib/bld/bld-wrapper.properties
Normal file
7
examples/bld/lib/bld/bld-wrapper.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
bld.downloadExtensionJavadoc=false
|
||||
bld.downloadExtensionSources=true
|
||||
bld.extensions=com.uwyn.rife2:bld-kotlin:0.9.0-SNAPSHOT
|
||||
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
|
||||
bld.downloadLocation=
|
||||
bld.sourceDirectories=
|
||||
bld.version=1.7.5
|
|
@ -0,0 +1,59 @@
|
|||
package com.example;
|
||||
|
||||
import rife.bld.BaseProject;
|
||||
import rife.bld.BuildCommand;
|
||||
import rife.bld.extension.CompileKotlinOperation;
|
||||
import rife.bld.extension.CompileKotlinOptions;
|
||||
import rife.bld.operations.RunOperation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
|
||||
import static rife.bld.dependencies.Repository.MAVEN_LOCAL;
|
||||
import static rife.bld.dependencies.Scope.compile;
|
||||
|
||||
public class ReadingTimeExampleBuild extends BaseProject {
|
||||
public ReadingTimeExampleBuild() {
|
||||
pkg = "com.example";
|
||||
name = "ReadingTimeExample";
|
||||
version = version(0, 1, 0);
|
||||
|
||||
mainClass = "com.example.ReadingTimeExampleKt";
|
||||
|
||||
javaRelease = 11;
|
||||
downloadSources = true;
|
||||
autoDownloadPurge = true;
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL);
|
||||
|
||||
scope(compile)
|
||||
.include(dependency("org.jetbrains.kotlin", "kotlin-stdlib", version(1, 9, 20)))
|
||||
.include(dependency("net.thauvin.erik", "readingtime", version(0, 9, 2, "SNAPSHOT")));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ReadingTimeExampleBuild().start(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compile() throws Exception {
|
||||
new CompileKotlinOperation()
|
||||
.fromProject(this)
|
||||
.compileOptions(
|
||||
new CompileKotlinOptions()
|
||||
.jdkRelease(javaRelease)
|
||||
.verbose(true)
|
||||
)
|
||||
.execute();
|
||||
|
||||
// Also compile the Java source code
|
||||
super.compile();
|
||||
}
|
||||
|
||||
@BuildCommand(value = "run-java", summary = "Runs the Java example")
|
||||
public void runJava() throws Exception {
|
||||
new RunOperation()
|
||||
.fromProject(this)
|
||||
.mainClass("com.example.ReadingTimeSample")
|
||||
.execute();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.example;
|
||||
|
||||
import net.thauvin.erik.readingtime.ReadingTime;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class ReadingTimeSample {
|
||||
public static void main(String[] args) {
|
||||
if (args.length >= 1) {
|
||||
final Path text = Path.of(args[0]);
|
||||
try {
|
||||
final ReadingTime rt = new ReadingTime(Files.readString(text));
|
||||
rt.setPostfix("minute to read");
|
||||
rt.setPlural("minutes to read");
|
||||
|
||||
System.out.println("It will take " + rt.calcReadingTime() + ' ' + ReadingTime.wordCount(rt.getText())
|
||||
+ " words and " + ReadingTime.imgCount(rt.getText()) + " images at " + rt.getWpm()
|
||||
+ " words per minute.");
|
||||
} catch (IOException e) {
|
||||
System.err.println("The file could not be read or found.");
|
||||
}
|
||||
} else {
|
||||
System.err.println("Please specify a file as an argument.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.example
|
||||
|
||||
import net.thauvin.erik.readingtime.ReadingTime
|
||||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (args.isNotEmpty()) {
|
||||
with(File(args[0])) {
|
||||
if (exists() && canRead()) {
|
||||
val rt = ReadingTime(readText())
|
||||
rt.postfix = "minute to read"
|
||||
rt.plural = "minutes to read"
|
||||
|
||||
println(
|
||||
"It will take ${rt.calcReadingTime()} ${ReadingTime.wordCount(rt.text)} words and " +
|
||||
"${ReadingTime.imgCount(rt.text)} images at ${rt.wpm} words per minute."
|
||||
)
|
||||
} else {
|
||||
System.err.println("The file could not be read or found.")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.err.println("Please specify a file as an argument.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.example;
|
||||
|
||||
import net.thauvin.erik.readingtime.ReadingTime;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class ReadingTimeSample {
|
||||
public static void main(String[] args) {
|
||||
if (args.length >= 1) {
|
||||
final Path text = Path.of(args[0]);
|
||||
try {
|
||||
final ReadingTime rt = new ReadingTime(Files.readString(text));
|
||||
rt.setPostfix("minute to read");
|
||||
rt.setPlural("minutes to read");
|
||||
|
||||
System.out.println("It will take " + rt.calcReadingTime() + ' ' + ReadingTime.wordCount(rt.getText())
|
||||
+ " words and " + ReadingTime.imgCount(rt.getText()) + " images at " + rt.getWpm()
|
||||
+ " words per minute.");
|
||||
} catch (IOException e) {
|
||||
System.err.println("The file could not be read or found.");
|
||||
}
|
||||
} else {
|
||||
System.err.println("Please specify a file as an argument.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.example
|
||||
|
||||
import net.thauvin.erik.readingtime.ReadingTime
|
||||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (args.isNotEmpty()) {
|
||||
with(File(args[0])) {
|
||||
if (exists() && canRead()) {
|
||||
val rt = ReadingTime(readText())
|
||||
rt.postfix = "minute to read"
|
||||
rt.plural = "minutes to read"
|
||||
|
||||
println(
|
||||
"It will take ${rt.calcReadingTime()} ${ReadingTime.wordCount(rt.text)} words and " +
|
||||
"${ReadingTime.imgCount(rt.text)} images at ${rt.wpm} words per minute."
|
||||
)
|
||||
} else {
|
||||
System.err.println("The file could not be read or found.")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.err.println("Please specify a file as an argument.")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue