how to flutter build aar with androidSourceJar - flutter

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

Related

How add Build Phases Run Script Phase in Ionic Appflow

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);
}
});

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 >/...:*

Depending on apache_beam from a bazel project

I am creating a bazel python project which depends on apache_beam sdk. In the WORKSPACE file of my project, I have downloaded apache_beam zip file via http_archive.
Whenever I am trying to access apache_beam.testing sub-package in my project, I am getting an error
ModuleNotFoundError: No module named 'apache_beam.testing'
import apache_beam is working fine though.
WORKSPACE:
http_archive(
name = "apache_beam",
urls = ["https://github.com/apache/beam/archive/master.zip"],
strip_prefix = 'beam-master/sdks/python',
build_file = str(Label("//third_party:apache_beam.BUILD")),
)
apache_beam.BUILD:
py_library(
name = "apache_beam",
srcs = glob(["apache_beam/**/*.py"]),
visibility = ["//visibility:public"],
)
project's BUILD file:
py_test(
name = "project",
srcs = ["project.py"],
deps = [
"#apache_beam//:apache_beam",
],
project.py file:
from apache_beam.testing import util
In apache_beam.BUILD, you need to set the imports attribute:
py_library(
name = "apache_beam",
srcs = glob(["apache_beam/**/*.py"]),
visibility = ["//visibility:public"],
imports = "apache_beam",
)

How to set Gradle Artifactory Publish plugin default configuration/properties from custom plugin

I have been trying to set the properties of publish(PublisherConfig), defaults(defaultsClosure) from my custom plugin. What is the best way to do this ?
I tried the following;
Approach 1: Tried setting the properties on the extensions
project.getExtensions().publishing.getProperties().each { println it }
Approach 2: Tried adding compile time dependency on the Gradle Artifactory plugin and importing the plugin classes...
```
if (project.plugins.hasPlugin("com.jfrog.artifactory")) {
println "I found jfrog.artifactory plugin"
Plugin jfrogArtifactory = project.getPlugins().getPlugin("com.jfrog.artifactory")
ArtifactoryPluginConvention apc = new ArtifactoryPluginConvention(project);
project.getExtensions().add("artifactory", apc);
apc.contextUrl = 'https://myrepo.com/artifactory/'
PublisherConfig pc = new PublisherConfig(apc);
pc.defaults {
println "in my plugin pc.defaults : " + it.metaClass
publications('mavenJava')
publishConfigs('archives', 'published')
properties = ['my.gitCommitUrl': project.getExtensions().findByType(BuildPropertiesPluginExtension.class).gitCommitUrl, 'my.gitHash': project.getExtensions().findByType(BuildPropertiesPluginExtension.class).gitHash, 'my.gitBranch': project.getExtensions().findByType(BuildPropertiesPluginExtension.class).gitBranch]
publishBuildInfo = true //Publish build-info to Artifactory (true by default)
publishArtifacts = true //Publish artifacts to Artifactory (true by default)
publishPom = true //Publish generated POM files to Artifactory (true by default).
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default).
}
pc.repository {
println "in my plugin pc.repository : " + it.metaClass
repoKey = 'my-mvn' //The Artifactory repository key to publish to
username = project.findProperty("artifactory_user") ?: "" //The publisher user name
password = project.findProperty("artifactory_api_key") ?: "" //The publisher password
}
apc.setPublisherConfig(pc)
}
```
Compile and Build are successful, artifact and its info is not published.
:artifactoryPublish
BUILD SUCCESSFUL
Total time: 3.313 secs
Here is what worked for me!!!
`
if (project.plugins.hasPlugin("com.jfrog.artifactory")) {
Plugin jfrogArtifactory = project.getPlugins().getPlugin("com.jfrog.artifactory")
//maven install task is required to publishPom (using artifactory plugin)
if (!project.plugins.hasPlugin("maven")) {
project.apply(plugin: MavenPlugin)
}
Closure artifactoryPublishClosure = {
contextUrl = 'https://myrepo.com/artifactory/'
publications('mavenJava')
publishConfigs('archives', 'published')
properties = ['gitCommitUrl': project.getExtensions().findByType(BuildPropertiesPluginExtension.class).gitCommitUrl, 'gitHash': project.getExtensions().findByType(BuildPropertiesPluginExtension.class).gitHash, 'gitBranch': project.getExtensions().findByType(BuildPropertiesPluginExtension.class).gitBranch]
publishBuildInfo = true //Publish build-info to Artifactory (true by default)
publishArtifacts = true //Publish artifacts to Artifactory (true by default)
publishPom = true //Publish generated POM files to Artifactory (true by default).
publishIvy = false //Publish generated Ivy descriptor files to Artifactory (true by default).
// Redefine basic properties of the build info object
clientConfig.setIncludeEnvVars(true)
clientConfig.timeout = 600 // Artifactory connection timeout (in seconds). The default timeout is 300 seconds.
publish {
//A closure defining publishing information
repository {
repoKey = 'my-mvn' //The Artifactory repository key to publish to
username = project.findProperty("artifactory_user") ?: "" //The publisher user name
password = project.findProperty("artifactory_api_key") ?: "" //The publisher password
}
}
resolve {
repository {
repoKey = 'my-mvn' //The Artifactory (preferably virtual) repository key to resolve from
}
}
}
project.getTasks().findByName("artifactoryPublish").configure(artifactoryPublishClosure)
}
`

How to read an installed feature (eclipse PDE)?

Is it possible to read a feature like its possible to read a plugin use the eclipse PDE API? Currently I read plugins using:
Bundle[] bundles = Platform.getBundles(name, version);
if (bundles == null) {
throw new NullPointerException("No bundle found with ID: " + name
+ " and version: " + version);
} else {
for (Bundle bundle : bundles) {
System.out.println(bundle.getSymbolicName());
}
}
But if I specify the name of an installed feature I just get null. Is there some other way that features should be read?
And when I have read the feature I would like to iterate all the plugins that it reference.
You can try to use p2 API to query the installed feature. P2 is the manager of eclipse installation.
// IProvisioningAgent is a OSGi service
IProvisioningAgent agent = ...;
IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
IQueryResult rt = profile.query(QueryUtil.createIUPropertyQuery("org.eclipse.equinox.p2.eclipse.type", "feature"), null);