I'm using repo to build Android. I want to build from a previous release (e.g. build #1234 from last month). I do something like this:
I start with a special copy of the manifest that explicitly sets the revision for each package:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
...
<project name="packages/apps/Browser" revision="f42301ffb36a68fadffdb87fa1bdc09aceac53cb"/>
<project name="packages/apps/Calculator" revision="481a23ed78397e35201de3638ec0d76797b77d25"/>
<project name="packages/apps/Calendar" revision="19a0737be4d51aa71a0d122f5f24ab7e53869398"/>
<project name="packages/apps/Camera" revision="67e6c190f82f0f7b8704fe5663eb92082c4cc943"/>
...
</manifest>
This is basically a copy of default.xml, but with the revision for each package specified explicitly for the commit that was in place when build #1234 was created.
So now I give the commands
cp ~/manifest-build-1234.xml .repo/manifests
repo init -m manifest-build-1234.xml
repo sync
The result: Some of the packages are set to the revision specified in the manifest, but some of the others remain at the previous head.
If I delete those packages entirely, and then do another repo sync, then the packages are checked out at the correct revision.
So my question is: short of just deleting everything before I do the repo sync, how can I guarantee that all packages are checked out at the correct revision?
Use --trace with repo command to check what steps get executed while running repo commands. e.g "repo --trace sync -j4"
Related
I found the 'upstream' attribute in manifest file, repo.
I'm not sure what it means during 'repo sync' and 'repo sync -c'
And what's the difference between projectA and projectB below example.
During 'repo sync', I think it will clone projectA with commit '12345',
In projectB case, it will also clone projectB with commit 'abcde'.
Why 'upstream' is needed?
Please could you explain what it means?
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="projectA" path="project/A" remote="aosp" revision="12345" upstream="projectA/develop"/>
<project name="projectB" path="project/B" remote="aosp" revision="abcde" />
</manifest>
Attribute upstream as defined in repo Manifest Format
Attribute upstream: Name of the Git ref in which a sha1 can be found. Used when syncing a revision locked manifest in -c mode to avoid having to sync the entire ref space.
From this I understand that the sha mentioned in revision="12345" can be found in branch develop
I am guessing that there is some default entry at the top of manifest which will help the second line in your snippet.
I need to do the following steps,i need to update the default.xml to change the revision of some projects and then sync the code,is there a repo option to sync to local default.xml files?if not can you please advise how to deal with this problem?
1.repo init -u git://git. company.com/platform/manifest.git -b <branchname>
2.Update default.xml to change the revision of some projects
<project path="kernel"
name="kernel/msm"
revision="refs/heads/3.18" />
3. repo sync
It is not recommended to modify default.xml directly, you can put your modification in local_manifests.
For how to use local_manifest.xml, you can refer to here
I am new to GIT. I have a manifest file that contains group of related projects. I installed eGIT eclipse plugin to clone the projects. I am able to clone projects one by one in the manifest file. But I want all the projects in my manifest file to by clone at a single time for a specific branch.
Manifest file
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote fetch="ssh://xyz.com:29418/" name="origin" review="xyz.com:8081"/>
<default remote="origin" revision="refs/heads/evo_main" sync-j="4"/>
<project groups="common" name="ACT.git" path="code/ACT"/>
<project groups="common" name="AppEngine.git" path="code/AppEngine"/>
.
.
.
.
</manifest>
I am able to clone a single project with the url
ssh://user#xyz.com:29418/ACT.git
But since there are lot of projects I need a way to download all in a single clone. I dont want to use GitBash or any other command line tools. I want to achieve this eclipse plugins. Please help!
You will have to write script that does it for you or to use external program like
mr
The above mr is a software that know how to handle sereveral repository types.
If you dont use anything like that you will have to write script that does something like:
- run on every folder in a given path (or give it a list of paths)
- verify that each folder is a git repository (has .git folder inside)
- execute your git command (like git fetch --all --prune or git pull ...)
Upgraded to Android Studio 0.2.0 and got the following error. The error got resolved after applying suggested solution but now the following error appeared.
Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assemble' not found in root project 'MerlinCheckProject'.
* Try:
Run gradle tasks to get a list of available tasks.
I have no clue what the error is how to solve it. Appreciate help.
Remove <component name="FacetManager"> ... </component> from your iml file.
From http://tools.android.com/knownissues:
If you get the following error message:
Gradle:
FAILURE: Could not determine which tasks to execute.
What went wrong:
Task 'assemble' not found in root project 'MyProject'.
Try:
Run gradle tasks to get a list of available tasks.
The real problem is that previous version of Android Studio misconfigured the IDEA file (e.g. MyProject.iml) -- it added an extra <component name="FacetManager"> XML element that shouldn't be present. In the case above, the solution is to edit MyProject.iml and to remove the <component name="FacetManager"> part as shown here:
<?xml version="1.0" encoding="UTF-8"?>
<module external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
...remove this element and everything inside such as <facet> elements...
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
...keep this part...
</component>
</module>
Alternatively you could remove the project's .idea folder and iml files and re-import your sources into a new Android Studio project.
In the next release we'll fix this -- there will be a "fix this" button to do that fix automatically for you.
In my case, in a cordova project, I had an old gradle version 1.4 and that was the problem.
So try to remove gradle
sudo apt-get remove gradle
then, download new binary relase of gradle from here . I got v3.5.1.
Finally, Create a directory for the Gradle installation.
sudo mkdir /opt/gradle
Extract the downloaded archive to the newly created directory.
sudo unzip -d /opt/gradle gradle-3.5.1-bin.zip
Configure the PATH environment variable so that the gradle executable can be directly executed anywhere on the system.
export PATH=$PATH:/opt/gradle/gradle-3.5.1/bin
You can run the following command to check if the Gradle install was successful.
gradle -v
Deleting the facet-manager component from IML file did not solve the problem for me. I got the same error and closing and reopening the project caused the facet-manager component to be recreated in the iml file.
I had to delete the .idea directory and the .iml file and then import the top level gradle.build file to solve the problem. I was able to import the project in place using the import option on the initial Android Studio menu (with no project open).
The solution works fine. If you're having issues with it, ensure you close Android Studio completely, then edit the file, then reopen it.
I am a Windows user. The solution that worked for me was to remove the previous version of Android Studio:
http://developer.android.com/sdk/installing/studio.html#Updating
Inspired by the answer from #Dhafer.Dhib to check the installed gradle version, I want to add: The recommended way to install gradle under linux is using sdk, see https://gradle.org, I did the following steps:
sudo apt install zip ## zip required by SDKman, see http://sdkman.io/
## do the following steps as the user who wants to use the tools NOT root!
curl -s "https://get.sdkman.io" | bash ## SDKman recommended option to install *up-to-date* gradle, see https://gradle.org/install/
source "/root/.sdkman/bin/sdkman-init.sh" ## set env to use sdk without opening a new shell
sdk install gradle 4.6
gradle -v
I need to download src code of different android tags. Each time it takes half an hour and GIGS of space. Instead I'd prefer to switch to different tag. How can I do so?
cd android-4.0.4_r1.1
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.4_r1.1
repo sync
cd ../android-4.2.2_r1
repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1
repo sync
What's the proper way to switch/update from android-4.0.4_r1.1 to android-4.2.2_r1?
As mentioned in the comments of the accepted answer, you can change the default revision in manifest.xml. There's a snippet about it in repo help init:
Switching Manifest Branches
To switch to another manifest branch, repo init -b otherbranch may be
used in an existing client. However, as this only updates the manifest,
a subsequent repo sync (or repo sync -d) is necessary to update the
working directory files.
This won't download everything fresh, but will perform the necessary git operations to checkout the correct branch/tag across projects. Actually, if you run it with --trace, you'll see it does a good bit more than just git checkout.
NOTE: If you use this method you must make sure you supply the exact same parameters to repo init as you had for your previous invocation. Specifically, if you supplied -g options, supply them again or repo sync will remove directories now unnecessary in the new set of groups.
You can fetch tags with :
git fetch
git fetch --tags
And do checkout by :
git checkout tag_name
Also if it is taking more time to sync than usual run below command in that repo :
git gc