Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Temporarily disable the license report generation to speed up build #704

Merged
merged 14 commits into from
Jan 23, 2024
2 changes: 1 addition & 1 deletion .github/workflows/link-validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: coursier/[email protected]

- name: Create the Pekko site
run: sbt -Dpekko.genjavadoc.enabled=true "Javaunidoc/doc; Compile/unidoc; docs/paradox"
run: sbt -Dpekko.genjavadoc.enabled=true -Dpekko.genlicensereport.enabled=true "Javaunidoc/doc; Compile/unidoc; docs/paradox"

- name: Run Link Validator
run: cs launch net.runne::site-link-validator:0.2.2 -- scripts/link-validator.conf
2 changes: 1 addition & 1 deletion .github/workflows/publish-1.0-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
# TODO come up with a better way to control the version, possibly based on git tags
- name: Build Documentation
run: |-
sbt -Dpekko.genjavadoc.enabled=true "set ThisBuild / version := \"1.0.2\"; docs/paradox; unidoc"
sbt -Dpekko.genjavadoc.enabled=true -Dpekko.genlicensereport.enabled=true "set ThisBuild / version := \"1.0.2\"; docs/paradox; unidoc"

# Create directory structure upfront since rsync does not create intermediate directories otherwise
- name: Create directory structure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-1.0-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:

- name: Build Documentation
run: |-
sbt -Dpekko.genjavadoc.enabled=true docs/paradox unidoc
sbt -Dpekko.genjavadoc.enabled=true -Dpekko.genlicensereport.enabled=true docs/paradox unidoc
2 changes: 1 addition & 1 deletion .github/workflows/publish-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:

- name: Build Documentation
run: |-
sbt -Dpekko.genjavadoc.enabled=true docs/paradox unidoc
sbt -Dpekko.genjavadoc.enabled=true -Dpekko.genlicensereport.enabled=true docs/paradox unidoc

# Create directory structure upfront since rsync does not create intermediate directories otherwise
- name: Create nightly directory structure
Expand Down
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,18 @@ sbt -Dpekko.genjavadoc.enabled=true Javaunidoc/doc

Which will generate JavaDoc style docs in `./target/javaunidoc/index.html`. This requires a JDK version 11 or later.

#### Changing the project information page index

In case you want to change the index of `Project Information` page, you need to change it on the
`project/ProjectIndexGenerator.scala` so it can be included in the automatic docs generation.

#### License Report Generation

By default, license report generation is disabled to improve compilation speed. You can enable it by configuring `-Dpekko.genlicensereport.enabled=true`. e.g.:

- `sbt -Dpekko.genlicensereport.enabled=true "docs/paradox"`
- `sbt -Dpekko.genlicensereport.enabled=true shell` And then `docs/paradox`

### External dependencies

All the external runtime dependencies for the project, including transitive dependencies, must have an open source license that is equal to, or compatible with, [Apache 2](https://www.apache.org/licenses/LICENSE-2.0).
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ lazy val docs = pekkoModule("docs")
PekkoParadoxPlugin,
NoPublish,
ParadoxBrowse,
ProjectIndexGenerator,
ScaladocNoVerificationOfDiagrams,
StreamOperatorsIndexGenerator,
Jdk9)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/paradox/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* [index-utilities](index-utilities.md)
* [common/other-modules](common/other-modules.md)
* [additional/deploy](additional/deploy.md)
* [project/index](project/index.md)
* [project/index](project/project-index.md)
* [classic](index-classic.md)

@@@
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- DO NOT EDIT DIRECTLY: This file is generated by `project/ProjectIndexGenerator`. See CONTRIBUTING.md for details. -->
# Project Information

@@toc { depth=2 }
Expand All @@ -8,16 +9,15 @@
* [scala3](scala3.md)
* [downstream-upgrade-strategy](downstream-upgrade-strategy.md)
* [../common/may-change](../common/may-change.md)
* [ide] (../additional/ide.md)
* [lombok](immutable.md)
* [osgi](../additional/osgi.md)
* [../additional/ide](../additional/ide.md)
* [immutable](immutable.md)
* [../additional/osgi](../additional/osgi.md)
* [migration-guides](migration-guides.md)
* [rolling-update](rolling-update.md)
* [issue-tracking](issue-tracking.md)
* [licenses](licenses.md)
* [license-report](license-report.md)
* [faq](../additional/faq.md)
* [books](../additional/books.md)
* [../additional/faq](../additional/faq.md)
* [../additional/books](../additional/books.md)
Roiocam marked this conversation as resolved.
Show resolved Hide resolved
* [examples](examples.md)
* [links](links.md)

