크롬 빌드의 경우 크롬 휴대폰 버전에서는 User-Agent 플러그인을 깔 수 없으니 해당 부분을 수정하여 User-Agent 필터링으로 접속 불가한 사이트에 접속 가능토록 하는 것이 Goal 인 프로젝트 였다.
아래 링크에서 가장 마지막 .mm 파일을 보면 수정 포인트가 있다. 엔터프라이즈용으로 내부 배포만 하는 회사의 경우 크로미움으로 전용 브라우저를 만들 수 있다는 것과 크롬에서 제공하는 full profile 로 웹앱의 기능을 거의 모두 쓸 수 있다는 것이 핵심인 프로젝트 이다.
- 이렇게 정리 안하고 나니 무슨 의미인지 잘 모르는 것 같아 시간이 지나서 핵심만 요약 해 본다. -
xcrun security find-identity -v -p codesigning 1) --8730DFD2437------------------------------ "Apple Development: JUNHO HA (----5----)" 1 valid identities found
패키지명 변경 및 폰에서도 잘 되어서 프로젝트 종료한다. 다른 것 보다 시뮬레이터 말고 폰에 돌릴 때 많은 고생을 할 것인데, 개삽질에 대한 정보를 공유하면 바로 실행은 하지 말라고 하고 싶다. 구글이 만든 스크립트 자체가 바이너리 생성에 iMAC pro 로도 빌드가 그리 빠르진 않으니 여건이 허락된다면 MAC PRO 로 가는 것을 추천한다. 시뮬레이터 크롬이랑 일반 디바이스 크롬이랑 동작이 다르다. 그리고 원 소스에서 out 폴더의 스크립트는 본 스크립트를 쓰면 안되며 수정이 필요하다. 다음 두 스샷은 개발에 도움이 될 것 같다. 즉, ***방식으로 개발하고 테스트 하라는 이야기.
WKWebView의 customUserAgent를 이용하면 특정 클라이언트만 접속할 수 있는 사이트 개발이 가능하다.
요구 사항 없이 순수하게 개인 OCR 프로젝트 중인데 잘되면 회사에 적용 시켜 주려고 한다. 뭔, 보상이야 하겠지만 최근 임원이 회사일을 이렇게 자기 일처럼 하는 사람은 100명에 1명 나올까 한다며 칭찬을 해 주셨다. 가끔 알아봐 주는 누군가를 만날 때 그렇게 짜릿할 수 없다.
전 글 댓글 문제점은 git init 후에 setup 을 실행시키니 해결되었다. git history 가 너무 많아 shell도 힘들어 할 정도니 history 검색은 원 폴더에서 하고 작업은 copy folder에서 하는 것이 맞다. Xcode도 git 지원이 되니 말이다.
네이버 웨일이던 이스트소프트 스윙이던 http://www.chromium.org/크로미움 프로젝트에서 branch out? clone? copy? 하여 만든 프로젝트인데 나름 시장을 개척하고 있는 것 같고, 지금 개인이 branch out 하면 더 이득일 것 같아서 프로젝트를 진행 해 보기로 한다. 본래 잘 되는 오픈 소스에서 branch out을 할 때는 타이밍을 잘 봐야 이 후 merge 되는 killer function 을 놓치지 않을 수 있는데. 나 같은 경우 모바일이 주 전공이다 보니 충분히 기다렸다는 생각이 든다. 개인이라 커스터 마이징 기록을 남겨 두고 패치로 만든 다면 굳이 어려운 merging이 아니라 언제든 새로운 브랜치에서 out 할 수 있는 가벼움까지 가질 수 있으니 개인이 기업을 이길 또 하나의 무기가 될 것이라 생각이 된다.뭐, 사실 개인이 이길 수 밖에 없는 이유는 진입 불가능한 비용 시장 때문이고. 언리얼과 같은 오픈 소스가 이길 수 밖에 없는 이유는 생태계와 브랜드를 잡은 업체가 모두를 흡수 할 수 마이크로소프트 전략도 있고, 도저히 변화를 따라갈 수 없는 오픈 환경이라는 것도 있다. 텐서플로우도 그 중 하나인데 어느 정도 시기가 되면 모두 closed 되거나 close 와 비슷한 행태(일부를 떼서 무조건 원격으로 받아야 하는 모듈로 만든다던지...) 때문에 branch out project를 하는 것이다. 가져 간다는 의미는 아니고. 어차피 시간과 충분한 돈이 있다면 이미 만들어진 cpu instruction set과 오랜 기간 공부 해 본 operating system 아키텍팅 기법에서 못 만들 것은 없으니까.
소스 받는데 2시간 걸린다. 히스토리 안 받는 옵션 주면 빠르다고 해서 줬더니 나중에 오류가 난다. ㅡㅡ; 중간에 멈추니 다시 시작 하는 옵션없으니 지우고 받으라고 한다. 믓튼, 그렇게 소스 받는데만 4시간 쓰고.
원 소스는 소중하여 저장하였다.
tar --exclude='./src/.git' -zcvf chrome.tar.gz ./src
그리고 개인 프로젝트니 chromium 보다 chrome build라고 한다. open jdk 할 때도 그냥 jdk라 불렀듯이.
Adddepot_toolsto the end of your PATH (you will probably want to put this in your~/.bashrcor~/.zshrc). Assuming you cloneddepot_toolsto/path/to/depot_tools:
$ export PATH="$PATH:/path/to/depot_tools"
Get the code
Create achromiumdirectory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the full path has no spaces):
$ mkdir chromium && cd chromium
Run thefetchtool fromdepot_toolsto check out the code and its dependencies.
$ fetch ios
If you don't want the full repo history, you can save a lot of time by adding the--no-historyflag tofetch.
Expect the command to take 30 minutes on even a fast connection, and many hours on slower ones.
Whenfetchcompletes, it will have created a hidden.gclientfile and a directory calledsrcin the working directory. The remaining instructions assume you have switched to thesrcdirectory:
$ cd src
Optional: You can alsoinstall API keysif you want your build to talk to some Google services, but this is not necessary for most development and testing purposes.
Setting up the build
Since the iOS build is a bit more complicated than a desktop build, we provideios/build/tools/setup-gn.py, which will create four appropriately configured build directories underoutfor Release and Debug device and simulator builds, and generates an appropriate Xcode project (out/build/all.xcodeproj) as well.
More information aboutdeveloping with Xcode.Xcode project is an artifact, any changes made in the project itself will be ignored.
You can customize the build by editing the file$HOME/.setup-gn(create it if it does not exist). Look atsrc/ios/build/tools/setup-gn.configfor available configuration options.
From this point, you can either build from Xcode or from the command line usingautoninja.setup-gn.pycreates sub-directories namedout/${configuration}-${platform}, so for aDebugbuild for simulator use:
$ autoninja -C out/Debug-iphonesimulator gn_all
(autoninjais a wrapper that automatically provides optimal values for the arguments passed toninja.)
Note: Thesetup-gn.pyscript needs to run every time one of theBUILD.gnfiles is updated (either by you or after rebasing). If you forget to run it, the list of targets and files in the Xcode solution may be stale. You can run the script directly or use eithergclient syncorgclient runhookswhich will runsetup-gn.pyfor you as part of the update hooks.
You can add a custom hook to.gclientfile to configuresetup-gn.pyto be run as part ofgclient runhooks. In that case, your.gclientfile would look like this:
You can also follow the manual instructions on theMac page, but make sure you set the GN argtarget_os="ios".
Building for device
To be able to build and run Chromium and the tests for devices, you need to have an Apple developer account (a free one will work) and the appropriate provisioning profiles, then configure the build to use them.
Code signing identity
Please refer to the Apple documentation on how to get a code signing identity and certificates. You can check that you have a code signing identity correctly installed by running the following command.
If the command output says you have zero valid identities, then you do not have a code signing identity installed and need to get one from Apple. If you have more than one identity, the build system may select the wrong one automatically, and you can use theios_code_signing_identitygn variable to control which one to use by setting it to the identity hash, e.g. to"0123456789ABCDEF0123456789ABCDEF01234567".
Mobile provisioning profiles
Once you have the code signing identity, you need to decide on a prefix for the application bundle identifier. This is controlled by the gn variableios_app_bundle_id_prefixand usually corresponds to a reversed domain name (the default value is"org.chromium").
You then need to request provisioning profiles from Apple for your devices for the following bundle identifiers to build and run Chromium with these application extensions:
All these certificates need to have the “App Groups” (com.apple.security.application-groups) capability enabled for the following groups:
group.${prefix}.chrome
group.${prefix}.common
Thegroup.${prefix}.chromeis only shared by Chromium and its extensions to share files and configurations while thegroup.${prefix}.commonis shared with Chromium and other applications from the same organisation and can be used to send commands to Chromium.
Mobile provisioning profiles for tests
In addition to that, you need a different provisioning profile for each test application. Those provisioning profile will have a bundle identifier matching the following pattern${prefix}.gtest.${test-suite-name}where${test-suite-name}is the name of the test suite with underscores changed to dashes (e.g.base_unittestsapp will use${prefix}.gest.base-unittestsas bundle identifier).
To be able to run the EarlGrey tests on a device, you'll need two provisioning profiles for EarlGrey and OCHamcrest frameworks:
${prefix}.test.OCHamcrest
${prefix}.test.EarlGrey
In addition to that, then you'll need one additional provisioning profile for the XCTest module too. It must match the pattern:${prefix}.gtest.${test-suite-name}-module.
Other applications
Other applications likeios_web_shellusually will require mobile provisioning profiles with bundle identifiers that may usually match the following pattern${prefix}.${application-name}and may require specific capabilities.
Generally, if the mobile provisioning profile is missing then the code signing step will fail and will print the bundle identifier of the bundle that could not be signed on the command line, e.g.:
$ autoninja -C out/Debug-iphoneos ios_web_shell ninja:Entering directory `out/Debug-iphoneos' FAILED: ios_web_shell.app/ios_web_shell ios_web_shell.app/_CodeSignature/CodeResources ios_web_shell.app/embedded.mobileprovision python ../../build/config/ios/codesign.py code-sign-bundle -t=iphoneos -i=0123456789ABCDEF0123456789ABCDEF01234567 -e=../../build/config/ios/entitlements.plist -b=obj/ios/web/shell/ios_web_shell ios_web_shell.app Error: no mobile provisioning profile found for "org.chromium.ios-web-shell". ninja: build stopped: subcommand failed.
Here, the build is failing because there are no mobile provisioning profiles installed that could sign theios_web_shell.appbundle with the identity0123456789ABCDEF0123456789ABCDEF01234567. To fix the build, you'll need to request such a mobile provisioning profile from Apple.
You can inspect the file passed via the-eflag to thecodesign.pyscript to check which capabilites are required for the mobile provisioning profile (e.g.src/build/config/ios/entitlements.plistfor the above build error, remember that the paths are relative to the build directory, not to the source directory).
If the required capabilities are not enabled on the mobile provisioning profile, then it will be impossible to install the application on a device (Xcode will display an error stating that “The application was signed with invalid entitlements”).
Running apps from the command line
Any target that is built and runs on the bots (seebelow) should run successfully in a local build. To run in the simulator from the command line, you can useiossim. For example, to run a debug build ofChromium:
With Xcode 9,iossimno longer automatically launches the Simulator. This must now be done manually from within Xcode (Xcode > Open Developer Tool > Simulator), and also must be doneafterrunningiossim.
Passing arguments
Arguments needed to be passed to the test application throughiossim, such as--gtest_filter=SomeTest.FooBarshould be passed through the-cflag:
EarlGrey tests are run differently than other test targets, as there is an XCTest bundle that is injected into the target application. Therefore you must also pass in the test bundle:
By default,iossimwill pick an arbitrary simulator to run the tests. If you want to run them on a specific simulator, you can use-dto pick the simulated device and-sto select the iOS version.
For example, to run the tests on a simulated iPhone 6s running iOS 10.0, you would invokeiossimlike this.
Please note that by default only a subset of simulator devices are installed with Xcode. You may have to install additional simulators in Xcode (or even an older version of Xcode) to be able to run on a specific configuration.
Go to “Preferences > Components” tab in Xcode to install other simulator images (this is the location the setting is in Xcode 9.2; it may be different in other version of the tool).
Update your checkout
To update an existing checkout, you can run
$ git rebase-update $ gclient sync
The first command updates the primary Chromium source repository and rebases any of your local branches on top of tip-of-tree (aka the Git branchorigin/master). If you don't want to use this script, you can also just usegit pullor other common Git commands to update the repo.
The second command syncs dependencies to the appropriate versions and re-runs hooks as needed.
Tips, tricks, and troubleshooting
Remember that the XCode project you interact with while working on Chromium is a build artifact, generated from theBUILD.gnfiles. Do not use it to add new files; instead see the procedures forworking with files.
If you have problems building, join us in#chromiumonirc.freenode.netand ask there. As mentioned above, be sure that thewaterfallis green and the tree is open before checking out. This will increase your chances of success.
Improving performance ofgit status
Increase the vnode cache size
git statusis used frequently to determine the status of your checkout. Due to the large number of files in Chromium‘s checkout,git statusperformance can be quite variable. Increasing the system’s vnode cache appears to help. By default, this command:
$ sysctl -a | egrep kern\..*vnodes
Outputskern.maxvnodes: 263168(263168 is 257 * 1024). To increase this setting:
$ sudo sysctl kern.maxvnodes=$((512*1024))
Higher values may be appropriate if you routinely move between different Chromium checkouts. This setting will reset on reboot, the startup setting can be set in/etc/sysctl.conf:
$ echo kern.maxvnodes=$((512*1024))| sudo tee -a /etc/sysctl.conf
Or edit the file directly.
Configure git to use an untracked cache
Ifgit --versionreports 2.8 or higher, try running
$ git update-index --test-untracked-cache
If the output ends withOK, then the following may also improve performance ofgit status:
$ git config core.untrackedCache true
Ifgit --versionreports 2.6 or higher, but below 2.8, you can instead run
$ git update-index --untracked-cache
Xcode license agreement
If you're getting the error
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
the Xcode license hasn't been accepted yet which (contrary to the message) any user can do by running:
$ xcodebuild -license
Only accepting for all users of the machine requires root: