Skip to content

Commit

Permalink
2022.2 Code drop
Browse files Browse the repository at this point in the history
  • Loading branch information
ajindal-mdx committed Feb 5, 2024
1 parent 7fa2d62 commit 9438607
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 98 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, Perforce Software, Inc. All rights reserved.
Copyright (c) 2024, Perforce Software, Inc. All rights reserved.


BY INSTALLING OR DOWNLOADING THE SOFTWARE, YOU ARE ACCEPTING AND AGREEING TO THE TERMS OF
Expand Down
20 changes: 16 additions & 4 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Release Notes for
P4Java, the Perforce Java API

Version 2022.2
Version 2023.1

Introduction

Expand Down Expand Up @@ -121,6 +121,15 @@ Known Limitations
<java-home>/lib/security/local_policy.jar
<java-home>/lib/security/US_export_policy.jar
* P4Java would not support file operations on altsync enabled clients.

-------------------------------------------
Updates in 2023.1 (2023.1/2512805) (2023/11/01)

#2497593, #2509668, #2502386 (Job #116934)
Added support for the updated client spec in the 2023.1 Helix Core
server release.

-------------------------------------------
Updates in 2022.2 (2022.2/2444480) (2023/05/23)

Expand All @@ -135,15 +144,18 @@ Updates in 2022.2 (2022.2/2444480) (2023/05/23)
Added support for 'Components' in the stream spec.

-------------------------------------------
Updates in 2022.1 Patch 2 (2023/03/27)
Updates in 2022.1 Patch 2 (2022.1/2423241) (2023/03/28)

#2421117 (Job #112706)
Fixed a bug where P4Java failed to update the sync time in db.have
during a sync operation

#2409816 (Job #113999)
Fixed a bug in decoding UTF-16 encoded files, which leads to file corruption

Fixed a bug in decoding UTF-16 encoded files, which leads to file corruption

#2369664 (Job #115104)
Fixed a bug where using Metadata class for version information did not return a result.

-------------------------------------------
Updates in 2022.1 Patch 1 (2023/01/12)

