Commit Graph

85 Commits

Author SHA1 Message Date
Torsten Grote d30695bf44 Update errorprone after gradle/java update
without this gradle tasks fail
2024-03-05 14:43:28 +00:00
Torsten Grote 2048d6f478 Add code style to repo and fix it 2023-06-09 17:24:58 +00:00
Hans-Christoph Steiner 12a677a225 purge unused ZipSigner code
This includes some references to the "BC" provider that now do not need to
be ported:
https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html
2023-05-25 11:58:01 +00:00
Sylvia van Os ee1abd9132 Fix crash on launch in nightly
The priority field is no longer supported.

This crash was reported in
https://gitlab.com/fdroid/acra-crash-reports/-/issues/173.

In
https://matrix.to/#/!UAdCANfoQdxlMXhNuM:f-droid.org/$RQa00dUdnkUsmz_iCXh-JDjlJDo9ZynoTHazBT7GiUI?via=f-droid.org&via=matrix.org&via=mozilla.org
it was found that the nightly repo was the culprit.

This crash only affected the nightly builds, not the regular builds.
2023-01-24 12:01:59 +00:00
Hans-Christoph Steiner 2828bf1f9f
-Pstrict.release build flag to disable dev tools
Keep the release build as small as possible, so it is faster.  This also
makes it less important to track all the dev tool projects for security
issues, since they are disabled on release builds.
2022-12-20 20:59:59 +01:00
Torsten Grote c463b3c9ed Upgrade to Gradle 7 and Java 11 2022-05-18 12:52:55 +02:00
Hans-Christoph Steiner 8a573a7b59
vendor commons-codec to implement getFileHexDigest and more
Android includes a crippled version of commons-codec 1.3, which it will
silently use instead of any version included in an app.  So we are forced
to vendor it.

This comes from the tag "commons-codec-1.16-rc1":
https://github.com/apache/commons-codec/tree/commons-codec-1.16-rc1/src/main/java/org/apache/commons/codec

For more on this:
* https://github.com/ExCiteS/apache-commons-codec-shaded
* https://gitlab.com/fdroid/fdroidclient/-/merge_requests/1089#note_822501322
2022-01-26 19:24:29 +01:00
Hans-Christoph Steiner 80a50dcfd4
vendor 'cc.mvdan.accesspoint:library:0.2.0' to remove jcenter entirely
Code was in https://github.com/mvdan/libaccesspoint

Note that this project is **abandoned** since its method doesn't work on Android
7.1 or later. Have a look at these newer alternatives that have been tested to
work on Android 8.0:

* https://github.com/shinilms/direct-net-share
* https://github.com/geekywoman/direct-net-share
* https://github.com/aegis1980/WifiHotSpot
2022-01-19 20:43:24 +01:00
Hans-Christoph Steiner 3c22024d94 remove pedandic checkstyle error 2021-02-23 17:53:33 +01:00
Hans-Christoph Steiner 850b1cf414
fix checkstyle after androidx update !899 2020-07-15 15:02:34 +02:00
Hans-Christoph Steiner 3b67aa1a60
modernize PMD setup 2020-01-10 16:27:58 +01:00
Hans-Christoph Steiner 309694458b some safe library version bimps
This is a collection of minor version updates for included libraries
that should be safe to do.  Doing this at the very beginning of the
release cycle so they'll be tested.

thanks @TacoTheDank for finding these

fdroid/fdroidclient!776

Some related changelogs:
* https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.8.11
* https://github.com/jmdns/jmdns/releases
2018-12-31 17:36:33 +01:00
Hans-Christoph Steiner 1571e28f68 support swapping with removable storage on android-21+
This uses the new Storage Access Framework, which was required for
accessing files on the SD Card starting in android-19.  But the API
was really limited until android-21, and not really complete until
android-23 or even android-26.  So the levels of usability will vary a
lot based on how new the version of Android is.
2018-12-21 00:03:39 +01:00
Hans-Christoph Steiner 3d05363c31 enable Espresso tests with some basic UI tasks 2018-08-17 10:09:59 +02:00
Hans-Christoph Steiner 898c731fcc don't run checkstyle or pmd on zipsigner, the format is too different
If someone wants to clean this up, feel free...
2018-04-19 16:19:21 +02:00
Hans-Christoph Steiner 96fb01ca52 Merge branch 'error-prone' into 'master'
Configure error prone

