diff --git a/.gitignore b/.gitignore index 7650f10..60111e7 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,5 @@ tmp/ .DS_Store .env -/nbproject/private/ \ No newline at end of file +/nbproject/private/ +/bin/ diff --git a/.travis.yml b/.travis.yml index 2f9a71d..91d5e24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,26 +11,12 @@ cache: env: global: - - _ANT_VERSION=1.9.14 - - _CLOC_VERSION=1.82 - - _PMD_VERSION=6.17.0 - - _IVY_VERSION=2.5.0-rc1 - - PACKAGE_VERSION=0.5.$TRAVIS_BUILD_NUMBER + - _IVY_VERSION=2.5.0 + - PACKAGE_VERSION=0.6.$TRAVIS_BUILD_NUMBER install: - - if [ ! -d .tmp ]; then mkdir .tmp; fi - # SFDX CLI - - cd .tmp && npm install sfdx-cli --loglevel info --cache npm-cache && cd .. - - export SFDX_HOME=$TRAVIS_BUILD_DIR/.tmp/node_modules/.bin - - export PATH=$SFDX_HOME:$PATH - # Apache Ant - - if [ ! -f .tmp/apache-ant-$_ANT_VERSION/bin/ant ]; then wget -nv -O .tmp/apache-ant-$_ANT_VERSION-bin.tar.gz http://mirrors.ircam.fr/pub/apache//ant/binaries/apache-ant-$_ANT_VERSION-bin.tar.gz && tar -xzvf .tmp/apache-ant-$_ANT_VERSION-bin.tar.gz -C .tmp; fi - - export ANT_HOME=$TRAVIS_BUILD_DIR/.tmp/apache-ant-$_ANT_VERSION - # PMD - - if [ ! -f .tmp/pmd-bin-$_PMD_VERSION/bin/run.sh ]; then wget -nv -O .tmp/pmd-bin-$_PMD_VERSION.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F$_PMD_VERSION/pmd-bin-$_PMD_VERSION.zip && unzip .tmp/pmd-bin-$_PMD_VERSION.zip -d .tmp; fi - - export PMD_HOME=$TRAVIS_BUILD_DIR/.tmp/pmd-bin-$_PMD_VERSION - # CLOC - - if [ ! -f .tmp/cloc.pl ]; then wget -nv -O .tmp/cloc.pl https://github.com/AlDanial/cloc/releases/download/$_CLOC_VERSION/cloc-$_CLOC_VERSION.pl; fi + - . build/.bashrc + # Apache Ivy - if [ ! -d ivy ]; then mkdir ivy; fi - if [ ! -f ivy/ivy.jar ]; then wget -nv -O ivy/ivy.jar https://repo1.maven.org/maven2/org/apache/ivy/ivy/$_IVY_VERSION/ivy-$_IVY_VERSION.jar; fi diff --git a/.vscode/settings.json b/.vscode/settings.json index ab6405f..973c2e4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,13 +16,12 @@ "**/tmp/*/**": true }, "terminal.integrated.shell.linux": "bash", - "terminal.integrated.shell.osx": "bash", - "terminal.integrated.shell.windows": "cmd.exe", "terminal.integrated.shellArgs.linux": [ "--rcfile", "build/.bashrc", "-i" ], + "terminal.integrated.shell.osx": "bash", "terminal.integrated.shellArgs.osx": [ "--rcfile", "build/.bashrc", @@ -31,6 +30,7 @@ "/bin/zsh", "-l" ], + "terminal.integrated.shell.windows": "cmd.exe", "terminal.integrated.shellArgs.windows": [ "/V:ON", "/K", diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0cf69d8..299a913 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,51 +1,17 @@ pool: - # cf. https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md - vmImage: 'vs2017-win2016' + # cf. https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md + vmImage: 'windows-2019' variables: - _ANT_VERSION: 1.9.14 - _CLOC_VERSION: 1.82 - _PMD_VERSION: 6.17.0 - IVY_VERSION: 2.5.0-rc1 - ANT_HOME: + IVY_VERSION: 2.5.0 steps: -- script: | - ECHO ##vso[task.setvariable variable=SFDX_HOME]%AGENT_BUILDDIRECTORY%\.tmp\node_modules\.bin - ECHO ##vso[task.prependpath]%AGENT_BUILDDIRECTORY%\.tmp\node_modules\.bin - IF NOT EXIST .tmp MKDIR .tmp - PUSHD .tmp - npm install sfdx-cli --loglevel info --cache npm-cache - POPD - displayName: Install SFDX CLI -- script: | - ECHO ##vso[task.setvariable variable=ANT_HOME]%AGENT_BUILDDIRECTORY%\.tmp\apache-ant-%_ANT_VERSION% - ECHO ##vso[task.prependpath]%AGENT_BUILDDIRECTORY%\.tmp\apache-ant-%_ANT_VERSION%\bin - IF NOT EXIST "%CD%\.tmp\apache-ant-%_ANT_VERSION%\bin\ant.bat" ( - IF NOT EXIST .tmp MKDIR .tmp - powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest http://mirrors.ircam.fr/pub/apache//ant/binaries/apache-ant-$Env:_ANT_VERSION-bin.zip -OutFile .tmp\apache-ant-$Env:_ANT_VERSION-bin.zip; }" - IF ERRORLEVEL 1 GOTO ERROR_ANT - powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "Expand-Archive -Path .tmp\apache-ant-$Env:_ANT_VERSION-bin.zip -DestinationPath .tmp -Force" - IF ERRORLEVEL 1 GOTO ERROR_ANT - ) - displayName: Install Ant $(_ANT_VERSION) -- script: | - ECHO ##vso[task.setvariable variable=PMD_HOME]%AGENT_BUILDDIRECTORY%\.tmp\pmd-bin-%_PMD_VERSION% - IF NOT EXIST "%CD%\.tmp\pmd-bin-%_PMD_VERSION%\bin\pmd.bat" ( - IF NOT EXIST .tmp MKDIR .tmp - powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest https://github.com/pmd/pmd/releases/download/pmd_releases%%2F$Env:_PMD_VERSION/pmd-bin-$Env:_PMD_VERSION.zip -OutFile .tmp\pmd-bin-$Env:_PMD_VERSION.zip; }" - IF ERRORLEVEL 1 GOTO ERROR_PMD - powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "Expand-Archive -Path .tmp\pmd-bin-$Env:_PMD_VERSION.zip -DestinationPath .tmp -Force" - IF ERRORLEVEL 1 GOTO ERROR_PMD - ) - displayName: Install PMD $(_PMD_VERSION) -- script: | - IF NOT EXIST "%CD%\.tmp\cloc.exe" ( - IF NOT EXIST .tmp MKDIR .tmp - powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest https://github.com/AlDanial/cloc/releases/download/$Env:_CLOC_VERSION/cloc-$Env:_CLOC_VERSION.exe -OutFile .tmp\cloc.exe; }" - IF ERRORLEVEL 1 GOTO ERROR_CLOC - ) - displayName: Install CLOC $(_CLOC_VERSION) +- task: BatchScript@1 + inputs: + filename: build\SetEnv.bat + arguments: /useCurrentJavaHome + modifyEnvironment: True + workingFolder: $(Build.Repository.LocalPath) - script: | IF NOT EXIST ivy MKDIR ivy PUSHD ivy @@ -60,10 +26,9 @@ steps: - task: Ant@1 inputs: buildFile: 'build.xml' - options: -noclasspath -nouserlib -noinput -lib 'ivy/lib/test' -Dverbosity=verbose + options: -noclasspath -nouserlib -noinput -lib ivy/lib/test -Dverbosity=verbose targets: release publishJUnitResults: true - testResultsFiles: '$(Agent.BuildDirectory)\tmp\obj\test\results\**\TEST-*.xml' - antHomeDirectory: '$(Agent.BuildDirectory)\.tmp\apache-ant-$(_ANT_VERSION)' + testResultsFiles: '$(Build.Repository.LocalPath)\tmp\obj\test\results\**\TEST-*.xml' + antHomeDirectory: '$(ANT_HOME)' jdkVersionOption: 1.8 -- script: ECHO ##vso[build.uploadlog]$(Agent.BuildDirectory)\build.log diff --git a/build.bat b/build.bat index 4204f65..d304f74 100644 --- a/build.bat +++ b/build.bat @@ -14,7 +14,7 @@ VERIFY OTHER 2>nul SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION IF ERRORLEVEL 1 GOTO ERROR_EXT -SET IVY_VERSION=2.5.0-rc1 +SET IVY_VERSION=2.5.0 SET NO_PAUSE=0 SET PROJECT=build.xml diff --git a/build.sh b/build.sh index 531ba44..c696840 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ source build/.bashrc -_IVY_VERSION=2.5.0-rc1 +_IVY_VERSION=2.5.0 _PROJECT=build.xml _TARGET=build diff --git a/build/.bashrc b/build/.bashrc old mode 100644 new mode 100755 index 93d8aa2..e325fc8 --- a/build/.bashrc +++ b/build/.bashrc @@ -1,12 +1,18 @@ #!/bin/bash -_ANT_VERSION=1.9.14 -_CLOC_VERSION=1.82 -_PMD_VERSION=6.6.0 - if [ -f ~/.bashrc ]; then . ~/.bashrc; fi + +if [ -f ./build/versions.env ]; then + # xargs does not support the -d option on BSD (MacOS X) + export $(grep -a -v -e '^#' -e '^[[:space:]]*$' build/versions.env | tr '\n' '\0' | xargs -0 ) + grep -a -v -e '^#' -e '^[[:space:]]*$' build/versions.env | tr '\n' '\0' | xargs -0 printf "\$%s\n" + echo +fi + +echo \$JAVA_HOME=$JAVA_HOME + if [ -f ./.env ]; then # xargs does not support the -d option on BSD (MacOS X) export $(grep -a -v -e '^#' -e '^[[:space:]]*$' .env | tr '\n' '\0' | xargs -0) @@ -14,15 +20,28 @@ if [ -f ./.env ]; then echo fi -echo \$JAVA_HOME=$JAVA_HOME - if [ ! -d .tmp ]; then mkdir .tmp; fi +case "$-" in + *i*) _wget_interactive_options="--show-progress" ;; + *) _wget_interactive_options= ;; +esac + + + +#Node.js +export NODEJS_HOME=$(pwd)/.tmp/node-v$_NODEJS_VERSION-linux-x64 +if [ ! -f $NODEJS_HOME/npm ]; then + wget -nv $_wget_interactive_options -O .tmp/node-v$_NODEJS_VERSION-linux-x64.tar.gz https://nodejs.org/dist/v$_NODEJS_VERSION/node-v$_NODEJS_VERSION-linux-x64.tar.gz + tar -xzvf .tmp/node-v$_NODEJS_VERSION-linux-x64.tar.gz -C .tmp +fi +echo \$NODEJS_HOME=$NODEJS_HOME + #SFDX CLI -export SFDX_HOME=$TRAVIS_BUILD_DIR/.tmp/node_modules/.bin -if [ ! -f .tmp/node_modules/.bin/sfdx ]; then +export SFDX_HOME=$(pwd)/.tmp/node_modules/.bin +if [ ! -f $SFDX_HOME/sfdx ]; then cd .tmp - npm install sfdx-cli --loglevel info --cache npm-cache + $NODEJS_HOME/npm install sfdx-cli --cache npm-cache cd .. fi echo \$SFDX_HOME=$SFDX_HOME @@ -30,7 +49,7 @@ echo \$SFDX_HOME=$SFDX_HOME #Ant export ANT_HOME=$(pwd)/.tmp/apache-ant-$_ANT_VERSION if [ ! -f $_ANT_HOME/bin/ant ]; then - wget -nv --show-progress -O .tmp/apache-ant-$_ANT_VERSION-bin.tar.gz http://mirrors.ircam.fr/pub/apache//ant/binaries/apache-ant-$_ANT_VERSION-bin.tar.gz + wget -nv $_wget_interactive_options -O .tmp/apache-ant-$_ANT_VERSION-bin.tar.gz http://mirrors.ircam.fr/pub/apache//ant/binaries/apache-ant-$_ANT_VERSION-bin.tar.gz tar -xzvf .tmp/apache-ant-$_ANT_VERSION-bin.tar.gz -C .tmp fi echo \$ANT_HOME=$ANT_HOME @@ -39,14 +58,14 @@ echo \$ANT_HOME=$ANT_HOME # Best would to be able to manage PMD with Apache Ivy but this looks like an impossible task... export PMD_HOME=$(pwd)/.tmp/pmd-bin-$_PMD_VERSION if [ ! -f $PMD_HOME/bin/run.sh ]; then - wget -nv --show-progress -O .tmp/pmd-bin-$_PMD_VERSION.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F$_PMD_VERSION/pmd-bin-$_PMD_VERSION.zip + wget -nv $_wget_interactive_options -O .tmp/pmd-bin-$_PMD_VERSION.zip https://github.com/pmd/pmd/releases/download/pmd_releases%2F$_PMD_VERSION/pmd-bin-$_PMD_VERSION.zip unzip .tmp/pmd-bin-$_PMD_VERSION.zip -d .tmp fi echo \$PMD_HOME=$PMD_HOME echo if [ ! -f $(pwd)/.tmp/cloc.pl ]; then - wget -nv --show-progress -O .tmp/cloc.pl https://github.com/AlDanial/cloc/releases/download/$_CLOC_VERSION/cloc-$_CLOC_VERSION.pl + wget -nv $_wget_interactive_options -O .tmp/cloc.pl https://github.com/AlDanial/cloc/releases/download/$_CLOC_VERSION/cloc-$_CLOC_VERSION.pl fi export PATH=$SFDX_HOME:$ANT_HOME/bin:$PATH diff --git a/build/SetEnv.bat b/build/SetEnv.bat index 9f2a980..29c9e76 100644 --- a/build/SetEnv.bat +++ b/build/SetEnv.bat @@ -4,9 +4,9 @@ VERIFY OTHER 2>nul -SET _ANT_VERSION=1.9.14 -SET _CLOC_VERSION=1.82 -SET _PMD_VERSION=6.17.0 + +CALL :SetVersionsEnvHelper 2>nul + :: ------------------------------------------------------------------- @@ -15,16 +15,29 @@ SET _PMD_VERSION=6.17.0 CALL :SetLocalEnvHelper 2>nul :: Java -CALL :SetJavaHomeHelper > nul 2>&1 -IF ERRORLEVEL 1 GOTO ERROR_JDK +IF NOT "%1" == "/useCurrentJavaHome" ( + CALL :SetJavaHomeHelper > nul 2>&1 + IF ERRORLEVEL 1 GOTO ERROR_JDK +) ECHO SET JAVA_HOME=%JAVA_HOME% +:: Node.js +SET NODEJS_HOME=%CD%\.tmp\node-v%_NODEJS_VERSION%-win-x64 +IF NOT EXIST "%NODEJS_HOME%\npm.cmd" ( + IF NOT EXIST .tmp MKDIR .tmp + powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest https://nodejs.org/dist/v$Env:_NODEJS_VERSION/node-v$Env:_NODEJS_VERSION-win-x64.zip -OutFile .tmp\node-v$Env:_NODEJS_VERSION-win-x64.zip; }" + IF ERRORLEVEL 1 GOTO ERROR_NODEJS + powershell.exe -NoLogo -NonInteractive -ExecutionPolicy ByPass -Command "Expand-Archive -Path .tmp\node-v$Env:_NODEJS_VERSION-win-x64.zip -DestinationPath .tmp -Force" + IF ERRORLEVEL 1 GOTO ERROR_NODEJS +) +ECHO SET NODEJS_HOME=%NODEJS_HOME% + :: SFDX CLI SET SFDX_HOME=%CD%\.tmp\node_modules\.bin IF NOT EXIST "%SFDX_HOME%\sfdx.cmd" ( IF NOT EXIST .tmp MKDIR .tmp PUSHD .tmp - npm install sfdx-cli --loglevel info --cache npm-cache + CALL "%NODEJS_HOME%\npm.cmd" install sfdx-cli --cache npm-cache POPD ) ECHO SET SFDX_HOME=%SFDX_HOME% @@ -79,6 +92,18 @@ EXIT /B 0 +:SetVersionsEnvHelper +IF EXIST build\versions.env ( + FOR /F "eol=# tokens=1* delims==" %%i IN (build\versions.env) DO ( + SET "%%i=%%j" + ECHO SET %%i=%%j + ) + ECHO. +) +EXIT /B 0 + + + :SetJavaHomeHelper SET JAVA_HOME= FOR /F "tokens=1,2*" %%i IN ('REG QUERY "HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.8" /V JavaHome') DO ( diff --git a/build/versions.env b/build/versions.env new file mode 100644 index 0000000..11d17d8 --- /dev/null +++ b/build/versions.env @@ -0,0 +1,4 @@ +_ANT_VERSION=1.9.14 +_CLOC_VERSION=1.82 +_NODEJS_VERSION=12.14.1 +_PMD_VERSION=6.17.0 diff --git a/docs/force-source-convert.html b/docs/force-source-convert.html index 0ead390..261816b 100644 --- a/docs/force-source-convert.html +++ b/docs/force-source-convert.html @@ -41,15 +41,15 @@
Specifies the name of a metadata component to convert.
+ +The sourcepath attribute is a path-like structure and can also be set via a nested <sourcepath>
element.
+<sfdx:force-source-convert sourcepath="force-app/main/default/objects/Case"> + <sourcepath> + <pathelement location="force-app/main/default/objects/Contact" /> + <dirset dir="force-app/main/default/objects"> + <include name="Ac*" /> + </dirset> + </sourcepath> +</sfdx:sfdx:force-source-convert>