From e4e2aaad953fd911c12b5e2655c3fa22d275d80e Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sat, 30 Jun 2018 20:53:29 -0400 Subject: [PATCH] Ensure GitLab CI does clean builds. --- .gitlab-ci.yml | 5 +++-- gradle/settings.gradle | 28 +++++++++++------------- lib/bin/build_lib | 6 ++--- platform-independent/c/core/build.gradle | 4 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 835c0390..81855515 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,9 +6,10 @@ build_project: stage: build script: - "( brew bundle )" - - "( ./lib/bin/build_libsodium-macos )" + - "( ./lib/bin/build_libsodium-macos clean && ./lib/bin/build_libsodium-macos )" + - "( ./lib/bin/build_libjson-c-macos clean && ./lib/bin/build_libjson-c-macos )" - "( cd ./platform-independent/c/cli && ./clean && targets=all ./build && ./mpw-tests && ./mpw-cli-tests )" - - "( cd ./gradle && ./gradlew --info clean test )" + - "( cd ./gradle && ./gradlew --stacktrace clean test )" - "( xcodebuild -workspace platform-darwin/MasterPassword.xcworkspace -configuration 'Test' -scheme 'MasterPassword iOS' -sdk iphonesimulator clean build )" - "( xcodebuild -workspace platform-darwin/MasterPassword.xcworkspace -configuration 'Test' -scheme 'MasterPassword macOS' clean build )" tags: diff --git a/gradle/settings.gradle b/gradle/settings.gradle index 6086dddb..74f5bc7f 100644 --- a/gradle/settings.gradle +++ b/gradle/settings.gradle @@ -1,29 +1,27 @@ rootProject.name = 'masterpassword' -def local = new Properties(); -try { - local.load(file('local.properties').newDataInputStream()) -} catch (FileNotFoundException ignored) { -} +def local = new Properties() +def localFile = file( 'local.properties' ) +localFile.exists() && local.load( localFile.newDataInputStream() ) include 'masterpassword-core' -project(':masterpassword-core').projectDir = new File( '../platform-independent/c/core' ) +project( ':masterpassword-core' ).projectDir = new File( '../platform-independent/c/core' ) include 'masterpassword-algorithm' -project(':masterpassword-algorithm').projectDir = new File( '../platform-independent/java/algorithm' ) +project( ':masterpassword-algorithm' ).projectDir = new File( '../platform-independent/java/algorithm' ) include 'masterpassword-model' -project(':masterpassword-model').projectDir = new File( '../platform-independent/java/model' ) +project( ':masterpassword-model' ).projectDir = new File( '../platform-independent/java/model' ) include 'masterpassword-tests' -project(':masterpassword-tests').projectDir = new File( '../platform-independent/java/tests' ) +project( ':masterpassword-tests' ).projectDir = new File( '../platform-independent/java/tests' ) include 'masterpassword-gui' -project(':masterpassword-gui').projectDir = new File( '../platform-independent/java/gui' ) +project( ':masterpassword-gui' ).projectDir = new File( '../platform-independent/java/gui' ) -//if (local.containsKey('sdk.dir')) { +if (local.containsKey( 'sdk.dir' ) && file( local.getProperty( 'sdk.dir' ) ).exists()) { include 'masterpassword-android' - project(':masterpassword-android').projectDir = new File( '../platform-android' ) -//} else { -// logger.warn( "Skipping masterpassword-android since sdk.dir is not defined in local.properties." ) -//} + project( ':masterpassword-android' ).projectDir = new File( '../platform-android' ) +} else { + logger.warn( "Skipping masterpassword-android since sdk.dir is not defined in local.properties." ) +} diff --git a/lib/bin/build_lib b/lib/bin/build_lib index d3634655..1b9760b1 100755 --- a/lib/bin/build_lib +++ b/lib/bin/build_lib @@ -2,7 +2,7 @@ # # Your build script should simply source this script, optionally override any build hooks and then invoke `build`. # The build product should be available under `build-~/out`, under the library path. -# +# # Hook lifecycle: # - build # - initialize @@ -187,7 +187,7 @@ _target_build() { if [[ $platform = windows ]]; then # I cannot for the life of me figure out how to pass this command directly into cmd. - printf '"%%VSINSTALLDIR%%\Common7\Tools\VsMSBuildCmd.bat" && msbuild /t:Rebuild /p:Configuration=Release;Platform=%s;OutDir=%s' "$arch" "$(cygpath -w "${prefix##$PWD/}/$arch/")" > .build.bat + printf '"%%VSINSTALLDIR%%\Common7\Tools\VsMSBuildCmd.bat" && msbuild /t:Rebuild /p:Configuration=ReleaseDLL;Platform=%s;OutDir=%s' "$arch" "$(cygpath -w "${prefix##$PWD/}/$arch/")" > .build.bat cmd //c .build.bat rm -f .build.bat else @@ -280,6 +280,7 @@ _build() { 'ios') archs=( 'i386' 'x86_64' 'armv7' 'armv7s' 'arm64' ) ;; 'android') archs=( 'arm' 'arm64' 'x86' 'x86_64' ) ;; 'windows') archs=( 'Win32' 'x64' ) ;; + *) archs=( 'i386' 'x86_64' ) ;; esac fi @@ -354,4 +355,3 @@ _build() { finalize "$prefix" "$platform" "${archs[@]}" } - diff --git a/platform-independent/c/core/build.gradle b/platform-independent/c/core/build.gradle index 3ebdaafb..8237f9ad 100644 --- a/platform-independent/c/core/build.gradle +++ b/platform-independent/c/core/build.gradle @@ -64,11 +64,11 @@ library { } archive.dependsOn project.tasks.maybeCreate( "build_libsodium-${system}", Exec.class ).configure { - commandLine 'bash', "$rootDir/../lib/bin/build_libsodium-${system}" + commandLine 'bash', '-x', "$rootDir/../lib/bin/build_libsodium-${system}" privateHeaders.from "$rootDir/../lib/libsodium/src/libsodium/include" } archive.dependsOn project.tasks.maybeCreate( "build_libjson-c-${system}", Exec.class ).configure { - commandLine 'bash', "$rootDir/../lib/bin/build_libjson-c-${system}" + commandLine 'bash', '-x', "$rootDir/../lib/bin/build_libjson-c-${system}" privateHeaders.from "$rootDir/../lib/libjson-c/build-${system}~/out" } }