So I am developing an electron application. I know electron is running a chromium browser in its core.
One of the use cases I am currently working on involves changing the source code of Chromium. I have cloned the Chromium project and made the changes. Now is it possible to use my version of Chromium to build my electron application?
If yes, how can I do it? If no, what are the alternatives?
So I had to basically rebuild the entire electron code.
Get the libchromium source from here
To modify the code in content module of electron we have to write a patch in libchromium/patches.
And then build libchromiumcontent :
./scripts/bootstrap
./scripts/update
Compile and package libchromiumcontent with the following commands:
./script/build
./script/create-dist
After the build is done, take note of the hash from the libchromiumcontent commit that includes your patch and perform the following commands, replacing your operating system and architecture as appropriate:
# Use either win|linux|osx to reference the platform
mkdir -p osx/x64/<commit>
mv libchromiumcontent* osx/x64/<commit>
And then build Electron with our custom libchromiumcontent :
Clone electron if you have not done already
git clone https://github.com/atom/electron && cd electron
Bootstrap Electron with our custom libchromiumcontent:
./script/bootstrap.py -v --url file:///path/to/libchromiumcontent
And finally build Electron:
./script/build.py -c D
Related
I inherited a clojure code base and I'm trying to containerize it for local development. The creators used deps.edn to manage the dependencies. However, I can't figure out what RUN command I should use to pre-install the dependencies for the project.
Currently, my entrypoint is the following ['clj', '-m', 'app'] which installs the dependencies every time I start the container.
How do I pre-install dependencies for a clojure project using a Docker RUN command?
Deps/CLI caching is described here. Generally speaking, dependencies are downloaded once and saved in a subdirectory of the project directory named
./.cpcache # "class path cache"
The ./.cpcache directory is analagous to the ~/.m2 cache directory used by Maven and related tools (e.g. Leiningen).
If you run the code locally, you should be able to copy the .cpcache dir with its cached dependencies into your Docker container. Then the dependencies don't need to be re-downloaded
for each startup of the Docker container.
See also the Deps/CLI overview.
P.S.
This template project is set up to run using both lein and Deps/CLI via the Kaocha tool. You may find the comparison helpful.
P.P.S.
You may find it easiest to run your code by building an uberjar file which contains all your code and all
dependencies in a single artifact. You can do this either using Leiningen or other tools such as depstar. You then invoke the application with a single command like:
java -jar demo-0.1.0-standalone.jar
Running this should do it:
clj -P
I have an Angular project. I want to convert him to Desktop application. For this i use Electron.js.
I can run
electron .
It works fine.
But now i want to make an exe.
For this i want to use electron-packager.
The problem:
I run:
electron-packager . --platform=win32
The error:
getaddrinfo EAI_AGAIN github.com
I understand that electron-packager needs github, but how to solve it?! Again i work offline(with jfrog artifactory) without internet.
Is there another electron package which can do the same without internet? (make an exe)
The problem is that electron-packager go to github.com to download electron.js.
So as #Alexander Leithner said to use electronZipDir option. (and also malept in electron channel in Discord)
The solution is simple, when you executed:
npm install electron
A zip file of the binaries of electron are cached in your computer.
The command for electron-packager looks like this:
npm install -D electron-packager
npx electron-packager . -- platform=win32 --electronZipDir=C:/Users/baruc/AppData/Local/electron/Cache/**some long string**
Thats all
Edit 25/7/2021
Theoretically, electron-packager has an option called "download" which you can pass to him a "cacheRoot" or "mirrorOptions" to download the electron.zip file.
By default you dont need to change the cacheRoot, but unfortunately both options of the download didnt work for me.
BTW, mirrorOptions got an object, not a string. So its not clear how to pass an object from the command line.
I saw that in the file artifact-utils.js of the #electron/get library, and there in the function called "mirrorVar" it search a special environment variables or the mirrorOptions which i tell before. If this function wont find them it will take the default which is github.
Solution when you have an artifactory:
Create in your project an .npmrc file and write there:
ELECTRON_MIRROR="http://my mirror site/electron/"
Be aware that it end with back slash.
Go to package.json file, and there to scripts write:
"pac": "electron-packager -- . --platform=win32"
3.execute it: npm run pac
I need to test my app on windows, but I am using a mac. It is very easy to package the app to run on windows, but I cannot package the app in dev-mode. I am using electron-is-dev to decide if I am running in dev or not. I need to run my tests on windows because I am testing a very specific windows hardware functionality. I don't want to comment my if(isDev){doSomething} just to run these test, and then uncomment it before I push the change. I was hoping there is some flag I can set in the electron-build cli, or maybe run electon . -windows?
Parse the parameter by adding sample code below to your electron main.js
const args = process.argv.slice(1);
windows = args.some(val => val === '-windows');
It can still be parsed on electron executable app by running in cmd like "electronapp.exe -windows"
The best way to do this so as to use the IsDev is to add the ELECTRON_IS_DEV environment variable to the app kinda like #carlokid suggested. I used: https://stackoverflow.com/a/34769146/3966009. This is the target I used for my app:
C:\Windows\System32\cmd.exe /c "SET ELECTRON_IS_DEV=1 && START ^"^" ^"C:\Program Files (x86)\My App\Fun Time.exe^""
I have cloned and built the waf script using:
./waf-light configure
Then to build my project (provided by Gomspace) I need to add waf and the eclipse.py to my path. So far I haven't found better than this setenv script:
WAFROOT=~/git/waf/
export PYTHONPATH=$WAFROOT/waflib/extras/:$PYTHONPATH
export PATH=~/git/waf/:$PATH
Called with:
source setenv
This is somehow a pretty ugly solution. Is there a more elegant way to install waf?
You don't install waf. The command you found correctly builds waf: /waf-light configure build Then for each project you create, you put the built waf script into that projects root directory. I can't find a reference, but this is the way in which waf:s primary author Thomas Nagy wants the tool to be used. Projects that repackage waf to make the tool installable aren't "officially sanctioned."
There are advantages and disadvantages with non-installation:
Disadvantages:
You have to add the semi-binary 100kb large waf file to your repository.
Because the file contains binary code, people can have legal objections to distributing it.
Advantages:
It doesn't matter if new versions of waf break the old API.
Users don't need to install waf before compiling the project -- having Python on the system is enough.
Fedora (at least Fedora 22) has a yum package for waf, so you could see that it's possible to do a system install of waf, albeit with a hack.
After you run something like python3 ./waf-light configure build, you'll get a file called waf that's actually a Python script with some binary data at the end. If you put it into /usr/bin and run it as non-root, you'll get an error because it fails to create a directory in /usr/bin. If you run it as root, you'll get the new directory and /usr/bin/waf runs normally.
Here's the trick that I learned from examining the find_lib() function in the waf Python script.
Copy the waf to /usr/bin/waf
As root, run /usr/bin/waf. Notice that it creates a directory. You'll see something like /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18
mv that directory to /usr/lib, dropping the . in the directory name, e.g. mv /usr/bin/.waf-2.0.19-b2f63c807a4215294bf6005410c74c18 /usr/lib/waf-2.0.19-b2f63c807a4215294bf6005410c74c18
If you want to use waf with Python3, repeat Steps 2-3 running the Python script /usr/bin/waf under Python3. Under Python3, the directory names will start with .waf3-/waf3- instead instead of .waf-/waf-.
(Optional) Remove the binary data at the end of /usr/bin/waf.
Now, non-root should be able to just use /usr/bin/waf.
That said, here's something to consider, like what another answer said: I believe waf's author intended waf to be embedded in projects so that each project can use its own version of waf without fear that a project will fail to build when there are newer versions of waf. Thus, the one-global-version use case seems to be not officially supported.
I am currently trying to get an ASP.NET Core 1.1 testproject to build within the microsoft/aspnetcore-build:1.1.0-msbuild docker image.
I am running Docker on Windows 10 Pro 64 and have the newest CLI/SDK (1.0.0-preview4-004233) installed. And I think there lies the problem. The current image uses (1.0.0-preview3-004056) and throws an error "error MSB4057: The target Restore does not exist in the project." when I execute "dotnet restore" within the running container in interactive mode.
My question is:
Is it the version mismatch that creates the error or am I missing something? My guess is that it has to do with some msbuild specific changes between preview3 and preview4.
Can I build my own docker image that uses the right SDK version? Links to good tutorials are very appreciated.
Steps to replicate:
Install the newest 1.1 SDK
Open Powershell and navigate in an new and empty project folder
Validate that you have preview4 "dotnet --info"
Create new project "dotnet new -t Web"
Open the *.csproj file change netcoreapp1.0 to netcoreapp1.1 and
Microsoft.NETCore.App Version to "1.1.0".
Restore packages "dotnet restore"
Test with "dotnet run"
Start docker-container in interactive mode
docker run -it --rm -v "$pwd:/sln" --workdir /sln microsoft/aspnetcore-build:1.1.0-msbuild
Within the running container use "dotnet restore" to force the error
Cheers
Martin
Tooling is still in preview, and there are huge movements about xproj/csproj project file format. So it's very probable that differences between preview3 and preview4 are critical for your project.
Install appropriate (preview3) CLI to your computer.
There is no user-friendly listing of al versions on MS site, but in docker image you can see download location like this:
https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-dev-debian-x64.$DOTNET_SDK_VERSION.tar.gz
Replace variables with desired values: 1.0.0-preview3-004056 and dotnet-dev-win-x64.1.0.0-preview3-004056.exe (second is guess using up-to-date file names from download page).
Now you need to set you app to use appropriate tooling version (now you have two installed). Create global.json file with:
{
"sdk": {
"version": "1.0.0-preview3-004056"
}
}
To verify: running dotnet --version from solution dir (or below) will print 1.0.0-preview3-004056, while running from any other folder will print 1.0.0-preview4-004233