161 lines
4.9 KiB
Groovy
161 lines
4.9 KiB
Groovy
group 'com.companyname.artifactname'
|
|
version '1.0-SNAPSHOT'
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// THIS goes in the root build.gradle
|
|
//
|
|
buildscript {
|
|
repositories {
|
|
// put first to pull here first
|
|
mavenLocal()
|
|
google()
|
|
jcenter()
|
|
maven {
|
|
url "https://maven.google.com" // Google's Maven repository
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.0.1'
|
|
}
|
|
}
|
|
allprojects {
|
|
repositories {
|
|
// put first to pull here first
|
|
mavenLocal()
|
|
google()
|
|
jcenter()
|
|
maven {
|
|
url "https://maven.google.com" // Google's Maven repository
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
// END
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
// THIS goes in APP specific build.gradle
|
|
//
|
|
apply plugin: 'com.android.library'
|
|
android {
|
|
compileSdkVersion 28
|
|
buildToolsVersion '28.0.3'
|
|
|
|
defaultConfig {
|
|
minSdkVersion 23
|
|
targetSdkVersion 28
|
|
versionCode 1
|
|
versionName "1.1"
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
dependencies {
|
|
compile 'com.android.support:appcompat-v7:23.2.1'
|
|
compile 'com.android.support:support-v4:23.2.1'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// pull in everything from ./libs folder
|
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
|
}
|
|
|
|
|
|
//
|
|
// This is the SIMPLE method to publish locally
|
|
//
|
|
apply plugin: 'maven-publish'
|
|
project.afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
library(MavenPublication) {
|
|
groupId 'io.malloc.ccc'
|
|
artifactId 'nc-jni'
|
|
version "1.1"
|
|
artifact(bundleReleaseAar)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// more complicated example (gen the XML explicitly)
|
|
project.afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
mavenDebugAAR(MavenPublication) {
|
|
artifact bundleDebugAar
|
|
|
|
pom.withXml {
|
|
def dependenciesNode = asNode().appendNode('dependencies')
|
|
configurations.api.allDependencies.each { ModuleDependency dp ->
|
|
def dependencyNode = dependenciesNode.appendNode('dependency')
|
|
dependencyNode.appendNode('groupId', dp.group)
|
|
dependencyNode.appendNode('artifactId', dp.name)
|
|
dependencyNode.appendNode('version', dp.version)
|
|
|
|
if (dp.excludeRules.size() > 0) {
|
|
def exclusions = dependencyNode.appendNode('exclusions')
|
|
dp.excludeRules.each { ExcludeRule ex ->
|
|
def exclusion = exclusions.appendNode('exclusion')
|
|
exclusion.appendNode('groupId', ex.group)
|
|
exclusion.appendNode('artifactId', ex.module)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
mavenReleaseAAR(MavenPublication) {
|
|
artifact bundleReleaseAar
|
|
|
|
pom.withXml {
|
|
def dependenciesNode = asNode().appendNode('dependencies')
|
|
configurations.api.allDependencies.each { ModuleDependency dp ->
|
|
def dependencyNode = dependenciesNode.appendNode('dependency')
|
|
dependencyNode.appendNode('groupId', dp.group)
|
|
dependencyNode.appendNode('artifactId', dp.name)
|
|
dependencyNode.appendNode('version', dp.version)
|
|
|
|
if (dp.excludeRules.size() > 0) {
|
|
def exclusions = dependencyNode.appendNode('exclusions')
|
|
dp.excludeRules.each { ExcludeRule ex ->
|
|
def exclusion = exclusions.appendNode('exclusion')
|
|
exclusion.appendNode('groupId', ex.group)
|
|
exclusion.appendNode('artifactId', ex.module)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
name 'nexusSnapshot'
|
|
credentials {
|
|
username '<User with deployment rights>'
|
|
password '<User password>'
|
|
}
|
|
url '<URL to nexus>'
|
|
}
|
|
|
|
maven {
|
|
name 'nexusRelease'
|
|
credentials {
|
|
username '<User with deployment rights>'
|
|
password '<User password>'
|
|
}
|
|
url '<URL to nexus>'
|
|
}
|
|
}
|
|
} |