Ant task - longer examples update; Maze doesn't compile, HtmlBuilder doesn't run; Ivy configuration files updated to use public TeamCity; Wiki update
This commit is contained in:
+15
-11
@@ -37,19 +37,14 @@ Another way to define Ant's {{*<kotlinc>*}} task is by using Ivy:
|
||||
<url name="sonatype-repo" m2compatible="true">
|
||||
<artifact pattern="https://oss.sonatype.org/content/repositories/central/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
|
||||
</url>
|
||||
<url name='kotlin-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
|
||||
<!-- Temporary URL until Kotlin artifacts become available in http://teamcity.jetbrains.com -->
|
||||
<ivy pattern='http://localhost:8111/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'/>
|
||||
<artifact pattern='http://localhost:8111/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'/>
|
||||
</url>
|
||||
<url name='idea-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
|
||||
<url name='jetbrains-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
|
||||
<ivy pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'/>
|
||||
<artifact pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'/>
|
||||
</url>
|
||||
</resolvers>
|
||||
<modules>
|
||||
<module organisation='org' name='bt2' matcher='regexp' resolver='kotlin-repo'/>
|
||||
<module organisation='org' name='bt343' matcher='regexp' resolver='idea-repo'/>
|
||||
<module organisation='org' name='bt343' matcher='regexp' resolver='jetbrains-repo'/>
|
||||
<module organisation='org' name='bt344' matcher='regexp' resolver='jetbrains-repo'/>
|
||||
</modules>
|
||||
</ivysettings>
|
||||
{code}
|
||||
@@ -60,11 +55,13 @@ Another way to define Ant's {{*<kotlinc>*}} task is by using Ivy:
|
||||
<ivy-module version="1.3">
|
||||
<info organisation="com.jetbrains" module="kotlin"/>
|
||||
<dependencies>
|
||||
<dependency org="org" name="bt2" rev="latest.lastSuccessful">
|
||||
<!-- Kotlin build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt344 -->
|
||||
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt344/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<dependency org="org" name="bt344" rev="latest.lastSuccessful">
|
||||
<include ext="jar" matcher="exactOrRegexp"/>
|
||||
</dependency>
|
||||
<!-- http://teamcity.jetbrains.com/viewType.html?tab=buildTypeStatusDiv&buildTypeId=bt343 -->
|
||||
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt343/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<!-- IDEA build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt343 -->
|
||||
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt343/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<dependency org="org" name="bt343" rev="latest.lastSuccessful">
|
||||
<include name="core/.*" ext="jar" matcher="exactOrRegexp"/>
|
||||
</dependency>
|
||||
@@ -167,3 +164,10 @@ h3. Classpath examples
|
||||
</classpath>
|
||||
</kotlinc>
|
||||
{code}
|
||||
|
||||
|
||||
h1. Maven
|
||||
|
||||
See [{{"kotlin-maven-plugin"}}|http://evgeny-goldin.com/wiki/Kotlin-maven-plugin].
|
||||
|
||||
h1. Gradle
|
||||
@@ -263,16 +263,16 @@
|
||||
<kotlinc-dir src = "${basedir}/build-tools/test/longer-examples"/>
|
||||
|
||||
<run-java classname = "bottles.namespace" equals="false" out="12 bottles of beer on the wall, 12 bottles of beer."/>
|
||||
<!--<run-java classname = "maze.namespace" equals="false" out="O ~OOOOOOOOOOOOOO"/>-->
|
||||
<run-java classname = "life.namespace" equals="false" out="*** ** ** ***"/>
|
||||
<run-java classname = "html.namespace" equals="false" out="<a href="http://jetbrains.com/kotlin">"/>
|
||||
<!--<run-java classname = "maze.namespace" equals="false" out="O ~OOOOOOOOOOOOOO"/>-->
|
||||
<!--<run-java classname = "html.namespace" equals="false" out="<a href="http://jetbrains.com/kotlin">"/>-->
|
||||
|
||||
<kotlinc-jar src = "${basedir}/build-tools/test/longer-examples"/>
|
||||
|
||||
<run-java classname = "bottles.namespace" equals="false" run-jar="true" out="12 bottles of beer on the wall, 12 bottles of beer."/>
|
||||
<!--<run-java classname = "maze.namespace" equals="false" run-jar="true" out="O ~OOOOOOOOOOOOOO"/>-->
|
||||
<run-java classname = "life.namespace" equals="false" run-jar="true" out="*** ** ** ***"/>
|
||||
<run-java classname = "html.namespace" equals="false" run-jar="true" out="<a href="http://jetbrains.com/kotlin">"/>
|
||||
<!--<run-java classname = "maze.namespace" equals="false" run-jar="true" out="O ~OOOOOOOOOOOOOO"/>-->
|
||||
<!--<run-java classname = "html.namespace" equals="false" run-jar="true" out="<a href="http://jetbrains.com/kotlin">"/>-->
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
|
||||
+5
-3
@@ -5,12 +5,14 @@
|
||||
<ivy-module version="1.3">
|
||||
<info organisation="com.jetbrains" module="kotlin"/>
|
||||
<dependencies>
|
||||
<dependency org="org" name="bt2" rev="latest.lastSuccessful">
|
||||
<!-- http://localhost:8111/guestAuth/repository/download/bt2/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<!-- Kotlin build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt344 -->
|
||||
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt344/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<dependency org="org" name="bt344" rev="latest.lastSuccessful">
|
||||
<include ext="jar" matcher="exactOrRegexp"/>
|
||||
</dependency>
|
||||
<!-- IDEA build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt343 -->
|
||||
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt343/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<dependency org="org" name="bt343" rev="latest.lastSuccessful">
|
||||
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt343/latest.lastSuccessful/teamcity-ivy.xml -->
|
||||
<include name="core/.*" ext="jar" matcher="exactOrRegexp"/>
|
||||
</dependency>
|
||||
<dependency org="asm" name="asm-util" rev="3.3.1"/>
|
||||
|
||||
@@ -13,17 +13,13 @@
|
||||
<url name="sonatype-repo" m2compatible="true">
|
||||
<artifact pattern="https://oss.sonatype.org/content/repositories/central/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
|
||||
</url>
|
||||
<url name='kotlin-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
|
||||
<ivy pattern='http://localhost:8111/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'/>
|
||||
<artifact pattern='http://localhost:8111/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'/>
|
||||
</url>
|
||||
<url name='idea-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
|
||||
<url name='jetbrains-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
|
||||
<ivy pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'/>
|
||||
<artifact pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'/>
|
||||
</url>
|
||||
</resolvers>
|
||||
<modules>
|
||||
<module organisation='org' name='bt2' matcher='regexp' resolver='kotlin-repo'/>
|
||||
<module organisation='org' name='bt343' matcher='regexp' resolver='idea-repo'/>
|
||||
<module organisation='org' name='bt343' matcher='regexp' resolver='jetbrains-repo'/>
|
||||
<module organisation='org' name='bt344' matcher='regexp' resolver='jetbrains-repo'/>
|
||||
</modules>
|
||||
</ivysettings>
|
||||
@@ -73,6 +73,7 @@ fun bottlesOfBeer(count : Int) : String =
|
||||
* An excerpt from the Standard Library
|
||||
*/
|
||||
|
||||
|
||||
// From the std package
|
||||
// This is an extension property, i.e. a property that is defined for the
|
||||
// type Array<T>, but does not sit inside the class Array
|
||||
|
||||
@@ -144,4 +144,3 @@ fun html(init : HTML.() -> Unit) : HTML {
|
||||
|
||||
// An excerpt from the Standard Library
|
||||
fun <K, V> Map<K, V>.set(key : K, value : V) = this.put(key, value)
|
||||
|
||||
|
||||
@@ -146,20 +146,22 @@ fun makeField(s : String) : Field {
|
||||
return Field(w.size, lines.size) {i, j -> data[i][j]}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// An excerpt from the Standard Library
|
||||
val String?.indices : IntRange get() = IntRange(0, this.sure().size)
|
||||
|
||||
fun <K, V> Map<K, V>.set(k : K, v : V) { put(k, v) }
|
||||
|
||||
fun comparator<T> (f : (T, T) -> Int) : Comparator<T> = object : Comparator<T> {
|
||||
override fun compare(o1 : T, o2 : T) : Int = f(o1, o2)
|
||||
override fun equals(p : Any?) : Boolean = false
|
||||
override fun compare(o1 : T, o2 : T) : Int = f(o1, o2)
|
||||
override fun equals(p : Any?) : Boolean = false
|
||||
}
|
||||
|
||||
val <T> Array<T>.isEmpty : Boolean get() = size == 0
|
||||
|
||||
fun <T, C: Collection<T>> Array<T>.to(result: C) : C {
|
||||
for (elem in this)
|
||||
result.add(elem)
|
||||
result.add(elem)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -134,27 +134,28 @@ fun main(args : Array<String>) {
|
||||
// UTILITIES
|
||||
|
||||
fun printMaze(str : String) {
|
||||
val maze = makeMaze(str)
|
||||
val maze = makeMaze(str)
|
||||
|
||||
println("Maze:")
|
||||
val path = findPath(maze)
|
||||
for (i in 0..maze.height - 1) {
|
||||
for (j in 0..maze.width - 1) {
|
||||
val cell = #(i, j)
|
||||
print(
|
||||
if (maze.walls[i][j]) "O"
|
||||
else if (cell == maze.start) "I"
|
||||
else if (cell == maze.end) "$"
|
||||
else if (path != null && path.contains(cell)) "~"
|
||||
else " "
|
||||
)
|
||||
}
|
||||
println("")
|
||||
}
|
||||
println("Result: " + if (path == null) "No path" else "Path found")
|
||||
println("")
|
||||
println("Maze:")
|
||||
val path = findPath(maze)
|
||||
for (i in 0..maze.height - 1) {
|
||||
for (j in 0..maze.width - 1) {
|
||||
val cell = #(i, j)
|
||||
print(
|
||||
if (maze.walls[i][j]) "O"
|
||||
else if (cell == maze.start) "I"
|
||||
else if (cell == maze.end) "$"
|
||||
else if (path != null && path.contains(cell)) "~"
|
||||
else " "
|
||||
)
|
||||
}
|
||||
println("")
|
||||
}
|
||||
println("Result: " + if (path == null) "No path" else "Path found")
|
||||
println("")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A maze is encoded in the string s: the big 'O' letters are walls.
|
||||
* I stand where a big 'I' stands and the prize is marked with
|
||||
@@ -207,18 +208,19 @@ fun makeMaze(s : String) : Maze {
|
||||
return Maze(w.size, lines.size, data, start.sure(), end.sure())
|
||||
}
|
||||
|
||||
|
||||
// An excerpt from the Standard Library
|
||||
val String?.indices : IntRange get() = IntRange(0, this.sure().size)
|
||||
|
||||
fun <K, V> Map<K, V>.set(k : K, v : V) { put(k, v) }
|
||||
|
||||
fun comparator<T> (f : (T, T) -> Int) : Comparator<T> = object : Comparator<T> {
|
||||
override fun compare(o1 : T, o2 : T) : Int = f(o1, o2)
|
||||
override fun equals(p : Any?) : Boolean = false
|
||||
override fun compare(o1 : T, o2 : T) : Int = f(o1, o2)
|
||||
override fun equals(p : Any?) : Boolean = false
|
||||
}
|
||||
|
||||
fun <T, C: Collection<T>> Array<T>.to(result: C) : C {
|
||||
for (elem in this)
|
||||
result.add(elem)
|
||||
result.add(elem)
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user