-
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0a4153
commit 917a024
Showing
7 changed files
with
165 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
contrib/scoverage/api/src/mill/contrib/scoverage/api/FileReportType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package mill.contrib.scoverage.api; | ||
|
||
public abstract class FileReportType extends ReportType { | ||
private final String folderName; | ||
|
||
/*private[api]*/ | ||
FileReportType(String name, String folderName) { | ||
super(name); | ||
this.folderName = folderName; | ||
} | ||
|
||
public String folderName() { | ||
return folderName; | ||
} | ||
|
||
/* private[api]*/ | ||
static final FileReportType _Html = | ||
new FileReportType("Html", "htmlReport") {}; | ||
|
||
/* private[api]*/ | ||
static final FileReportType _Xml = | ||
new FileReportType("Xml", "xmlReport") {}; | ||
|
||
/* private[api]*/ | ||
static final FileReportType _XmlCobertura = | ||
new FileReportType("XmlCobertura", "xmlCoberturaReport") {}; | ||
} |
18 changes: 18 additions & 0 deletions
18
contrib/scoverage/api/src/mill/contrib/scoverage/api/ReportType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package mill.contrib.scoverage.api; | ||
|
||
public abstract class ReportType { | ||
private String name; | ||
|
||
/*private[api]*/ | ||
ReportType(String name) {} | ||
|
||
public static final ReportType Console = new ReportType("Console") {}; | ||
public static final FileReportType Html = FileReportType._Html; | ||
public static final FileReportType Xml = FileReportType._Xml; | ||
public static final FileReportType XmlCobertura = FileReportType._XmlCobertura; | ||
|
||
@Override | ||
public String toString() { | ||
return name; | ||
} | ||
} |
82 changes: 41 additions & 41 deletions
82
contrib/scoverage/api/src/mill/contrib/scoverage/api/ScoverageReportWorkerApi.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
package mill.contrib.scoverage.api | ||
// package mill.contrib.scoverage.api | ||
|
||
import mill.api.Ctx | ||
// import mill.api.Ctx | ||
|
||
trait ScoverageReportWorkerApi { | ||
import ScoverageReportWorkerApi._ | ||
// trait ScoverageReportWorkerApi { | ||
// import ScoverageReportWorkerApi._ | ||
|
||
@deprecated("Use other overload instead.", "Mill after 0.10.7") | ||
def report( | ||
reportType: ReportType, | ||
sources: Seq[os.Path], | ||
dataDirs: Seq[os.Path] | ||
)(implicit | ||
ctx: Ctx | ||
): Unit = { | ||
report(reportType, sources, dataDirs, ctx.workspace) | ||
} | ||
// @deprecated("Use other overload instead.", "Mill after 0.10.7") | ||
// def report( | ||
// reportType: ReportType, | ||
// sources: Seq[os.Path], | ||
// dataDirs: Seq[os.Path] | ||
// )(implicit | ||
// ctx: Ctx | ||
// ): Unit = { | ||
// report(reportType, sources, dataDirs, ctx.workspace) | ||
// } | ||
|
||
def report( | ||
reportType: ReportType, | ||
sources: Seq[os.Path], | ||
dataDirs: Seq[os.Path], | ||
sourceRoot: os.Path | ||
)(implicit | ||
ctx: Ctx | ||
): Unit = { | ||
// FIXME: We only call the deprecated version here, to preserve binary compatibility. Remove when appropriate. | ||
ctx.log.error( | ||
"Binary compatibility stub may cause infinite loops with StackOverflowError. You need to implement: def report(ReportType, Seq[Path], Seq[Path], os.Path): Unit" | ||
) | ||
report(reportType, sources, dataDirs) | ||
} | ||
} | ||
// def report( | ||
// reportType: ReportType, | ||
// sources: Seq[os.Path], | ||
// dataDirs: Seq[os.Path], | ||
// sourceRoot: os.Path | ||
// )(implicit | ||
// ctx: Ctx | ||
// ): Unit = { | ||
// // FIXME: We only call the deprecated version here, to preserve binary compatibility. Remove when appropriate. | ||
// ctx.log.error( | ||
// "Binary compatibility stub may cause infinite loops with StackOverflowError. You need to implement: def report(ReportType, Seq[Path], Seq[Path], os.Path): Unit" | ||
// ) | ||
// report(reportType, sources, dataDirs) | ||
// } | ||
// } | ||
|
||
object ScoverageReportWorkerApi { | ||
sealed trait ReportType | ||
sealed trait FileReportType extends ReportType { def folderName: String } | ||
object ReportType { | ||
final case object Html extends FileReportType { val folderName: String = "htmlReport" } | ||
final case object Xml extends FileReportType { val folderName: String = "xmlReport" } | ||
final case object XmlCobertura extends FileReportType { | ||
val folderName: String = "xmlCoberturaReport" | ||
} | ||
final case object Console extends ReportType | ||
} | ||
} | ||
// object ScoverageReportWorkerApi { | ||
// sealed trait ReportType | ||
// sealed trait FileReportType extends ReportType { def folderName: String } | ||
// object ReportType { | ||
// final case object Html extends FileReportType { val folderName: String = "htmlReport" } | ||
// final case object Xml extends FileReportType { val folderName: String = "xmlReport" } | ||
// final case object XmlCobertura extends FileReportType { | ||
// val folderName: String = "xmlCoberturaReport" | ||
// } | ||
// final case object Console extends ReportType | ||
// } | ||
// } |
32 changes: 32 additions & 0 deletions
32
contrib/scoverage/api/src/mill/contrib/scoverage/api/ScoverageReportWorkerApi2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package mill.contrib.scoverage.api; | ||
|
||
import java.nio.file.Path; | ||
import java.nio.file.Files; | ||
import java.io.IOException; | ||
|
||
public interface ScoverageReportWorkerApi2 { | ||
|
||
interface Logger { | ||
void info(String msg); | ||
void error(String msg); | ||
void debug(String msg); | ||
void warn(String msg); | ||
} | ||
|
||
interface Ctx { | ||
Logger log(); | ||
Path dest(); | ||
} | ||
|
||
void report(ReportType reportType, Path[] sources, Path[] dataDirs, Path sourceRoot, Ctx ctx); | ||
|
||
static void makeAllDirs(Path path) throws IOException { | ||
// Replicate behavior of `os.makeDir.all(path)` | ||
if (Files.isDirectory(path) && Files.isSymbolicLink(path)) { | ||
// do nothing | ||
} else { | ||
Files.createDirectories(path); | ||
} | ||
} | ||
|
||
} |
32 changes: 18 additions & 14 deletions
32
contrib/scoverage/worker/src/mill/contrib/scoverage/worker/ScoverageReportWorkerImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 18 additions & 14 deletions
32
contrib/scoverage/worker2/src/mill/contrib/scoverage/worker/ScoverageReportWorkerImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters