Skip to content

Commit 2af359f

Browse files
committed
Merge pull request jfrog#39 from Manabu-GT/feature/update-android-sample
update android sample to use latest tools/plugins which solves jfrog#28
2 parents d1711e3 + e44d967 commit 2af359f

File tree

6 files changed

+142
-154
lines changed

6 files changed

+142
-154
lines changed
Lines changed: 46 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,77 @@
11
buildscript {
22
repositories {
3-
maven {
4-
mavenLocal()
5-
url 'http://jcenter.bintray.com'
6-
}
3+
jcenter()
74
}
85
dependencies {
9-
classpath 'com.android.tools.build:gradle:0.9.2'
10-
classpath 'com.github.dcendents:android-maven-plugin:1.0'
11-
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0'
6+
classpath 'com.android.tools.build:gradle:2.0.0'
7+
//Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
8+
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.1.1'
129
}
1310
}
1411

15-
group = 'org.jfrog.example.android'
16-
version = currentVersion
17-
1812
// Plugins
19-
apply plugin: 'android-library'
13+
apply plugin: 'com.android.library'
14+
2015
apply plugin: 'com.jfrog.artifactory'
2116

22-
// We need the patched maven plugin since 'install' task is overriden by 'installDebugTest', see: https://github.com/dcendents/android-maven-plugin
23-
apply plugin: 'android-maven'
17+
apply plugin: 'maven-publish'
18+
19+
def artifactVersion = '1.0-SNAPSHOT'
20+
21+
publishing {
22+
publications {
23+
aar(MavenPublication) {
24+
groupId = 'org.jfrog.example.android'
25+
artifactId project.name
26+
version = artifactVersion
27+
artifact "${project.buildDir}/outputs/aar/${project.name}-release.aar"
28+
29+
pom.withXml {
30+
def root = asNode()
31+
def license = root.appendNode('licenses').appendNode('license')
32+
license.appendNode('name', 'The Apache Software License, Version 2.0')
33+
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
34+
license.appendNode('distribution', 'repo')
35+
}
36+
}
37+
}
38+
}
2439

2540
// Android
2641
android {
27-
compileSdkVersion 19
28-
buildToolsVersion "19.0.3"
42+
compileSdkVersion 23
43+
buildToolsVersion "23"
2944

3045
defaultConfig {
3146
minSdkVersion 16
32-
targetSdkVersion 19
47+
targetSdkVersion 23
3348
}
34-
}
3549

36-
configurations {
37-
published
38-
}
39-
40-
task sourceJar(type: Jar) {
41-
from android.sourceSets.main.java
42-
classifier "sources"
43-
}
44-
45-
artifactoryPublish {
46-
dependsOn sourceJar
50+
buildTypes {
51+
release {
52+
minifyEnabled false
53+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
54+
}
55+
}
4756
}
4857