fdroidclient!635
2018-02-13 20:30:23 +01:00
Hans-Christoph Steiner a4d35244bc errorprone: All Disabled Checks As Warnings 2018-02-13 20:20:02 +01:00
Hans-Christoph Steiner 3c341b7e4b move errorprone config to its own gitlab CI job 2018-02-13 20:19:45 +01:00
Hans-Christoph Steiner bb37a013a8 checkstyle: do not include URLs in line length checks 2018-02-06 00:17:43 +01:00
Hans-Christoph Steiner 91b67a9b39 gitlab-ci: add nightly repo to deploy builds as default enabled 2018-01-04 23:01:00 +01:00
Hans-Christoph Steiner 0983a6a0b0 gitlab-ci: nightly builds using `fdroid nightly` 2018-01-04 23:00:55 +01:00
Hans-Christoph Steiner d4d9707631 on debug builds, set versionCode using DB_VERSION + commit count
This provides an automatic way to generate updates from each new debug
build, it is build from the developer's machine or via the nightly repo.
2017-11-23 10:55:13 +01:00
Hans-Christoph Steiner f0438a67b1 gitlab-ci: push nightly builds to fdroid repo on gitlab
If a repo is set with the gitlab-ci Secret Variable DEBUG_KEYSTORE and
there is a repo named the same as this repo with -nightly appended,
then this will automatically generate an fdroid repo of each build
produced by gitlab-ci runs on the master branch.

closes fdroidserver#256
2017-10-11 23:48:12 +02:00
Hans-Christoph Steiner 48fd6d287d enforce max line length at 118
gitlab's diff views wrap badly when lines are longer than 118.  Android
Studio places a grey line in the UI at 120.

@SuppressWarnings("LineLength") is added to a bunch of files to prevent
making this commit huge.  People can remove that as they work on those
files, and fix the issues then.

I also ran Android Studio's default Ctrl-Alt-L code formatter, where it was
easy to do, and I was already in the file.
2017-06-06 16:12:23 +02:00
Hans-Christoph Steiner 40643855c4 do not let Jackson set instance vars that never come from index
Tell the Jackson JSON parser to ignore App/Apk fields that should never
come from the index, but instead are set locally to keep track of the
current state of things on the device.

There are two forms of tests to enforce that the proper things get
ignored.  It is not possible to do this with decorators alone, so I
chose to use @JsonIgnore and leave the variables we want filled in
undecorated.  Also, all of the instance variables in Apk/App/Repo
should come directly from the index metadata so that they are pure
data classes.  Currently some state info is stored in them, those are
decorated with @JsonIgnore.

The tests then include lists of accepted and ignored properties, and
anything that is not in those lists will cause the tests to fail.  So
if someone is adding a new instance variable, they will get a fail
until the tests are updated.  One set of tests actually writes blank
instances out as JSON since that's the easiest test to write, and
Jackson treats @JsonIgnore the same in both directions.  Then there is
another test that reads a JSON file with added, unsupported values to
make sure that they are properly ignored.
2017-03-31 09:09:31 +11:00
Peter Serwylo 4f7116fcfb Add checkstyle rule to catch usage of member variables prefixed with 'm' 2016-12-05 22:56:26 +11:00
Daniel Martí 8af44b1af5 checkstyle: bump to 7.0
Remove LITERAL_DO from the config in RightCurly as we want this:

        do {
            foo;
        } while (bar);

Not this:

        do {
            foo;
        }
        while (bar);

This went unnoticed as LITERAL_DO was broken in RightCurly in earlier
Checkstyle versions.
2016-07-04 11:31:41 +01:00
Peter Serwylo 53e74dcdbd Appease checkstyle for test code.
Like PMD, we also had to add a concession to allow static imports.
This time, it was achieved by moving the assertions to a more generally
named `Assert` class, and then allowing static imports from that.
2016-06-09 10:44:40 +10:00
Peter Serwylo 4e73d1e5e6 Finish porting tests to Robolectric, and appease PMD.
To appease PMD, we now have a three rulesets in `config/pmd/*.xml`:

 * `rules.xml`: The bulk of the rules, used by both main and test code.
 * `rules-main.xml`: Rules specific to the andoid client code.
 * `rules-test.xml`: Rules specific to test code.

