How add Build Phases Run Script Phase in Ionic Appflow - ionic-framework

I need to run a native Xcode build script during the iOS build in Ionic Appflow.
For e.g I am using cordova-plugin-salesforce-snapins plugin and as per their documentation we need to run these scripts:
select Build Phases
create Run script
paste this line of code $PODS_ROOT/ServiceSDK/Frameworks/ServiceCore.framework/prepare-framework
It is possible in Xcode but there is no such way to achieve this in ionic Appflow.
Please help me to configure this.

I use the npm plugin cordova-node-xcode, which allows you to write the build phase to the generated Xcode project file. Add "xcode": "^3.0.1" to your devDependencies in package.json.
Call a .js script AddBuildScript.js from a Cordova "after_build" hook in your config.xml:
<platform name="ios">
<hook src="AddBuildScript.js" type="after_build" />
Script AddBuildScript.js:
var xcode = require('xcode'),
fs = require('fs'),
projectPath = 'platforms/ios/MyProj.xcodeproj/project.pbxproj',
proj = xcode.project(projectPath);
proj.parse(function (err) {
var scriptName = 'My Script';
var buildPhases = proj.getPBXObject('PBXShellScriptBuildPhase');
if (JSON.stringify(buildPhases).match(scriptName)) {
console.log('Xcode project not updated - ' + scriptName + ' already exists')
} else {
var options = {shellPath: '/bin/sh', shellScript: '$PODS_ROOT/ServiceSDK/Frameworks/ServiceCore.framework/prepare-framework'};
proj.addBuildPhase([], 'PBXShellScriptBuildPhase', scriptName, proj.getFirstTarget().uuid, options);
fs.writeFileSync(projectPath, proj.writeSync());
console.log('Xcode project updated - added ' + scriptName);
}
});

Related

how to flutter build aar with androidSourceJar

run flutter build aar build local maven repo,how to add java/kotlin source code
use Flutter 3.3.9,the aar_init_script.gradle config publish like this
`
project.publishing.publications.forEach { pub ->
def relocationArtifactId = pub.artifactId
pub.artifactId = "${relocationArtifactId}_${pub.name}"
pub.alias = true
pub.pom.distributionManagement {
relocation {
// New artifact coordinates
groupId = "${pub.groupId}"
artifactId = "${relocationArtifactId}"
version = "${pub.version}"
message = "Use classifiers rather than _variant for new publish plugin"
}
}
}
`
how to add sourceJar without edit aar_init_script.gradle

VSCode problem retrieving Bazel build targets

I'm having trouble getting VSCode to load build targets for a Java project. The error message that I get is the following:
Command failed: bazel --output_base=/var/folders/cj/1fv063dx1772zbpnfpzvj_c00000gn/T/5b71fd39758e7fd8e710c281fbbdda92 query ...:* --output=package Loading: 0 packages loaded ERROR: error loading package 'bazel-test/external/rules_jvm_external': cannot load '//:private/versions.bzl': no such file Loading: 12 packages loaded currently loading: bazel-test/external/local_config_cc ... (6 packages) Loading: 12 packages loaded currently loading: bazel-test/external/local_config_cc ... (6 packages)
My WORKSPACE file is as follows:
load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_docker",
sha256 = "4521794f0fba2e20f3bf15846ab5e01d5332e587e9ce81629c7f96c793bb7036",
strip_prefix = "rules_docker-0.14.4",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.14.4/rules_docker-v0.14.4.tar.gz"],
)
load(
"#io_bazel_rules_docker//repositories:repositories.bzl",
container_repositories = "repositories",
)
container_repositories()
load("#io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")
container_deps()
load("#io_bazel_rules_docker//repositories:pip_repositories.bzl", "pip_deps")
pip_deps()
load(
"#io_bazel_rules_docker//java:image.bzl",
_java_image_repos = "repositories",
)
_java_image_repos()
load(
"#io_bazel_rules_docker//container:container.bzl",
"container_pull",
)
container_pull(
name = "openjdk11_slim",
registry = "index.docker.io",
repository = "library/openjdk",
tag = "11-slim"
)
RULES_JVM_EXTERNAL_TAG = "3.3"
RULES_JVM_EXTERNAL_SHA = "d85951a92c0908c80bd8551002d66cb23c3434409c814179c0ff026b53544dab"
http_archive(
name = "rules_jvm_external",
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
sha256 = RULES_JVM_EXTERNAL_SHA,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
load("#rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = [
# Accessed as dependency: #maven://io_vertx_vertx_core
"io.vertx:vertx-core:3.9.2",
# Accessed as dependency: #maven://io_vertx_vertx_web
"io.vertx:vertx-web:3.9.2",
# Accessed as dependency: #maven://io_vertx_vertx_rx_java2
"io.vertx:vertx-rx-java2:3.9.2",
],
repositories = [
"https://repo1.maven.org/maven2",
]
)
I don't see anything obviously wrong with my WORKSPACE file, so I'm tempted to assume the problem is with VSCode or in the BUILD files in one of my external dependencies. Other than that the project contains a single Hello.java and its accompanying java_binary rule. If I run myself the same query for all packages I get the following:
% bazel query ...:\* --output=package
src/main/java
Loading: 0 packages loaded
In other words, there's no error. Any ideas how I could try to debug or fix this? I just installed everything on the laptop, so the software versions are:
Bazel version: 3.5.0
VSCode versio: 1.48.2
Following the comment ignoring the convenience symlink solved it for me:
echo bazel-`basename ${PWD}` >> .bazelignore
I got around this issue by changing the Query Expression in Bazel extension Settings from
...:*
to
//< directory name >/...:*

