Skip to content

Commit bb98b06

Browse files
committed
fix scaladoc creation
- link to jdk (fixes warnings about the throws clauses) - link to all the AWS jars (no longer just one)
1 parent 53eb552 commit bb98b06

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

scaladoc.sbt

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import scala.util.matching.Regex.Match
22

33

4-
scalacOptions in (Compile, doc) ++=
4+
scalacOptions in (Compile, doc) :=
55
Seq(
6+
"-encoding", "UTF-8",
67
"-sourcepath", baseDirectory.value.getAbsolutePath,
78
"-doc-source-url", s"https://github.com/dwhjames/aws-wrap/tree/v${version.value}€{FILE_PATH}.scala")
89

@@ -11,10 +12,17 @@ autoAPIMappings := true
1112

1213
apiURL := Some(url("https://dwhjames.github.io/aws-wrap/api/current/"))
1314

14-
apiMappings += {
15+
apiMappings ++= {
16+
val builder = Map.newBuilder[sbt.File, sbt.URL]
1517
val jarFiles = (managedClasspath in Compile).value.files
16-
val datomicJarFile = jarFiles.find(file => file.toString.contains("com.amazonaws/aws-java-sdk")).get
17-
(datomicJarFile -> url("http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/"))
18+
jarFiles.filter(file => file.toString.contains("com.amazonaws/aws-java-sdk")).foreach { awsJarFile =>
19+
builder += awsJarFile -> url("http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/")
20+
}
21+
val bootPath = System.getProperty("sun.boot.library.path")
22+
if (bootPath ne null) {
23+
builder += file(bootPath + "/rt.jar") -> url("http://docs.oracle.com/javase/6/docs/api/")
24+
}
25+
builder.result()
1826
}
1927

2028
lazy val transformJavaDocLinksTask = taskKey[Unit](
@@ -26,17 +34,24 @@ transformJavaDocLinksTask := {
2634
log.info("Transforming JavaDoc links")
2735
val t = (target in (Compile, doc)).value
2836
(t ** "*.html").get.filter(hasJavadocApiLink).foreach { f =>
29-
log.info("Transforming " + f)
30-
val newContent = javadocApiLink.replaceAllIn(IO.read(f), transformJavaDocLinks)
31-
IO.write(f, newContent)
37+
log.debug("Transforming " + f)
38+
val content1 = javadocApiLink.replaceAllIn(IO.read(f), transformJavaDocLinks)
39+
val content2 = awsJavadocApiLink.replaceAllIn(content1, transformJavaDocLinks)
40+
IO.write(f, content2)
3241
}
3342
}
3443

3544
val transformJavaDocLinks: Match => String = m =>
3645
"href=\"" + m.group(1) + "?" + m.group(2).replace(".", "/") + ".html"
3746

38-
val javadocApiLink = """href=\"(http://docs\.aws\.amazon\.com/AWSJavaSDK/latest/javadoc/index\.html)#([^"]*)""".r
47+
val javadocApiLink = """href=\"(http://docs\.oracle\.com/javase/6/docs/api/index\.html)#([^"]*)""".r
3948

40-
def hasJavadocApiLink(f: File): Boolean = (javadocApiLink findFirstIn IO.read(f)).nonEmpty
49+
val awsJavadocApiLink = """href=\"(http://docs\.aws\.amazon\.com/AWSJavaSDK/latest/javadoc/index\.html)#([^"]*)""".r
50+
51+
def hasJavadocApiLink(f: File): Boolean = {
52+
val content = IO.read(f)
53+
(javadocApiLink findFirstIn content).nonEmpty ||
54+
(awsJavadocApiLink findFirstIn content).nonEmpty
55+
}
4156

4257
transformJavaDocLinksTask <<= transformJavaDocLinksTask triggeredBy (doc in Compile)

src/main/scala/dynamodb/ConcurrentBatchWriter.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class ConcurrentBatchWriter(
282282
* Note that this is an blocking call
283283
*
284284
* @return true if the group of writes completed without errors
285-
* @throws InterruptedException if interrupted while waiting
285+
* @throws java.lang.InterruptedException if interrupted while waiting
286286
*/
287287
@throws(classOf[InterruptedException])
288288
def awaitCompletionOfAllWrites(): Boolean = {
@@ -387,7 +387,7 @@ class ConcurrentBatchWriter(
387387
*
388388
* @param requests
389389
* an iterable collection of WriteRequests
390-
* @throws InterruptedException if interrupted while waiting
390+
* @throws java.lang.InterruptedException if interrupted while waiting
391391
*/
392392
@throws(classOf[InterruptedException])
393393
def queueWriteRequests(requests: Iterable[WriteRequest]): Unit = {

0 commit comments

Comments
 (0)