Moved from Gradle to bld
This commit is contained in:
parent
b7aee90edd
commit
d326f5c6dd
83 changed files with 905 additions and 907 deletions
8
examples/bld/src/.idea/workspace.xml
generated
Normal file
8
examples/bld/src/.idea/workspace.xml
generated
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"settings.editor.selected.configurable": "reference.settings.ide.settings.new.ui"
|
||||
}
|
||||
}</component>
|
||||
</project>
|
57
examples/bld/src/bld/java/com/example/ExampleBuild.java
Normal file
57
examples/bld/src/bld/java/com/example/ExampleBuild.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
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.*;
|
||||
import static rife.bld.dependencies.Scope.compile;
|
||||
|
||||
public class ExampleBuild extends BaseProject {
|
||||
public ExampleBuild() {
|
||||
pkg = "com.example";
|
||||
name = "Example";
|
||||
version = version(0, 1, 0);
|
||||
|
||||
mainClass = "com.example.IsgdExampleKt";
|
||||
|
||||
javaRelease = 11;
|
||||
downloadSources = true;
|
||||
autoDownloadPurge = true;
|
||||
repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, SONATYPE_SNAPSHOTS_LEGACY);
|
||||
|
||||
scope(compile)
|
||||
.include(dependency("net.thauvin.erik:isgd-shorten:1.0.0"));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new ExampleBuild().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.IsgdSample")
|
||||
.execute();
|
||||
}
|
||||
}
|
28
examples/bld/src/main/java/com/example/IsgdSample.java
Normal file
28
examples/bld/src/main/java/com/example/IsgdSample.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package com.example;
|
||||
|
||||
import net.thauvin.erik.isgd.Config;
|
||||
import net.thauvin.erik.isgd.Format;
|
||||
import net.thauvin.erik.isgd.Isgd;
|
||||
import net.thauvin.erik.isgd.IsgdException;
|
||||
|
||||
public final class IsgdSample {
|
||||
public static void main(final String[] args) {
|
||||
if (args.length > 0) {
|
||||
for (final String arg : args) {
|
||||
try {
|
||||
if (arg.contains("is.gd")) {
|
||||
System.out.println(arg + " <-- " + Isgd.lookup(arg));
|
||||
System.out.print(Isgd.lookup(new Config.Builder().shortUrl(arg).format(Format.WEB).build()));
|
||||
} else {
|
||||
System.out.println(arg + " --> " + Isgd.shorten(arg));
|
||||
}
|
||||
} catch (IsgdException e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.err.println("Try specifying one or more URLs as arguments.");
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
23
examples/bld/src/main/kotlin/com/example/IsgdExample.kt
Normal file
23
examples/bld/src/main/kotlin/com/example/IsgdExample.kt
Normal file
|
@ -0,0 +1,23 @@
|
|||
package com.example
|
||||
|
||||
import net.thauvin.erik.isgd.Isgd
|
||||
import net.thauvin.erik.isgd.IsgdException
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
if (args.isNotEmpty()) {
|
||||
args.forEach {
|
||||
try {
|
||||
if (it.contains("is.gd"))
|
||||
println(it + " <-- " + Isgd.lookup(it))
|
||||
else
|
||||
println(it + " --> " + Isgd.shorten(it))
|
||||
} catch (e: IsgdException) {
|
||||
println(e.message)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println("Try specifying one or more URLs as arguments.")
|
||||
}
|
||||
exitProcess(0)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue