From c16fe7a7c9dc9c5682c2b9a36b52de59d7578ab1 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 24 Sep 2019 10:50:51 +0200 Subject: [PATCH 1/3] Using workflows to build on circleci --- .circleci/config.yml | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 258340afc..fccd6d8cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ version: 2 jobs: - build: + test: docker: - image: circleci/android:api-28 @@ -21,11 +21,24 @@ jobs: - v1-android- - run: - # To build release, we need to create a temporary keystore that can be used to sign the app - command: | - keytool -noprompt -genkey -v -keystore "app/keystore" -alias alias -storepass password -keypass password -keyalg RSA -validity 10 -dname "CN=antennapod.org, OU=dummy, O=dummy, L=dummy, S=dummy, C=US" - ./gradlew assembleRelease :core:testPlayReleaseUnitTest :app:assemblePlayDebugAndroidTest -PdisablePreDex - no_output_timeout: 1800 + name: Create temporary release keystore + command: keytool -noprompt -genkey -v -keystore "app/keystore" -alias alias -storepass password -keypass password -keyalg RSA -validity 10 -dname "CN=antennapod.org, OU=dummy, O=dummy, L=dummy, S=dummy, C=US" + + - run: + name: Build debug + command: ./gradlew assembleDebug -PdisablePreDex + + - run: + name: Build release + command: ./gradlew assembleRelease -PdisablePreDex + + - run: + name: Execute unit tests + command: ./gradlew :core:testPlayReleaseUnitTest -PdisablePreDex + + - run: + name: Build integration tests + command: ./gradlew :app:assemblePlayDebugAndroidTest -PdisablePreDex - store_artifacts: path: app/build/outputs/apk @@ -37,3 +50,10 @@ jobs: - ~/.gradle - ~/android key: v1-android-{{ checksum "build.gradle" }} + +workflows: + version: 2 + + test: + jobs: + - test From b7301ca3600cee93d25a81c07740812a42eaeff4 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 24 Sep 2019 11:12:35 +0200 Subject: [PATCH 2/3] Added checkstyle --- .circleci/config.yml | 16 ++++++++++++++++ build.gradle | 11 +++++++++++ config/checkstyle/checkstyle.xml | 28 ++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 config/checkstyle/checkstyle.xml diff --git a/.circleci/config.yml b/.circleci/config.yml index fccd6d8cb..a4db1befd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,9 +51,25 @@ jobs: - ~/android key: v1-android-{{ checksum "build.gradle" }} + checkstyle: + docker: + - image: circleci/android:api-28 + working_directory: ~/AntennaPod + + steps: + - checkout + + - run: + name: Checkstyle + command: ./gradlew checkstyle + workflows: version: 2 test: jobs: - test + + checkstyle: + jobs: + - checkstyle diff --git a/build.gradle b/build.gradle index 2ca680ccb..1a00c2e65 100644 --- a/build.gradle +++ b/build.gradle @@ -82,3 +82,14 @@ wrapper { def doFreeBuild() { return hasProperty("freeBuild") } + +apply plugin: "checkstyle" +checkstyle { + toolVersion '8.24' +} + +task checkstyle(type: Checkstyle) { + classpath = files() + source "${project.rootDir}" + exclude("**/gen/**") +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 000000000..4bc3d0b51 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + From 58348908ea5821af5e6e8be823e43bdd4450b006 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 24 Sep 2019 11:27:08 +0200 Subject: [PATCH 3/3] Fixed checkstyle violations --- .../danoeh/antennapod/activity/MediaplayerActivity.java | 2 +- .../antennapod/adapter/actionbutton/ItemActionButton.java | 6 +++--- .../danoeh/antennapod/dialog/ChooseDataFolderDialog.java | 2 +- .../java/de/danoeh/antennapod/fragment/QueueFragment.java | 2 +- .../danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java | 8 ++++++-- .../antennapod/core/service/download/DownloadService.java | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java index 52497a27f..d3a4268f9 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MediaplayerActivity.java @@ -635,7 +635,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements } } - static public void showSkipPreference(Activity activity, SkipDirection direction) { + public static void showSkipPreference(Activity activity, SkipDirection direction) { int checked = 0; int skipSecs = direction.getPrefSkipSeconds(); final int[] values = activity.getResources().getIntArray(R.array.seek_delta_values); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/ItemActionButton.java b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/ItemActionButton.java index da5ebf6e1..6dbeccfc9 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/ItemActionButton.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/actionbutton/ItemActionButton.java @@ -20,12 +20,12 @@ public abstract class ItemActionButton { } @StringRes - abstract public int getLabel(); + public abstract int getLabel(); @AttrRes - abstract public int getDrawable(); + public abstract int getDrawable(); - abstract public void onClick(Context context); + public abstract void onClick(Context context); public int getVisibility() { return View.VISIBLE; diff --git a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java index c185a5557..4cfa7e870 100644 --- a/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java +++ b/app/src/main/java/de/danoeh/antennapod/dialog/ChooseDataFolderDialog.java @@ -9,7 +9,7 @@ import de.danoeh.antennapod.adapter.DataFolderAdapter; public class ChooseDataFolderDialog { - public static abstract class RunnableWithString implements Runnable { + public abstract static class RunnableWithString implements Runnable { public RunnableWithString() { super(); } diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java index 5f6fe26ee..6ea654d6c 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/QueueFragment.java @@ -640,7 +640,7 @@ public class QueueFragment extends Fragment { / playbackSpeed); } } - info += " \u2022 "; + info += " • "; info += getString(R.string.time_left_label); info += Converter.getDurationStringLocalized(getActivity(), timeLeft); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java b/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java index b75e1630c..bb34e2c0f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java @@ -21,8 +21,12 @@ import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.HttpDownloader; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.NetworkUtils; -import okhttp3.*; -import okhttp3.internal.http.RealResponseBody; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Protocol; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; /** * @see com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index e4dedc23b..0f346893e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -1076,7 +1076,7 @@ public class DownloadService extends Service { private static String compileNotificationString(List downloads) { List lines = new ArrayList<>(downloads.size()); for (Downloader downloader : downloads) { - StringBuilder line = new StringBuilder("\u2022 "); + StringBuilder line = new StringBuilder("• "); DownloadRequest request = downloader.getDownloadRequest(); switch (request.getFeedfileType()) { case Feed.FEEDFILETYPE_FEED: