Skip to content

Commit

Permalink
IDEA-273510 Building of distribution — provide report like webpack/ro…
Browse files Browse the repository at this point in the history
…llup do

GitOrigin-RevId: 0b838c5995df58136f4af8771144aac744902555
  • Loading branch information
develar authored and intellij-monorepo-bot committed Jul 13, 2021
1 parent b383c8d commit 3de0fd9
Show file tree
Hide file tree
Showing 18 changed files with 1,302 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ final class IntelliJCoreArtifactsBuilder {
void generateProjectStructureMapping(@NotNull File targetFile) {
def mapping = new ProjectStructureMapping()
processCoreLayout(buildContext.paths.tempDir, mapping, false)
mapping.addEntry(new ProjectLibraryEntry("annotations.jar", "jetbrains-annotations-java5", ""))
mapping.addEntry(new ProjectLibraryEntry("annotations.jar", "jetbrains-annotations-java5", null, 0))
mapping.generateJsonFile(targetFile.toPath())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import java.nio.channels.FileChannel
import java.nio.file.Files
import java.nio.file.Path

fun mergeJars(targetFile: Path, files: List<Path>) {
fun mergeJars(targetFile: Path, files: List<Path>): Map<Path, Int> {
Files.createDirectories(targetFile.parent)
FileChannel.open(targetFile, RW_CREATE_NEW).use { outChannel ->
val packageIndexBuilder = PackageIndexBuilder()

val zipCreator = ZipFileWriter(outChannel, deflater = null)
val sizes = HashMap<Path, Int>()
for (file in files) {
ImmutableZipFile.load(file).use { zipFile ->
@Suppress("SpellCheckingInspection")
val entries = zipFile.entries.filter {
val name = it.name
!name.endsWith(".kotlin_metadata") &&
Expand All @@ -42,10 +44,13 @@ fun mergeJars(targetFile: Path, files: List<Path>) {
}
writeEntries(entries, zipCreator, zipFile)
packageIndexBuilder.add(entries)

sizes.put(file, entries.asSequence().map { it.size }.sum())
}
}
writeDirs(packageIndexBuilder.dirsToCreate, zipCreator)
packageIndexBuilder.writePackageIndex(zipCreator)
zipCreator.finish()
return sizes
}
}
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist
plugin-graph/node_modules
node_modules
plugin-graph/plugin-graph.local.json
.DS_Store
17 changes: 17 additions & 0 deletions docs/dist-visualizer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Dist Content</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
</head>

<body>
<input id="fileInput"
type="file"
class="p-1 fixed right-0 text-sm z-50"
accept="application/json"/>
<div id="app" class="w-screen h-screen"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions docs/dist-visualizer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build --emptyOutDir",
"deploy": "pnpm run build && space hosting publish --public ij dist-content ./dist",
"serve": "vite preview"
},
"dependencies": {
"echarts": "^5.1.2",
"pretty-bytes": "^5.6.0"
},
"devDependencies": {
"autoprefixer": "^10.2.6",
"postcss": "^8.3.5",
"tailwindcss": "^2.2.4",
"vite": "^2.4.2"
}
}
Loading

0 comments on commit 3de0fd9

Please sign in to comment.