Skip to content

Commit

Permalink
Merge pull request #17 from eggheadgames/update_build_versions
Browse files Browse the repository at this point in the history
Update build versions
  • Loading branch information
mikemee authored May 16, 2020
2 parents 1ef4025 + 2f8767a commit 1d4c6c1
Showing 15 changed files with 122 additions and 56 deletions.
30 changes: 30 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
jobs:
build:
working_directory: ~/code
docker:
- image: circleci/android:api-29
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "library/build.gradle" }}
- run:
name: Download Dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "library/build.gradle" }}
- run:
name: Run Tests
command: ./gradlew check evaluateViolations test
- store_artifacts:
path: library/build/reports
destination: reports
- store_artifacts:
path: library/build/outputs
destination: reports
- store_test_results:
path: library/build/test-results
22 changes: 18 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext {
app = [
versionCode: 11,
versionName: "1.2.8"
]

general = [
compileSdkVersion: 29,
minSdkVersion : 15,
targetSdkVersion : 29,
buildToolsVersion: "29.0.3"
]
}

repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.android.tools.build:gradle:3.5.3'
}
}

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

12 changes: 0 additions & 12 deletions circle.yml

This file was deleted.

4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -15,4 +15,6 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Dec 28 10:00:20 PST 2015
#Tue Feb 25 09:26:59 EET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
48 changes: 35 additions & 13 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
plugins {
id 'com.android.library'
id 'com.novoda.static-analysis' version '1.2'
id "com.github.spotbugs" version '3.0.0'
}

group='com.github.eggheadgames'
group = 'com.github.eggheadgames'

repositories {
mavenCentral()
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
compileSdkVersion rootProject.ext.general.compileSdkVersion
buildToolsVersion rootProject.ext.general.buildToolsVersion

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 11
versionName "1.2.8"
minSdkVersion rootProject.ext.general.minSdkVersion
targetSdkVersion rootProject.ext.general.targetSdkVersion
versionCode rootProject.ext.general.versionCode
versionName rootProject.ext.general.versionName
}

lintOptions {
@@ -27,9 +30,28 @@ android {
}

dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
api files('libs/in-app-purchasing-2.0.61.jar')
api 'androidx.appcompat:appcompat:1.1.0'

compile files('libs/in-app-purchasing-2.0.61.jar')
compile 'com.android.support:appcompat-v7:23.2.1'
testImplementation 'junit:junit:4.13'
testImplementation 'org.mockito:mockito-core:2.24.0'
}

staticAnalysis {
penalty {
maxErrors = 0
maxWarnings = 0
}
pmd {
ignoreFailures = false
reportsDir = file("$project.buildDir/outputs/")
}
spotbugs {
ignoreFailures = false
reportsDir = file("$project.buildDir/outputs/")
reportLevel = "medium"
effort = "max"

excludeFilter rootProject.file('library/findbugs_excludes.xml')
}
}
10 changes: 10 additions & 0 deletions library/findbugs_excludes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<FindBugsFilter>

<Match>
<Class name="~.*R\$.*" />
</Match>
<Match>
<Class name="~.*Manifest\$.*" />
</Match>

</FindBugsFilter>

This file was deleted.

8 changes: 5 additions & 3 deletions library/src/main/java/com/android/vending/billing/Base64.java
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@

import android.annotation.SuppressLint;

import java.nio.charset.Charset;

/**
* Base64 converter class. This code is not a complete MIME encoder;
* it simply converts binary data to base64 data and back.
@@ -295,7 +297,7 @@ public static String encode(byte[] source, int off, int len, byte[] alphabet,
outLen -= 1;
}

return new String(outBuff, 0, outLen);
return new String(outBuff, 0, outLen, Charset.defaultCharset());
}

/**
@@ -430,7 +432,7 @@ private static int decode4to3(byte[] source, int srcOffset,
* @since 1.4
*/
public static byte[] decode(String s) throws Base64DecoderException {
byte[] bytes = s.getBytes();
byte[] bytes = s.getBytes(Charset.defaultCharset());
return decode(bytes, 0, bytes.length);
}

@@ -442,7 +444,7 @@ public static byte[] decode(String s) throws Base64DecoderException {
* @return the decoded data
*/
public static byte[] decodeWebSafe(String s) throws Base64DecoderException {
byte[] bytes = s.getBytes();
byte[] bytes = s.getBytes(Charset.defaultCharset());
return decodeWebSafe(bytes, 0, bytes.length);
}

Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
import android.text.TextUtils;
import android.util.Log;

import java.nio.charset.Charset;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
@@ -100,7 +101,7 @@ public static boolean verify(PublicKey publicKey, String signedData, String sign
try {
sig = Signature.getInstance(SIGNATURE_ALGORITHM);
sig.initVerify(publicKey);
sig.update(signedData.getBytes());
sig.update(signedData.getBytes(Charset.defaultCharset()));
if (!sig.verify(Base64.decode(signature))) {
Log.e(TAG, "Signature verification failed.");
return false;
Original file line number Diff line number Diff line change
@@ -65,6 +65,10 @@ public String getDescription() {
return mDescription;
}

public String getItemType() {
return mItemType;
}

@Override
public String toString() {
return "SkuDetails:" + mJson;
2 changes: 1 addition & 1 deletion library/src/main/java/com/billing/BillingService.java
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import android.app.Activity;
import android.content.Context;
import android.support.annotation.CallSuper;
import androidx.annotation.CallSuper;

import java.util.ArrayList;
import java.util.List;
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ public void onPurchaseResponse(PurchaseResponse response) {
@SuppressWarnings({"ConstantConditions", "ToArrayCallWithZeroLengthArrayArgument"})
@Override
public void onPurchaseUpdatesResponse(PurchaseUpdatesResponse response) {
logDebug("onPurchaseUpdatesResponse " + response.getRequestStatus());
logDebug("onPurchaseUpdatesResponse " + (response == null ? "null" : response.getRequestStatus()));
if (response == null)
return;
if (response.getRequestStatus() == PurchaseUpdatesResponse.RequestStatus.SUCCESSFUL) {
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.eggheadgames.inapppayments;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;

import com.billing.BillingService;
import com.billing.google.GoogleBillingService;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.eggheadgames.inapppayments;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;

@@ -15,16 +16,21 @@

public class IAPManager {

public static final int BUILD_TARGET_GOOGLE = 0;
public static final int BUILD_TARGET_AMAZON = 1;

@SuppressLint("StaticFieldLeak")
private static BillingService billingService;
public static int BUILD_TARGET_GOOGLE = 0;
public static int BUILD_TARGET_AMAZON = 1;

public static void build(Context context, int buildTarget, List<String> iapkeys) {
Context applicationContext = context.getApplicationContext();
Context contextLocal = applicationContext == null ? context : applicationContext;

//Build-specific initializations
if (buildTarget == BUILD_TARGET_GOOGLE) {
billingService = new GoogleBillingService(context, iapkeys);
billingService = new GoogleBillingService(contextLocal, iapkeys);
} else if (buildTarget == BUILD_TARGET_AMAZON) {
billingService = new AmazonBillingService(context, iapkeys);
billingService = new AmazonBillingService(contextLocal, iapkeys);
}
}

0 comments on commit 1d4c6c1

Please sign in to comment.