The rationale is because checkstyle by default checks for "too many static
imports", which is a fair call. However in JUnit4 code, it is common to
import many `assert*` static methods.
2016-06-09 10:44:40 +10:00
Daniel Martí c432bf1ea0 PMD: Enable most empty code rules 2016-05-12 13:34:20 +01:00
Daniel Martí 65e2931fe8 PMD: Enable UnnecessaryWrapperObjectCreation 2016-05-12 13:34:20 +01:00
Hans-Christoph Steiner 7fbdfaaae7 enable PMD's java-basic ruleset
* CollapsibleIfStatements is pedantic
* that one NOPMD is for debug logging, it'll go away

closes #623 https://gitlab.com/fdroid/fdroidclient/issues/623
2016-05-12 09:36:08 +02:00
Daniel Martí 78af79cd4f checkstyle: enable OneTopLevelClass
The only remaining error was ClipboardCompat, which was unnecessarily
exposing three top-level classes. Make the two implementation classes be
nested, private and static.
2016-05-07 21:28:06 +01:00
Daniel Martí 023a6d01bd PMD: Enable some extra boolean/logic rules 2016-04-29 19:22:30 +01:00
Daniel Martí ac8d3ff600 PMD: Enable and obey UnnecessaryParentheses
This works on statements, not expressions, so it's a lot easier and
saner to obey than UselessParentheses.
2016-04-29 19:22:04 +01:00
Daniel Martí e5bc365b64 PMD: Enable a bunch of strictexception rules
We already obey them.
2016-04-28 17:17:17 +01:00
Daniel Martí 50b2e6f7a5 PMD: Enable and obey SingularField 2016-04-23 17:27:22 +01:00
Daniel Martí 68db3ae353 PMD: Enable and obey ImmutableField 2016-04-23 17:27:22 +01:00
Daniel Martí c746a49b15 PMD: Enable some design.xml rules we already obey 2016-04-23 17:27:22 +01:00
Daniel Martí f655f49aee PMD: Enable and obey UnnecessaryConstructor 2016-04-23 16:17:55 +01:00
Daniel Martí 857b0ea1c7 PMD: Enable and obey AddEmptyString 2016-04-23 16:14:05 +01:00
Daniel Martí 5d3d8786e2 PMD: Enable and obey PrematureDeclaration 2016-04-23 16:06:41 +01:00
Daniel Martí 32c67d05ec PMD: XML config file, enable most of unnecessary 2016-04-23 15:59:04 +01:00
Hans-Christoph Steiner 9656de0147 remove checkstyle ExplicitInitialization check
"Variable explicitly initialized to 'false' (default value for its type)"

I never remember what the default init value of booleans are, so this error
is quite annoying to me, and I can't see the harm of this behavior.
checkstyle says: "So in this case, x gets initialized to 0 twice, and bar
gets initialized to null twice. So there is a minor inefficiency."
2016-03-29 10:57:55 +02:00
Hans-Christoph Steiner 538830d5a3 ignore checkstyle AvoidStaticImport for test frameworks
For whatever reason, both JUnit and Google recommend using static method
imports when writing tests.
2016-03-29 10:57:55 +02:00
Daniel Martí 17c731ef1d checkstyle: obey ConstantName 2016-02-17 15:59:04 +00:00
Daniel Martí a6b804e93a checkstyle: obey NeedBraces on multi-line stmts
We still allow them in single-line statements, like:

	if (foo) bar;
	for (int i : ints) bar;

Everything else should use braces to help readability and avoid silly
human mistakes that might result in bugs.

These changes were completely automated via a python script.
2016-02-17 12:04:36 +00:00
Daniel Martí 6ab5299e40 checkstyle: clean up modules we'll never use 2016-01-06 21:51:23 +01:00
Daniel Martí 3a8051898a checkstyle: be more strict with curly rules 2015-12-29 22:18:38 +01:00
Daniel Martí c1d4248723 checkstyle: Check comment indentation too 2015-12-29 22:10:19 +01:00