How to integrated mender within lk-bootloader base-on Yocto Project

I am new for yocto ,now I use a MTK-demo-board to build a linux-distro base on Yocto. I want to realize OTA by mender followed this tutorial:https://docs.mender.io/1.0/Devices/Integrating-with-U-Boot.
but Mender support u-boot as bootloader by default, the MTK use lk bootloader,Then how to realize this function?
The AP which I used is MT8183,The steps I have done list below:
1. /meta/meta-mediatek/recipes-bsp/lk/lk_2.0.0.0.bb . add follow code:
require recipes-bsp/u-boot/u-boot-mender.inc
PROVIDES += "u-boot"
RPROVIDES_{PN} += "u-boot"
2.cp lk_2.0.0.0 lk-fw-utils_2.0.0.0,and changed the file as behind:
a. delete do_genkey{} function;
b. add EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1'
c. add "oe_runmake env" in function do_compile()
d. add PROVIDES_${PN} = "lk-fw-utils"
RPROVIDES_${PN} = "lk-fw-utils"
DEPENDS += "mtd-utils"
3./build/local.conf,add these code
MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"
MACHINE = "aiv8183m1v2"
PREFERRED_VERSION_pn-mender = "1.0.%"
PREFERRED_VERSION_pn-mender-artifact = "1.0.%"
PREFERRED_VERSION_pn-mender-artifact-native = "1.0.%"
DISTRO_FEATURES_append = "systemd"
VIRTUAL-RUNTIME_init_manager = "systemed"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMAGE_FSTYPES = "ext4"
4.execute bitbake-layers add-layer /meta/meta-mender/meta-mender-core
5.bitbake-layers create-layer meta-mylayer,in this layer,I mkdir -p /recipes-mender/mender/files, in directory mender,I touch mender_%.bbappend file as bellow:
FILESEXTARPATHS_prepend := "${THISDIR}/file:"
SRC_URI_append = "file://server.crt"
and put servert.crt in the the file directory.
6.in the mancine.conf(aiv8183m1v2.conf),I have added
PREFERRED_PROVIDER_u-boot-fw-utils = "lk-fw-utils"
PREFERRED_PROVIDER_u-boot = "lk"
IMAGE_INSTALL_append = "kernel-modules"
MENDER_STORAGE_DEVICE = "/dev/mmcblk0"
7./meta-mender/meta-mender-core/classes/mender-full.bbclass
MENDER_FEATURES_ENABLE_append_arm = ""
MENDER_FEATURES_ENABLE_append_aarch64 = ""
the result I expected is the linux can OTA over mender.
But,actual results is the project can't cross build.the log says:
DEBUG: Executing shell function soft_link_to_rootfs
| ln: target ‘mender.bmap’ is not a directory
| WARNING: /home/yewkui/yocto-linux/build/tmp/work/aiv8183m1v2-poky-linux/mtk-image-openmm-aiv/1.0-r0/temp/run.soft_link_to_rootfs.1347217:1 exit 1 from 'ln -nfs mtk-image-openmm-aiv-aiv8183m1v2-20181224064735.rootfs.ext4 mender mender.bmap /home/yewkui/yocto-linux/build/tmp/deploy/images/aiv8183m1v2/rootfs.ext4 mender mender.bmap'
| DEBUG: Python function do_rootfs finished
| ERROR: Function failed: soft_link_to_rootfs (log file is located at /home/yewkui/yocto-linux/build/tmp/work/aiv8183m1v2-poky-linux/mtk-image-openmm-aiv/1.0-r0/temp/log.do_rootfs.1347217)
ERROR: Task (/home/yewkui/yocto-linux/meta/poky/../meta-mediatek-mt8183/recipes-aiv/images/mtk-image-openmm-aiv.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2392 tasks of which 2391 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
Maybe I am wrong at first step,but how to realize the OTA by yocto base on MTK lk-bootloader,please help! thanks a lot!

Broccoli-compass and ember-cli 0.39

I recently upgraded ember-cli to .39, and something changed to cause my broccoli-compass code to break.
Here's the code:
app.styles = function() {
return compileCompass(this.appAndDependencies(), this.name + '/styles/app.scss', {
compassCommand: 'bundle exec compass',
outputStyle: 'expanded',
sassDir: this.name + '/styles',
imagesDir: 'public/images',
cssDir: '/assets'
});
};
I get this error:
[broccoli-compass] Error: Command failed: Errno::ENOENT on line ["155"] of ~/.rvm/gems/ruby-2.1.1/gems/compass-0.12.6/lib/compass/compiler.rb: No such file or directory # rb_sysopen - ~/campaign-designer/ember/tmp/tree_merger-tmp_dest_dir-pSk32Zuy.tmp/campaign-designer/styles/app.scss
Run with --trace to see the full backtrace
arguments: `bundle exec compass compile campaign-designer/styles/app.scss --relative-assets --sass-dir campaign-designer/styles --output-style expanded --images-dir public/images --css-dir "../compass_compiler-tmp_cache_dir-8Yu97OaF.tmp/assets"`
Has app.styles or this.appAndDependencies() changed? I've tried many variants of this config to no avail.
There's a similar question here, but I still couldn't get things working.
For what it's worth, something like this ended up helping me:
// Compass config in Brocfile.js
app.registry.add('css', 'broccoli-compass', 'scss', {
toTree: function(tree, inputPath, outputPath, options) {
// broccoli-compass doesn't like leading slashes
if (inputPath[0] === '/') { inputPath = inputPath.slice(1); }
// tree = mergeTrees([
// tree,
// 'public'
// ], {
// description: 'TreeMerger (stylesAndVendorAndPublic)'
// });
return compileCompass(tree, inputPath + '/app.scss', {
outputStyle: 'expanded',
// require: 'sass-css-importer', // Allows us to import CSS files with #import("CSS:path")
sassDir: inputPath,
imagesDir: 'images',
//fontsDir: 'fonts',
cssDir: outputPath
});
}
});
Ultimately I removed compass from my project (I just had to write a few SASS mixins myself) to avoid the troubles with the config + attempt to get faster build speeds.
Update: You may now want to check out the ember-cli-compass-compiler ember-cli addon, which makes it easier to get started with Compass in your ember-cli project.

phonegap 3.1 BarcodeScanner uncaught module cordova/plugin/BarcodeScanner not found

I'm new on Phonegap and JS... and I tried it with a barcode scanner... I installed the phonegap and everything with this tutorial http://teusink.blogspot.com/2013/07/guide-phonegap-3-android-windows.html
I installed the BarcodeScanner from CMD and exported the project as android platform...
Add it to Eclipse ... followed all the tutorials how to do it, added all permissions and stuff..
when i try the app on ma samsung tab2 ... the app comes up but when i click the "scan" link i get the error uncaught module cordova/plugin/BarcodeScanner not found in the logcat.
this is the call <a href="#" class="btn large" onclick="scaning();">Scan</a
i have this in the index html head
<script src="phonegap.js"></script>
<script src="barcodescanner.js"></script>
this is the scaning function
function scaning(){
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);};
and this is in the config.xml
<feature name="BarcodeScanner">
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
</feature>
I think I checked the whole Google for the answer ... but till now nothing worked... and still for the phonegap 3.0+ version there is almost none documentation for the barcode scanner ... at least for a beginner ...
if you can help me guys .... couse I'm totally lost :S
Although I've never used older versions as I'm quite new into Phonegap/Cordova, Version 3.1 seems to use a slightly different approach for accessing plugins. Following worked for me with Cordova 3.1 and BarcodeScanner.
Install plugin with
plugman install --platform android --project=DIR-TO-CORDOVA-PROJECT --plugin=https://github.com/wildabeast/BarcodeScanner
You don't have to reference barcodescanner.js by your own, cordova takes care of the includes - the example code from https://github.com/wildabeast/BarcodeDemo worked except I had to change the plugin path from
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
to
var scanner = cordova.require("com.phonegap.plugins.barcodescanner.BarcodeScanner");
edit the file: js/index.js
find the code: var scanner = cordova.require("cordova/plugin/BarcodeScanner");
replace "cordova/plugin/BarcodeScanner"
to "com.phonegap.plugins.barcodescanner.BarcodeScanner"
This one worked for me:
var scanner = cordova.plugins.barcodeScanner;
Had the same problem , got fixed by installing it via plugman like this
plugman install --platform android --project=DIR-TO-CORDOVA-PROJECT --plugin=https://github.com/wildabeast/BarcodeScanner
where DIR-TO-CORDOVA-PROJECT is E:/ProjectName/platform/android
If I didn't add the /platform/android it gave an error
and then put this in the scanning() function
cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Format: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);