понедельник, 1 августа 2016 г.

воскресенье, 10 июля 2016 г.

How to publish library on Android Studio to AAR with dependencies through local repository.

On your library build.gradle put this:
publishing {
    publications {
        libary(MavenPublication) {
            groupId 'com.libary.api.android'
            artifactId 'libary'
            version '0.1'            
            artifact("$buildDir/outputs/aar/library-release.aar")

            pom.withXml {           
                def dependenciesNode = asNode().appendNode('dependencies')
                configurations.compile.allDependencies.each { dp->
                    if (dp instanceof ModuleDependency) {
                        def dependencyNode = dependenciesNode.appendNode('dependency')
                        dependencyNode.appendNode('groupId', dp.group)
                        dependencyNode.appendNode('artifactId', dp.name)
                        dependencyNode.appendNode('version', dp.version)
                    }
                }
            }
        }
    }
    repositories {
        maven {
            url "c:/Bit/AndroidExample/build/repo"        }
    }
}
Execute this on the folder where project with library is located:
gradlew clean build publish
Now folder repo is created with our library in .aar format where our class builded and packed on .zip format. Also there is .pom file with our dependencies.

On your application that should use this library put this to the project build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'  }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url "c:/path_to_local_repo/repo"        }
    }
}

On the app build.gradle put this:
allprojects {
    repositories {
        jcenter()
        flatDir {
            dirs 'libs'        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'    compile 'com.android.support:appcompat-v7:23.4.0'  
    compile ('com.libary.api.android:libary:0.1@aar'){transitive=true}
}

Useful links:

понедельник, 6 июня 2016 г.


Добавить сабмодуль:

git submodule add git://github.com/

Изменить текст коммита:
git commit --amend -m "New commit message"

четверг, 19 мая 2016 г.

Выкачка сабмодулей:
git submodule update --init --recursive
https://git-scm.com/book/ru/Инструменты-Git-Подмодули
Решение проблемы с незапушены сабмодулем:
$ git submodule update fatal: reference is not a tree: 2d7cfbd09fc96c04c4c41148d44ed7778add6b43 Unable to checkout '2d7cfbd09fc96c04c4c41148d44ed7778add6b43' in submodule path 'mysubmodule'
http://stackoverflow.com/questions/2155887/git-submodule-head-reference-is-not-a-tree-error


Как сделать изменения разработчику в CSS и запушить в сабмодуле в его репозиторий?
мы в корне главного репозитория

cd sub
git checkout master # (!) вы обязаны сделать этот шаг, иначе беда номер 2
... ваши изменения ...
git add .
git commit -m "%message%"
git push origin master
cd ..
git add .
git commit -m "added changes to submodule"
git push origin master

среда, 18 мая 2016 г.

Поменять имя коммита: git commit --amend --reset-author
Отмена последнего коммита:
Если игнорируемые файлы уже есть в репозитории - обязательно почистите кеш репозитория:
git rm -r --cached .
git add .

git commit -am ".gitignore tune. Clean."git push origin +master
http://evtuhovich.ru/blog/2009/04/03/git-reset/
http://ncona.com/2011/07/how-to-delete-a-commit-in-git-local-and-remote/
http://wiki.dieg.info/git


воскресенье, 28 февраля 2016 г.

суббота, 13 февраля 2016 г.