Skip to content

Commit

Permalink
Merge pull request #15 from jquick-axway/TIMOB-27730
Browse files Browse the repository at this point in the history
feat(android): migrate to gradle and AndroidX

Fixes TIMOB-27730
  • Loading branch information
sgtcoolguy authored Feb 10, 2020
2 parents 9072e52 + 2ff1465 commit 3f8c37f
Show file tree
Hide file tree
Showing 26 changed files with 6,550 additions and 192 deletions.
11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules

android/bin/
android/build/
android/dist/
ios/build/
ios/dist/

# These should eventually be linted as well
android/example/
ios/example/
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": [ "axway/env-titanium", "axway/env-node" ],
"parserOptions": {
"ecmaVersion": 2015,
"sourceType": "script"
},
"overrides": [
{
"files": [ "dangerfile.js" ],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
}
}
]
}
45 changes: 38 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
.DS_Store
metadata.json
*.zip
tmp
bin
build

*/*/modules
*/*/modules*
.apt_generated
build.properties
.gitignore
.svn
*.pyc
*~.nib/
*.pbxuser
*.perspective
*.perspectivev3
*.xcworkspace/
xcuserdata
*.xcuserstate
xcuserdata/
build/
/android/dist
ios/titanium-web-dialog.xcodeproj/project.xcworkspace/xcuserdata
android/libs
*.xcuserdata*

.idea/
libs/

android/clean
android/ant_clean
android/.classpath
android/.settings
android/dist/
android/launch-*
android/java-sources.txt
nbproject
/ios/metadata.json
/ios/dist
/ios/ti.map-iphone-*.zip

node_modules/

TESTS-*.xml

.vscode/
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
android/documentation/
android/example/

iphone/documentation/
iphone/example/
iphone/platform/

test/
apidoc/
Jenkinsfile
dangerfile.js
11 changes: 6 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@Library('pipeline-library') _
library 'pipeline-library'

def isMaster = env.BRANCH_NAME.equals('master')

buildModule {
// defaults:
//nodeVersion = '4.7.3' // Must have version set up on Jenkins master before it can be changed
//sdkVersion = '6.0.3.GA'
//androidAPILevel = '23' // if changed, must install on build nodes
sdkVersion = '9.0.0.v20200127103011'
npmPublish = isMaster // By default it'll do github release on master anyways too
iosLabels = 'osx && xcode-11'
}
11 changes: 0 additions & 11 deletions android/.classpath

This file was deleted.

29 changes: 0 additions & 29 deletions android/.project

This file was deleted.

7 changes: 0 additions & 7 deletions android/.settings/org.eclipse.jdt.apt.core.prefs

This file was deleted.

3 changes: 0 additions & 3 deletions android/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

dependencies {
implementation 'androidx.browser:browser:1.2.0'
}
3 changes: 0 additions & 3 deletions android/build.properties

This file was deleted.

56 changes: 0 additions & 56 deletions android/build.xml

This file was deleted.

10 changes: 0 additions & 10 deletions android/java-sources.txt

This file was deleted.

Binary file removed android/lib/custom-tabs.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.1.0
version: 2.0.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: titanium-web-dialog
author: Prashant Saini
license: Apache 2.0
Expand All @@ -15,4 +15,4 @@ name: titanium-web-dialog
moduleid: ti.webdialog
guid: 1f19cce1-0ad7-4e25-ab3b-0666f54a0a49
platform: android
minsdk: 7.0.0
minsdk: 9.0.0
26 changes: 12 additions & 14 deletions android/src/ti/webdialog/TitaniumWebDialogModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,29 @@
*/
package ti.webdialog;

import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.util.DisplayMetrics;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsService;
import java.util.ArrayList;
import java.util.List;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollModule;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiBlob;
import org.appcelerator.titanium.util.TiFileHelper;
import org.appcelerator.titanium.util.TiUIHelper;
import org.appcelerator.titanium.util.TiUrl;
import org.appcelerator.titanium.view.TiDrawableReference;
import org.appcelerator.kroll.common.Log;

import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.customtabs.CustomTabsIntent;
import android.support.customtabs.CustomTabsService;
import android.util.DisplayMetrics;

@Kroll.module(name = "TitaniumWebDialog", id = "ti.webdialog")
public class TitaniumWebDialogModule extends KrollModule
Expand Down
16 changes: 7 additions & 9 deletions android/src/ti/webdialog/Utils.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package ti.webdialog;

import java.lang.reflect.Field;
import java.util.List;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.util.TiRHelper;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiRHelper.ResourceNotFoundException;

import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.net.Uri;
import android.util.DisplayMetrics;
import java.lang.reflect.Field;
import java.util.List;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.util.TiConvert;
import org.appcelerator.titanium.util.TiRHelper;
import org.appcelerator.titanium.util.TiRHelper.ResourceNotFoundException;

public class Utils
{
Expand Down
2 changes: 1 addition & 1 deletion apidoc/WebDialog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ properties:
optional: true
type: Number
constants: Titanium.Android.FLAG_*
platform: [android]
platforms: [android]
48 changes: 48 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* global danger, fail, message */

// requires
const junit = require('@seadub/danger-plugin-junit').default;
const dependencies = require('@seadub/danger-plugin-dependencies').default;
const moduleLint = require('@seadub/danger-plugin-titanium-module').default;
const fs = require('fs');
const path = require('path');
const ENV = process.env;

// Add links to artifacts we've stuffed into the ENV.ARTIFACTS variable
async function linkToArtifacts() {
if (ENV.ARTIFACTS && (ENV.BUILD_STATUS === 'SUCCESS' || ENV.BUILD_STATUS === 'UNSTABLE')) {
const artifacts = ENV.ARTIFACTS.split(';');
if (artifacts.length !== 0) {
const artifactsListing = '- ' + artifacts.map(a => danger.utils.href(`${ENV.BUILD_URL}artifact/${a}`, a)).join('\n- ');
message(`:floppy_disk: Here are the artifacts produced:\n${artifactsListing}`);
}
}
}

async function checkLintLog() {
const lintLog = path.join(__dirname, 'lint.log');
if (!fs.existsSync(lintLog)) {
return;
}
const contents = fs.readFileSync(lintLog, 'utf8');
fail('`npm run lint` failed, please check messages below for output.');
message(`:bomb: Here's the output of \`npm run lint\`:\n\`\`\`${contents}\`\`\``);
}

async function main() {
// do a bunch of things in parallel
// Specifically, anything that collects what labels to add or remove has to be done first before...
await Promise.all([
junit({ pathToReport: './TESTS-*.xml' }),
dependencies({ type: 'npm' }),
linkToArtifacts(),
checkLintLog(),
moduleLint(),
]);
}
main()
.then(() => process.exit(0))
.catch(err => {
fail(err.toString());
process.exit(1);
});
Loading

0 comments on commit 3f8c37f

Please sign in to comment.