Skip to content

Commit

Permalink
Merge pull request #10735 from playframework/mergify/bp/2.8.x/pr-10707
Browse files Browse the repository at this point in the history
Routes compiler: Remove generation date, keep the source relative (bp #10707)
  • Loading branch information
mergify[bot] committed Mar 3, 2021
2 parents 3d3c353 + 40a8883 commit 2a43f63
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ object InjectedRoutesGenerator extends RoutesGenerator {
val folder = namespace.map(_.replace('.', '/') + "/").getOrElse("") + "/"

val sourceInfo =
RoutesSourceInfo(task.file.getCanonicalPath.replace(File.separator, "/"), new java.util.Date().toString)
RoutesSourceInfo(
new File(".").toURI.relativize(task.file.toURI).getPath.replace(File.separator, "/"),
new java.util.Date().toString
)
val routes = rules.collect { case r: Route => r }

val routesPrefixFiles = Seq(folder + RoutesPrefixFile -> generateRoutesPrefix(sourceInfo, namespace))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
deps: Seq[Dependency[Rule]], rules: Seq[Dependency[Rule]], includes: Seq[Dependency[Include]])
// @@GENERATOR:play-routes-compiler
// @@SOURCE:@sourceInfo.source
// @@DATE:@sourceInfo.date

@for(p <- pkg) {package @p}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@(sourceInfo: RoutesSourceInfo, pkg: Option[String], packageName: Option[String], controllers: Seq[String])
// @@GENERATOR:play-routes-compiler
// @@SOURCE:@sourceInfo.source
// @@DATE:@sourceInfo.date

@{packageName.map("package " + _ + ";").getOrElse("")}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@(sourceInfo: RoutesSourceInfo, pkg: Option[String], imports: Seq[String], packageName: Option[String], routes: Seq[Route], namespaceReverseRouter: Boolean, useInjector: Route => Boolean)
// @@GENERATOR:play-routes-compiler
// @@SOURCE:@sourceInfo.source
// @@DATE:@sourceInfo.date

import play.api.routing.JavaScriptReverseRoute

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@(sourceInfo: RoutesSourceInfo, pkg: Option[String], imports: Seq[String], packageName: Option[String], routes: Seq[Route], namespaceReverseRouter: Boolean, useInjector: Route => Boolean)
// @@GENERATOR:play-routes-compiler
// @@SOURCE:@sourceInfo.source
// @@DATE:@sourceInfo.date

import play.api.mvc.Call

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@(sourceInfo: RoutesSourceInfo, pkg: Option[String], useInjector: Route => Boolean)
// @@GENERATOR:play-routes-compiler
// @@SOURCE:@sourceInfo.source
// @@DATE:@sourceInfo.date

@* Can't put in the root package because Java can't refer to the root package *@
package @pkg.getOrElse("_routes_") @ob
Expand Down

0 comments on commit 2a43f63

Please sign in to comment.