Expand Down
19 changes: 12 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,29 +91,34 @@ publishing {
repositories {
def mavenUser = project.hasProperty('mavenUser') ? project.ext.mavenUser : ''
def mavenPassword = project.hasProperty('mavenPassword') ? project.ext.mavenPassword : ''
def artifactoryUser = project.hasProperty('artifactoryUser') ? project.ext.artifactoryUser : ''
def artifactoryPassword = project.hasProperty('artifactoryPassword') ? project.ext.artifactoryPassword : ''
def mavenStagingUrl = project.hasProperty('mavenStagingUrl') ? project.ext.mavenStagingUrl : ''
def artifactorySnapshotUrl = project.hasProperty('artifactorySnapshotUrl') ? project.ext.artifactorySnapshotUrl : ''
def artifactoryReleaseUrl = project.hasProperty('artifactoryReleaseUrl') ? project.ext.artifactoryReleaseUrl : ''

maven {
name = 'p4mavencentral-staging'
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
url = mavenStagingUrl
credentials {
username = mavenUser
password = mavenPassword
}
}
maven {
name = 'artifactory-snapshots'
url = 'https://artifactory.bnr.perforce.com/artifactory/snapshots/'
url = artifactorySnapshotUrl
credentials {
username = mavenUser
password = mavenPassword
username = artifactoryUser
password = artifactoryPassword
}
}
maven {
name = 'artifactory-release'
url = 'https://artifactory.bnr.perforce.com/artifactory/releases/'
url = artifactoryReleaseUrl
credentials {
username = mavenUser
password = mavenPassword
username = artifactoryUser
password = artifactoryPassword
}
}
}
Expand Down
168 changes: 84 additions & 84 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/perforce/p4java/client/IClientSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public interface IClientOptions {
boolean isRmdir();

void setRmdir(boolean rmdir);

boolean isaltSync();

void setAltsync(boolean altsync);
}

;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class ClientOptions implements IClientOptions {
private boolean locked = false;
private boolean modtime = false;
private boolean rmdir = false;
private boolean altsync = false;
private boolean altSyncFeatureEnabled = false;

/**
* Default constructor; sets all fields to false.
Expand All @@ -43,9 +45,32 @@ public ClientOptions(boolean allWrite, boolean clobber, boolean compress, boolea
this.rmdir = rmdir;
}

/**
* Explicit-value constructor.
*
* @param allWrite allWrite
* @param clobber clobber
* @param compress compress
* @param locked locked
* @param modtime modtime
* @param rmdir rmdir
* @param altsync altsync
*/
public ClientOptions(boolean allWrite, boolean clobber, boolean compress, boolean locked, boolean modtime, boolean rmdir, boolean altsync) {
this.allWrite = allWrite;
this.clobber = clobber;
this.compress = compress;
this.locked = locked;
this.modtime = modtime;
this.rmdir = rmdir;
this.altsync = altsync;

this.altSyncFeatureEnabled = true;
}

/**
* Attempts to construct a ClientOptions object from a typical p4 cmd options string,
* e.g. "noallwrite noclobber nocompress unlocked nomodtime normdir". If optionsString
* e.g. "noallwrite noclobber nocompress unlocked nomodtime normdir noaltsync". If optionsString
* is null, this is equivalent to calling the default constructor.
*
* @param optionsString options
Expand All @@ -54,6 +79,9 @@ public ClientOptions(String optionsString) {

if (optionsString != null) {
String opts[] = optionsString.split(" ");

this.altSyncFeatureEnabled = isAltSyncFeatureEnabled(opts);

for (String str : opts) {
if (str.equalsIgnoreCase("allwrite")) {
this.allWrite = true;
Expand All @@ -67,18 +95,31 @@ public ClientOptions(String optionsString) {
this.modtime = true;
} else if (str.equalsIgnoreCase("rmdir")) {
this.rmdir = true;
} else if (str.equalsIgnoreCase("altsync")) {
this.altsync = true;
}
}
}
}

private boolean isAltSyncFeatureEnabled(String[] opts) {
for (String str : opts) {
if (str.equalsIgnoreCase("altsync") || str.equalsIgnoreCase("noaltsync"))
return true;
}
return false;
}

/**
* Return a Perforce-standard representation of these options. This
* string is in the same format as used by the ClientOptions(String optionsString)
* constructor.
*/
public String toString() {
return (this.allWrite ? "allwrite" : "noallwrite") + (this.clobber ? " clobber" : " noclobber") + (this.compress ? " compress" : " nocompress") + (this.locked ? " locked" : " nolocked") + (this.modtime ? " modtime" : " nomodtime") + (this.rmdir ? " rmdir" : " normdir");
if (this.altSyncFeatureEnabled) //means [no]altsync is present and server version >= 2023.1
return (this.allWrite ? "allwrite" : "noallwrite") + (this.clobber ? " clobber" : " noclobber") + (this.compress ? " compress" : " nocompress") + (this.locked ? " locked" : " nolocked") + (this.modtime ? " modtime" : " nomodtime") + (this.rmdir ? " rmdir" : " normdir") + (this.altsync ? " altsync" : " noaltsync");
else
return (this.allWrite ? "allwrite" : "noallwrite") + (this.clobber ? " clobber" : " noclobber") + (this.compress ? " compress" : " nocompress") + (this.locked ? " locked" : " nolocked") + (this.modtime ? " modtime" : " nomodtime") + (this.rmdir ? " rmdir" : " normdir");
}

public boolean isAllWrite() {
Expand Down Expand Up @@ -128,4 +169,13 @@ public boolean isRmdir() {
public void setRmdir(boolean rmdir) {
this.rmdir = rmdir;
}

public boolean isaltSync() {
return altsync;
}

public void setAltsync(boolean altsync) {
this.altsync = altsync;
this.altSyncFeatureEnabled = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ public static Map<String, Object> map(IClient client) {
+ (opts.isLocked() ? "locked " : "unlocked ")
+ (opts.isModtime() ? "modtime " : "nomodtime ")
+ (opts.isRmdir() ? "rmdir" : "normdir");

if(opts.toString().split(" ").length > 6)
optStr = optStr + (opts.isaltSync() ? " altsync" : " noaltsync");

clientMap.put("Options", optStr);
}

Expand Down

0 comments on commit 9438607

Please sign in to comment.