exposed the project version as a system property so we can use it in the tests & generation of the kdoc
This commit is contained in:
@@ -14,6 +14,11 @@ class KDocConfig() {
|
||||
*/
|
||||
public var title: String = "Documentation"
|
||||
|
||||
/**
|
||||
* Returns the version name of the documentation set
|
||||
*/
|
||||
public var version: String = "SNAPSHOT"
|
||||
|
||||
/**
|
||||
* Returns a map of the package prefix to the URLs to use to link to it in the documentation
|
||||
*/
|
||||
|
||||
@@ -140,7 +140,7 @@ abstract class KClassOrPackage(model: KModel, declarationDescriptor: Declaration
|
||||
}
|
||||
}
|
||||
|
||||
class KModel(var context: BindingContext, val config: KDocConfig, var title: String = "Documentation", var version: String = "TODO") {
|
||||
class KModel(var context: BindingContext, val config: KDocConfig) {
|
||||
// TODO generates java.lang.NoSuchMethodError: kotlin.util.namespace.hashMap(Ljet/TypeInfo;Ljet/TypeInfo;)Ljava/util/HashMap;
|
||||
//val packages = sortedMap<String,KPackage>()
|
||||
public val packageMap: SortedMap<String, KPackage> = TreeMap<String, KPackage>()
|
||||
@@ -157,6 +157,12 @@ class KModel(var context: BindingContext, val config: KDocConfig, var title: Str
|
||||
|
||||
public var markdownProcessor: PegDownProcessor = PegDownProcessor(Extensions.ALL)
|
||||
|
||||
public val title: String
|
||||
get() = config.title
|
||||
|
||||
public val version: String
|
||||
get() = config.version
|
||||
|
||||
/** Loads the model from the given set of source files */
|
||||
fun load(sources: List<JetFile?>): Unit {
|
||||
val allNamespaces = HashSet<NamespaceDescriptor>()
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
</includes>
|
||||
<excludes>
|
||||
</excludes>
|
||||
<systemProperties>
|
||||
<project.version>${project.version}</project.version>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -10,8 +10,8 @@ class GenerateSiteTest : TestCase() {
|
||||
val srcDir = findTemplateDir()
|
||||
val siteOutputDir = File(srcDir, "../../../target/site")
|
||||
|
||||
// TODO find version from environment?
|
||||
val versionDir = "snapshot"
|
||||
val version = System.getProperty("project.version") ?: "SNAPSHOT"
|
||||
val versionDir = if (version.contains("SNAPSHOT")) "snapshot" else version
|
||||
|
||||
fun testGenerateSite(): Unit {
|
||||
val generator = SiteGenerator(srcDir, siteOutputDir)
|
||||
@@ -28,7 +28,8 @@ class GenerateSiteTest : TestCase() {
|
||||
args.setDocOutputDir(outDir.toString())
|
||||
args.setOutputDir("target/classes-stdlib")
|
||||
val config = args.docConfig
|
||||
config.title = "Kotlin API"
|
||||
config.title = "Kotlin API ($version)"
|
||||
config.version = version
|
||||
|
||||
val compiler = KDocCompiler()
|
||||
compiler.exec(System.out, args)
|
||||
|
||||
@@ -16,15 +16,11 @@
|
||||
<orderEntry type="library" name="Maven: org.pegdown:pegdown:1.1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.parboiled:parboiled-core:1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.parboiled:parboiled-java:1.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm:3.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm-util:3.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm-tree:3.3.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm-analysis:3.3.1" level="project" />
|
||||
<orderEntry type="module" module-name="kdoc" scope="TEST" />
|
||||
<orderEntry type="library" name="Maven: picocontainer:picocontainer:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: trove4j:trove4j:1.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: guava:guava:11.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: asm:asm-commons:1.0" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user