Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/join native as build type #920

Open
wants to merge 5 commits into
base: release/2.3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ buildscript {
}

repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.3.0'
}
}

Expand All @@ -24,18 +25,14 @@ def isReleaseBuild() {
}

allprojects {
version = VERSION_NAME
group = GROUP

repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
8 changes: 5 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=2.2.9-native
VERSION_CODE=28
GROUP=com.yalantis

POM_DESCRIPTION=Android Library for cropping images
Expand All @@ -31,4 +29,8 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=yalantis
POM_DEVELOPER_NAME=Yalantis
android.useAndroidX=true
android.useAndroidX=true

# TODO remove after migration to kotlin
android.nonFinalResIds=false
android.nonTransitiveRClass=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
92 changes: 46 additions & 46 deletions mavenpush.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,6 @@ def getRepositoryPassword() {
return hasProperty('nexusPassword') ? nexusPassword : ""
}


tasks.register('androidJavadocs', Javadoc) {
source = android.sourceSets.main.java.sourceFiles
}

tasks.register('androidJavadocsJar', Jar) {
classifier = 'javadoc'
//basename = artifact_id
from androidJavadocs.destinationDir
}

tasks.register('androidSourcesJar', Jar) {
classifier = 'sources'
//basename = artifact_id
from android.sourceSets.main.java.sourceFiles
}

publishing {
repositories {
maven {
Expand All @@ -47,40 +30,56 @@ publishing {
}
}
}
repositories {
mavenLocal()
}
publications {
maven(MavenPublication) {
nativeRelease(MavenPublication) {
afterEvaluate { project ->
from components.release
artifact androidSourcesJar
artifact androidJavadocsJar
version = project.version
def baseName = project.android.defaultConfig.versionName
def suffix = project.android.productFlavors.getByName("native").versionNameSuffix
version = baseName + (suffix ? suffix : "")
from components.nativeRelease
}
applyDefaultPomInfo(nativeRelease)
}
nonNativeRelease(MavenPublication) {
alias = true
afterEvaluate { project ->
def baseName = project.android.defaultConfig.versionName
def suffix = project.android.productFlavors.getByName("nonNative").versionNameSuffix
version = baseName + (suffix ? suffix : "")
from components.nonNativeRelease
}
applyDefaultPomInfo(nonNativeRelease)
}
}
}

pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}
def applyDefaultPomInfo(MavenPublication publication) {
publication.pom {
name = POM_NAME
packaging = POM_PACKAGING
description = POM_DESCRIPTION
url = POM_URL
scm {
url = POM_SCM_URL
connection = POM_SCM_CONNECTION
developerConnection = POM_SCM_DEV_CONNECTION
}

licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}
licenses {
license {
name = POM_LICENCE_NAME
url = POM_LICENCE_URL
distribution = POM_LICENCE_DIST
}
}

developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
developers {
developer {
id = POM_DEVELOPER_ID
name = POM_DEVELOPER_NAME
}
}
}
Expand All @@ -89,7 +88,8 @@ publishing {

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("publishing") }
sign publishing.publications.maven
sign publishing.publications.nativeRelease
sign publishing.publications.nonNativeRelease
sign configurations.archives
}

21 changes: 17 additions & 4 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ android {
compileSdk 33
defaultConfig {
applicationId "com.yalantis.ucrop.sample"
minSdkVersion 14
namespace "com.yalantis.ucrop.sample"
minSdkVersion 21
targetSdkVersion 33
versionCode 13
versionName "1.2.4"
}
flavorDimensions "default"
buildFeatures {
buildConfig = true
}
buildTypes {
release {
minifyEnabled false
Expand All @@ -23,12 +26,22 @@ android {
lintOptions {
abortOnError false
}
flavorDimensions += "processing_type"
flavorDimensions += "app_type"
productFlavors {
activity {
buildConfigField("int","RequestMode", "1")
dimension = "app_type"
buildConfigField("int","REQUEST_MODE", "1")
}
fragment {
buildConfigField("int","RequestMode", "2")
dimension = "app_type"
buildConfigField("int","REQUEST_MODE", "2")
}
create("native") {
dimension = "processing_type"
}
create("nonNative") {
dimension = "processing_type"
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yalantis.ucrop.sample">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;

import com.yalantis.ucrop.UCrop;
import com.yalantis.ucrop.UCropActivity;
import com.yalantis.ucrop.UCropFragment;
Expand All @@ -34,13 +41,6 @@
import java.util.Locale;
import java.util.Random;

import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;

/**
* Created by Oleksii Shliama (https://github.com/shliama).
*/
Expand All @@ -62,7 +62,7 @@ public class SampleActivity extends BaseActivity implements UCropFragmentCallbac
private CheckBox mCheckBoxFreeStyleCrop;
private Toolbar toolbar;
private ScrollView settingsView;
private int requestMode = BuildConfig.RequestMode;
private int requestMode = BuildConfig.REQUEST_MODE;

private UCropFragment fragment;
private boolean mShowLoader;
Expand Down
47 changes: 40 additions & 7 deletions ucrop/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,60 @@
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply from: '../mavenpush.gradle'

android {
compileSdk 33
defaultConfig {
minSdkVersion 14
minSdkVersion 21
targetSdkVersion 33
versionCode 27
versionName "2.2.9-native"
versionName "2.3.0"
namespace "com.yalantis.ucrop"

vectorDrawables.useSupportLibrary = true

aarMetadata {
minCompileSdk = 21
}
}
publishing {
singleVariant('nativeRelease') {
withSourcesJar()
withJavadocJar()
}
singleVariant('nonNativeRelease') {
withSourcesJar()
withJavadocJar()
}
}
buildFeatures {
buildConfig = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

flavorDimensions += "processing_type"
productFlavors {
create("native") {
dimension = "processing_type"
versionNameSuffix = "-native"
buildConfigField("String", "TYPE", '"NATIVE"')
}
create("nonNative") {
dimension = "processing_type"
buildConfigField("String", "TYPE", '"NON_NATIVE"')
}
}

androidComponents {
onVariants(selector().withFlavor('processing_type', 'nonNative')) {
packaging.jniLibs.excludes.add('**/**.so')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -26,11 +64,6 @@ android {
}

resourcePrefix 'ucrop_'

sourceSets.main {
jni.srcDirs = []
}

}

dependencies {
Expand Down
6 changes: 5 additions & 1 deletion ucrop/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
POM_NAME=uCrop
POM_ARTIFACT_ID=ucrop
POM_PACKAGING=aar
POM_PACKAGING=aar

# TODO remove after migration to kotlin
android.nonFinalResIds=false
android.nonTransitiveRClass=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.yalantis.ucrop.backend;

public enum UCropBackendType {
NATIVE("NATIVE"),
DEFAULT("NON_NATIVE");

public final String label;

private UCropBackendType(String label) {
this.label = label;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package com.yalantis.ucrop.callback;

import android.graphics.Bitmap;

import com.yalantis.ucrop.model.ExifInfo;
import android.net.Uri;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.yalantis.ucrop.model.ExifInfo;

public interface BitmapLoadCallback {

void onBitmapLoaded(@NonNull Bitmap bitmap, @NonNull ExifInfo exifInfo, @NonNull String imageInputPath, @Nullable String imageOutputPath);
void onBitmapLoaded(@NonNull Bitmap bitmap, @NonNull ExifInfo exifInfo, @NonNull Uri imageInputUri, @Nullable Uri imageOutputUri);

void onFailure(@NonNull Exception bitmapWorkerException);

Expand Down
Loading