Add local maven publishing for libHttpClient (#305)

* Add maven publishing for libHttpClient
This commit is contained in:
John L 2018-10-08 17:04:18 -07:00 коммит произвёл GitHub
Родитель ded34400a2
Коммит 9f548a385e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 156 добавлений и 10 удалений

Просмотреть файл

@ -1,11 +1,17 @@
apply plugin: 'java'
apply plugin: 'maven-publish'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
buildscript
{
repositories
{
jcenter()
mavenCentral()
}
dependencies {
dependencies
{
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
// NOTE: Do not place your application dependencies here; they belong
@ -13,9 +19,75 @@ buildscript {
}
}
allprojects {
repositories {
allprojects
{
repositories
{
jcenter()
mavenCentral()
}
}
// To publish artifacts locally, first build the .aar with visual studio and then run the following command from /Build/libHttpClient.141.Android.Java/
// gradlew.bat publish -PHCVersion=[Version] -PLocalMavenRepositoryPath=[Path to local maven repository]
publishing
{
publications
{
mavenAar(MavenPublication)
{
groupId 'libHttpClientAndroid'
artifactId 'libHttpClient'
version (project.hasProperty("HCVersion") ? HCVersion : '0.0.0')
artifact (project.hasProperty('InputAar') ? InputAar : '../../Binaries/Release/x86/libHttpClient.141.Android.Java/libHttpClient.aar')
pom.withXml
{
def dependencies = asNode().appendNode('dependencies')
project(':app').configurations.compile.allDependencies.each
{
if (it.group != null)
{
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.group)
dependency.appendNode('artifactId', it.name)
dependency.appendNode('version', it.version)
}
}
}
}
}
repositories
{
if (project.hasProperty("PublishRemote") && (System.getenv("VSTS_ENV_ACCESS_TOKEN") != null || project.hasProperty("vstsMavenAccessToken")))
{
maven
{
url 'https://microsoft.pkgs.visualstudio.com/_packaging/gaming/maven/v1'
credentials
{
username "VSTS"
//The VSTS build system will use the "VSTS_ENV_ACCCESS_TOKEN" to authenticate to VSTS feeds, otherwise it will fall back on the "vstsMavenAccessToken" property,
// and as a final fallback it will pass an invalid token so other build tasks can continue to succeed.
password System.getenv("VSTS_ENV_ACCESS_TOKEN") != null ? System.getenv("VSTS_ENV_ACCESS_TOKEN") : vstsMavenAccessToken
}
}
}
else if (System.getenv("TFS_DropLocation") != null)
{
maven
{
url ('file:///' + System.getenv("TFS_DropLocation") + '/Maven')
}
}
else
{
maven
{
url (project.hasProperty("LocalMavenRepositoryPath") ? 'file:///' + LocalMavenRepositoryPath : "file://${buildDir}/Maven")
}
}
}
}

Просмотреть файл

@ -1,11 +1,17 @@
apply plugin: 'java'
apply plugin: 'maven-publish'
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
buildscript
{
repositories
{
jcenter()
mavenCentral()
}
dependencies {
dependencies
{
classpath 'com.android.tools.build:$(GradlePlugin)'
// NOTE: Do not place your application dependencies here; they belong
@ -13,9 +19,75 @@ buildscript {
}
}
allprojects {
repositories {
allprojects
{
repositories
{
jcenter()
mavenCentral()
}
}
// To publish artifacts locally, first build the .aar with visual studio and then run the following command from /Build/libHttpClient.141.Android.Java/
// gradlew.bat publish -PHCVersion=[Version] -PLocalMavenRepositoryPath=[Path to local maven repository]
publishing
{
publications
{
mavenAar(MavenPublication)
{
groupId 'libHttpClientAndroid'
artifactId 'libHttpClient'
version (project.hasProperty("HCVersion") ? HCVersion : '0.0.0')
artifact (project.hasProperty('InputAar') ? InputAar : '../../Binaries/Release/x86/libHttpClient.141.Android.Java/libHttpClient.aar')
pom.withXml
{
def dependencies = asNode().appendNode('dependencies')
project(':app').configurations.compile.allDependencies.each
{
if (it.group != null)
{
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.group)
dependency.appendNode('artifactId', it.name)
dependency.appendNode('version', it.version)
}
}
}
}
}
repositories
{
if (project.hasProperty("PublishRemote") && (System.getenv("VSTS_ENV_ACCESS_TOKEN") != null || project.hasProperty("vstsMavenAccessToken")))
{
maven
{
url 'https://microsoft.pkgs.visualstudio.com/_packaging/gaming/maven/v1'
credentials
{
username "VSTS"
//The VSTS build system will use the "VSTS_ENV_ACCCESS_TOKEN" to authenticate to VSTS feeds, otherwise it will fall back on the "vstsMavenAccessToken" property,
// and as a final fallback it will pass an invalid token so other build tasks can continue to succeed.
password System.getenv("VSTS_ENV_ACCESS_TOKEN") != null ? System.getenv("VSTS_ENV_ACCESS_TOKEN") : vstsMavenAccessToken
}
}
}
else if (System.getenv("TFS_DropLocation") != null)
{
maven
{
url ('file:///' + System.getenv("TFS_DropLocation") + '/Maven')
}
}
else
{
maven
{
url (project.hasProperty("LocalMavenRepositoryPath") ? 'file:///' + LocalMavenRepositoryPath : "file://${buildDir}/Maven")
}
}
}
}

Просмотреть файл

@ -39,6 +39,7 @@
<JavaSourceRoots>src\main\java</JavaSourceRoots>
</PropertyGroup>
<Import Project="$(AndroidTargetsPath)\Android.Default.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), libHttpClient.paths.props))\libHttpClient.paths.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Library</ConfigurationType>
</PropertyGroup>

Просмотреть файл

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(XES_OUTDIR)'==''">
<HCBuildRoot Condition="'$(HCBuildRoot)'==''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), build.root))\</HCBuildRoot>
<!-- Both of these will be overwritten by the XES build -->
<OutDir>$(HCBuildRoot)Binaries\$(Configuration)\$(Platform)\$(ProjectName)\</OutDir>
<IntDir>$(HCBuildRoot)Obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>