Skip to content

Commit

Permalink
Create module for tcpdump binary
Browse files Browse the repository at this point in the history
Contains tcpdump binary and libpcap library dependance.
Dedicated module improves build time and separes concerns.
  • Loading branch information
PerfectSlayer committed May 10, 2018
1 parent 1979a5f commit d776ebd
Show file tree
Hide file tree
Showing 565 changed files with 75 additions and 47 deletions.
49 changes: 3 additions & 46 deletions app/build.gradle
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,10 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'

repositories { repositories {
jcenter() jcenter()
google() google()
} }

dependencies { dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1'
Expand All @@ -12,13 +14,13 @@ dependencies {
implementation 'com.android.support:support-fragment:27.1.1' implementation 'com.android.support:support-fragment:27.1.1'
implementation 'com.evernote:android-job:1.2.4' implementation 'com.evernote:android-job:1.2.4'
implementation project(':libraries:RootCommands') implementation project(':libraries:RootCommands')
implementation project(':tcpdump')
implementation project(':webserver') implementation project(':webserver')
implementation 'net.sf.trove4j:trove4j:3.0.3' implementation 'net.sf.trove4j:trove4j:3.0.3'
implementation 'org.sufficientlysecure:html-textview:2.0' implementation 'org.sufficientlysecure:html-textview:2.0'
implementation 'org.sufficientlysecure:donations:2.4' implementation 'org.sufficientlysecure:donations:2.4'
} }



def getGitSha1 = { -> def getGitSha1 = { ->
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()
exec { exec {
Expand All @@ -29,12 +31,6 @@ def getGitSha1 = { ->
} }


android { android {
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}

compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion '27.0.3' buildToolsVersion '27.0.3'


Expand Down Expand Up @@ -79,47 +75,8 @@ android {
abortOnError false abortOnError false
} }


externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
} }

/**
* Task to rename executables from hello_world to libhello_world_exec.so
* If they look like libraries, they are packaged in the apk and deployed on the device in the lib folder!
*
* http://www.gradle.org/docs/current/userguide/working_with_files.html
*/
task renameDebugExecutables(type: Sync) {
from('build/intermediates/ndkBuild/debug/obj/local') {
rename(/(.+)/, 'lib$1_exec.so')
}
into 'libs'

exclude '*/objs'
exclude '*/*.a'
}
task renameReleaseExecutables(type: Sync) {
from('build/intermediates/ndkBuild/release/obj/local') {
rename(/(.+)/, 'lib$1_exec.so')
}
into 'libs'

exclude '*/objs'
exclude '*/*.a'
}

gradle.projectsEvaluated {
if (project.hasProperty('packageDebug')) {
packageDebug.dependsOn renameDebugExecutables
}
if (project.hasProperty('packageRelease')) {
packageRelease.dependsOn renameReleaseExecutables
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1,2 @@
include ':app', ':webserver' include ':app', ':tcpdump', ':webserver'
include ':libraries:RootCommands' include ':libraries:RootCommands'
3 changes: 3 additions & 0 deletions tcpdump/.gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
/.externalNativeBuild
/build
/libs
63 changes: 63 additions & 0 deletions tcpdump/build.gradle
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,63 @@
apply plugin: 'com.android.library'

android {
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}

compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
}

externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}

/**
* Task to rename executables from hello_world to libhello_world_exec.so
* If they look like libraries, they are packaged in the apk and deployed on the device in the lib folder!
*
* http://www.gradle.org/docs/current/userguide/working_with_files.html
*/
task renameDebugExecutables(type: Sync) {
from('build/intermediates/ndkBuild/debug/obj/local') {
rename(/(.+)/, 'lib$1_exec.so')
}
into 'libs'

exclude '*/objs*'
exclude '*/*.a'
}
task renameReleaseExecutables(type: Sync) {
from('build/intermediates/ndkBuild/release/obj/local') {
rename(/(.+)/, 'lib$1_exec.so')
}
into 'libs'

exclude '*/objs'
exclude '*/*.a'
}

gradle.projectsEvaluated {
if (project.hasProperty('assembleDebug')) {
assembleDebug.dependsOn renameDebugExecutables
}
if (project.hasProperty('assembleRelease')) {
assembleRelease.dependsOn renameReleaseExecutables
}
}
3 changes: 3 additions & 0 deletions tcpdump/jni/Android.mk
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
include jni/libpcap/Android.mk
include jni/tcpdump/Android.mk

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d776ebd

Please sign in to comment.