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

tz: add support for the Android platform #199

Merged
merged 2 commits into from
Jan 12, 2025
Merged

tz: add support for the Android platform #199

merged 2 commits into from
Jan 12, 2025

Conversation

BurntSushi
Copy link
Owner

Android support has two prongs:

  • The special Android concatenated time zone database will now be read
    by Jiff automatically.
  • The persist.sys.timezone Android property is read to determine the
    system's configured IANA time zone identifier.

Closes #140

@BurntSushi BurntSushi force-pushed the ag/android branch 4 times, most recently from c52e3cb to 404ce75 Compare January 12, 2025 20:19
Android support has two prongs:

* The special Android concatenated time zone database will now be read
  by Jiff automatically.
* The `persist.sys.timezone` Android property is read to determine the
  system's configured IANA time zone identifier.

Closes #140
@BurntSushi BurntSushi merged commit 6926d6d into master Jan 12, 2025
19 checks passed
@BurntSushi BurntSushi deleted the ag/android branch January 12, 2025 20:38
Comment on lines +186 to +188
// SAFETY: `name` is a valid NUL terminated string and
// `system_property_find` is a valid function read from `dlsym`
// according to the declaration in `include/sys/system_properties.h`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is meant to refer to system_property_read & prop_info being valid instead?

Comment on lines +20 to +21
# `integration` test target is being ignored. We don't include anything else
# so tests obviously won't work, but it makes `cargo package` quiet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be a problem for the Android build for some reason if we included the entire tests/ directory so tests work?

Context: I'm trying to import this crate in our repo at work and the tooling takes the files from the crate (not the Git commit) and tries to set up tests. I can easily configure it not to set up tests, so it's not a problem. I'm just wondering if there's a good reason for not including tests in the crate.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that the test ls bloat the binary. And pretty much everyone wastes bandwidth on it. As I understand it, many crates do this, so I assume y'all already have proceses in place for dealing with this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that the test ls bloat the binary.

Do you mean the archive that's published on crates.io? Because I would assume that Rust binaries would not be bloated by tests in crates they depend on, right?

As I understand it, many crates do this, so I assume y'all already have proceses in place for dealing with this.

I've imported hundreds of crates (~250?) into Google's monorepo. It's not uncommon that tests fail for various reasons (e.g. attempting to read files that are not in the crate), but I don't think it's common that tests don't compile. I may just have forgotten some such cases, though.

Anyway, we do have processes to not even attempt to build the tests, so no problem.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, yes, I mean the archive downloaded from crates.io.

I did this when I added a test tzdata file for Android. Even compressed, it adds an extra 100KB to the artifact. It wasn't obviously worth it to me to imclude it or spend the effort to make tests work in its absence. So I figured I would just remove everything.

I recently did this for bstr as well upon request. I'm considering doing it for my other crates as well.

How important is running tests from the crate downloaded for you? Do you commonly catch regressions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining. That sounds reasonable.

How important is running tests from the crate downloaded for you? Do you commonly catch regressions?

I'm not on the Rust team, but I think it's not very important. As an indication, we typically don't add build targets for the tests if it requires importing additional dev dependencies.

I think I would not even have noticed if tests/lib.rs had not been in the archive. rust-lang/cargo#14290 seems to be the bug for getting a way to silence the warning and not have to include the test target.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, just getting back around to this. I don't think I have anything else to add, but please let me know if this winds up being an issue. I'm open to revisiting it. Philosophically, I do like the idea of being able to run tests from the crate artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android Platform Support
3 participants