Add proprietary and foss product flavors

The introduction of the proprietary PhotoEditor SDK prevented this app from
being truly free and open source, and so F-Droid could no longer build the app.
By adding a licensing flavor dimension, we segregate the non-FOSS code to a
separate version, while providing a FOSS version without the editor.

To build the proprietary version, select one of the proprietary build variants
from Build Variants pane in Android Studio (on the left side of the window).

Fixes #1706.
This commit is contained in:
Leo Pham 2020-02-28 21:47:57 +11:00
parent 99547ac3ff
commit d917e42b72
6 changed files with 81 additions and 27 deletions

View file

@ -53,6 +53,16 @@ android {
main.java.srcDirs += 'src/main/kotlin'
}
flavorDimensions "licensing"
productFlavors {
proprietary { }
foss {
// We're not using PhotoEditor here, so changing the name is fine.
applicationIdSuffix ".foss"
versionNameSuffix "-foss"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
@ -92,28 +102,30 @@ dependencies {
}
// Apply the PESDKPlugin
apply plugin: 'ly.img.android.sdk'
if (is_proprietary) {
apply plugin: 'ly.img.android.sdk'
imglyConfig {
pesdk {
enabled true
licencePath 'pesdk_license'
}
imglyConfig {
pesdk {
enabled true
licencePath 'pesdk_license'
}
supportLibVersion "28.0.0"
supportLibVersion "28.0.0"
modules {
include 'ui:core'
include 'ui:text'
include 'ui:focus'
include 'ui:brush'
include 'ui:filter'
include 'ui:transform'
include 'ui:adjustment'
modules {
include 'ui:core'
include 'ui:text'
include 'ui:focus'
include 'ui:brush'
include 'ui:filter'
include 'ui:transform'
include 'ui:adjustment'
include 'backend:serializer'
include 'backend:serializer'
include 'assets:font-basic'
include 'assets:filter-basic'
include 'assets:font-basic'
include 'assets:filter-basic'
}
}
}

View file

@ -201,20 +201,18 @@
</activity>
<activity
android:name=".activities.NewEditActivity"
android:name=".activities.EditActivity"
android:label="@string/editor">
<intent-filter>
<intent-filter
android:name="foss-editor">
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
<activity
android:name=".activities.EditActivity"
android:label="@string/editor">
<intent-filter>
<action android:name="com.android.camera.action.CROP"/>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.simplemobiletools.gallery.pro"
android:installLocation="auto">
<application
android:name=".App">
<activity
android:name=".activities.EditActivity">
<intent-filter
android:name="foss-editor"
tools:node="remove">
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
<activity
android:name=".activities.NewEditActivity"
android:label="@string/editor">
<intent-filter>
<action android:name="android.intent.action.EDIT"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -2,17 +2,22 @@
buildscript {
ext.kotlin_version = '1.3.61'
ext.is_proprietary = gradle.startParameter.taskNames.any { task -> task.contains("Proprietary") }
repositories {
google()
jcenter()
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
if (is_proprietary) {
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'ly.img.android.pesdk:plugin:7.0.10'
if (is_proprietary) {
classpath 'ly.img.android.pesdk:plugin:7.0.10'
}
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files