49-
artifacts {
50-
published sourceJar
58+
repositories {
59+
jcenter()
5160
}
5261

53-
configure(install.repositories.mavenInstaller) {
54-
pom.project {
55-
licenses {
56-
license {
57-
name 'The Apache Software License, Version 2.0'
58-
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
59-
distribution 'repo'
60-
}
61-
}
62-
}
63-
}
64-
6562
artifactory {
66-
contextUrl = 'http://localhost:8081/artifactory'
63+
contextUrl = "${artifactory_contextUrl}"
6764
publish {
6865
repository {
69-
repoKey = 'libs-snapshot-local' // The Artifactory repository key to publish to
66+
// The Artifactory repository key to publish to
67+
repoKey = artifactVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'
7068
username = "${artifactory_user}" // The publisher user name
7169
password = "${artifactory_password}" // The publisher password
70+
maven = true
7271
}
7372
defaults {
74-
publishConfigs('archives', 'published')
75-
properties = ['build.status': "$it.project.status".toString()]
73+
publishArtifacts = true
74+
publications('aar')
7675
publishPom = true //Publish generated POM files to Artifactory (true by default)
7776
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default)
7877
}
@@ -86,18 +85,11 @@ artifactory {
8685
}
8786
}
8887

89-
repositories {
90-
jcenter()
91-
}
92-
9388
// Our project dependencies
9489
dependencies {
9590
compile 'joda-time:joda-time:2.3'
96-
97-
// Backward compatibility for andoird <http://developer.android.com/tools/support-library/index.html>
98-
// compile 'com.android.support:support-v4:19.1.+'
9991
}
10092

10193
task wrapper(type: Wrapper) {
102-
gradleVersion = '1.11'
94+
gradleVersion = '2.10'
10395
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
currentVersion=1.0-SNAPSHOT
1+
artifactory_contextUrl=http://localhost:8081/artifactory
22
artifactory_user=admin
33
artifactory_password=password
44

Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Jul 20 09:52:53 IDT 2015
1+
#Tue Apr 19 11:27:48 PDT 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-1.10-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

gradle-examples/4/gradle-android-aar/gradlew

100644100755
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ case "`uname`" in
4242
;;
4343
esac
4444

45-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
46-
if $cygwin ; then
47-
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48-
fi
49-
5045
# Attempt to set APP_HOME
5146
# Resolve links: $0 may be a link
5247
PRG="$0"
@@ -61,9 +56,9 @@ while [ -h "$PRG" ] ; do
6156
fi
6257
done
6358
SAVED="`pwd`"
64-
cd "`dirname \"$PRG\"`/" >&-
59+
cd "`dirname \"$PRG\"`/" >/dev/null
6560
APP_HOME="`pwd -P`"
66-
cd "$SAVED" >&-
61+
cd "$SAVED" >/dev/null
6762

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

@@ -114,6 +109,7 @@ fi
114109
if $cygwin ; then
115110
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116111
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112+
JAVACMD=`cygpath --unix "$JAVACMD"`
117113

118114
# We build the pattern for arguments to be converted via cygpath
119115
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
@if "%DEBUG%" == "" @echo off
2-
@rem ##########################################################################
3-
@rem
4-
@rem Gradle startup script for Windows
5-
@rem
6-
@rem ##########################################################################
7-
8-
@rem Set local scope for the variables with windows NT shell
9-
if "%OS%"=="Windows_NT" setlocal
10-
11-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12-
set DEFAULT_JVM_OPTS=
13-
14-
set DIRNAME=%~dp0
15-
if "%DIRNAME%" == "" set DIRNAME=.
16-
set APP_BASE_NAME=%~n0
17-
set APP_HOME=%DIRNAME%
18-
19-
@rem Find java.exe
20-
if defined JAVA_HOME goto findJavaFromJavaHome
21-
22-
set JAVA_EXE=java.exe
23-
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
25-
26-
echo.
27-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28-
echo.
29-
echo Please set the JAVA_HOME variable in your environment to match the
30-
echo location of your Java installation.
31-
32-
goto fail
33-
34-
:findJavaFromJavaHome
35-
set JAVA_HOME=%JAVA_HOME:"=%
36-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37-
38-
if exist "%JAVA_EXE%" goto init
39-
40-
echo.
41-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42-
echo.
43-
echo Please set the JAVA_HOME variable in your environment to match the
44-
echo location of your Java installation.
45-
46-
goto fail
47-
48-
:init
49-
@rem Get command-line arguments, handling Windowz variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
if "%@eval[2+2]" == "4" goto 4NT_args
53-
54-
:win9xME_args
55-
@rem Slurp the command line arguments.
56-
set CMD_LINE_ARGS=
57-
set _SKIP=2
58-
59-
:win9xME_args_slurp
60-
if "x%~1" == "x" goto execute
61-
62-
set CMD_LINE_ARGS=%*
63-
goto execute
64-
65-
:4NT_args
66-
@rem Get arguments from the 4NT Shell from JP Software
67-
set CMD_LINE_ARGS=%$
68-
69-
:execute
70-
@rem Setup the command line
71-
72-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73-
74-
@rem Execute Gradle
75-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76-
77-
:end
78-
@rem End local scope for the variables with windows NT shell
79-
if "%ERRORLEVEL%"=="0" goto mainEnd
80-
81-
:fail
82-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83-
rem the _cmd.exe /c_ return code!
84-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85-
exit /b 1
86-
87-
:mainEnd
88-
if "%OS%"=="Windows_NT" endlocal
89-
90-
:omega
1+
@if "%DEBUG%" == "" @echo off
2+
@rem ##########################################################################
3+
@rem
4+
@rem Gradle startup script for Windows
5+
@rem
6+
@rem ##########################################################################
7+
8+
@rem Set local scope for the variables with windows NT shell
9+
if "%OS%"=="Windows_NT" setlocal
10+
11+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12+
set DEFAULT_JVM_OPTS=
13+
14+
set DIRNAME=%~dp0
15+
if "%DIRNAME%" == "" set DIRNAME=.
16+
set APP_BASE_NAME=%~n0
17+
set APP_HOME=%DIRNAME%
18+
19+
@rem Find java.exe
20+
if defined JAVA_HOME goto findJavaFromJavaHome
21+
22+
set JAVA_EXE=java.exe
23+
%JAVA_EXE% -version >NUL 2>&1
24+
if "%ERRORLEVEL%" == "0" goto init
25+
26+
echo.
27+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28+
echo.
29+
echo Please set the JAVA_HOME variable in your environment to match the
30+
echo location of your Java installation.
31+
32+
goto fail
33+
34+
:findJavaFromJavaHome
35+
set JAVA_HOME=%JAVA_HOME:"=%
36+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37+
38+
if exist "%JAVA_EXE%" goto init
39+
40+
echo.
41+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42+
echo.
43+
echo Please set the JAVA_HOME variable in your environment to match the
44+
echo location of your Java installation.
45+
46+
goto fail
47+
48+
:init
49+
@rem Get command-line arguments, handling Windowz variants
50+
51+
if not "%OS%" == "Windows_NT" goto win9xME_args
52+
if "%@eval[2+2]" == "4" goto 4NT_args
53+
54+
:win9xME_args
55+
@rem Slurp the command line arguments.
56+
set CMD_LINE_ARGS=
57+
set _SKIP=2
58+
59+
:win9xME_args_slurp
60+
if "x%~1" == "x" goto execute
61+
62+
set CMD_LINE_ARGS=%*
63+
goto execute
64+
65+
:4NT_args
66+
@rem Get arguments from the 4NT Shell from JP Software
67+
set CMD_LINE_ARGS=%$
68+
69+
:execute
70+
@rem Setup the command line
71+
72+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73+
74+
@rem Execute Gradle
75+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76+
77+
:end
78+
@rem End local scope for the variables with windows NT shell
79+
if "%ERRORLEVEL%"=="0" goto mainEnd
80+
81+
:fail
82+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83+
rem the _cmd.exe /c_ return code!
84+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85+
exit /b 1
86+
87+
:mainEnd
88+
if "%OS%"=="Windows_NT" endlocal
89+
90+
:omega

0 commit comments

Comments
 (0)