diff --git a/gtoolkit/run.sh b/gtoolkit/run.sh index 76eaebdb..b8762233 100644 --- a/gtoolkit/run.sh +++ b/gtoolkit/run.sh @@ -111,7 +111,14 @@ gtoolkit::prepare_gt() { download_name="$(basename "${gtoolkit_image_url}")" target="${SMALLTALK_CI_CACHE}/${download_name}" - if ! is_file "${target}"; then + if "${config_overwrite_cache}" && is_dir "${target}"; then + print_info "Removing cached image resources for ${smalltalk_name} (update forced)" + rm -r "${target}" + fi + if ! is_dir "${target}"; then + mkdir "${target}" + fi + if ! is_file "${target}"/*.image; then fold_start download_image "Downloading ${smalltalk_name} image..." download_file "${gtoolkit_image_url}" "${target}" fold_end download_image diff --git a/helpers.sh b/helpers.sh index 1ffc8e5e..517e1dbf 100644 --- a/helpers.sh +++ b/helpers.sh @@ -63,39 +63,41 @@ print_help() { This program prepares Smalltalk images/vms, loads projects, and runs tests. OPTIONS: - --clean Clear cache and delete builds. - -d | --debug Enable debug mode. - -h | --help Show this help text. - --headful Open vm in headful mode and do not close image. - --image Custom image for build (Squeak/Pharo). - --install Install symlink to this smalltalkCI instance. - --print-env Print all environment variables used by smalltalkCI - --no-color Disable colored output - --no-tracking Disable collection of anonymous build metrics (Travis CI & AppVeyor only). - -s | --smalltalk Overwrite Smalltalk image selection. - --uninstall Remove symlink to any smalltalkCI instance. - -v | --verbose Enable 'set -x'. - --vm Custom VM for build (Squeak/Pharo). + --clean Clear cache and delete builds. + -d | --debug Enable debug mode. + --force-cache Force use of the cache for all images (overrides '--overwrite-cache'). + -h | --help Show this help text. + --headful Open vm in headful mode and do not close image. + --image Custom image for build (Squeak/Pharo). + --install Install symlink to this smalltalkCI instance. + --overwrite-cache Download the newest image and cache it. + --print-env Print all environment variables used by smalltalkCI + --no-color Disable colored output + --no-tracking Disable collection of anonymous build metrics (Travis CI & AppVeyor only). + -s | --smalltalk Overwrite Smalltalk image selection. + --uninstall Remove symlink to any smalltalkCI instance. + -v | --verbose Enable 'set -x'. + --vm Custom VM for build (Squeak/Pharo). GEMSTONE OPTIONS: - --gs-DEBUG Enable remote debugging of GsDevKit_stones .solo scripts - via topaz DEBUGGEM command. + --gs-DEBUG Enable remote debugging of GsDevKit_stones .solo scripts + via topaz DEBUGGEM command. --gs-PRODUCTS= - Specify directory containing GemStone product downloads - to be used instead of downloading products from - https://ftp.gemtalksystems.com for each run. + Specify directory containing GemStone product downloads + to be used instead of downloading products from + https://ftp.gemtalksystems.com for each run. --gs-REPOS= - Specify directory containing existing server projects to be - used instead of cloning projects from GitHub for each run. + Specify directory containing existing server projects to be + used instead of cloning projects from GitHub for each run. --gs-STONE_DIR= - Specify directory of an existing stone. A symbolic link named - product is expected to exist in the - and point to the GEMSTONE product tree for the stone. The name - stone is expected to be managed independently of the run.sh - script. + Specify directory of an existing stone. A symbolic link named + product is expected to exist in the + and point to the GEMSTONE product tree for the stone. The name + stone is expected to be managed independently of the run.sh + script. EXAMPLE: $(basename -- $0) -s "Squeak64-trunk" --headfull /path/to/project/.smalltalk.ston @@ -440,6 +442,8 @@ export_coveralls_data() { local service_pull_request="" local url="unknown" + pushd "${SMALLTALK_CI_BUILD}" > /dev/null + if ! grep -q "#coverage" "${config_ston}"; then return 0 # Coverage data not needed fi @@ -518,6 +522,9 @@ export_coveralls_data() { } } EOL + + +popd > /dev/null } upload_coveralls_results() { diff --git a/pharo/run.sh b/pharo/run.sh index cab26ffe..dc55b9c6 100644 --- a/pharo/run.sh +++ b/pharo/run.sh @@ -278,8 +278,14 @@ pharo::prepare_image() { local target="${SMALLTALK_CI_CACHE}/${smalltalk_name}" local pharo_zeroconf="${target}/zeroconfig" + if "${config_overwrite_cache}" && is_dir "${target}"; then + print_info "Removing cached image resources for ${smalltalk_name} (update forced)" + rm -r "${target}" + fi if ! is_dir "${target}"; then mkdir "${target}" + fi + if ! is_file "${target}"/*.image; then pushd "${target}" > /dev/null fold_start download_image "Downloading ${smalltalk_name} image..." download_file "${pharo_image_url}" "${pharo_zeroconf}" diff --git a/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/allCategoryNames.st b/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/allCategoryNames.st index 7cc3450b..fa3c36e6 100644 --- a/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/allCategoryNames.st +++ b/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/allCategoryNames.st @@ -7,5 +7,5 @@ allCategoryNames streamContents: [ :stream | packages do: [ :package | stream nextPut: package name asString. - package classTags do: [ :tag | + package tags do: [ :tag | stream nextPut: tag categoryName asString ] ] ]) asSet asArray \ No newline at end of file diff --git a/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/setAuthor..st b/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/setAuthor..st new file mode 100644 index 00000000..d3f55096 --- /dev/null +++ b/repository/SmalltalkCI-Pharo-Core.package/SmalltalkCIPharo12.class/class/setAuthor..st @@ -0,0 +1,3 @@ +helpers +setAuthor: anAuthor + (Smalltalk at: #Author) fullName: anAuthor \ No newline at end of file diff --git a/repository/SmalltalkCI-Tests.package/SmalltalkCITest.class/instance/testAuthor.st b/repository/SmalltalkCI-Tests.package/SmalltalkCITest.class/instance/testAuthor.st index 0a823ffb..f0716127 100644 --- a/repository/SmalltalkCI-Tests.package/SmalltalkCITest.class/instance/testAuthor.st +++ b/repository/SmalltalkCI-Tests.package/SmalltalkCITest.class/instance/testAuthor.st @@ -1,11 +1,11 @@ testing testAuthor | currentAuthor | - currentAuthor := SmalltalkCI getAuthor. + currentAuthor := SmalltalkCI platformClass getAuthor. [ - SmalltalkCI basicNew initialize. - self deny: SmalltalkCI defaultAuthor isNil. + SmalltalkCI platformClass: nil. + self deny: SmalltalkCI platformClass defaultAuthor isNil. ] ensure: [ - SmalltalkCI setAuthor: currentAuthor. - self assert: SmalltalkCI getAuthor equals: currentAuthor ] \ No newline at end of file + SmalltalkCI platformClass setAuthor: currentAuthor. + self assert: SmalltalkCI platformClass getAuthor equals: currentAuthor ] \ No newline at end of file diff --git a/run.sh b/run.sh index 0da83a30..79e77d5d 100755 --- a/run.sh +++ b/run.sh @@ -280,12 +280,33 @@ validate_configuration() { fi } +################################################################################ +# Set options that depend on the context, i.e., the input values and selections +# performed so far. +################################################################################ +set_context_options() { + if [[ "${config_force_cache}" = "true" ]]; then + print_info "Forcing cache use" + config_overwrite_cache="false" + else + case "${config_smalltalk}" in + *-alpha | *-trunk) + print_info "Forcing image update for in-development version" + config_overwrite_cache="true" + ;; + *) + ;; + esac + fi +} + ################################################################################ # Handle user-defined options. # Locals: # config_clean # config_debug # config_headless +# config_overwrite_cache # config_smalltalk # config_verbose # Arguments: @@ -324,6 +345,10 @@ parse_options() { fi shift 2 ;; + --force-cache) + config_force_cache="true" + shift + ;; --no-color) config_colorful="false" shift @@ -332,6 +357,10 @@ parse_options() { config_tracking="false" shift ;; + --overwrite-cache) + config_overwrite_cache="true" + shift + ;; --print-env) print_env exit 0 @@ -524,14 +553,16 @@ run() { # All positional parameters ################################################################################ main() { - export config_smalltalk="" - local config_ston="" local config_clean="false" + local config_colorful="true" local config_debug="false" local config_first_arg_or_empty="" - local config_headless="true" + local config_force_cache="false" + export config_headless="true" local config_image="" - local config_colorful="true" + export config_overwrite_cache="false" + export config_smalltalk="" + local config_ston="" export config_tracking="true" local config_verbose="false" local config_vm="" @@ -544,6 +575,7 @@ main() { ensure_ston_config_exists "${config_first_arg_or_empty}" select_smalltalk validate_configuration + set_context_options config_vm_dir="${SMALLTALK_CI_VMS}/${config_smalltalk}" prepare_folders export_coveralls_data diff --git a/squeak/run.sh b/squeak/run.sh index 758eba42..496718c6 100755 --- a/squeak/run.sh +++ b/squeak/run.sh @@ -74,6 +74,10 @@ squeak::download_prepared_image() { local git_tag=$2 local target="${SMALLTALK_CI_CACHE}/${download_name}" + if "${config_overwrite_cache}" && is_file "${target}"; then + print_info "Removing cached image resources for ${smalltalk_name} (update forced)" + rm "${target}" + fi if ! is_file "${target}"; then fold_start download_image "Downloading '${download_name}' testing image..." download_file "${BASE_DOWNLOAD}/${git_tag}/${download_name}" "${target}"