Skip to content

Commit

Permalink
AndroidX support for NativeScript 6 #27
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jul 4, 2019
1 parent ed268ad commit 32261d4
Show file tree
Hide file tree
Showing 10 changed files with 378 additions and 8,687 deletions.
23 changes: 8 additions & 15 deletions demo/app/App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
//dependencies {
// compile 'com.android.support:recyclerview-v7:+'
//}

android {
defaultConfig {
android {
defaultConfig {
generatedDensities = []
applicationId = "org.nativescript.starter"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
applicationId = "org.nativescript.plugin.speechrecognition"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
2 changes: 1 addition & 1 deletion demo/app/app.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import 'nativescript-theme-core/css/core.light.css';
@import '~nativescript-theme-core/css/core.light.css';
2 changes: 1 addition & 1 deletion demo/app/app.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import * as application from "tns-core-modules/application";
application.start({ moduleName: "main-page" });
application.run({ moduleName: "main-page" });
45 changes: 38 additions & 7 deletions demo/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = function(config) {
config.set({
module.exports = function (config) {
const options = {

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Expand All @@ -11,9 +11,7 @@ module.exports = function(config) {


// list of files / patterns to load in the browser
files: [
'app/**/*.js',
],
files: ['app/tests/**/*.*'],


// list of files to exclude
Expand Down Expand Up @@ -73,5 +71,38 @@ module.exports = function(config) {
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
};

setWebpackPreprocessor(config, options);
setWebpack(config, options);

config.set(options);
}

function setWebpackPreprocessor(config, options) {
if (config && config.bundle) {
if (!options.preprocessors) {
options.preprocessors = {};
}

options.files.forEach(file => {
if (!options.preprocessors[file]) {
options.preprocessors[file] = [];
}
options.preprocessors[file].push('webpack');
});
}
}

function setWebpack(config, options) {
if (config && config.bundle) {
const env = {};
env[config.platform] = true;
env.sourceMap = config.debugBrk;
options.webpack = require('./webpack.config')(env);
delete options.webpack.entry;
delete options.webpack.output.libraryTarget;
const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"];
options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name));
}
}
Loading

0 comments on commit 32261d4

Please sign in to comment.