diff --git a/.drone.yml b/.drone.yml index 71e49b10..effb7ac0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,7 @@ clone: steps: - name: clone - image: cirrusci/flutter:2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.7.1 environment: buildbot_key_b64: from_secret: buildbot_key_b64 @@ -24,14 +24,14 @@ steps: - git checkout $DRONE_COMMIT - name: fetch - image: cirrusci/flutter:2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.7.1 volumes: - name: deps path: /root/.pub-cache commands: - ./fetch-tor.sh - echo `git describe --tags --abbrev=1` > VERSION - - echo `date +%G-%m-%d-%H-%M` > BUILDDATE + - echo `git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M` > COMMIT_DATE - flutter pub get - mkdir deploy - ./fetch-libcwtch-go.sh @@ -47,12 +47,12 @@ steps: # #Todo: fix all the lint errors and add `-set_exit_status` above to enforce linting - name: build-linux - image: openpriv/flutter-desktop:linux-fstable-2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.7.1 volumes: - name: deps path: /root/.pub-cache commands: - - flutter build linux --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE` + - flutter build linux --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat COMMIT_DATE` - linux/package-release.sh - mkdir -p deploy/cwtch - cp -r build/linux/x64/release/bundle/* deploy/cwtch @@ -60,8 +60,17 @@ steps: - tar -czf cwtch-`cat ../VERSION`.tar.gz cwtch - rm -r cwtch + - name: linux-ui-tests + image: openpriv/flutter-desktop:linux-fstable-3.7.1 + volumes: + - name: deps + path: /root/.pub-cache + commands: + # Run 01_general, 02_global_settings, and 04_profile_mgmt features... + - ./run-tests-headless.sh "01_general|02_global_settings|04_profile_mgmt" + - name: test-build-android - image: cirrusci/flutter:2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.7.1 when: event: pull_request volumes: @@ -71,7 +80,7 @@ steps: - flutter build apk --debug - name: build-android - image: cirrusci/flutter:2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.7.1 when: event: push environment: @@ -86,16 +95,16 @@ steps: - echo $upload_jks_file_b64 > upload-keystore.jks.b64 - base64 -i --decode upload-keystore.jks.b64 > android/app/upload-keystore.jks - sed -i "s/%jks-password%/$upload_jks_pass/g" android/key.properties - - flutter build appbundle --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE` + - flutter build appbundle --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat COMMIT_DATE` # cant do debug for final release, this is just a stop gap - - flutter build apk --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE` + - flutter build apk --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat COMMIT_DATE` # or build apk --split-per-abi ? - - cp build/app/outputs/bundle/release/app-release.aab deploy/ - - cp build/app/outputs/apk/release/app-release.apk deploy/ + - cp build/app/outputs/bundle/release/app-release.aab deploy/cwtch-`cat VERSION`.aab + - cp build/app/outputs/apk/release/app-release.apk deploy/cwtch-`cat VERSION`.apk #- cp build/app/outputs/flutter-apk/app-debug.apk deploy/android - name: widget-tests - image: cirrusci/flutter:2.8.0 + image: openpriv/flutter-desktop:linux-fstable-3.7.1 volumes: - name: deps path: /root/.pub-cache @@ -118,27 +127,16 @@ steps: - echo $BUILDFILES_KEY > ~/id_rsab64 - base64 -d ~/id_rsab64 > ~/id_rsa - chmod 400 ~/id_rsa - - export DIR=flwtch-`cat BUILDDATE`-`cat VERSION` + - export DIR=flwtch-`cat COMMIT_DATE`-`cat VERSION` - mv deploy $DIR - cp -r coverage/html $DIR/coverage-tests - cp -r test/failures $DIR/test-failures || true - cd $DIR - - find . -type f -exec sha256sum {} \; > ./../sha256s.txt - - mv ./../sha256s.txt . + - find . -type f -exec sha512sum {} \; > ./../sha512s.txt + - mv ./../sha512s.txt . - cd .. - scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ - - name: notify-email - image: drillster/drone-email - pull: if-not-exists - settings: - host: build.openprivacy.ca - port: 25 - skip_verify: true - from: drone@openprivacy.ca - when: - status: [ failure ] - - name: notify-gogs image: openpriv/drone-gogs pull: if-not-exists @@ -177,7 +175,7 @@ clone: steps: - name: clone - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.7.1 environment: buildbot_key_b64: from_secret: buildbot_key_b64 @@ -195,21 +193,21 @@ steps: - git checkout $Env:DRONE_COMMIT - name: fetch - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.7.1 commands: - git describe --tags --abbrev=1 > VERSION - - powershell -command "Get-Date -Format 'yyyy-MM-dd-HH-mm'" > BUILDDATE + - git log -1 --format=%cd --date=format:'%Y-%m-%d-%H-%M' > COMMIT_DATE - .\fetch-tor-win.ps1 - .\fetch-libcwtch-go.ps1 - name: build-windows - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.7.1 commands: - flutter pub get - $Env:version += type .\VERSION - - $Env:builddate += type .\BUILDDATE + - $Env:commitdate += type .\COMMIT_DATE - $Env:releasedir = "build\\windows\\runner\\Release\\" - - flutter build windows --dart-define BUILD_VER=$Env:version --dart-define BUILD_DATE=$Env:builddate + - flutter build windows --dart-define BUILD_VER=$Env:version --dart-define BUILD_DATE=$Env:commitdate - copy windows\libCwtch.dll $Env:releasedir # flutter hasn't worked out it's packaging of required dll's so we have to resort to this manual nonsense # https://github.com/google/flutter-desktop-embedding/issues/587 @@ -229,38 +227,38 @@ steps: status: [ success ] environment: pfx: - from_secret: pfx + from_secret: pfx2022_b64 pfx_pass: from_secret: pfx_pass commands: - $Env:version += type .\VERSION - - $Env:builddate += type .\BUILDDATE + - $Env:commitdate += type .\COMMIT_DATE - $Env:releasedir = "build\\windows\\runner\\Release\\" - $Env:zip = 'cwtch-' + $Env:version + '.zip' - - $Env:zipsha = $Env:zip + '.sha512' - - $Env:msix = 'cwtch-install-' + $Env:version + '.msix' - - $Env:msixsha = $Env:msix + '.sha512' - - $Env:buildname = 'flwtch-win-' + $Env:builddate + '-' + $Env:version + - $Env:zipsha = $Env:zip + '.sha512.txt' + - $Env:buildname = 'flwtch-' + $Env:commitdate + '-' + $Env:version - $Env:builddir = $Env:buildname - echo $Env:pfx > codesign.pfx.b64 - certutil -decode codesign.pfx.b64 codesign.pfx - signtool sign /v /fd sha256 /a /f codesign.pfx /p $Env:pfx_pass /tr http://timestamp.digicert.com $Env:releasedir\cwtch.exe + - signtool sign /v /fd sha256 /a /f codesign.pfx /p $Env:pfx_pass /tr http://timestamp.digicert.com $Env:releasedir\libCwtch.dll + - signtool sign /v /fd sha256 /a /f codesign.pfx /p $Env:pfx_pass /tr http://timestamp.digicert.com $Env:releasedir\flutter_windows.dll - copy windows\runner\resources\knot_128.ico $Env:releasedir\cwtch.ico - makensis windows\nsis\cwtch-installer.nsi - move windows\nsis\cwtch-installer.exe cwtch-installer.exe - signtool sign /v /fd sha256 /a /f codesign.pfx /p $Env:pfx_pass /tr http://timestamp.digicert.com cwtch-installer.exe - - powershell -command "(Get-FileHash cwtch-installer.exe -Algorithm sha512).Hash" > cwtch-installer.sha512 + - powershell -command "(Get-FileHash cwtch-installer.exe -Algorithm sha512).Hash" > cwtch-installer.sha512.txt - mkdir deploy - mkdir deploy\$Env:builddir - move $Env:releasedir $Env:builddir - powershell -command "Compress-Archive -Path $Env:builddir -DestinationPath cwtch.zip" - powershell -command "(Get-FileHash cwtch.zip -Algorithm sha512).Hash" > $Env:zipsha - - move cwtch-installer.exe deploy\$Env:builddir\cwtch-installer.exe + - move cwtch-installer.exe deploy\$Env:builddir\cwtch-installer-$Env:version.exe - move cwtch.zip deploy\$Env:builddir\$Env:zip - - move *.sha512 deploy\$Env:builddir + - move *.sha512.txt deploy\$Env:builddir - name: deploy-windows - image: openpriv/flutter-desktop:windows-sdk30-fstable-2.8.1 + image: openpriv/flutter-desktop:windows-sdk30-fstable-3.7.1 when: event: push status: [ success ] @@ -317,7 +315,7 @@ steps: commands: - ./fetch-tor-macos.sh - echo `git describe --tags --abbrev=1` > VERSION - - echo `date +%G-%m-%d-%H-%M` > BUILDDATE + - echo `git log -1 --format=%cd --date=format:%G-%m-%d-%H-%M` > COMMIT_DATE - export PATH=$PATH:/Users/Dan/development/flutter/bin - flutter pub get - mkdir deploy @@ -330,11 +328,11 @@ steps: - export GEM_HOME=$HOME/.gem - export PATH=$GEM_HOME/ruby/2.6.0/bin:$PATH - flutter config --enable-macos-desktop - - flutter build macos --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE` + - flutter build macos --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat COMMIT_DATE` - export PATH=$PATH:/usr/local/bin #create-dmg - macos/package-release.sh - mkdir -p deploy - - mv Cwtch.dmg deploy + - mv Cwtch.dmg deploy/Cwtch-`cat VERSION`.dmg - name: deploy-buildfiles environment: @@ -347,11 +345,11 @@ steps: - echo $BUILDFILES_KEY > ~/id_rsab64 - base64 -d ~/id_rsab64 > ~/id_rsa - chmod 400 ~/id_rsa - - export DIR=flwtch-macos-`cat BUILDDATE`-`cat VERSION` + - export DIR=flwtch-`cat COMMIT_DATE`-`cat VERSION` - mv deploy $DIR - cd $DIR - - find . -type f -exec shasum -a 512 {} \; > ./../sha512s.txt - - mv ./../sha512s.txt . + - find . -type f -exec shasum -a 512 {} \; > ./../Cwtch.dmg.sha512.txt + - mv ./../Cwtch.dmg.sha512.txt . - cd .. - scp -r -o StrictHostKeyChecking=no -i ~/id_rsa $DIR buildfiles@build.openprivacy.ca:/home/buildfiles/buildfiles/ diff --git a/.gitignore b/.gitignore index c2dfc6e5..1a15686e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,11 @@ .buildlog/ .history .svn/ +package.json +package-lock.json +libCwtch* +cwtch.aar +node_modules # IntelliJ related *.iml @@ -40,10 +45,32 @@ app.*.symbols # Obfuscation related app.*.map.json +# Tor +*data-dir* + +# Test Artificats +*.log +flutter_gherkin +run-tests.env +report.json +package. + +# Compiled Libs linux/tor linux/libCwtch.so android/cwtch/cwtch.aar android/app/src/main/jniLibs/*/libtor.so +*.dylib +integration_test/gherkin_suite_test.g.dart +integration_test/gherkin_suite_test.dart +integration_test/gherkin/ +integration_test/CustomSteps.md +analysis_options.yaml +integration_test/env/default/tor +integration_test/env/temp* +linux/Tor +linux/tor.tar.gz + coverage test/failures .gradle diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version deleted file mode 100644 index c1b3b9f6..00000000 --- a/LIBCWTCH-GO-MACOS.version +++ /dev/null @@ -1 +0,0 @@ -2022-04-21-19-14-1.7.1 \ No newline at end of file diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index f0bb418d..8ac98c3e 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2022-04-21-23-14-1.7.1 \ No newline at end of file +2023-04-05-19-46-v0.0.3-13-gb7a4bc2 \ No newline at end of file diff --git a/README.md b/README.md index 755398a4..86c50e26 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ To build a release version and load normal profiles, use `build-release.sh X` in ### Building on MacOS - Cocaopods is required, you may need to `gem install cocaopods -v 1.9.3` -- copy `libCwtch.dylib` into the root folder, or run `fetch-libcwtch-go-macos.sh` to download it +- copy `libCwtch.x64.dylib` and `libCwtch.arm/dylib` into the root folder, or run `fetch-libcwtch-go-macos.sh` to download it - run `fetch-tor-macos.sh` to fetch Tor or Download and install Tor Browser and `cp -r /Applications/Tor\ Browser.app/Contents/MacOS/Tor ./macos/` - `flutter build macos` - optional: launch cwtch-ui release build with `./build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/Cwtch` diff --git a/android/app/build.gradle b/android/app/build.gradle index 4899ea9e..c616f190 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 30 + compileSdkVersion 33 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -42,15 +42,23 @@ android { lintOptions { disable 'InvalidPackage' + + // For some reason we get Error: LottieAnimationView must extend android.view.View + // Given the newer gradle build...I'm not sure why, but it does impact functionality at all + // there is no information about this error and the command output suggests including the + // following: + abortOnError false } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "im.cwtch.flwtch" minSdkVersion 16 - targetSdkVersion 30 + targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + multiDexEnabled true } signingConfigs { @@ -89,17 +97,27 @@ dependencies { implementation project(':cwtch') implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2" - implementation "com.airbnb.android:lottie:4.2.1" + implementation "com.airbnb.android:lottie:5.2.0" implementation "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0" implementation "com.android.support.constraint:constraint-layout:2.0.4" + // Test Dependencies + testImplementation 'junit:junit:4.12' + + // https://developer.android.com/jetpack/androidx/releases/test/#1.2.0 + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + // WorkManager // (Java only) //implementation("androidx.work:work-runtime:$work_version") // Kotlin + coroutines - implementation("androidx.work:work-runtime-ktx:2.5.0") + // 2022.06: upgraded from 2.5 to 2.7 for android 12 + // err: "requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent" + // as per https://github.com/flutter/flutter/issues/93609 + implementation 'androidx.work:work-runtime-ktx:2.7.0' // optional - RxJava2 support //implementation("androidx.work:work-rxjava2:$work_version") @@ -117,5 +135,5 @@ dependencies { // needed to prevent a ListenableFuture dependency conflict/bug // see https://github.com/google/ExoPlayer/issues/7905#issuecomment-692637059 - implementation 'com.google.guava:guava:any' + implementation "com.google.guava:guava:31.0.1-android" } diff --git a/android/app/src/androidTest/java/im/cwtch/flwtch/MainActivityTest.java b/android/app/src/androidTest/java/im/cwtch/flwtch/MainActivityTest.java new file mode 100644 index 00000000..e221facf --- /dev/null +++ b/android/app/src/androidTest/java/im/cwtch/flwtch/MainActivityTest.java @@ -0,0 +1,12 @@ +package im.cwtch.flwtch; + +import androidx.test.rule.ActivityTestRule; +import dev.flutter.plugins.integration_test.FlutterTestRunner; +import org.junit.Rule; +import org.junit.runner.RunWith; + +@RunWith(FlutterTestRunner.class) +public class MainActivityTest { + @Rule + public ActivityTestRule rule = new ActivityTestRule<>(MainActivity.class, true, false); +} \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 379253be..6c9df750 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -16,7 +16,8 @@ android:theme="@style/NormalTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" - android:windowSoftInputMode="adjustResize"> + android:windowSoftInputMode="adjustResize" + android:exported="true">