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

chore(android): migrate to gradle #44

Merged
merged 63 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
2f9326f
chore: update npm org name to @titanium-sdk
sgtcoolguy Oct 15, 2019
9201fab
chore(package): add husky 3.0.9
sgtcoolguy Oct 15, 2019
5497174
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
1da5b38
chore(package): add @commitlint/cli 8.2.0
sgtcoolguy Oct 15, 2019
a23d544
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
acc2bc6
chore(package): add @commitlint/config-conventional 8.2.0
sgtcoolguy Oct 15, 2019
e67e76a
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
d73cc75
build: hook up commitlint config
sgtcoolguy Oct 15, 2019
431bbcc
chore(package): add lint-staged 9.4.2
sgtcoolguy Oct 15, 2019
9e68863
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
c1b4622
build: add husky hooks
sgtcoolguy Oct 15, 2019
d2e7242
chore(package): add clang-format 1.2.3
sgtcoolguy Oct 15, 2019
3b093e5
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
7f518e9
style: hook clang-format to lint-staged/husky
sgtcoolguy Oct 15, 2019
c6e3090
chore(package): add @seadub/clang-format-lint 0.0.2
sgtcoolguy Oct 15, 2019
e1db80f
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
52e985a
chore(package): update karma-titanium-launcher to 0.7.5
sgtcoolguy Oct 15, 2019
3facccb
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
c3cc0a4
chore(package): add commitizen 4.0.3
sgtcoolguy Oct 15, 2019
a85f2d0
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
c699dd4
build: hook commitizen config/script
sgtcoolguy Oct 15, 2019
62948d3
build: add npm scripts for lint/format/test
sgtcoolguy Oct 15, 2019
61bcf40
chore(package): add titanium-docgen 0.2.0
sgtcoolguy Oct 15, 2019
826f4f5
chore(package): update lockfile
sgtcoolguy Oct 15, 2019
2296cbb
style: fix type whitelist for doc validation
sgtcoolguy Oct 15, 2019
6ff3ca6
style: add clang-format config files
sgtcoolguy Oct 15, 2019
5693a4b
style(android): fix formatting
sgtcoolguy Oct 15, 2019
55bab83
style(ios): fix formatting
sgtcoolguy Oct 15, 2019
31cd091
style: add eslint config files
sgtcoolguy Oct 15, 2019
74be64e
style(js): fix eslint errors
sgtcoolguy Oct 15, 2019
4bf1cc7
chore(package): update lockfile from npm audit fix
sgtcoolguy Oct 15, 2019
95f526e
ci(danger): check lint log via danger.js
sgtcoolguy Oct 15, 2019
f415654
chore(package): update @seadub/danger-plugin-junit to 0.1.2
sgtcoolguy Oct 15, 2019
d3d2f78
chore(package): add @seadub/danger-plugin-titanium-module@0.0.4
sgtcoolguy Feb 3, 2020
f9bc1d1
chore(package): update lockfile
sgtcoolguy Feb 3, 2020
ebaafde
ci(danger): add module linting to danger.js
sgtcoolguy Feb 3, 2020
0a6ecbc
ci(jenkins): use SDk 9.0.0 master build, never publish to npm
sgtcoolguy Feb 5, 2020
9f78428
fix(android): fix build issue around setter annotation
sgtcoolguy Feb 5, 2020
22e13be
chore(android): migrate to gradle, update sqlcipher to 4.3.0
Jan 28, 2020
2416a3e
chore(android): remove redundant platform dir
Jan 28, 2020
6e8f6d7
chore(package): update @seadub/danger-plugin-titanium-module to 0.0.6
sgtcoolguy Feb 5, 2020
29fc35b
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
9e33fa6
test: use same sdk version as jenkins
sgtcoolguy Feb 5, 2020
892967d
chore(release): update package.json version to 4.0.0
sgtcoolguy Feb 5, 2020
ee2abc1
chore(package): update to titanium-docgen 4.2.0
sgtcoolguy Feb 5, 2020
02bd248
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
ef303a2
chore(package): update to danger 9.2.10
sgtcoolguy Feb 5, 2020
5e71300
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
be3928a
chore(package): update to husky 4.2.1
sgtcoolguy Feb 5, 2020
e2fd5ca
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
d3533ec
chore(package): update to lint-staged 10.0.7
sgtcoolguy Feb 5, 2020
7e26e74
chore: fix lint-staged to remove unnecessary git add commands
sgtcoolguy Feb 5, 2020
e1f9ed3
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
c77d0d0
chore(package): update to eslint 6.8.0
sgtcoolguy Feb 5, 2020
6693783
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
cfc76c3
chore(package): update to eslint-config-axway 4.5.0
sgtcoolguy Feb 5, 2020
62bcdf0
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
36babb9
chore(package): update to @commitlint/cli 8.3.5
sgtcoolguy Feb 5, 2020
715e991
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
d3065fe
chore(package): update to @commitlint/config-conventional 8.3.4
sgtcoolguy Feb 5, 2020
882a70f
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
c6b6dbd
chore(package): update to socket.io 2.3.0
sgtcoolguy Feb 5, 2020
79486ad
chore(package): update lockfile
sgtcoolguy Feb 5, 2020
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
10 changes: 10 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules

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

# These should eventually be linted as well
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"
}
}
]
}
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library 'pipeline-library'

buildModule {
sdkVersion = '8.2.0.GA'
sdkVersion = '9.0.0.v20200128095338'
npmPublish = false // By default it'll do github release on master anyways too
}
26 changes: 26 additions & 0 deletions android/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
Language: Java
AccessModifierOffset: -4
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
# class, constructor, method should be next line
BreakBeforeBraces: Linux
# Keep '=' at end of line when wrapping, but move things like '&&', '||' to beginning of newline
BreakBeforeBinaryOperators: NonAssignment
# FIXME: break for brace after synchronized block, anonymous class declarations
BreakAfterJavaFieldAnnotations: true
ColumnLimit: 120
IndentCaseLabels: true
IndentWidth: 4
MaxEmptyLinesToKeep: 1
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
TabWidth: 4
UseTab: ForContinuationAndIndentation
SpaceAfterCStyleCast: true
# Spaces inside {} for array literals, i.e. "new Object[] { args }"
Cpp11BracedListStyle: false
ReflowComments: false
3 changes: 3 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies {
implementation "androidx.sqlite:sqlite:2.1.0"
}
Binary file modified android/lib/sqlcipher.jar
Binary file not shown.
Binary file modified android/libs/arm64-v8a/libsqlcipher.so
Binary file not shown.
Binary file modified android/libs/armeabi-v7a/libsqlcipher.so
Binary file not shown.
Binary file modified android/libs/x86/libsqlcipher.so
Binary file not shown.
Binary file added android/libs/x86_64/libsqlcipher.so
Binary file not shown.
7 changes: 3 additions & 4 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 3.2.0
version: 4.0.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
architectures: arm64-v8a armeabi-v7a x86 x86_64
description: Provides transparent, secure 256-bit AES encryption of SQLite database files.
author: Dawson Toth
license: Appcelerator Commercial License
copyright: Copyright (c) 2013-2019 by Axway, Inc.


# these should not be edited
name: encrypteddatabase
moduleid: appcelerator.encrypteddatabase
guid: d1b3740c-ec53-45c6-8454-8748f91da6ad
platform: android
minsdk: 7.0.0
minsdk: 9.0.0
3 changes: 0 additions & 3 deletions android/platform/README

This file was deleted.

Binary file removed android/platform/android/bin/assets/icudt46l.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
import net.sqlcipher.database.SQLiteDatabaseHook;

@Kroll.module(name = "Encrypteddatabase", id = "appcelerator.encrypteddatabase")
public class EncrypteddatabaseModule extends KrollModule {
public class EncrypteddatabaseModule extends KrollModule
{
private static final String TAG = "TiDatabase";
private String password = null;

Expand All @@ -45,30 +46,43 @@ public class EncrypteddatabaseModule extends KrollModule {
@Kroll.constant
public static final int FIELD_TYPE_DOUBLE = 3;

public EncrypteddatabaseModule() {
public EncrypteddatabaseModule()
{
super();
SQLiteDatabase.loadLibs(TiApplication.getAppCurrentActivity());
}

@Kroll.getProperty @Kroll.method
public String getPassword() {
// clang-format off
@Kroll.getProperty
@Kroll.method
public String getPassword()
// clang-format on
{
return password == null ? TiApplication.getInstance().getAppGUID() : password;
}

@Kroll.setProperty @Kroll.method
public void setPassword(String value) {
// clang-format off
@Kroll.setProperty
@Kroll.method
public void setPassword(String value)
// clang-format on
{
password = value;
}

@Kroll.method
public TiDatabaseProxy open(Object file) {
public TiDatabaseProxy open(Object file)
{
// Attempt to create/open the given database file/name.
TiDatabaseProxy dbp = null;

// Migrate database if necessary.
final SQLiteDatabaseHook migrationHook = new SQLiteDatabaseHook() {
public void preKey(SQLiteDatabase database) {}
public void postKey(SQLiteDatabase database) {
public void preKey(SQLiteDatabase database)
{
}
public void postKey(SQLiteDatabase database)
{
database.rawExecSQL("PRAGMA cipher_migrate;");
}
};
Expand All @@ -81,8 +95,9 @@ public void postKey(SQLiteDatabase database) {
String absolutePath = tiFile.getBaseFile().getNativeFile().getAbsolutePath();
Log.d(TAG, "Opening database from filesystem: " + absolutePath);

SQLiteDatabase db = SQLiteDatabase.openDatabase(absolutePath, getPassword(), null,
SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS, migrationHook);
SQLiteDatabase db = SQLiteDatabase.openDatabase(
absolutePath, getPassword(), null, SQLiteDatabase.OPEN_READONLY | SQLiteDatabase.NO_LOCALIZED_COLLATORS,
migrationHook);
if (db != null) {
dbp = new TiDatabaseProxy(db);
} else {
Expand Down Expand Up @@ -110,7 +125,8 @@ public void postKey(SQLiteDatabase database) {
}

@Kroll.method
public TiDatabaseProxy install(KrollInvocation invocation, String url, String name) throws IOException {
public TiDatabaseProxy install(KrollInvocation invocation, String url, String name) throws IOException
{
try {
// TiContext tiContext = invocation.getTiContext();
Context ctx = TiApplication.getInstance();
Expand Down
39 changes: 28 additions & 11 deletions android/src/appcelerator/encrypteddatabase/TiDatabaseProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
import net.sqlcipher.database.SQLiteDatabase;

@Kroll.proxy(parentModule = EncrypteddatabaseModule.class)
public class TiDatabaseProxy extends KrollProxy {
public class TiDatabaseProxy extends KrollProxy
{
private static final String TAG = "TiDB";

protected SQLiteDatabase db;
protected String name;
boolean statementLogging, readOnly;

public TiDatabaseProxy(String name, SQLiteDatabase db) {
public TiDatabaseProxy(String name, SQLiteDatabase db)
{
// super(tiContext);
super();
this.name = name;
Expand All @@ -38,7 +40,8 @@ public TiDatabaseProxy(String name, SQLiteDatabase db) {
}

// readonly database
public TiDatabaseProxy(SQLiteDatabase db) {
public TiDatabaseProxy(SQLiteDatabase db)
{
// super(tiContext);
super();
this.name = db.getPath();
Expand All @@ -48,7 +51,8 @@ public TiDatabaseProxy(SQLiteDatabase db) {
}

@Kroll.method
public void close() {
public void close()
{
if (db.isOpen()) {
Log.d(TAG, "Closing database: " + name, Log.DEBUG_MODE);
db.close();
Expand All @@ -58,7 +62,8 @@ public void close() {
}

@Kroll.method
public TiResultSetProxy execute(String sql, Object... args) {
public TiResultSetProxy execute(String sql, Object... args)
{
// Handle the cases where an array is passed containing the SQL query
// arguments.
// Otherwise use the variable argument list for the SQL query.
Expand Down Expand Up @@ -154,32 +159,45 @@ public TiResultSetProxy execute(String sql, Object... args) {
return rs;
}

// clang-format off
@Kroll.getProperty
@Kroll.method
public String getName() {
public String getName()
// clang-format on
{
return name;
}

// clang-format off
@Kroll.getProperty
@Kroll.method
public TiFileProxy getFile() {
public TiFileProxy getFile()
// clang-format on
{
return new TiFileProxy(TiFileFactory.createTitaniumFile(db.getPath(), false));
}

// clang-format off
@Kroll.getProperty
@Kroll.method
public int getLastInsertRowId() {
public int getLastInsertRowId()
// clang-format on
{
return (int) DatabaseUtils.longForQuery(db, "select last_insert_rowid()", null);
}

// clang-format off
@Kroll.getProperty
@Kroll.method
public int getRowsAffected() {
public int getRowsAffected()
// clang-format on
{
return (int) DatabaseUtils.longForQuery(db, "select changes()", null);
}

@Kroll.method
public void remove() {
public void remove()
{
if (readOnly) {
Log.w(TAG, name + " is a read-only database, cannot remove");
return;
Expand All @@ -196,5 +214,4 @@ public void remove() {
Log.w(TAG, "Unable to remove database, context has been reclaimed by GC: " + name);
}
}

}
Loading