-
-
Save fincha/e00baa73cfbf173d7d93e64e1867d0ff to your computer and use it in GitHub Desktop.
Trigger Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"do": { | |
"android_add_permission": { | |
"permission": "android.permission.INTERNET" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_permission": { | |
"permission": "android.permission.WAKE_LOCK" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_permission": { | |
"permission": "com.google.android.c2dm.permission.RECEIVE" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_permission": { | |
"permission": "de.myapp.app.de.permission.C2D_MESSAGE" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_manifest": { | |
"element": { | |
"tag": "permission", | |
"attributes": { | |
"android:name": "de.myapp.app.de.permission.C2D_MESSAGE", | |
"android:protectionLevel": "signature" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_application_manifest": { | |
"element": { | |
"tag": "receiver", | |
"attributes": { | |
"android:name": "com.google.android.gms.gcm.GcmReceiver", | |
"android:exported": "true", | |
"android:permission": "com.google.android.c2dm.permission.SEND" | |
}, | |
"children": [{ | |
"tag": "intent-filter", | |
"children": [{ | |
"tag": "action", | |
"attributes": { | |
"android:name": "com.google.android.c2dm.intent.RECEIVE" | |
} | |
}, { | |
"tag": "action", | |
"attributes": { | |
"android:name": "com.google.android.c2dm.intent.REGISTRATION" | |
} | |
}, { | |
"tag": "category", | |
"attributes": { | |
"android:name": "de.myapp.app.de" | |
} | |
}] | |
}] | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_application_manifest": { | |
"element": { | |
"tag": "service", | |
"attributes": { | |
"android:name": "io.trigger.forge.android.modules.pushnotifications.MyGcmListenerService", | |
"android:exported": "false" | |
}, | |
"children": [{ | |
"tag": "intent-filter", | |
"children": [{ | |
"tag": "action", | |
"attributes": { | |
"android:name": "com.google.android.c2dm.intent.RECEIVE" | |
} | |
}] | |
}] | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_application_manifest": { | |
"element": { | |
"tag": "service", | |
"attributes": { | |
"android:name": "io.trigger.forge.android.modules.pushnotifications.MyInstanceIDListenerService", | |
"android:exported": "false" | |
}, | |
"children": [{ | |
"tag": "intent-filter", | |
"children": [{ | |
"tag": "action", | |
"attributes": { | |
"android:name": "com.google.android.gms.iid.InstanceID" | |
} | |
}] | |
}] | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_application_manifest": { | |
"element": { | |
"tag": "meta-data", | |
"attributes": { | |
"android:name": "com.google.android.gms.version", | |
"android:value": "@integer/google_play_services_version" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_proguard_rule": { | |
"rule": "-keep class * extends java.util.ListResourceBundle {\n protected Object[][] getContents();\n}" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_proguard_rule": { | |
"rule": "-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {\n public static final *** NULL;\n}" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_proguard_rule": { | |
"rule": "-keepnames @com.google.android.gms.common.annotation.KeepName class *\n-keepclassmembernames class * {\n @com.google.android.gms.common.annotation.KeepName *;\n}" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_proguard_rule": { | |
"rule": "-keepnames class * implements android.os.Parcelable {\n public static final ** CREATOR;\n}" | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_application_manifest": { | |
"element": { | |
"tag": "receiver", | |
"attributes": { | |
"android:name": "io.trigger.forge.android.modules.pushnotifications.NotificationPublisher" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_application_manifest": { | |
"element": { | |
"tag": "receiver", | |
"attributes": { | |
"android:name": "io.trigger.forge.android.modules.pushnotifications.NotificationReceiver" | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"do": { | |
"android_add_to_activity_manifest": { | |
"element": { | |
"tag": "intent-filter", | |
"children": [{ | |
"tag": "action", | |
"attributes": { | |
"android:name": "default" | |
} | |
}, { | |
"tag": "category", | |
"attributes": { | |
"android:name": "android.intent.category.DEFAULT" | |
} | |
}] | |
} | |
} | |
} | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: "com.android.application" | |
android { | |
compileSdkVersion rootProject.ext.compileSdkVersion | |
buildToolsVersion rootProject.ext.buildToolsVersion | |
defaultConfig { | |
applicationId "io.trigger.forge.android.inspector" | |
minSdkVersion rootProject.ext.minSdkVersion | |
targetSdkVersion rootProject.ext.targetSdkVersion | |
compileOptions rootProject.ext.compileOptions | |
manifestPlaceholders = moduleManifestPlaceholders() | |
multiDexEnabled true | |
} | |
flavorDimensions "default" | |
productFlavors { | |
vanilla { | |
dimension "default" | |
} | |
crosswalk { | |
dimension "default" | |
minSdkVersion moduleMinSdkVersion() ?: 16 | |
ndk { | |
abiFilters "armeabi-v7a", "" | |
} | |
} | |
} | |
sourceSets { | |
main { | |
manifest.srcFile "AndroidManifest.xml" | |
java.srcDirs = ["src"] | |
resources.srcDirs = ["src"] | |
aidl.srcDirs = ["src"] | |
renderscript.srcDirs = ["src"] | |
res.srcDirs = ["res"] + new File("ForgeInspector").listFiles().findAll { | |
it.isDirectory() and it.name.startsWith("res_module_") | |
}.collect { | |
println "Added module resource directory: " + it | |
it.name | |
} | |
assets.srcDirs = ["assets"] | |
} | |
} | |
buildTypes { | |
debug rootProject.ext.debug | |
release rootProject.ext.release << { | |
proguardFile getDefaultProguardFile("proguard-android.txt") | |
proguardFile "proguard-project.txt" | |
} | |
} | |
lintOptions { | |
abortOnError false | |
} | |
aaptOptions { | |
noCompress "xml", "png" | |
} | |
} | |
dependencies { | |
crosswalkImplementation "org.xwalk:xwalk_core_library:" + rootProject.ext.crosswalkVersion | |
crosswalkImplementation project(path: ":ForgeModule") | |
vanillaImplementation project(path: ":ForgeModule") | |
implementation fileTree(dir: "libs", include: ["*.jar"], exclude: ["forgecore.jar", "guava-13.0.1.jar"]) | |
} | |
repositories{ | |
flatDir { | |
dirs "../ForgeModule/libs" | |
} | |
} | |
// Force Android support library version for Crosswalk builds | |
configurations.all { conf -> | |
if (conf.name.contains("crosswalk")) { | |
println "Munging support library for: " + conf.name | |
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | |
def requested = details.requested | |
if (requested.group == "com.android.support") { | |
if (!requested.name.startsWith("multidex")) { | |
details.useVersion rootProject.ext.supportLibraryVersion | |
} | |
} | |
} | |
} | |
} | |
// Apply custom gradle plugins | |
for (Object plugin : moduleGradlePlugins()) { | |
println "Applying gradle plugin: " + plugin | |
project.plugins.apply(plugin.name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.library' | |
android { | |
compileSdkVersion rootProject.ext.compileSdkVersion | |
buildToolsVersion rootProject.ext.buildToolsVersion | |
defaultConfig { | |
minSdkVersion rootProject.ext.minSdkVersion | |
targetSdkVersion rootProject.ext.targetSdkVersion | |
compileOptions rootProject.ext.compileOptions | |
manifestPlaceholders = moduleManifestPlaceholders() | |
} | |
flavorDimensions "default" | |
productFlavors { | |
vanilla { | |
dimension "default" | |
} | |
crosswalk { | |
dimension "default" | |
minSdkVersion moduleMinSdkVersion() ?: 16 | |
ndk { | |
abiFilters "armeabi-v7a", "" | |
} | |
} | |
} | |
sourceSets { | |
main { | |
manifest.srcFile 'AndroidManifest.xml' | |
java.srcDirs = ['src'] | |
resources.srcDirs = ['src'] | |
aidl.srcDirs = ['src'] | |
renderscript.srcDirs = ['src'] | |
res.srcDirs = ['res'] | |
assets.srcDirs = ['assets'] | |
jniLibs.srcDirs = ['libs'] | |
} | |
crosswalk { | |
java.srcDirs = ["flavors/crosswalk/src"] | |
} | |
vanilla { | |
java.srcDirs = ["flavors/vanilla/src"] | |
} | |
} | |
buildTypes { | |
debug rootProject.ext.debug | |
release rootProject.ext.release << { | |
proguardFile getDefaultProguardFile("proguard-android.txt") | |
proguardFile "../ForgeInspector/proguard-project.txt" | |
} | |
} | |
lintOptions { | |
abortOnError false | |
} | |
} | |
dependencies { | |
implementation fileTree(dir: "libs", include: ["*.jar"], exclude: ["android-support-v4.jar", | |
"forgecore.jar", | |
"guava-13.0.1.jar", | |
"metadata-extractor-2.6.4.jar", | |
"org.apache.http.legacy.jar", | |
"xmpcore.jar"]) | |
implementation "com.android.support:support-v4:" + rootProject.ext.supportLibraryVersion | |
implementation "com.android.support:appcompat-v7:" + rootProject.ext.supportLibraryVersion | |
implementation "com.google.guava:guava:13.0.1" | |
implementation 'com.google.android.gms:play-services:11.0.4' | |
crosswalkImplementation "org.xwalk:xwalk_core_library:" + rootProject.ext.crosswalkVersion | |
vanillaImplementation (name:'ForgeCore-vanilla-debug', ext:'aar') | |
crosswalkImplementation (name:'ForgeCore-crosswalk-debug', ext:'aar') | |
implementation moduleDependencies() | |
} | |
repositories{ | |
flatDir { | |
dirs 'libs' | |
} | |
} | |
task updateModule (dependsOn: ":ForgeModule:assembleRelease") { | |
doLast { | |
// copy vanilla jar for backwards compatibility | |
copy { | |
from "build/intermediates/bundles/vanilla/debug/classes.jar" | |
into "../../../module/android" | |
rename { "module.jar" } | |
} | |
println "\n\tUpdated module/android/module.jar" | |
// copy aar flavors for platforms >= 2.4.1 | |
copy { | |
from "build/outputs/aar/ForgeModule-vanilla-release.aar" | |
into "../../../module/android" | |
} | |
println "\tUpdated module/android/ForgeModule-vanilla-release.aar" | |
copy { | |
from "build/outputs/aar/ForgeModule-crosswalk-release.aar" | |
into "../../../module/android" | |
} | |
println "\tUpdated module/android/ForgeModule-crosswalk-release.aar\n" | |
} | |
} | |
// Force Android support library version for Crosswalk builds | |
configurations.all { conf -> | |
if (conf.name.contains("crosswalk")) { | |
println "Munging support library for: " + conf.name | |
resolutionStrategy.eachDependency { DependencyResolveDetails details -> | |
def requested = details.requested | |
if (requested.group == "com.android.support") { | |
if (!requested.name.startsWith("multidex")) { | |
details.useVersion rootProject.ext.supportLibraryVersion | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment