Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
e6fb0c95
Unverified
Commit
e6fb0c95
authored
Jan 05, 2018
by
Lucio Maciel
Committed by
GitHub
Jan 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #679 from RocketChat/sdk-as-jars
Remove the SDK as an module
parents
ac2b6927
56690663
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
124 additions
and
39 deletions
+124
-39
build-sdk.sh
app/build-sdk.sh
+85
-0
build.gradle
app/build.gradle
+13
-3
ServerDao.java
...chat/rocket/android/server/infraestructure/ServerDao.java
+0
-30
ServerDao.kt
...a/chat/rocket/android/server/infraestructure/ServerDao.kt
+23
-0
circle.yml
circle.yml
+1
-1
dependencies.gradle
dependencies.gradle
+1
-1
settings.gradle
settings.gradle
+1
-4
No files found.
app/build-sdk.sh
0 → 100755
View file @
e6fb0c95
#!/bin/bash
CURRENT_DIR
=
`
pwd
`
# The SDK dir should be 2 directories up in the tree, so we use dirname 2 times
# to get the common parent dir of the SDK and the app
tmp
=
`
dirname
$CURRENT_DIR
`
tmp
=
`
dirname
$tmp
`
SDK_DIR
=
"
$tmp
/Rocket.Chat.Kotlin.SDK"
echo
"CURRENT DIR:
$CURRENT_DIR
"
echo
"SDK DIR:
$SDK_DIR
"
# check if there are changes not commited
function
git_stat
{
local
__resultvar
=
$1
cd
$SDK_DIR
&&
git diff
--shortstat
--exit-code
eval
$__resultvar
=
"'
$?
'"
}
# check for changes already on the index not commited
function
git_stat_cached
{
local
__resultvar
=
$1
cd
$SDK_DIR
&&
git diff
--cached
--shortstat
--exit-code
eval
$__resultvar
=
"'
$?
'"
}
# get the SHA of the lastest commit
function
git_sha
{
temp_sha
=
`
cd
$SDK_DIR
&&
git rev-parse
--short
HEAD
`
echo
"
$temp_sha
"
}
# check if the tree is dirty (has modifications not commited yet)
function
check_git_dirty
{
git_stat
stat
git_stat_cached cached
if
[
$stat
-eq
0
]
&&
[
$cached
-eq
0
]
;
then
echo
"not dirty"
return
1
else
echo
"is dirty"
return
0
fi
}
# check if the saved last commit is the same as the latest SHA in the tree
function
check_last_commit
{
if
[
!
-f
$SDK_DIR
/.last_commit_hash
]
;
then
echo
"last_commit_hash not found"
return
0
fi
saved_hash
=
`
cat
$SDK_DIR
/.last_commit_hash
`
last_hash
=
$(
git_sha
)
#`cd $SDK_DIR && git rev-parse --short HEAD`
if
[
"
$saved_hash
"
==
"
$last_hash
"
]
;
then
echo
"same hash as before
$saved_hash
=
$last_hash
"
return
1
fi
echo
"different commits, build again"
return
0
}
SHA
=
$(
git_sha
)
echo
"CURRENT SHA:
$SHA
"
# if the tree is not dirty, there is no new commit and the .jars are still there, just skip the build
if
!
check_git_dirty
&&
!
check_last_commit
&&
[
-f
$CURRENT_DIR
/libs/common-
$SHA
.jar
]
&&
[
-f
$CURRENT_DIR
/libs/core-
$SHA
.jar
]
;
then
echo
"NO BUILD NEEDED"
exit
0
fi
cd
$SDK_DIR
&&
./gradlew common:assemble
&&
cd
$CURRENT_DIR
cd
$SDK_DIR
&&
./gradlew core:assemble
&&
cd
$CURRENT_DIR
rm
$CURRENT_DIR
/libs/common
*
$CURRENT_DIR
/libs/core
*
mkdir
-p
$CURRENT_DIR
/libs/
cp
-v
$SDK_DIR
/common/build/libs/common-0.1-SNAPSHOT.jar
$CURRENT_DIR
/libs/common-
$SHA
.jar
cp
-v
$SDK_DIR
/core/build/libs/core-0.1-SNAPSHOT.jar
$CURRENT_DIR
/libs/core-
$SHA
.jar
echo
"
$SHA
"
>
$SDK_DIR
/.last_commit_hash
exit
0
app/build.gradle
View file @
e6fb0c95
...
...
@@ -14,7 +14,7 @@ android {
versionCode
1
versionName
"2.0.0-beta1"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled
fals
e
multiDexEnabled
tru
e
}
buildTypes
{
...
...
@@ -22,6 +22,10 @@ android {
minifyEnabled
false
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
debug
{
applicationIdSuffix
".dev"
}
}
packagingOptions
{
...
...
@@ -32,7 +36,6 @@ android {
dependencies
{
implementation
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
implementation
project
(
':core'
)
implementation
project
(
':player'
)
implementation
libraries
.
kotlin
...
...
@@ -95,3 +98,10 @@ kotlin {
coroutines
"enable"
}
}
// FIXME - build and install the sdk into the app/libs directory
// We were having some issues with the kapt generated files from the sdk when importing as a module
task
compileSdk
(
type:
Exec
)
{
commandLine
'./build-sdk.sh'
}
preBuild
.
dependsOn
compileSdk
app/src/main/java/chat/rocket/android/server/infraestructure/ServerDao.java
deleted
100644 → 0
View file @
ac2b6927
package
chat
.
rocket
.
android
.
server
.
infraestructure
;
import
android.arch.persistence.room.Dao
;
import
android.arch.persistence.room.Delete
;
import
android.arch.persistence.room.Insert
;
import
android.arch.persistence.room.OnConflictStrategy
;
import
android.arch.persistence.room.Query
;
import
android.arch.persistence.room.Update
;
import
java.util.List
;
import
io.reactivex.Single
;
@Dao
public
interface
ServerDao
{
@Insert
(
onConflict
=
OnConflictStrategy
.
FAIL
)
void
insertServer
(
ServerEntity
serverEntity
);
@Update
void
updateServer
(
ServerEntity
serverEntity
);
@Delete
void
deleteServer
(
ServerEntity
serverEntity
);
@Query
(
"SELECT * FROM server"
)
Single
<
List
<
ServerEntity
>>
getServers
();
@Query
(
"SELECT * FROM server WHERE id = :serverId"
)
Single
<
ServerEntity
>
getServer
(
Long
serverId
);
}
app/src/main/java/chat/rocket/android/server/infraestructure/ServerDao.kt
0 → 100644
View file @
e6fb0c95
package
chat.rocket.android.server.infraestructure
import
android.arch.persistence.room.*
import
io.reactivex.Single
@Dao
interface
ServerDao
{
@Query
(
"SELECT * FROM server"
)
fun
getServers
():
Single
<
List
<
ServerEntity
>>
@Insert
(
onConflict
=
OnConflictStrategy
.
FAIL
)
fun
insertServer
(
serverEntity
:
ServerEntity
)
@Update
fun
updateServer
(
serverEntity
:
ServerEntity
)
@Delete
fun
deleteServer
(
serverEntity
:
ServerEntity
)
@Query
(
"SELECT * FROM server WHERE id = :serverId"
)
fun
getServer
(
serverId
:
Long
?):
Single
<
ServerEntity
>
}
circle.yml
View file @
e6fb0c95
...
...
@@ -10,7 +10,7 @@ machine:
GRADLE_OPTS
:
'
-Xmx1024m
-Dorg.gradle.jvmargs="-Xmx1024m
-XX:MaxPermSize=512m
-XX:+HeapDumpOnOutOfMemoryError"'
JAVA_OPTS
:
"
-Xms518m
-Xmx1024m"
pre
:
-
git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git Rocket.Chat.Kotlin.S
dk
-
git clone https://github.com/RocketChat/Rocket.Chat.Kotlin.SDK.git Rocket.Chat.Kotlin.S
DK
dependencies
:
pre
:
...
...
dependencies.gradle
View file @
e6fb0c95
...
...
@@ -7,7 +7,7 @@ ext {
targetSdk
:
27
,
buildTools
:
'27.0.0'
,
kotlin
:
'1.2.10'
,
coroutine
:
'0.2
0
'
,
coroutine
:
'0.2
1
'
,
dokka
:
'0.9.15'
,
kotshi
:
'0.3.0-beta2'
,
...
...
settings.gradle
View file @
e6fb0c95
include
':app'
,
'common'
,
'core'
,
':player'
project
(
':common'
).
projectDir
=
new
File
(
settingsDir
,
'../Rocket.Chat.Kotlin.SDK/common'
)
project
(
':core'
).
projectDir
=
new
File
(
settingsDir
,
'../Rocket.Chat.Kotlin.SDK/core'
)
include
':app'
,
':player'
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment