Skip to content

Commit 3f8c37f

Browse files
authored
Merge pull request #15 from jquick-axway/TIMOB-27730
feat(android): migrate to gradle and AndroidX Fixes TIMOB-27730
2 parents 9072e52 + 2ff1465 commit 3f8c37f

26 files changed

+6550
-192
lines changed

.eslintignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
3+
android/bin/
4+
android/build/
5+
android/dist/
6+
ios/build/
7+
ios/dist/
8+
9+
# These should eventually be linted as well
10+
android/example/
11+
ios/example/

.eslintrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": [ "axway/env-titanium", "axway/env-node" ],
3+
"parserOptions": {
4+
"ecmaVersion": 2015,
5+
"sourceType": "script"
6+
},
7+
"overrides": [
8+
{
9+
"files": [ "dangerfile.js" ],
10+
"parserOptions": {
11+
"ecmaVersion": 2017,
12+
"sourceType": "module"
13+
}
14+
}
15+
]
16+
}

.gitignore

+38-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
11
.DS_Store
2-
metadata.json
3-
*.zip
2+
tmp
3+
bin
4+
build
5+
6+
*/*/modules
7+
*/*/modules*
8+
.apt_generated
9+
build.properties
10+
.gitignore
11+
.svn
12+
*.pyc
13+
*~.nib/
14+
*.pbxuser
15+
*.perspective
16+
*.perspectivev3
417
*.xcworkspace/
18+
xcuserdata
519
*.xcuserstate
6-
xcuserdata/
7-
build/
8-
/android/dist
9-
ios/titanium-web-dialog.xcodeproj/project.xcworkspace/xcuserdata
10-
android/libs
20+
*.xcuserdata*
21+
22+
.idea/
23+
libs/
24+
25+
android/clean
26+
android/ant_clean
27+
android/.classpath
28+
android/.settings
29+
android/dist/
30+
android/launch-*
31+
android/java-sources.txt
32+
nbproject
33+
/ios/metadata.json
34+
/ios/dist
35+
/ios/ti.map-iphone-*.zip
36+
37+
node_modules/
38+
39+
TESTS-*.xml
40+
41+
.vscode/

.npmignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
android/documentation/
2+
android/example/
3+
4+
iphone/documentation/
5+
iphone/example/
6+
iphone/platform/
7+
8+
test/
9+
apidoc/
10+
Jenkinsfile
11+
dangerfile.js

Jenkinsfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
@Library('pipeline-library') _
1+
library 'pipeline-library'
2+
3+
def isMaster = env.BRANCH_NAME.equals('master')
24

35
buildModule {
4-
// defaults:
5-
//nodeVersion = '4.7.3' // Must have version set up on Jenkins master before it can be changed
6-
//sdkVersion = '6.0.3.GA'
7-
//androidAPILevel = '23' // if changed, must install on build nodes
6+
sdkVersion = '9.0.0.v20200127103011'
7+
npmPublish = isMaster // By default it'll do github release on master anyways too
8+
iosLabels = 'osx && xcode-11'
89
}

android/.classpath

-11
This file was deleted.

android/.project

-29
This file was deleted.

android/.settings/org.eclipse.jdt.apt.core.prefs

-7
This file was deleted.

android/.settings/org.eclipse.jdt.core.prefs

-3
This file was deleted.

android/build.gradle

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
dependencies {
3+
implementation 'androidx.browser:browser:1.2.0'
4+
}

android/build.properties

-3
This file was deleted.

android/build.xml

-56
This file was deleted.

android/java-sources.txt

-10
This file was deleted.

android/lib/custom-tabs.jar

-40.7 KB
Binary file not shown.

android/manifest

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# this is your module manifest and used by Titanium
33
# during compilation, packaging, distribution, etc.
44
#
5-
version: 1.1.0
5+
version: 2.0.0
66
apiversion: 4
7-
architectures: arm64-v8a armeabi-v7a x86
7+
architectures: arm64-v8a armeabi-v7a x86 x86_64
88
description: titanium-web-dialog
99
author: Prashant Saini
1010
license: Apache 2.0
@@ -15,4 +15,4 @@ name: titanium-web-dialog
1515
moduleid: ti.webdialog
1616
guid: 1f19cce1-0ad7-4e25-ab3b-0666f54a0a49
1717
platform: android
18-
minsdk: 7.0.0
18+
minsdk: 9.0.0

android/src/ti/webdialog/TitaniumWebDialogModule.java

+12-14
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,29 @@
88
*/
99
package ti.webdialog;
1010