Expand Down
8 changes: 4 additions & 4 deletions project/Paradox.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ object Paradox {
lazy val sourceGeneratorSettings = Seq(
Compile / paradoxMarkdownToHtml / sourceGenerators += Def.taskDyn {
val targetFile = (Compile / paradox / sourceManaged).value / "project" / "license-report.md"

(LocalRootProject / dumpLicenseReportAggregate).map { dir =>
IO.copy(List(dir / "pekko-root-licenses.md" -> targetFile)).toList
}
ProjectIndexGenerator.CliOptions.generateLicenseReportEnabled.ifTrue(
(LocalRootProject / dumpLicenseReportAggregate).map { dir =>
IO.copy(List(dir / "pekko-root-licenses.md" -> targetFile)).toList
}).orElse(Some(Def.task(List.empty[File]))).get
}.taskValue)

lazy val settings =
Expand Down
5 changes: 3 additions & 2 deletions project/PekkoBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ object PekkoBuild {
UsefulTask("sortImports", "Sort the imports"),
UsefulTask("mimaReportBinaryIssues ", "Check binary issues"),
UsefulTask("validatePullRequest ", "Validate pull request"),
UsefulTask("docs/paradox", "Build documentation (takes ~10+ minutes)"),
UsefulTask("docs/paradoxBrowse", "Browse the generated documentation (takes ~10+ minutes)"),
UsefulTask("docs/paradox", "Build documentation (license report will be generate on CI or Publish)"),
UsefulTask("docs/paradoxBrowse",
"Browse the generated documentation (license report will be generate on CI or Publish)"),
UsefulTask("tips:", "prefix commands with `+` to run against cross Scala versions."),
UsefulTask("Contributing guide:", "https://github.com/apache/incubator-pekko/blob/main/CONTRIBUTING.md")).map(
_.noAlias))
Expand Down
75 changes: 75 additions & 0 deletions project/ProjectIndexGenerator.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import sbt._
import Keys._

object ProjectIndexGenerator extends AutoPlugin {

object CliOptions {
val generateLicenseReportEnabled = CliOption("pekko.genlicensereport.enabled", false)
}

override val projectSettings: Seq[Setting[_]] = inConfig(Compile)(
Seq(
resourceGenerators +=
generateIndex(sourceDirectory, _ / "paradox" / "project" / "project-index.md")))

def generateIndex(dir: SettingKey[File], locate: File => File) = Def.task[Seq[File]] {
val file = locate(dir.value)

val markdownFilesBeforeLicense = Seq(
"../common/binary-compatibility-rules.md",
"scala3.md",
"downstream-upgrade-strategy.md",
"../common/may-change.md",
"../additional/ide.md",
"immutable.md",
"../additional/osgi.md",
"migration-guides.md",
"rolling-update.md",
"issue-tracking.md",
"licenses.md")
val markdownFilesAfterLicense = Seq(
"../additional/faq.md",
"../additional/books.md",
"examples.md",
"links.md")

val markdownFiles = if (CliOptions.generateLicenseReportEnabled.get) {
markdownFilesBeforeLicense ++ Seq("license-report.md") ++ markdownFilesAfterLicense
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add a paradoxFast and paradoxFastBrowse task which turn this off?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have tried those approach:

  • (Compile / paradox / javaOptions += "-Dpekko.genlicensereport.enabled=false")
  • (javaOptions += "-Dpekko.genlicensereport.enabled=false")
  • Compile / paradoxMarkdownToHtml / sourceGenerators := { (Compile / paradoxMarkdownToHtml / sourceGenerators).value.filterNot(_ == Paradox.licenseReportGeneratorTask.taskValue) }
  • Compile / paradoxMarkdownToHtml / sourceGenerators := { Seq.empty }

None of them can be filtered in the license report generated, will keep find a new approach tomorrow.

} else {
markdownFilesBeforeLicense ++ markdownFilesAfterLicense
}

val content =
s"""<!-- DO NOT EDIT DIRECTLY: This file is generated by `project/ProjectIndexGenerator`. See CONTRIBUTING.md for details. -->
|# Project Information
|
|@@toc { depth=2 }
|
|@@@ index
|
|${markdownFiles.map(f => s"* [${f.replace(".md", "")}]($f)").mkString("\n")}
|
|@@@
|""".stripMargin

if (!file.exists || IO.read(file) != content) IO.write(file, content)
Seq(file)
}
}