Use a separate Knit tool (#1486)
* Use a separate Knit tool version 0.1.2
* Hierarchical knit.properties files are introduced which are
gathered while walking up the directory tree with the properties
in knit resources being top-level ones.
* Freemarker templates for "knit.include" (top-level of example files)
and "test.template" (test template) are introduced with locations that
are resolved from properties.
* KNIT and TEST_OUT directives are not supported anymore.
- Knitting is controlled by "knit.dir" and "knit.pattern" props.
- "test.name" prop or TEST_NAME directive drives test gen.
* All markdown files are now clean of top-level knit-related boilerplate
(only TEST_NAME directive is remaining in some)
* All example files are renumbered. It affects example-basic-xx,
which had the legacy numbering with later insertions.
* All auto-generated files now have the correct source-file name
specified at their beginning, due to consistent use of template
substitution.
* No need to customize knit.pattern anymore (works out-of-the box)
* "knit.name" is automatically generated based on example's file name
"example-basic-01" -> "exampleBasic01"
* Not match-pattern-group woodoo anymore, "knit.pattern" cannot have any
user-defined match groups.
* No need to look for "package xxx" in knitted sources, as the
example's package is always ${knit.package}.${knit.name}
* Simpler test names:
testKotlinxCoroutinesGuideBasic01 -> testExampleBasic01
* Replaced END_TOC with END directive
* Build-scripts are improved:
- Consistent code to use mavenLocal when snapshots versions are used.
- Proper substitution logic to use Android AAR files so that Dokka has correct links to Google APIs.
- Google repository is added to all projects.
diff --git a/ui/knit.code.include b/ui/knit.code.include
new file mode 100644
index 0000000..adf1957
--- /dev/null
+++ b/ui/knit.code.include
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
+ */
+
+// This file was automatically generated from ${file.name} by Knit tool. Do not edit.
+package ${knit.package}.${knit.name}
+
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.*
+import kotlinx.coroutines.javafx.JavaFx as Main
+import javafx.application.Application
+import javafx.event.EventHandler
+import javafx.geometry.*
+import javafx.scene.*
+import javafx.scene.input.MouseEvent
+import javafx.scene.layout.StackPane
+import javafx.scene.paint.Color
+import javafx.scene.shape.Circle
+import javafx.scene.text.Text
+import javafx.stage.Stage
+
+fun main(args: Array<String>) {
+ Application.launch(ExampleApp::class.java, *args)
+}
+
+class ExampleApp : Application() {
+ val hello = Text("Hello World!").apply {
+ fill = Color.valueOf("#C0C0C0")
+ }
+
+ val fab = Circle(20.0, Color.valueOf("#FF4081"))
+
+ val root = StackPane().apply {
+ children += hello
+ children += fab
+ StackPane.setAlignment(hello, Pos.CENTER)
+ StackPane.setAlignment(fab, Pos.BOTTOM_RIGHT)
+ StackPane.setMargin(fab, Insets(15.0))
+ }
+
+ val scene = Scene(root, 240.0, 380.0).apply {
+ fill = Color.valueOf("#303030")
+ }
+
+ override fun start(stage: Stage) {
+ stage.title = "Example"
+ stage.scene = scene
+ stage.show()
+ setup(hello, fab)
+ }
+}
\ No newline at end of file