11+
import android.content.Context;
12+
import android.content.Intent;
13+
import android.content.pm.ResolveInfo;
14+
import android.graphics.Bitmap;
15+
import android.graphics.BitmapFactory;
16+
import android.graphics.drawable.BitmapDrawable;
17+
import android.graphics.drawable.Drawable;
18+
import android.net.Uri;
19+
import android.util.DisplayMetrics;
20+
import androidx.browser.customtabs.CustomTabsIntent;
21+
import androidx.browser.customtabs.CustomTabsService;
1122
import java.util.ArrayList;
1223
import java.util.List;
13-
1424
import org.appcelerator.kroll.KrollDict;
1525
import org.appcelerator.kroll.KrollModule;
1626
import org.appcelerator.kroll.annotations.Kroll;
27+
import org.appcelerator.kroll.common.Log;
1728
import org.appcelerator.titanium.TiApplication;
1829
import org.appcelerator.titanium.TiBlob;
1930
import org.appcelerator.titanium.util.TiFileHelper;
2031
import org.appcelerator.titanium.util.TiUIHelper;
2132
import org.appcelerator.titanium.util.TiUrl;
2233
import org.appcelerator.titanium.view.TiDrawableReference;
23-
import org.appcelerator.kroll.common.Log;
24-
25-
import android.content.Context;
26-
import android.content.Intent;
27-
import android.content.pm.ResolveInfo;
28-
import android.net.Uri;
29-
import android.graphics.Bitmap;
30-
import android.graphics.BitmapFactory;
31-
import android.graphics.drawable.BitmapDrawable;
32-
import android.graphics.drawable.Drawable;
33-
import android.support.customtabs.CustomTabsIntent;
34-
import android.support.customtabs.CustomTabsService;
35-
import android.util.DisplayMetrics;
3634

3735
@Kroll.module(name = "TitaniumWebDialog", id = "ti.webdialog")
3836
public class TitaniumWebDialogModule extends KrollModule

android/src/ti/webdialog/Utils.java

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package ti.webdialog;
22

3-
import java.lang.reflect.Field;
4-
import java.util.List;
5-
6-
import org.appcelerator.kroll.KrollDict;
7-
import org.appcelerator.titanium.TiApplication;
8-
import org.appcelerator.titanium.util.TiRHelper;
9-
import org.appcelerator.titanium.util.TiConvert;
10-
import org.appcelerator.titanium.util.TiRHelper.ResourceNotFoundException;
11-
123
import android.content.Context;
134
import android.content.Intent;
145
import android.content.pm.ResolveInfo;
156
import android.graphics.Bitmap;
167
import android.net.Uri;
178
import android.util.DisplayMetrics;
9+
import java.lang.reflect.Field;
10+
import java.util.List;
11+
import org.appcelerator.kroll.KrollDict;
12+
import org.appcelerator.titanium.TiApplication;
13+
import org.appcelerator.titanium.util.TiConvert;
14+
import org.appcelerator.titanium.util.TiRHelper;
15+
import org.appcelerator.titanium.util.TiRHelper.ResourceNotFoundException;
1816

1917
public class Utils
2018
{

apidoc/WebDialog.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,4 @@ properties:
203203
optional: true
204204
type: Number
205205
constants: Titanium.Android.FLAG_*
206-
platform: [android]
206+
platforms: [android]

dangerfile.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* global danger, fail, message */
2+
3+
// requires
4+
const junit = require('@seadub/danger-plugin-junit').default;
5+
const dependencies = require('@seadub/danger-plugin-dependencies').default;
6+
const moduleLint = require('@seadub/danger-plugin-titanium-module').default;
7+
const fs = require('fs');
8+
const path = require('path');
9+
const ENV = process.env;
10+
11+
// Add links to artifacts we've stuffed into the ENV.ARTIFACTS variable
12+
async function linkToArtifacts() {
13+
if (ENV.ARTIFACTS && (ENV.BUILD_STATUS === 'SUCCESS' || ENV.BUILD_STATUS === 'UNSTABLE')) {
14+
const artifacts = ENV.ARTIFACTS.split(';');
15+
if (artifacts.length !== 0) {
16+
const artifactsListing = '- ' + artifacts.map(a => danger.utils.href(`${ENV.BUILD_URL}artifact/${a}`, a)).join('\n- ');
17+
message(`:floppy_disk: Here are the artifacts produced:\n${artifactsListing}`);
18+
}
19+
}
20+
}
21+
22+
async function checkLintLog() {
23+
const lintLog = path.join(__dirname, 'lint.log');
24+
if (!fs.existsSync(lintLog)) {
25+
return;
26+
}
27+
const contents = fs.readFileSync(lintLog, 'utf8');
28+
fail('`npm run lint` failed, please check messages below for output.');
29+
message(`:bomb: Here's the output of \`npm run lint\`:\n\`\`\`${contents}\`\`\``);
30+
}
31+
32+
async function main() {
33+
// do a bunch of things in parallel
34+
// Specifically, anything that collects what labels to add or remove has to be done first before...
35+
await Promise.all([
36+
junit({ pathToReport: './TESTS-*.xml' }),
37+
dependencies({ type: 'npm' }),
38+
linkToArtifacts(),
39+
checkLintLog(),
40+
moduleLint(),
41+
]);
42+
}
43+
main()
44+
.then(() => process.exit(0))
45+
.catch(err => {
46+
fail(err.toString());
47+
process.exit(1);
48+
});

0 commit comments

Comments
 (0)