Граф коммитов

37 Коммитов

Автор SHA1 Сообщение Дата
jhugman 955bef3fbd
FML: Generate Kotlin from FML intermediate representation (#4607) r=tarik
* Move cli around in preparation for askama and textwrap

* Add testing for the generated manifest.

* gradlew ktlint && detekt

* Cleanup target language testing

* Initial commit

* Skeleton code oracle and units-of-code for Kotlin

* Cargo.lock

* cargo fmt

* First cut of some incomplete stinking kotlin

* First feature has been generated, though no tests running

* Generating code, compiling it and testing it

* Change enums to work with kebab casing

* re-arrange testing infra to allow importing of static methods

* Add enum maps! Phew.

* Move enum map to structural

* Implement EnumMap and StringMap in terms of renamed MapCodeType

* Add list types

* Objects _almost_ done, but no passing in values from above.

* Move FeatureHolder into internal package

* Put in place guard rails re: object literals and merging

* cargo fmt / cargo clippy

* Add config file to specify package and nimbus object name

* Demoable for fenix homescreen

* Remove dead comments

* Add optionals

* Fixup testing scripts

Now we compile the runtime each time into a temp directory.

* Testing generated code

* Unit testing the code types

* Beef up the integration tests

* Cleanup: cargo fmt, clippy, and re-write some docs

* detekt

* Post rebase

* Detect kotlinc before running integration tests

* cargo fmt
2021-11-06 14:27:37 +00:00
Ryan Kelly c40fd3a12b
Update android dependencies [ci full] (#4345)
This uses the new, cleaner factoring of our Android config from #4194
as an excuse to update some of our Android dependencies to bring them
inline with what's used in current android-components. It was much
easier than it has been in the past!
2021-07-26 11:09:11 +10:00
Ryan Kelly e067d0aa63 Reduce gradle task dependencies on megazord build.
Prior to this commit, the gradle tasks for building and for testing
each component would depend on the "cargoBuild" gradle task of the
megazord, which means they would built it for all configured targets.
In TaskCluster we configure *seven* targets, so each `module-build-X`
TaskCluster job will build the full megazord seven times.

This commit makes two changes:

* Building the gradle package of a component no longer depends on
  building the megazord at all. We doesn't actually need to the
  Rust code built in order to package up the Kotlin files, and I
  think this dependency was a hangover from when each component
  used to build its own individual Rust library.
* Running the gradle tests of a component now depends only on
  building the megazord for the native host platform, since that's
  the only one that is actually needed for running the tests.

Given that we have 11 components that depend on the megazord,
each of which will now avoid building 6 useless copies of it
for non-native platforms, I expect this will save a total of
66 expensive `cargo build` invocations in a full TaskCluster run.

I've also included a few other tweaks to do less unnecessary
work in TaskCluster, which seem to save about a minute on the
much-more-common `android-build-pr` task.
2021-07-19 13:40:43 +10:00
Ryan Kelly 28e4982cd2
Consolidate megazord-related gradle logic into a shared helper. (#4187)
Prior to this commit, each of our individual components had its
own copy of gradle logic for depending on the megazord, including
a couple of lengthy comments about fiddling around with JNA for
the Android Studio test runner.

I've moved all that logic into a helper function in `publish.gradle`
so that we can maintain it in a single location from here out.
There may be a cleaner or more idiomatic way to achieve this kind
of code-sharing in gradle, but I figure this *has* to be better
than our current copy-paste-based approach.

I've manually confirmed that a local `./gradlew test` completes
successfully, as well as testing via Android Studio.
2021-07-19 13:14:08 +10:00
Ryan Kelly 9183da2264 Use a shared helper for gradle uniffi-bindgen tasks.
We currently have four copies of the logic for calling UniFFI
from gradle, several with their own little tweaks. Let's take
the best lessons from each and consolidate them into a single
shared helper.

This version is, I think, an improvement over all the existing
ones:

* Like the nimbus version, it registers the task as generating
  java source files, which should help things integrate cleanly
  into the broader build.
* Like the fxa-client version, it declares explicit inputs so
  that we can avoid re-running the task when nothing has changed.
* New in this version, it declares an input dependency on anything
  that would affect the version of `uniffi-bindgen` that is in use,
  since that too will change the generated outputs.

That last change should really help with smooth updates to the
version of UniFFI in use. Previously, if you changed the UniFFI
version it would not trigger a cleanup of old generated bindings,
and you'd get `java.lang.UnsatisfiedLinkError` errors like in #4054.
(This is UniFFI's last-line-of-defence measure to prevent you from
using bindings generated with one version of UniFFI on a library
compiled with another, which is very useful, but an extremely
confusing failure mode).

With this change, an updated version of UniFFI will invalidate
the gradle task that generates the bindings, causing them to
be regenerated with the new version.
2021-06-07 08:51:46 +10:00
Ryan Kelly a679951bbb
Add some quality-of-life improvements for running android smoketests.
The most important one is that we avoid publishing a new set of aars
if no code has actually changed. I'm not thrilled about the *way* we
accomplish it, but it works for me.
2020-04-02 16:40:47 +11:00
Ryan Kelly 0e31668247
Add support and docs for an auto-publish based local dev workflow.
Our docs currently recommend two ways of building consuming apps against
local changes to this repo: an automated-but-perpetually-buggy composite build
workflow, and a reliable-but-tedious manual workflow of publishing to a local
maven repo.

This commit removes them both and replaces them with something similar to
the workflow used by android-components: some scripting to automate publishing
to and consuming from a local maven repo.
2020-03-12 15:05:21 +11:00
Nick Alexander 2921db3571
Do not force Android packaging tasks to re-run on every build.
There where two issues.  The most obvious is that the task name that
merges JNI libraries has evolved; it's now `merge{...}JniLibFolders`.

The second, which really caught me out, is that when both
`main.jniLibs.srcDirs` and `debug.jniLibs.srcDirs` contain the same
path, then the Android source set merger silently fails.  I don't
really understand what's happening here, I just know that using only
`main.jniLibs.srcDirs` solves the issue.

Fixes #2659.
2020-03-02 12:08:26 +11:00
Ryan Kelly a1769d4aee
Force android packaging tasks to re-run on every build.
For inscrutable reasons, the various android packaging gradle tasks do
not get re-run when the underlying rust code changes. Something is not
correctly configuring gradle's up-to-date checks, but I've reached the
imit of how much time I'm willing to spend on figuring it out. Deleting
some intermediate files seems to force the tasks to re-run, and I was
not able to measure any increase in overall build time on my machine.

I don't like this, but I dislike it less than I dislike having to double-
check whether the rust code I have on disk the same as the rust code
compiled into my built artifacts.

Fixes #2659 (or at the very least, hacks its way around it).
2020-02-18 10:03:10 +11:00
Ryan Kelly d07fb1b27f
Include dependency license info in megazord .pom files.
Some of our consumers use this handy plugin [1] to automagically
include dependency license info in their app. By including our
own dependency license info in our .pom file we can make it
easy for those consumers to include correct license info for
all the transitive dependencies they pick up through us.

[1] https://github.com/google/play-services-plugins/tree/master/oss-licenses-plugin
2019-11-01 18:53:47 +11:00
Thom Chiovoloni d688681db8
Ensure the right packaging values are set in our pom files 2019-08-09 14:27:12 -07:00
Ryan Kelly 27d4771104
Include license info in binary distributions.
And also add some base-bones docs on how consumers can obtain it.
2019-08-02 07:41:18 +10:00
Thom Chiovoloni b0680ffb55
megazord: changelog, address comments from review 2019-07-15 11:19:37 -07:00
Thom Chiovoloni cb975b17e2
Merge branch 'master' into omegazord 2019-07-09 17:10:18 -07:00
Edouard Oger 270b0ea2a0
rc_crypto initial commit (#1349) 2019-07-09 14:00:48 -04:00
Mitchell Hentges 31d2238fc9
Resolves "PublicationType" not being properly used 2019-07-04 09:57:09 -07:00
Mitchell Hentges e60702f045
Renames publishedArtifacts to publications to match gradle 2019-07-04 09:57:08 -07:00
Thom Chiovoloni cd1ee72f50
Clean up publishing 2019-06-12 14:29:32 -07:00
Thom Chiovoloni c7455456d8
Get rid of `nss-libs-android` 2019-06-12 14:29:31 -07:00
Thom Chiovoloni b65abcb47c
Initial work on removing non-megazords. Very WIP 2019-06-12 12:19:41 -07:00
Ryan Kelly 3c6c029b2f
fix(build): Set ANDROID_NDK_HOME so that gradle can strip native libs.
This is required in order for stripping of debug symbols to work
correctly, since otherwise the gradle plugin doesn't know where
to find the appropriate `strip` command.

I've also added a very coarse test to ensure that the size of the
resulting release artifacts is sensible, which should help us check
whether this works in CI and guard against future regressions.
2019-05-15 11:45:31 +10:00
Edouard Oger 84e077d153
Publish on Maven via beetmover
Co-authored-by: Mihai Tabara <mtabara@mozilla.com>
2019-04-24 15:31:20 -04:00
Edouard Oger 7ec1742500
NSS crypto backend for SHA-256 digest 2019-04-11 17:33:03 -04:00
Nick Alexander 7d14946f8f
Publish to mozilla-appservices bintray organization, not a personal bintray account. (#843) 2019-03-22 16:21:16 -07:00
Edouard Oger 42d387bbd1 Per-module Taskcluster tasks 2019-03-20 15:11:07 -04:00
Nick Alexander 9aa43cc455 Publish all Maven artifacts to a single bintray package.
Right now, we publish each Maven artifact "cluster" -- for "logins",
say, that is "logins", "logins-withoutLibs", and "logins-forUnitTests"
-- to a single bintray package named like the Maven artifact ID (say,
"logins").

This seems to be common, but bintray mirrors packages to jcenter, and
bintray packages don't map directly to Maven coordinates.  AFAICT,
that is the thing that requires somebody (right now, me -- nalexander)
to push the "mirror to jcenter" button in the bintray UI.

If we instead have a single bintray "package" (say,
"org.mozilla.appservices") and then publish many Maven artifacts to
that package, we should get automatic jcenter mirroring for everything
that we have under it.  Let's try!
2019-03-15 16:00:34 -07:00
Nick Alexander aeb4877af5 Bump to Android-Gradle plugin 3.2.1. Fixes #484.
This is necessary to make Development with the Reference
Browser (https://mozilla.github.io/application-services/docs/applications/working-with-reference-browser.html)
smooth.

This was hard because the new kapt feature in 3.2.0+ interacts badly
with configuration resolution, and we were triggering resolution
earlier than the plugin could accommodate.  This is a generally
challenging thing to manage in Gradle, with confusing side effects;
this is one such confusing side effect!  See the in-code comments for
the details, which can't be left to a commit message.
2018-12-18 19:15:54 -08:00
Nick Alexander 91098f4407 Don't modify Maven group ID for derivatives.
This was intended to work around a bintray publishing issue, but it
didn't work.  So let's return to
`org.mozilla.places:places-{forUnitTests,withoutLib}` rather than
`org.mozilla.places-{forUnitTests,withoutLib}:places-{forUnitTests,withooutLib}`.

This will matter more when we publish to maven.mozilla.org, which is
prefix based.
2018-12-18 11:32:18 -08:00
Nick Alexander 7b8eb59c14 Rename "composites" to "megazords". Fixes #471. 2018-12-14 11:23:46 -08:00
Nick Alexander 594b12d873 Alter Maven group names for `withoutLib` and `forUnitTests` artifacts.
This is just working around a Bintray issue; it should make it easier
to mirror to jcenter.
2018-11-27 15:45:19 -08:00
Nick Alexander e81669ecb9 [automation] Publish zipped Maven repository rather than individual AARs. 2018-11-27 15:15:44 -08:00
Nick Alexander fa3f256d3e [automation] Bump to rust-android-gradle version 0.7.0.
This plugin version splits the "default" target into named Rust
targets, and the passes through specially named environment variables
to allow configuring cross compilers.  This allows us to produce
binaries for macOS in automation.
2018-11-27 15:15:44 -08:00
Nick Alexander c041b95d01 Part 2: Publish `-withoutLib` variants and aggregate them into composites.
This adds an Android build type that does not include the Rust native
libraries and publishes it.  The composite projects then arrange to
depend on these `-withoutLib` variants, there-by capturing the
Java/Kotlin code (and any future Android resources or assets) and any
transitive dependencies, but substituting their own libraries.

There's no way to "turn off" the parts of the `rust-android-gradle`
plugin that integrate the Rust libraries into the Android build, so we
do some manual `jniLibs` rewriting to achieve the same end.  (Features
like this in the plugin are tracked in
https://github.com/ncalexan/rust-android-gradle/issues/23).
2018-11-20 11:28:38 -08:00
Nick Alexander 375545d638 Fix scoping errors in publish.gradle. 2018-11-15 12:53:36 -08:00
Nick Alexander 83aa675616 Publish additional -forUnitTests JAR Maven publication.
The new publication has different Maven coordinates, like
"org.mozilla.places:places-forUnitTests" so that consumers can augment
their unit test configurations, like
```
dependencies {
    implementation 'org.mozilla.places:places:0.10.0'
    testImplementation 'org.mozilla.places:places-forUnitTests:0.10.0'
}
```
and get the additional JNA libraries and Rust native code libraries in
their unit tests mostly transparently.

Right now only the "default" target's native libraries will make it
intot he new Maven publication; broadening the set of targets here
will require expanding the rust-android-gradle plugins set of targets
so that it can cross-compile for multiple desktop architectures and
not just multiple Android architectures.  That's follow-up to this.

This will interact with megazord/composite libraries as well, but I
expect that the same process of dependency rewriting and unification
will extend to the additional "-forUnitTests" dependencies smoothly.
2018-11-15 11:43:21 -08:00
Nick Alexander 8805a710f5 Use newer `maven-publish` plugin to produce Maven publications.
The real advantage here is that the newer `maven-publish` plugin has
some support for multiple publications in a single Gradle project, and
we need that:
- for unit test specific archives (native code built for desktop hosts)
- for component libraries that don't have native libraries but are
  glued together into composites

This just paves the way for those changes.
2018-11-15 11:21:54 -08:00
Nick Alexander 185cb45128 [automation/fxa client] Part 1a: Lift Gradle multi-project to top-level.
There are two project layouts possible.  One is that each sub-project
is its own Gradle project with its own copy of the Gradle wrapper,
project configurations, etc.  The other is that there's one
multi-project with sub-Gradle projects.

Generally the multi-project approach, even for decoupled projects, is
simpler.  The `android-components` repository uses it, even though its
projects are very explicitly decoupled in most cases.
2018-09-19 11:09:48 -07:00