This repository has been archived by the owner on Aug 7, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce support for v8 heap snapshot generation
- Loading branch information
Showing
39 changed files
with
949 additions
and
156 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env node | ||
const ProjectSnapshotGenerator = require("../snapshot/android/project-snapshot-generator"); | ||
const args = require("../snapshot/android/project-snapshot-generator-cli-ags-parser")(); | ||
|
||
const generator = new ProjectSnapshotGenerator(args); | ||
generator.generate(args); |
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 @@ | ||
@node %~dp0\generate-android-snapshot %* |
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
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,14 +1,20 @@ | ||
#!/usr/bin/env node | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
const { resolve } = require("path"); | ||
|
||
const helpers = require("../projectHelpers"); | ||
const forceUpdateProjectDeps = require("../dependencyManager").forceUpdateProjectDeps; | ||
const { getPackageJson, writePackageJson } = require("../projectHelpers"); | ||
const { forceUpdateProjectDeps } = require("../dependencyManager"); | ||
const { editExistingProjectFiles } = require("../projectFilesManager"); | ||
|
||
const PROJECT_DIR = path.resolve(__dirname, "../../../"); | ||
const packageJson = helpers.getPackageJson(PROJECT_DIR); | ||
const PROJECT_DIR = resolve(__dirname, "../../../"); | ||
|
||
console.info("Updating dev dependencies..."); | ||
const packageJson = getPackageJson(PROJECT_DIR); | ||
const { deps } = forceUpdateProjectDeps(packageJson); | ||
packageJson.devDependencies = deps; | ||
writePackageJson(packageJson, PROJECT_DIR); | ||
|
||
console.info("\nUpdating configuration files..."); | ||
editExistingProjectFiles(PROJECT_DIR); | ||
|
||
console.info("\nProject successfully updated! Don't forget to run `npm install`"); | ||
|
||
helpers.writePackageJson(packageJson, PROJECT_DIR); |
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
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
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
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
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,47 @@ | ||
const { RawSource } = require("webpack-sources"); | ||
const { getPackageJson } = require("../projectHelpers"); | ||
|
||
exports.GenerateBundleStarterPlugin = (function() { | ||
function GenerateBundleStarterPlugin(bundles) { | ||
this.bundles = bundles; | ||
}; | ||
|
||
GenerateBundleStarterPlugin.prototype.apply = function(compiler) { | ||
const plugin = this; | ||
plugin.webpackContext = compiler.options.context; | ||
|
||
compiler.plugin("emit", function (compilation, cb) { | ||
compilation.assets["package.json"] = plugin.generatePackageJson(); | ||
compilation.assets["starter.js"] = plugin.generateStarterModule(); | ||
plugin.generateTnsJavaClasses(compilation); | ||
|
||
cb(); | ||
}); | ||
} | ||
|
||
GenerateBundleStarterPlugin.prototype.generateTnsJavaClasses = function (compilation) { | ||
const path = compilation.compiler.outputPath; | ||
const isAndroid = path.indexOf("android") > -1; | ||
|
||
if (isAndroid && !compilation.assets["tns-java-classes.js"]) { | ||
compilation.assets["tns-java-classes.js"] = new RawSource(""); | ||
} | ||
} | ||
|
||
GenerateBundleStarterPlugin.prototype.generatePackageJson = function () { | ||
const packageJson = getPackageJson(this.webpackContext); | ||
packageJson.main = "starter"; | ||
|
||
return new RawSource(JSON.stringify(packageJson, null, 4)); | ||
} | ||
|
||
GenerateBundleStarterPlugin.prototype.generateStarterModule = function () { | ||
const moduleSource = this.bundles | ||
.map(bundle => `require("${bundle}")`) | ||
.join("\n"); | ||
|
||
return new RawSource(moduleSource); | ||
} | ||
|
||
return GenerateBundleStarterPlugin; | ||
})(); |
Oops, something went wrong.