Skip to content

Commit

Permalink
Merge pull request #39 from Manabu-GT/feature/update-android-sample
Browse files Browse the repository at this point in the history
update android sample to use latest tools/plugins which solves #28
  • Loading branch information
eyalbe4 committed Apr 20, 2016
2 parents d1711e3 + e44d967 commit 2af359f
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 154 deletions.
100 changes: 46 additions & 54 deletions gradle-examples/4/gradle-android-aar/build.gradle
Original file line number Diff line number Diff line change
@@ -1,78 +1,77 @@
buildscript {
repositories {
maven {
mavenLocal()
url 'http://jcenter.bintray.com'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
classpath 'com.github.dcendents:android-maven-plugin:1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0'
classpath 'com.android.tools.build:gradle:2.0.0'
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.1.1'
}
}

group = 'org.jfrog.example.android'
version = currentVersion

// Plugins
apply plugin: 'android-library'
apply plugin: 'com.android.library'

apply plugin: 'com.jfrog.artifactory'

// We need the patched maven plugin since 'install' task is overriden by 'installDebugTest', see: https://github.com/dcendents/android-maven-plugin
apply plugin: 'android-maven'
apply plugin: 'maven-publish'

def artifactVersion = '1.0-SNAPSHOT'

publishing {
publications {
aar(MavenPublication) {
groupId = 'org.jfrog.example.android'
artifactId project.name
version = artifactVersion
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"

pom.withXml {
def root = asNode()
def license = root.appendNode('licenses').appendNode('license')
license.appendNode('name', 'The Apache Software License, Version 2.0')
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
license.appendNode('distribution', 'repo')
}
}
}
}

// Android
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
compileSdkVersion 23
buildToolsVersion "23"

defaultConfig {
minSdkVersion 16
targetSdkVersion 19
targetSdkVersion 23
}
}

configurations {
published
}

task sourceJar(type: Jar) {
from android.sourceSets.main.java
classifier "sources"
}

artifactoryPublish {
dependsOn sourceJar
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

artifacts {
published sourceJar
repositories {
jcenter()
}

configure(install.repositories.mavenInstaller) {
pom.project {
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}

artifactory {
contextUrl = 'http://localhost:8081/artifactory'
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to
// The Artifactory repository key to publish to
repoKey = artifactVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'
username = "${artifactory_user}" // The publisher user name
password = "${artifactory_password}" // The publisher password
maven = true
}
defaults {
publishConfigs('archives', 'published')
properties = ['build.status': "$it.project.status".toString()]
publishArtifacts = true
publications('aar')
publishPom = true //Publish generated POM files to Artifactory (true by default)
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default)
}
Expand All @@ -86,18 +85,11 @@ artifactory {
}
}

repositories {
jcenter()
}

// Our project dependencies
dependencies {
compile 'joda-time:joda-time:2.3'

// Backward compatibility for andoird <http://developer.android.com/tools/support-library/index.html>
// compile 'com.android.support:support-v4:19.1.+'
}

task wrapper(type: Wrapper) {
gradleVersion = '1.11'
gradleVersion = '2.10'
}
2 changes: 1 addition & 1 deletion gradle-examples/4/gradle-android-aar/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
currentVersion=1.0-SNAPSHOT
artifactory_contextUrl=http://localhost:8081/artifactory
artifactory_user=admin
artifactory_password=password

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jul 20 09:52:53 IDT 2015
#Tue Apr 19 11:27:48 PDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-1.10-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
10 changes: 3 additions & 7 deletions gradle-examples/4/gradle-android-aar/gradlew
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ case "`uname`" in
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
Expand All @@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

Expand Down Expand Up @@ -114,6 +109,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down
180 changes: 90 additions & 90 deletions gradle-examples/4/gradle-android-aar/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

0 comments on commit 2af359f

Please sign in to comment.